From owner-svn-src-head@freebsd.org Sun Apr 8 00:56:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B82C8F940C8; Sun, 8 Apr 2018 00:56:21 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6C08A73974; Sun, 8 Apr 2018 00:56: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 65F525E2; Sun, 8 Apr 2018 00:56: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 w380uLMU024113; Sun, 8 Apr 2018 00:56:21 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w380uKAg024101; Sun, 8 Apr 2018 00:56:20 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804080056.w380uKAg024101@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sun, 8 Apr 2018 00:56:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332262 - in head/sys: arm/broadcom/bcm2835 arm/conf dts/arm X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in head/sys: arm/broadcom/bcm2835 arm/conf dts/arm X-SVN-Commit-Revision: 332262 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 00:56:22 -0000 Author: gonzo Date: Sun Apr 8 00:56:19 2018 New Revision: 332262 URL: https://svnweb.freebsd.org/changeset/base/332262 Log: [rpi] Add fdt_pinctrl(4) support to Raspberry Pi GPIO driver On Raspberry Pi platform GPIO controller also responsible for pins multiplexing. Pi code predates proper FDT support in FreeBSD so a lot of pinmux info is hardcoded. This patch: - Implements pinctl methods in bcm2835_gpio - Converts all devices with ad-hoc pinmux info to proper pin control mechanisms and adds pinmux info in FreeBSD's custom dts files. - Adds fdt_pinctrl option to RPI2 and RPI-B kernels - Adds SPI pinmux config to FreeBSD's customization of GNU DTS. Reviewed by: imp, manu Differential Revision: https://reviews.freebsd.org/D14104 Deleted: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.h Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c head/sys/arm/broadcom/bcm2835/bcm2835_intr.c head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c head/sys/arm/broadcom/bcm2835/bcm2835_spi.c head/sys/arm/broadcom/bcm2835/bcm2835_spivar.h head/sys/arm/broadcom/bcm2835/bcm2836.c head/sys/arm/conf/RPI-B head/sys/arm/conf/RPI2 head/sys/dts/arm/rpi.dts head/sys/dts/arm/rpi2.dts Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Sat Apr 7 23:31:55 2018 (r332261) +++ head/sys/arm/broadcom/bcm2835/bcm2835_bsc.c Sun Apr 8 00:56:19 2018 (r332262) @@ -100,7 +100,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -298,9 +297,7 @@ static int bcm_bsc_attach(device_t dev) { struct bcm_bsc_softc *sc; - unsigned long start; - device_t gpio; - int i, rid; + int rid; sc = device_get_softc(dev); sc->sc_dev = dev; @@ -315,31 +312,6 @@ bcm_bsc_attach(device_t dev) sc->sc_bst = rman_get_bustag(sc->sc_mem_res); sc->sc_bsh = rman_get_bushandle(sc->sc_mem_res); - - /* Check the unit we are attaching by its base address. */ - start = rman_get_start(sc->sc_mem_res); - for (i = 0; i < nitems(bcm_bsc_pins); i++) { - if (bcm_bsc_pins[i].start == (start & BCM_BSC_BASE_MASK)) - break; - } - if (i == nitems(bcm_bsc_pins)) { - device_printf(dev, "only bsc0 and bsc1 are supported\n"); - bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); - return (ENXIO); - } - - /* - * Configure the GPIO pins to ALT0 function to enable BSC control - * over the pins. - */ - gpio = devclass_get_device(devclass_find("gpio"), 0); - if (!gpio) { - device_printf(dev, "cannot find gpio0\n"); - bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->sc_mem_res); - return (ENXIO); - } - bcm_gpio_set_alternate(gpio, bcm_bsc_pins[i].sda, BCM_GPIO_ALT0); - bcm_gpio_set_alternate(gpio, bcm_bsc_pins[i].scl, BCM_GPIO_ALT0); rid = 0; sc->sc_irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, Modified: head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Sat Apr 7 23:31:55 2018 (r332261) +++ head/sys/arm/broadcom/bcm2835/bcm2835_bscvar.h Sun Apr 8 00:56:19 2018 (r332262) @@ -32,16 +32,6 @@ #ifndef _BCM2835_BSCVAR_H #define _BCM2835_BSCVAR_H -struct { - uint32_t sda; - uint32_t scl; - unsigned long start; -} bcm_bsc_pins[] = { - { 0, 1, 0x205000 }, /* BSC0 GPIO pins and base address. */ - { 2, 3, 0x804000 } /* BSC1 GPIO pins and base address. */ -}; -#define BCM_BSC_BASE_MASK 0x00ffffff - struct iic_msg; struct bcm_bsc_softc { Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Sat Apr 7 23:31:55 2018 (r332261) +++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Sun Apr 8 00:56:19 2018 (r332262) @@ -48,11 +48,10 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include -#include - #include "gpio_if.h" #include "pic_if.h" @@ -73,6 +72,19 @@ __FBSDID("$FreeBSD$"); GPIO_INTR_LEVEL_HIGH | GPIO_INTR_EDGE_RISING | \ GPIO_INTR_EDGE_FALLING | GPIO_INTR_EDGE_BOTH) +#define BCM2835_FSEL_GPIO_IN 0 +#define BCM2835_FSEL_GPIO_OUT 1 +#define BCM2835_FSEL_ALT5 2 +#define BCM2835_FSEL_ALT4 3 +#define BCM2835_FSEL_ALT0 4 +#define BCM2835_FSEL_ALT1 5 +#define BCM2835_FSEL_ALT2 6 +#define BCM2835_FSEL_ALT3 7 + +#define BCM2835_PUD_OFF 0 +#define BCM2835_PUD_DOWN 1 +#define BCM2835_PUD_UP 2 + static struct resource_spec bcm_gpio_res_spec[] = { { SYS_RES_MEMORY, 0, RF_ACTIVE }, { SYS_RES_IRQ, 0, RF_ACTIVE }, /* bank 0 interrupt */ @@ -187,28 +199,28 @@ bcm_gpio_func_str(uint32_t nfunc, char *buf, int bufsi { switch (nfunc) { - case BCM_GPIO_INPUT: + case BCM2835_FSEL_GPIO_IN: strncpy(buf, "input", bufsize); break; - case BCM_GPIO_OUTPUT: + case BCM2835_FSEL_GPIO_OUT: strncpy(buf, "output", bufsize); break; - case BCM_GPIO_ALT0: + case BCM2835_FSEL_ALT0: strncpy(buf, "alt0", bufsize); break; - case BCM_GPIO_ALT1: + case BCM2835_FSEL_ALT1: strncpy(buf, "alt1", bufsize); break; - case BCM_GPIO_ALT2: + case BCM2835_FSEL_ALT2: strncpy(buf, "alt2", bufsize); break; - case BCM_GPIO_ALT3: + case BCM2835_FSEL_ALT3: strncpy(buf, "alt3", bufsize); break; - case BCM_GPIO_ALT4: + case BCM2835_FSEL_ALT4: strncpy(buf, "alt4", bufsize); break; - case BCM_GPIO_ALT5: + case BCM2835_FSEL_ALT5: strncpy(buf, "alt5", bufsize); break; default: @@ -221,21 +233,21 @@ bcm_gpio_str_func(char *func, uint32_t *nfunc) { if (strcasecmp(func, "input") == 0) - *nfunc = BCM_GPIO_INPUT; + *nfunc = BCM2835_FSEL_GPIO_IN; else if (strcasecmp(func, "output") == 0) - *nfunc = BCM_GPIO_OUTPUT; + *nfunc = BCM2835_FSEL_GPIO_OUT; else if (strcasecmp(func, "alt0") == 0) - *nfunc = BCM_GPIO_ALT0; + *nfunc = BCM2835_FSEL_ALT0; else if (strcasecmp(func, "alt1") == 0) - *nfunc = BCM_GPIO_ALT1; + *nfunc = BCM2835_FSEL_ALT1; else if (strcasecmp(func, "alt2") == 0) - *nfunc = BCM_GPIO_ALT2; + *nfunc = BCM2835_FSEL_ALT2; else if (strcasecmp(func, "alt3") == 0) - *nfunc = BCM_GPIO_ALT3; + *nfunc = BCM2835_FSEL_ALT3; else if (strcasecmp(func, "alt4") == 0) - *nfunc = BCM_GPIO_ALT4; + *nfunc = BCM2835_FSEL_ALT4; else if (strcasecmp(func, "alt5") == 0) - *nfunc = BCM_GPIO_ALT5; + *nfunc = BCM2835_FSEL_ALT5; else return (-1); @@ -247,9 +259,9 @@ bcm_gpio_func_flag(uint32_t nfunc) { switch (nfunc) { - case BCM_GPIO_INPUT: + case BCM2835_FSEL_GPIO_IN: return (GPIO_PIN_INPUT); - case BCM_GPIO_OUTPUT: + case BCM2835_FSEL_GPIO_OUT: return (GPIO_PIN_OUTPUT); } return (0); @@ -288,7 +300,7 @@ bcm_gpio_set_pud(struct bcm_gpio_softc *sc, uint32_t p BCM_GPIO_WRITE(sc, BCM_GPIO_GPPUDCLK(bank), 0); } -void +static void bcm_gpio_set_alternate(device_t dev, uint32_t pin, uint32_t nfunc) { struct bcm_gpio_softc *sc; @@ -297,10 +309,7 @@ bcm_gpio_set_alternate(device_t dev, uint32_t pin, uin sc = device_get_softc(dev); BCM_GPIO_LOCK(sc); - /* Disable pull-up or pull-down on pin. */ - bcm_gpio_set_pud(sc, pin, BCM_GPIO_NONE); - - /* And now set the pin function. */ + /* Set the pin function. */ bcm_gpio_set_function(sc, pin, nfunc); /* Update the pin flags. */ @@ -329,11 +338,11 @@ bcm_gpio_pin_configure(struct bcm_gpio_softc *sc, stru if (flags & GPIO_PIN_OUTPUT) { pin->gp_flags |= GPIO_PIN_OUTPUT; bcm_gpio_set_function(sc, pin->gp_pin, - BCM_GPIO_OUTPUT); + BCM2835_FSEL_GPIO_OUT); } else { pin->gp_flags |= GPIO_PIN_INPUT; bcm_gpio_set_function(sc, pin->gp_pin, - BCM_GPIO_INPUT); + BCM2835_FSEL_GPIO_IN); } } @@ -793,6 +802,9 @@ bcm_gpio_attach(device_t dev) if (sc->sc_busdev == NULL) goto fail; + fdt_pinctrl_register(dev, "brcm,pins"); + fdt_pinctrl_configure_tree(dev); + return (0); fail: @@ -1187,6 +1199,84 @@ bcm_gpio_get_node(device_t bus, device_t dev) return (ofw_bus_get_node(bus)); } +static int +bcm_gpio_configure_pins(device_t dev, phandle_t cfgxref) +{ + phandle_t cfgnode; + int i, pintuples, pulltuples; + uint32_t pin; + uint32_t *pins; + uint32_t *pulls; + uint32_t function; + static struct bcm_gpio_softc *sc; + + sc = device_get_softc(dev); + cfgnode = OF_node_from_xref(cfgxref); + + pins = NULL; + pintuples = OF_getencprop_alloc(cfgnode, "brcm,pins", sizeof(*pins), + (void **)&pins); + + char name[32]; + OF_getprop(cfgnode, "name", &name, sizeof(name)); + + if (pintuples < 0) + return (ENOENT); + + if (pintuples == 0) + return (0); /* Empty property is not an error. */ + + if (OF_getencprop(cfgnode, "brcm,function", &function, + sizeof(function)) <= 0) { + OF_prop_free(pins); + return (EINVAL); + } + + pulls = NULL; + pulltuples = OF_getencprop_alloc(cfgnode, "brcm,pull", sizeof(*pulls), + (void **)&pulls); + + if ((pulls != NULL) && (pulltuples != pintuples)) { + OF_prop_free(pins); + OF_prop_free(pulls); + return (EINVAL); + } + + for (i = 0; i < pintuples; i++) { + pin = pins[i]; + bcm_gpio_set_alternate(dev, pin, function); + if (bootverbose) + device_printf(dev, "set pin %d to func %d", pin, function); + if (pulls) { + if (bootverbose) + printf(", pull %d", pulls[i]); + switch (pulls[i]) { + /* Convert to gpio(4) flags */ + case BCM2835_PUD_OFF: + bcm_gpio_pin_setflags(dev, pin, 0); + break; + case BCM2835_PUD_UP: + bcm_gpio_pin_setflags(dev, pin, GPIO_PIN_PULLUP); + break; + case BCM2835_PUD_DOWN: + bcm_gpio_pin_setflags(dev, pin, GPIO_PIN_PULLDOWN); + break; + default: + printf("%s: invalid pull value for pin %d: %d\n", + name, pin, pulls[i]); + } + } + if (bootverbose) + printf("\n"); + } + + OF_prop_free(pins); + if (pulls) + OF_prop_free(pulls); + + return (0); +} + static device_method_t bcm_gpio_methods[] = { /* Device interface */ DEVMETHOD(device_probe, bcm_gpio_probe), @@ -1217,6 +1307,9 @@ static device_method_t bcm_gpio_methods[] = { /* ofw_bus interface */ DEVMETHOD(ofw_bus_get_node, bcm_gpio_get_node), + /* fdt_pinctrl interface */ + DEVMETHOD(fdt_pinctrl_configure, bcm_gpio_configure_pins), + DEVMETHOD_END }; @@ -1228,4 +1321,4 @@ static driver_t bcm_gpio_driver = { sizeof(struct bcm_gpio_softc), }; -DRIVER_MODULE(bcm_gpio, simplebus, bcm_gpio_driver, bcm_gpio_devclass, 0, 0); +EARLY_DRIVER_MODULE(bcm_gpio, simplebus, bcm_gpio_driver, bcm_gpio_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); Modified: head/sys/arm/broadcom/bcm2835/bcm2835_intr.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_intr.c Sat Apr 7 23:31:55 2018 (r332261) +++ head/sys/arm/broadcom/bcm2835/bcm2835_intr.c Sun Apr 8 00:56:19 2018 (r332262) @@ -452,4 +452,4 @@ static driver_t bcm_intc_driver = { static devclass_t bcm_intc_devclass; EARLY_DRIVER_MODULE(intc, simplebus, bcm_intc_driver, bcm_intc_devclass, - 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); + 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Sat Apr 7 23:31:55 2018 (r332261) +++ head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Sun Apr 8 00:56:19 2018 (r332262) @@ -46,7 +46,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include static struct ofw_compat_data compat_data[] = { @@ -93,7 +92,6 @@ static int bcm_pwm_reconf(struct bcm_pwm_softc *sc) { uint32_t u; - device_t gpio; /* Disable PWM */ W_CTL(sc, 0); @@ -103,14 +101,6 @@ bcm_pwm_reconf(struct bcm_pwm_softc *sc) if (sc->mode == 0) return (0); - - /* Ask GPIO0 to set ALT0 for pin 12 */ - gpio = devclass_get_device(devclass_find("gpio"), 0); - if (!gpio) { - device_printf(sc->sc_dev, "cannot find gpio0\n"); - return (ENXIO); - } - bcm_gpio_set_alternate(gpio, 12, BCM_GPIO_ALT0); u = bcm2835_clkman_set_frequency(sc->clkman, BCM_PWM_CLKSRC, sc->freq); if (u == 0) Modified: head/sys/arm/broadcom/bcm2835/bcm2835_spi.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_spi.c Sat Apr 7 23:31:55 2018 (r332261) +++ head/sys/arm/broadcom/bcm2835/bcm2835_spi.c Sun Apr 8 00:56:19 2018 (r332262) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include @@ -250,8 +249,7 @@ static int bcm_spi_attach(device_t dev) { struct bcm_spi_softc *sc; - device_t gpio; - int i, rid; + int rid; if (device_get_unit(dev) != 0) { device_printf(dev, "only one SPI controller supported\n"); @@ -260,15 +258,6 @@ bcm_spi_attach(device_t dev) sc = device_get_softc(dev); sc->sc_dev = dev; - - /* Configure the GPIO pins to ALT0 function to enable SPI the pins. */ - gpio = devclass_get_device(devclass_find("gpio"), 0); - if (!gpio) { - device_printf(dev, "cannot find gpio0\n"); - return (ENXIO); - } - for (i = 0; i < nitems(bcm_spi_pins); i++) - bcm_gpio_set_alternate(gpio, bcm_spi_pins[i], BCM_GPIO_ALT0); rid = 0; sc->sc_mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, Modified: head/sys/arm/broadcom/bcm2835/bcm2835_spivar.h ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_spivar.h Sat Apr 7 23:31:55 2018 (r332261) +++ head/sys/arm/broadcom/bcm2835/bcm2835_spivar.h Sun Apr 8 00:56:19 2018 (r332262) @@ -32,18 +32,6 @@ #ifndef _BCM2835_SPIVAR_H_ #define _BCM2835_SPIVAR_H_ -/* - * Only the available pins are listed here. - * i.e. CS2 isn't available. - */ -uint32_t bcm_spi_pins[] = { - 7, /* CS1 */ - 8, /* CS0 */ - 9, /* MISO */ - 10, /* MOSI */ - 11 /* SCLK */ -}; - struct bcm_spi_softc { device_t sc_dev; struct mtx sc_mtx; Modified: head/sys/arm/broadcom/bcm2835/bcm2836.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2836.c Sat Apr 7 23:31:55 2018 (r332261) +++ head/sys/arm/broadcom/bcm2835/bcm2836.c Sun Apr 8 00:56:19 2018 (r332262) @@ -736,4 +736,4 @@ static driver_t bcm_lintc_driver = { static devclass_t bcm_lintc_devclass; EARLY_DRIVER_MODULE(local_intc, simplebus, bcm_lintc_driver, bcm_lintc_devclass, - 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); + 0, 0, BUS_PASS_INTERRUPT); Modified: head/sys/arm/conf/RPI-B ============================================================================== --- head/sys/arm/conf/RPI-B Sat Apr 7 23:31:55 2018 (r332261) +++ head/sys/arm/conf/RPI-B Sun Apr 8 00:56:19 2018 (r332262) @@ -90,6 +90,8 @@ device bcm2835_spi device vchiq device sound +device fdt_pinctrl + # Flattened Device Tree options FDT # Configure using FDT/DTB data # Note: DTB is normally loaded and modified by RPi boot loader, then Modified: head/sys/arm/conf/RPI2 ============================================================================== --- head/sys/arm/conf/RPI2 Sat Apr 7 23:31:55 2018 (r332261) +++ head/sys/arm/conf/RPI2 Sun Apr 8 00:56:19 2018 (r332262) @@ -93,6 +93,8 @@ device bcm2835_spi device vchiq device sound +device fdt_pinctrl + # Flattened Device Tree options FDT # Configure using FDT/DTB data # Note: DTB is normally loaded and modified by RPi boot loader, then Modified: head/sys/dts/arm/rpi.dts ============================================================================== --- head/sys/dts/arm/rpi.dts Sat Apr 7 23:31:55 2018 (r332261) +++ head/sys/dts/arm/rpi.dts Sun Apr 8 00:56:19 2018 (r332262) @@ -53,6 +53,10 @@ spi@7e204000 { status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins &spi0_cs_pins>; + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins &spi0_cs_pins>; }; gpio@7e200000 { @@ -67,6 +71,16 @@ broadcom,pins = <48>, <49>, <50>, <51>, <52>, <53>; }; + + spi0_pins: spi0_pins { + brcm,pins = <9 10 11>; + brcm,function = <4>; /* alt0 */ + }; + + spi0_cs_pins: spi0_cs_pins { + brcm,pins = <8 7>; + brcm,function = <1>; /* output */ + }; } vchiq { @@ -89,4 +103,3 @@ }; }; - Modified: head/sys/dts/arm/rpi2.dts ============================================================================== --- head/sys/dts/arm/rpi2.dts Sat Apr 7 23:31:55 2018 (r332261) +++ head/sys/dts/arm/rpi2.dts Sun Apr 8 00:56:19 2018 (r332262) @@ -53,6 +53,8 @@ spi@7e204000 { status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&spi0_pins &spi0_cs_pins>; }; gpio@7e200000 { @@ -66,6 +68,16 @@ pins_reserved: reserved { broadcom,pins = <48>, <49>, <50>, <51>, <52>, <53>; + }; + + spi0_pins: spi0_pins { + brcm,pins = <9 10 11>; + brcm,function = <4>; /* alt0 */ + }; + + spi0_cs_pins: spi0_cs_pins { + brcm,pins = <8 7>; + brcm,function = <1>; /* output */ }; } From owner-svn-src-head@freebsd.org Sun Apr 8 01:32:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 89857F9679A; Sun, 8 Apr 2018 01:32:59 +0000 (UTC) (envelope-from mp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 32E4B879EA; Sun, 8 Apr 2018 01:32:59 +0000 (UTC) (envelope-from mp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CEA0CB2; Sun, 8 Apr 2018 01:32:59 +0000 (UTC) (envelope-from mp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w381WxQP043814; Sun, 8 Apr 2018 01:32:59 GMT (envelope-from mp@FreeBSD.org) Received: (from mp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w381Wuob043783; Sun, 8 Apr 2018 01:32:56 GMT (envelope-from mp@FreeBSD.org) Message-Id: <201804080132.w381Wuob043783@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mp set sender to mp@FreeBSD.org using -f From: Mark Peek Date: Sun, 8 Apr 2018 01:32:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332263 - in head: share/man/man4 sys/dev/vmware/vmci sys/modules/vmware/vmci X-SVN-Group: head X-SVN-Commit-Author: mp X-SVN-Commit-Paths: in head: share/man/man4 sys/dev/vmware/vmci sys/modules/vmware/vmci X-SVN-Commit-Revision: 332263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 01:32:59 -0000 Author: mp Date: Sun Apr 8 01:32:56 2018 New Revision: 332263 URL: https://svnweb.freebsd.org/changeset/base/332263 Log: Update VMCI license based on comments from core, the FreeBSD Foundation, and VMware legal: - Add a dual BSD-2 Clause/GPLv2 LICENSE file in the VMCI directory - Remove the use of "All Rights Reserved" - Per best practice, remove copyright/license info from Makefile Reviewed by: imp, emaste, jhb, Vishnu Dasa Approved by: VMware legal via Mark Peek Differential Revision: https://reviews.freebsd.org/D14979 Added: head/sys/dev/vmware/vmci/LICENSE (contents, props changed) Modified: head/share/man/man4/vmci.4 head/sys/dev/vmware/vmci/vmci.c head/sys/dev/vmware/vmci/vmci.h head/sys/dev/vmware/vmci/vmci_call_defs.h head/sys/dev/vmware/vmci/vmci_datagram.c head/sys/dev/vmware/vmci/vmci_datagram.h head/sys/dev/vmware/vmci/vmci_defs.h head/sys/dev/vmware/vmci/vmci_doorbell.c head/sys/dev/vmware/vmci/vmci_doorbell.h head/sys/dev/vmware/vmci/vmci_driver.c head/sys/dev/vmware/vmci/vmci_driver.h head/sys/dev/vmware/vmci/vmci_event.c head/sys/dev/vmware/vmci/vmci_event.h head/sys/dev/vmware/vmci/vmci_hashtable.c head/sys/dev/vmware/vmci/vmci_hashtable.h head/sys/dev/vmware/vmci/vmci_kernel_api.h head/sys/dev/vmware/vmci/vmci_kernel_api_1.h head/sys/dev/vmware/vmci/vmci_kernel_api_2.h head/sys/dev/vmware/vmci/vmci_kernel_defs.h head/sys/dev/vmware/vmci/vmci_kernel_if.c head/sys/dev/vmware/vmci/vmci_kernel_if.h head/sys/dev/vmware/vmci/vmci_qpair.c head/sys/dev/vmware/vmci/vmci_queue.h head/sys/dev/vmware/vmci/vmci_queue_pair.c head/sys/dev/vmware/vmci/vmci_queue_pair.h head/sys/dev/vmware/vmci/vmci_resource.c head/sys/dev/vmware/vmci/vmci_resource.h head/sys/dev/vmware/vmci/vmci_utils.h head/sys/modules/vmware/vmci/Makefile Modified: head/share/man/man4/vmci.4 ============================================================================== --- head/share/man/man4/vmci.4 Sun Apr 8 00:56:19 2018 (r332262) +++ head/share/man/man4/vmci.4 Sun Apr 8 01:32:56 2018 (r332263) @@ -1,4 +1,4 @@ -.\" Copyright (c) 2018 VMware, Inc. All Rights Reserved. +.\" Copyright (c) 2018 VMware, Inc. .\" .\" SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) .\" Added: head/sys/dev/vmware/vmci/LICENSE ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/vmware/vmci/LICENSE Sun Apr 8 01:32:56 2018 (r332263) @@ -0,0 +1,51 @@ +$FreeBSD$ + +These files are provided under a dual BSD-2 Clause/GPLv2 license. When +using or redistributing this file, you may do so under either license. + +BSD-2 Clause License + +Copyright (c) 2018 VMware, Inc. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions +are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in + the documentation and/or other materials provided with the + distribution. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER 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. + +GPL License Summary + +Copyright (c) 2018 VMware, Inc. + +This program is free software; you can redistribute it and/or modify +it under the terms of version 2 of the GNU General Public License as +published by the Free Software Foundation. + +This program is distributed in the hope that it will be useful, but +WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program; if not, write to the Free Software +Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. +The full GNU General Public License is included in this distribution +in the file called LICENSE.GPL. Modified: head/sys/dev/vmware/vmci/vmci.c ============================================================================== --- head/sys/dev/vmware/vmci/vmci.c Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci.c Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) */ Modified: head/sys/dev/vmware/vmci/vmci.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_call_defs.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_call_defs.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_call_defs.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_datagram.c ============================================================================== --- head/sys/dev/vmware/vmci/vmci_datagram.c Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_datagram.c Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) */ Modified: head/sys/dev/vmware/vmci/vmci_datagram.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_datagram.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_datagram.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_defs.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_defs.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_defs.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_doorbell.c ============================================================================== --- head/sys/dev/vmware/vmci/vmci_doorbell.c Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_doorbell.c Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) */ Modified: head/sys/dev/vmware/vmci/vmci_doorbell.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_doorbell.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_doorbell.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_driver.c ============================================================================== --- head/sys/dev/vmware/vmci/vmci_driver.c Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_driver.c Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) */ Modified: head/sys/dev/vmware/vmci/vmci_driver.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_driver.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_driver.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_event.c ============================================================================== --- head/sys/dev/vmware/vmci/vmci_event.c Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_event.c Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) */ Modified: head/sys/dev/vmware/vmci/vmci_event.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_event.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_event.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_hashtable.c ============================================================================== --- head/sys/dev/vmware/vmci/vmci_hashtable.c Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_hashtable.c Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) */ Modified: head/sys/dev/vmware/vmci/vmci_hashtable.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_hashtable.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_hashtable.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_kernel_api.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_kernel_api.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_kernel_api.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_kernel_api_1.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_kernel_api_1.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_kernel_api_1.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_kernel_api_2.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_kernel_api_2.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_kernel_api_2.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_kernel_defs.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_kernel_defs.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_kernel_defs.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_kernel_if.c ============================================================================== --- head/sys/dev/vmware/vmci/vmci_kernel_if.c Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_kernel_if.c Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) */ Modified: head/sys/dev/vmware/vmci/vmci_kernel_if.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_kernel_if.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_kernel_if.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_qpair.c ============================================================================== --- head/sys/dev/vmware/vmci/vmci_qpair.c Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_qpair.c Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) */ Modified: head/sys/dev/vmware/vmci/vmci_queue.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_queue.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_queue.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_queue_pair.c ============================================================================== --- head/sys/dev/vmware/vmci/vmci_queue_pair.c Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_queue_pair.c Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) */ Modified: head/sys/dev/vmware/vmci/vmci_queue_pair.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_queue_pair.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_queue_pair.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_resource.c ============================================================================== --- head/sys/dev/vmware/vmci/vmci_resource.c Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_resource.c Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) */ Modified: head/sys/dev/vmware/vmci/vmci_resource.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_resource.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_resource.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/dev/vmware/vmci/vmci_utils.h ============================================================================== --- head/sys/dev/vmware/vmci/vmci_utils.h Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/dev/vmware/vmci/vmci_utils.h Sun Apr 8 01:32:56 2018 (r332263) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. + * Copyright (c) 2018 VMware, Inc. * * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) * Modified: head/sys/modules/vmware/vmci/Makefile ============================================================================== --- head/sys/modules/vmware/vmci/Makefile Sun Apr 8 00:56:19 2018 (r332262) +++ head/sys/modules/vmware/vmci/Makefile Sun Apr 8 01:32:56 2018 (r332263) @@ -1,8 +1,3 @@ -# -# Copyright (c) 2018 VMware, Inc. All Rights Reserved. -# -# SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) -# # $FreeBSD$ .PATH: ${SRCTOP}/sys/dev/vmware/vmci From owner-svn-src-head@freebsd.org Sun Apr 8 02:05:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96D0BF98BA7; Sun, 8 Apr 2018 02:05:06 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 D9049792B8; Sun, 8 Apr 2018 02:05:05 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w38251bM011204; Sat, 7 Apr 2018 19:05:01 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w38250B6011200; Sat, 7 Apr 2018 19:05:00 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201804080205.w38250B6011200@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r332263 - in head: share/man/man4 sys/dev/vmware/vmci sys/modules/vmware/vmci In-Reply-To: <201804080132.w381Wuob043783@repo.freebsd.org> To: Mark Peek Date: Sat, 7 Apr 2018 19:05:00 -0700 (PDT) CC: 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-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 02:05:07 -0000 > Author: mp > Date: Sun Apr 8 01:32:56 2018 > New Revision: 332263 > URL: https://svnweb.freebsd.org/changeset/base/332263 > > Log: > Update VMCI license based on comments from core, the FreeBSD Foundation, > and VMware legal: > - Add a dual BSD-2 Clause/GPLv2 LICENSE file in the VMCI directory > - Remove the use of "All Rights Reserved" > - Per best practice, remove copyright/license info from Makefile > > Reviewed by: imp, emaste, jhb, Vishnu Dasa > Approved by: VMware legal via Mark Peek > Differential Revision: https://reviews.freebsd.org/D14979 Interesting that I was the one that raised issue with this, yet was not included in the diffential resolving it. For an "inclusive" project it seems to do a lot of "exclusive" things. > Added: > head/sys/dev/vmware/vmci/LICENSE (contents, props changed) > Modified: > head/share/man/man4/vmci.4 ... So lets say someone comes along and reworks one of these files, how does that person assert their copyright without asserting it on all of these files, which is what would happen if they did it in LICENSE. If they put it in the individual file it is discoupled from the clause that says "the above copyright", which they may or may not want as with it decoupled there would be no requirement to place this per file copyright notice per clause 1 and 2 in the end product. I still feel this is just an unworkable model for the long run. I do however thank you for improving the situation, at least now the "LICENSE" file is of complete form with a copyright above to make clause 1 and 2 work correctly, as well as the other fine nits repaired. There is one other fine niglect though, and that is the other SPDX work has the tags placed at the very top of the file on the line after /*-. I think this is done on intention for tooling, and is documented by exmaple in the "8. Preferred License for New Files" section of the committers-guide here: https://www.freebsd.org/doc/en_US.ISO8859-1/articles/committers-guide/pref-license.html Regards, Rod Grimes > Modified: head/share/man/man4/vmci.4 > ============================================================================== > --- head/share/man/man4/vmci.4 Sun Apr 8 00:56:19 2018 (r332262) > +++ head/share/man/man4/vmci.4 Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,4 +1,4 @@ > -.\" Copyright (c) 2018 VMware, Inc. All Rights Reserved. > +.\" Copyright (c) 2018 VMware, Inc. > .\" > .\" SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > .\" > > Added: head/sys/dev/vmware/vmci/LICENSE > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/vmware/vmci/LICENSE Sun Apr 8 01:32:56 2018 (r332263) > @@ -0,0 +1,51 @@ > +$FreeBSD$ > + > +These files are provided under a dual BSD-2 Clause/GPLv2 license. When > +using or redistributing this file, you may do so under either license. > + > +BSD-2 Clause License > + > +Copyright (c) 2018 VMware, Inc. > + > +Redistribution and use in source and binary forms, with or without > +modification, are permitted provided that the following conditions > +are met: > + > + * Redistributions of source code must retain the above copyright > + notice, this list of conditions and the following disclaimer. > + > + * Redistributions in binary form must reproduce the above copyright > + notice, this list of conditions and the following disclaimer in > + the documentation and/or other materials provided with the > + distribution. > + > +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS > +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT > +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR > +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT > +OWNER 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. > + > +GPL License Summary > + > +Copyright (c) 2018 VMware, Inc. > + > +This program is free software; you can redistribute it and/or modify > +it under the terms of version 2 of the GNU General Public License as > +published by the Free Software Foundation. > + > +This program is distributed in the hope that it will be useful, but > +WITHOUT ANY WARRANTY; without even the implied warranty of > +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU > +General Public License for more details. > + > +You should have received a copy of the GNU General Public License > +along with this program; if not, write to the Free Software > +Foundation, Inc., 51 Franklin St - Fifth Floor, Boston, MA 02110-1301 USA. > +The full GNU General Public License is included in this distribution > +in the file called LICENSE.GPL. > > Modified: head/sys/dev/vmware/vmci/vmci.c > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci.c Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci.c Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > */ > > Modified: head/sys/dev/vmware/vmci/vmci.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_call_defs.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_call_defs.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_call_defs.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_datagram.c > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_datagram.c Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_datagram.c Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > */ > > Modified: head/sys/dev/vmware/vmci/vmci_datagram.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_datagram.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_datagram.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_defs.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_defs.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_defs.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_doorbell.c > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_doorbell.c Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_doorbell.c Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > */ > > Modified: head/sys/dev/vmware/vmci/vmci_doorbell.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_doorbell.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_doorbell.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_driver.c > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_driver.c Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_driver.c Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > */ > > Modified: head/sys/dev/vmware/vmci/vmci_driver.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_driver.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_driver.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_event.c > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_event.c Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_event.c Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > */ > > Modified: head/sys/dev/vmware/vmci/vmci_event.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_event.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_event.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_hashtable.c > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_hashtable.c Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_hashtable.c Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > */ > > Modified: head/sys/dev/vmware/vmci/vmci_hashtable.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_hashtable.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_hashtable.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_kernel_api.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_kernel_api.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_kernel_api.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_kernel_api_1.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_kernel_api_1.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_kernel_api_1.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_kernel_api_2.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_kernel_api_2.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_kernel_api_2.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_kernel_defs.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_kernel_defs.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_kernel_defs.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_kernel_if.c > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_kernel_if.c Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_kernel_if.c Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > */ > > Modified: head/sys/dev/vmware/vmci/vmci_kernel_if.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_kernel_if.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_kernel_if.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_qpair.c > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_qpair.c Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_qpair.c Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > */ > > Modified: head/sys/dev/vmware/vmci/vmci_queue.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_queue.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_queue.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_queue_pair.c > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_queue_pair.c Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_queue_pair.c Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > */ > > Modified: head/sys/dev/vmware/vmci/vmci_queue_pair.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_queue_pair.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_queue_pair.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_resource.c > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_resource.c Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_resource.c Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > */ > > Modified: head/sys/dev/vmware/vmci/vmci_resource.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_resource.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_resource.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/dev/vmware/vmci/vmci_utils.h > ============================================================================== > --- head/sys/dev/vmware/vmci/vmci_utils.h Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/dev/vmware/vmci/vmci_utils.h Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2018 VMware, Inc. All Rights Reserved. > + * Copyright (c) 2018 VMware, Inc. > * > * SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > * > > Modified: head/sys/modules/vmware/vmci/Makefile > ============================================================================== > --- head/sys/modules/vmware/vmci/Makefile Sun Apr 8 00:56:19 2018 (r332262) > +++ head/sys/modules/vmware/vmci/Makefile Sun Apr 8 01:32:56 2018 (r332263) > @@ -1,8 +1,3 @@ > -# > -# Copyright (c) 2018 VMware, Inc. All Rights Reserved. > -# > -# SPDX-License-Identifier: (BSD-2-Clause OR GPL-2.0) > -# > # $FreeBSD$ > > .PATH: ${SRCTOP}/sys/dev/vmware/vmci > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Apr 8 02:27:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9D556F9A3F6 for ; Sun, 8 Apr 2018 02:27:24 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-it0-x233.google.com (mail-it0-x233.google.com [IPv6:2607:f8b0:4001:c0b::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0DFC785760 for ; Sun, 8 Apr 2018 02:27:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-it0-x233.google.com with SMTP id 15-v6so6201818itl.1 for ; Sat, 07 Apr 2018 19:27:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=HAc4a7KFiEU39x0hZHt4t8zMjD+xPb4m47CvH1exNE0=; b=ZjYEHTOBURJ3VJOUkUicMYmybBH0kJ+DSSYCTNZm/QtEtASkDGgp5mmU9h0GsNn0uZ GjX6SDvsAaxlcd2pgcM/c+F25HBrnIHJY01VqjLpiYJsm7N3qmAFJuRF+ZzFi9JBqjBP 29l6XxKp0eU7VJG8qr2pKmcVIyiXhg3GvhQqV6tXNZjz+0jBQRdCcb+IasTkpxgnwxPE i+7oNAwcp4Hh/g6XQpPVfDKGVT1fK0j9HYbMm9fevoDqaZIQXnuFnNLqcnAuXzOjRRKy Ru3YomBxjarsnluCkAXkZraCO8qJPFwz9CNFmolujPsNm6xPuAykJ0QoIEIavS1FwSlU hAxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=HAc4a7KFiEU39x0hZHt4t8zMjD+xPb4m47CvH1exNE0=; b=UWlzu6qkMbzYWbwZekyAAon/hHT/VzEJQwuOcq4kyLpKC+oyHEjWH2uAqJ78YkM88/ et8mxPkoZJaLxpI5GrQnUYo5Pa2i3IWhVxRzhHVCjUE7zlu/KZqTsX2VOsRIIinytHvk eYRnjUlDpPMfAbmVJpi3h6BPOqWgO7RY/VA70HcI1De+CrKGPnmbcjhReja+8TfqwpQy /MdloldsCoeWMGzreylpYd3FEeVbsLeW0IFVYIOSHv2n0xmN9F6nu1NR4P0a4u/MEl4u VZ69+yqmp5NaiTVdhIgqO1+9bD32v8LePBuANJhAbITOnk6NSZ1lWbo5mF2ajFyqLI66 2PXA== X-Gm-Message-State: ALQs6tAopi3SL5F5OGvzp/LXy6ylVOOhQhIWhtldr03NlaX2/1T01Pac 9+3EYeUuwDUwRrmNH7bj61cg6je5uI3Stfa0Rc1L0A== X-Google-Smtp-Source: AIpwx4+WjbDGBYO3NezqgcZOybb6csePrB/qz+IZHwox0yL9kUPYYBr8RX6tPkbUGQ4aqZ53XfLYkfJjvj/xQruUyZ8= X-Received: by 2002:a24:19c9:: with SMTP id b192-v6mr23252434itb.1.1523154443133; Sat, 07 Apr 2018 19:27:23 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.228.135 with HTTP; Sat, 7 Apr 2018 19:27:22 -0700 (PDT) X-Originating-IP: [2603:300b:6:5100:1052:acc7:f9de:2b6d] In-Reply-To: <201804080205.w38250B6011200@pdx.rh.CN85.dnsmgr.net> References: <201804080132.w381Wuob043783@repo.freebsd.org> <201804080205.w38250B6011200@pdx.rh.CN85.dnsmgr.net> From: Warner Losh Date: Sat, 7 Apr 2018 20:27:22 -0600 X-Google-Sender-Auth: L8-0HdyJADS2x-Py87NtdPcdkL4 Message-ID: Subject: Re: svn commit: r332263 - in head: share/man/man4 sys/dev/vmware/vmci sys/modules/vmware/vmci To: "Rodney W. Grimes" Cc: Mark Peek , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 02:27:24 -0000 On Sat, Apr 7, 2018 at 8:05 PM, Rodney W. Grimes < freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > Author: mp > > Date: Sun Apr 8 01:32:56 2018 > > New Revision: 332263 > > URL: https://svnweb.freebsd.org/changeset/base/332263 > > > > Log: > > Update VMCI license based on comments from core, the FreeBSD > Foundation, > > and VMware legal: > > - Add a dual BSD-2 Clause/GPLv2 LICENSE file in the VMCI directory > > - Remove the use of "All Rights Reserved" > > - Per best practice, remove copyright/license info from Makefile > > > > Reviewed by: imp, emaste, jhb, Vishnu Dasa > > Approved by: VMware legal via Mark Peek > > Differential Revision: https://reviews.freebsd.org/D14979 > > Interesting that I was the one that raised issue with this, > yet was not included in the diffential resolving it. > For an "inclusive" project it seems to do a lot of "exclusive" things. > This action was also explicitly approved also by core@, in consultation with the FF lawyers. You were dropped from the discussions because you weren't adding to the discussions, just arguing, I suppose. Warner From owner-svn-src-head@freebsd.org Sun Apr 8 02:39:34 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B1CDF9B31F; Sun, 8 Apr 2018 02:39:34 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F5916C1A4; Sun, 8 Apr 2018 02:39:34 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 1E9BBD403; Sun, 8 Apr 2018 02:39:34 +0000 (UTC) Date: Sun, 8 Apr 2018 02:39:34 +0000 From: Alexey Dokuchaev To: Conrad Meyer Cc: Roger Pau Monn?? , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Subject: Re: svn commit: r332092 - in head/sys: amd64/amd64 sys x86/x86 Message-ID: <20180408023934.GA85042@FreeBSD.org> References: <201804061120.w36BK6s6074635@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.2 (2017-12-15) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 02:39:34 -0000 On Fri, Apr 06, 2018 at 07:14:42AM -0700, Conrad Meyer wrote: > I like something like this for clarity. But I don't see any reason > for these function-like macros instead of the more general definition > of an SI prefix constant multiple. A multiple works with numeric > literals and variables alike. Something like: As Bruce had said, 1G is normally written as 1024 * 1024 * 1024 and this is clearer than 1 << 30. Macros/functions like these are evil and bring more problems than they solve (again, as Bruce had explained). GiB name is also ugly (correct spelling is GB). IMHO the whole thing should just be removed. ./danfe From owner-svn-src-head@freebsd.org Sun Apr 8 02:47:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09F9DF9BF46; Sun, 8 Apr 2018 02:47:39 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 65F9470906; Sun, 8 Apr 2018 02:47:38 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w382laNa011394; Sat, 7 Apr 2018 19:47:36 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w382la7E011393; Sat, 7 Apr 2018 19:47:36 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201804080247.w382la7E011393@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r332092 - in head/sys: amd64/amd64 sys x86/x86 In-Reply-To: <20180408023934.GA85042@FreeBSD.org> To: Alexey Dokuchaev Date: Sat, 7 Apr 2018 19:47:36 -0700 (PDT) CC: Conrad Meyer , "Roger Pau Monn??" , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers 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-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 02:47:39 -0000 > On Fri, Apr 06, 2018 at 07:14:42AM -0700, Conrad Meyer wrote: > > I like something like this for clarity. But I don't see any reason > > for these function-like macros instead of the more general definition > > of an SI prefix constant multiple. A multiple works with numeric > > literals and variables alike. Something like: > > As Bruce had said, 1G is normally written as 1024 * 1024 * 1024 and this > is clearer than 1 << 30. Macros/functions like these are evil and bring > more problems than they solve (again, as Bruce had explained). GiB name > is also ugly (correct spelling is GB). IMHO the whole thing should just > be removed. I support this as well. 1K, 1M and 1G can all very easily be express as products of 1024, and have been expressed that way for most of the life of the BSD source code. I would even support this being an addition to style(9). > ./danfe -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Apr 8 02:55:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 76D0DF9C953; Sun, 8 Apr 2018 02:55:40 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 CA0D075087; Sun, 8 Apr 2018 02:55:39 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w382tZD6011426; Sat, 7 Apr 2018 19:55:35 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w382tZAh011425; Sat, 7 Apr 2018 19:55:35 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201804080255.w382tZAh011425@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r332263 - in head: share/man/man4 sys/dev/vmware/vmci sys/modules/vmware/vmci In-Reply-To: To: Warner Losh Date: Sat, 7 Apr 2018 19:55:35 -0700 (PDT) CC: "Rodney W. Grimes" , Mark Peek , 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-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 02:55:40 -0000 > On Sat, Apr 7, 2018 at 8:05 PM, Rodney W. Grimes < > freebsd@pdx.rh.cn85.dnsmgr.net> wrote: > > > > Author: mp > > > Date: Sun Apr 8 01:32:56 2018 > > > New Revision: 332263 > > > URL: https://svnweb.freebsd.org/changeset/base/332263 > > > > > > Log: > > > Update VMCI license based on comments from core, the FreeBSD > > Foundation, > > > and VMware legal: > > > - Add a dual BSD-2 Clause/GPLv2 LICENSE file in the VMCI directory > > > - Remove the use of "All Rights Reserved" > > > - Per best practice, remove copyright/license info from Makefile > > > > > > Reviewed by: imp, emaste, jhb, Vishnu Dasa > > > Approved by: VMware legal via Mark Peek > > > Differential Revision: https://reviews.freebsd.org/D14979 > > > > Interesting that I was the one that raised issue with this, > > yet was not included in the diffential resolving it. > > For an "inclusive" project it seems to do a lot of "exclusive" things. > > > > This action was also explicitly approved also by core@, in consultation > with the FF lawyers. The consulted a free legal service that is mostly involved in GPL, which, imho, was not legal advice at all. As in you more or less get what you pay for in the legal arena, and that free lawyer is not going to be by your side if you should ever end up in a court. > You were dropped from the discussions because you weren't adding to the > discussions, just arguing, I suppose. You suppose, as in speculating or know for a fact? Either way, that is an "exclusitory" move. Most people see someone elses view as being argumentative when they do not take the time to actually try to understand the other persons view, or persuade them to take there view. Any discussion with 2 sides could be considered an argument. I find it I would assert that I was actually sighting verifiable facts, with URL's, that clarified what and why certain things had been done with respect to SPDX rather than hand waving generalizatons that could not be directly verified. Sighting users of it without saying how they used, etc. How did you put it? I poo poo'ed on your claims? -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Apr 8 05:15:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28E07F82424; Sun, 8 Apr 2018 05:15:35 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C7215813B8; Sun, 8 Apr 2018 05:15:34 +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 BEB0C3213; Sun, 8 Apr 2018 05:15:34 +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 w385FYSi053812; Sun, 8 Apr 2018 05:15:34 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w385FYdC053811; Sun, 8 Apr 2018 05:15:34 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201804080515.w385FYdC053811@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sun, 8 Apr 2018 05:15:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332264 - head/lib/libufs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/lib/libufs X-SVN-Commit-Revision: 332264 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 05:15:35 -0000 Author: mckusick Date: Sun Apr 8 05:15:34 2018 New Revision: 332264 URL: https://svnweb.freebsd.org/changeset/base/332264 Log: Defensive programming when reading inodes in getino(). Specifically check for out-of-range inodes, and whether return-value pointers are NULL. Modified: head/lib/libufs/inode.c Modified: head/lib/libufs/inode.c ============================================================================== --- head/lib/libufs/inode.c Sun Apr 8 01:32:56 2018 (r332263) +++ head/lib/libufs/inode.c Sun Apr 8 05:15:34 2018 (r332264) @@ -60,6 +60,10 @@ getino(struct uufsd *disk, void **dino, ino_t inode, i ERROR(disk, NULL); fs = &disk->d_fs; + if (inode >= fs->fs_ipg * fs->fs_ncg) { + ERROR(disk, "inode number out of range"); + return (-1); + } inoblock = disk->d_inoblock; min = disk->d_inomin; max = disk->d_inomax; @@ -81,13 +85,17 @@ getino(struct uufsd *disk, void **dino, ino_t inode, i gotit: switch (disk->d_ufs) { case 1: dp1 = &((struct ufs1_dinode *)inoblock)[inode - min]; - *mode = dp1->di_mode & IFMT; - *dino = dp1; + if (mode != NULL) + *mode = dp1->di_mode & IFMT; + if (dino != NULL) + *dino = dp1; return (0); case 2: dp2 = &((struct ufs2_dinode *)inoblock)[inode - min]; - *mode = dp2->di_mode & IFMT; - *dino = dp2; + if (mode != NULL) + *mode = dp2->di_mode & IFMT; + if (dino != NULL) + *dino = dp2; return (0); default: break; From owner-svn-src-head@freebsd.org Sun Apr 8 05:40:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1748FF83C01; Sun, 8 Apr 2018 05:40:03 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail109.syd.optusnet.com.au (mail109.syd.optusnet.com.au [211.29.132.80]) by mx1.freebsd.org (Postfix) with ESMTP id 8A0E56EB7D; Sun, 8 Apr 2018 05:40:01 +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 mail109.syd.optusnet.com.au (Postfix) with ESMTPS id BA9D4D6AA31; Sun, 8 Apr 2018 15:39:52 +1000 (AEST) Date: Sun, 8 Apr 2018 15:39:52 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Cy Schubert cc: Jeff Roberson , Justin Hibbits , Jeff Roberson , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331369 - head/sys/vm In-Reply-To: <201804072223.w37MNBQI009248@slippy.cwsent.com> Message-ID: <20180408153431.J1050@besplex.bde.org> References: <201804072223.w37MNBQI009248@slippy.cwsent.com> 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=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=VxmjJ2MpAAAA:8 a=JzwRw_2MAAAA:8 a=GXryfc7mSUmSGEy9oAIA:9 a=CjuIK1q_8ugA:10 a=jDxBBm0fxBEA:10 a=7gXAzLPJhVmCkEl4_tsf:22 a=_bBvcJC8wCc67rcU61zu:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 05:40:03 -0000 On Sat, 7 Apr 2018, Cy Schubert wrote: > In message <201803230615.w2N6FTMJ040628@slippy.cwsent.com>, Cy Schubert > writes: >> In message <20180323150709.H968@besplex.bde.org>, Bruce Evans writes: >>> On Thu, 22 Mar 2018, Jeff Roberson wrote: >>> >>>> On Thu, 22 Mar 2018, Cy Schubert wrote: >>>> >>>>> It broke i386 too. >>>> >>>> I just did >>>> TARGET_ARCH=i386 make buildworld >>>> TARGET_ARCH=i386 make buildkernel >>>> >>>> This worked for me? >>>>> >>>>> Index: sys/vm/vm_reserv.c >>>>> =================================================================== >>>>> --- sys/vm/vm_reserv.c (revision 331399) >>>>> +++ sys/vm/vm_reserv.c (working copy) >>>>> @@ -45,8 +45,6 @@ >>>>> >>>>> #include >>>>> #include >>>>> -#include >>>>> -#include >>>>> #include >>>>> #include >>>>> #include >>>>> @@ -55,6 +53,8 @@ >>>>> #include >>>>> #include >>>>> #include >>>>> +#include >>>>> +#include >>>>> #include >>>>> #include >>>>> >>>>> This is because sys/i386/include/machine.h uses critical_enter() and >>>>> critical_exit() which are defined in sys/systm.h. >>> >>> Wrong fix. I see you committed this. Now there are more bugs to fix. >>> >>> is a prerequisite for all kernel headers except >>> , since it defines and declares things like KASSERT() and > ... > Can you please give this a once over? > > diff --git a/sys/vm/vm_reserv.c b/sys/vm/vm_reserv.c > index d8869e3bdbe..6d31d79da39 100644 > --- a/sys/vm/vm_reserv.c > +++ b/sys/vm/vm_reserv.c > @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); > #include "opt_vm.h" > > #include > +#include > #include > #include > #include > @@ -52,7 +53,6 @@ __FBSDID("$FreeBSD$"); > #include > #include > #include > -#include > #include > #include > #include It is missing backing out the unsorting of counter.h and ktr.h. This should be fixed in the same commit, so that it only takes 3 instead of 4 commits to do the sorting. Reverting changes in historical order is too much for small patches, and doesn't work when the intermediate version is broken. Bruce From owner-svn-src-head@freebsd.org Sun Apr 8 06:52:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 09F20F884C1; Sun, 8 Apr 2018 06:52: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AB7FA76C40; Sun, 8 Apr 2018 06:52:58 +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 A36BF46BF; Sun, 8 Apr 2018 06:52:58 +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 w386qweP003666; Sun, 8 Apr 2018 06:52:58 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w386qwvo003663; Sun, 8 Apr 2018 06:52:58 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201804080652.w386qwvo003663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sun, 8 Apr 2018 06:52:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332265 - head/tools/diag/prtblknos X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/tools/diag/prtblknos X-SVN-Commit-Revision: 332265 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 06:52:59 -0000 Author: mckusick Date: Sun Apr 8 06:52:58 2018 New Revision: 332265 URL: https://svnweb.freebsd.org/changeset/base/332265 Log: Split tools/diag/prtblknos into two parts: main.c - opens disk and processes the argument list of inodes to be printed prtblknos.c - prints out the list of blocks used by an inode This change allows the fsdb program to import prtblknos() to use when printing out the set of blocks used by an inode. This program was switched to using the libufs library to ease its integration with fsdb and any other filesystem utility that might want to use it in the future. Added: head/tools/diag/prtblknos/main.c (contents, props changed) Modified: head/tools/diag/prtblknos/Makefile head/tools/diag/prtblknos/prtblknos.c Modified: head/tools/diag/prtblknos/Makefile ============================================================================== --- head/tools/diag/prtblknos/Makefile Sun Apr 8 05:15:34 2018 (r332264) +++ head/tools/diag/prtblknos/Makefile Sun Apr 8 06:52:58 2018 (r332265) @@ -1,8 +1,13 @@ # $FreeBSD$ -PROG= prtblknos +BINDIR?= /usr/bin +PROG= prtblknos MAN= + +SRCS= main.c prtblknos.c + +LIBADD+=ufs test: ${PROG} ./${PROG} > a Added: head/tools/diag/prtblknos/main.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/diag/prtblknos/main.c Sun Apr 8 06:52:58 2018 (r332265) @@ -0,0 +1,80 @@ +/* + * Copyright (c) 1998, 2003, 2013, 2018 Marshall Kirk McKusick. + * 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 MARSHALL KIRK MCKUSICK ``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 MARSHALL KIRK MCKUSICK BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#include +#include +#include +#include + +union dinode { + struct ufs1_dinode *dp1; + struct ufs2_dinode *dp2; +}; + +void prtblknos(struct uufsd *disk, union dinode *dp); + +int +main(argc, argv) + int argc; + char *argv[]; +{ + struct uufsd disk; + union dinode *dp; + struct fs *fs; + char *fsname; + int inonum, error; + + if (argc < 3) { + (void)fprintf(stderr,"usage: prtblknos filesystem inode ...\n"); + exit(1); + } + + fsname = *++argv; + + /* get the superblock. */ + if ((error = ufs_disk_fillout(&disk, fsname)) < 0) + errx(1, "Cannot find file system superblock on %s\n", fsname); + fs = (struct fs *)&disk.d_sb; + + /* remaining arguments are inode numbers. */ + while (*++argv) { + /* get the inode number. */ + if ((inonum = atoi(*argv)) <= 0 || + inonum >= fs->fs_ipg * fs->fs_ncg) + errx(1, "%s is not a valid inode number", *argv); + (void)printf("%d:", inonum); + + if ((error = getino(&disk, (void **)&dp, inonum, NULL)) < 0) + err(1, "Read of inode %d on %s failed", inonum, fsname); + + prtblknos(&disk, dp); + } + exit(0); +} Modified: head/tools/diag/prtblknos/prtblknos.c ============================================================================== --- head/tools/diag/prtblknos/prtblknos.c Sun Apr 8 05:15:34 2018 (r332264) +++ head/tools/diag/prtblknos/prtblknos.c Sun Apr 8 06:52:58 2018 (r332265) @@ -27,146 +27,78 @@ */ #include -#include -#include - -#include #include #include -#include -#include -#include -#include #include -#include -#include +#include union dinode { - struct ufs1_dinode *dp1; - struct ufs2_dinode *dp2; + struct ufs1_dinode dp1; + struct ufs2_dinode dp2; }; -struct fs *sbp; -char *fsname; -int fd; -void indirprt(int level, int blksperindir, int lbn, ufs2_daddr_t blkno, - int lastlbn); -void printblk(int lbn, ufs2_daddr_t blkno, int numblks, int lastlbn); +void prtblknos(struct uufsd *disk, union dinode *dp); -/* - * Possible superblock locations ordered from most to least likely. - */ -static int sblock_try[] = SBLOCKSEARCH; +static void indirprt(struct uufsd *, int, int, int, ufs2_daddr_t, int); +static char *distance(struct fs *, daddr_t, daddr_t); +static void printblk(struct fs *, int, ufs2_daddr_t, int, int); -int -main(argc, argv) - int argc; - char *argv[]; +void +prtblknos(disk, dp) + struct uufsd *disk; + union dinode *dp; { - int i, len, lbn, frags, inonum, numblks, blksperindir; - char sblock[SBLOCKSIZE], ibuf[MAXBSIZE]; + int i, len, lbn, frags, numblks, blksperindir; ufs2_daddr_t blkno; - off_t size, offset; - union dinode dp; + struct fs *fs; + off_t size; - if (argc < 3) { - (void)fprintf(stderr,"usage: prtblknos filesystem inode ...\n"); - exit(1); + fs = (struct fs *)&disk->d_sb; + if (fs->fs_magic == FS_UFS1_MAGIC) + size = dp->dp1.di_size; + else + size = dp->dp2.di_size; + numblks = howmany(size, fs->fs_bsize); + if (numblks == 0) { + printf(" empty file\n"); + return; } - - fsname = *++argv; - - /* get the superblock. */ - if ((fd = open(fsname, O_RDONLY, 0)) < 0) - err(1, "%s", fsname); - for (i = 0; sblock_try[i] != -1; i++) { - if (lseek(fd, sblock_try[i], SEEK_SET) < 0) - err(1, "lseek: %s", fsname); - if (read(fd, sblock, (long)SBLOCKSIZE) != SBLOCKSIZE) - err(1, "can't read superblock: %s", fsname); - sbp = (struct fs *)sblock; - if ((sbp->fs_magic == FS_UFS1_MAGIC || - (sbp->fs_magic == FS_UFS2_MAGIC && - sbp->fs_sblockloc == sblock_try[i])) && - sbp->fs_bsize <= MAXBSIZE && - sbp->fs_bsize >= sizeof(struct fs)) - break; + len = numblks < UFS_NDADDR ? numblks : UFS_NDADDR; + for (i = 0; i < len; i++) { + if (i < numblks - 1) + frags = fs->fs_frag; + else + frags = howmany(size % fs->fs_bsize, + fs->fs_fsize); + if (fs->fs_magic == FS_UFS1_MAGIC) + blkno = dp->dp1.di_db[i]; + else + blkno = dp->dp2.di_db[i]; + printblk(fs, i, blkno, frags, numblks); } - if (sblock_try[i] == -1) - errx(1, "Cannot find file system superblock\n"); - /* remaining arguments are inode numbers. */ - while (*++argv) { - /* get the inode number. */ - if ((inonum = atoi(*argv)) <= 0) - errx(1, "%s is not a valid inode number", *argv); - (void)printf("%d:", inonum); - - /* read in the appropriate block. */ - offset = ino_to_fsba(sbp, inonum); /* inode to fs blk */ - offset = fsbtodb(sbp, offset); /* fs blk disk blk */ - offset *= DEV_BSIZE; /* disk blk to bytes */ - - /* seek and read the block */ - if (lseek(fd, offset, SEEK_SET) < 0) - err(1, "%s", fsname); - if (read(fd, ibuf, sbp->fs_bsize) != sbp->fs_bsize) - err(1, "%s", fsname); - - /* get the inode within the block. */ - if (sbp->fs_magic == FS_UFS1_MAGIC) { - dp.dp1 = &((struct ufs1_dinode *)(ibuf)) - [ino_to_fsbo(sbp, inonum)]; - size = dp.dp1->di_size; - } else { - dp.dp2 = &((struct ufs2_dinode *)(ibuf)) - [ino_to_fsbo(sbp, inonum)]; - size = dp.dp2->di_size; - } - - numblks = howmany(size, sbp->fs_bsize); - if (numblks == 0) { - printf(" empty file\n"); - continue; - } - len = numblks < UFS_NDADDR ? numblks : UFS_NDADDR; - for (i = 0; i < len; i++) { - if (i < numblks - 1) - frags = sbp->fs_frag; - else - frags = howmany(size % sbp->fs_bsize, - sbp->fs_fsize); - if (sbp->fs_magic == FS_UFS1_MAGIC) - blkno = dp.dp1->di_db[i]; - else - blkno = dp.dp2->di_db[i]; - printblk(i, blkno, frags, numblks); - } - - blksperindir = 1; - len = numblks - UFS_NDADDR; - lbn = UFS_NDADDR; - for (i = 0; len > 0 && i < UFS_NIADDR; i++) { - if (sbp->fs_magic == FS_UFS1_MAGIC) - blkno = dp.dp1->di_ib[i]; - else - blkno = dp.dp2->di_ib[i]; - indirprt(i, blksperindir, lbn, blkno, numblks); - blksperindir *= NINDIR(sbp); - lbn += blksperindir; - len -= blksperindir; - } - - /* dummy print to flush out last extent */ - printblk(numblks, 0, frags, 0); + blksperindir = 1; + len = numblks - UFS_NDADDR; + lbn = UFS_NDADDR; + for (i = 0; len > 0 && i < UFS_NIADDR; i++) { + if (fs->fs_magic == FS_UFS1_MAGIC) + blkno = dp->dp1.di_ib[i]; + else + blkno = dp->dp2.di_ib[i]; + indirprt(disk, i, blksperindir, lbn, blkno, numblks); + blksperindir *= NINDIR(fs); + lbn += blksperindir; + len -= blksperindir; } - (void)close(fd); - exit(0); + + /* dummy print to flush out last extent */ + printblk(fs, numblks, 0, frags, 0); } -void -indirprt(level, blksperindir, lbn, blkno, lastlbn) +static void +indirprt(disk, level, blksperindir, lbn, blkno, lastlbn) + struct uufsd *disk; int level; int blksperindir; int lbn; @@ -174,41 +106,39 @@ indirprt(level, blksperindir, lbn, blkno, lastlbn) int lastlbn; { char indir[MAXBSIZE]; - off_t offset; + struct fs *fs; int i, last; - printblk(lbn, blkno, sbp->fs_frag, -level); + fs = (struct fs *)&disk->d_sb; + printblk(fs, lbn, blkno, fs->fs_frag, -level); /* read in the indirect block. */ - offset = fsbtodb(sbp, blkno); /* fs blk disk blk */ - offset *= DEV_BSIZE; /* disk blk to bytes */ - if (lseek(fd, offset, SEEK_SET) < 0) - err(1, "%s", fsname); - if (read(fd, indir, sbp->fs_bsize) != sbp->fs_bsize) - err(1, "%s", fsname); - last = howmany(lastlbn - lbn, blksperindir) < NINDIR(sbp) ? - howmany(lastlbn - lbn, blksperindir) : NINDIR(sbp); + if (bread(disk, fsbtodb(fs, blkno), indir, fs->fs_bsize) == -1) + err(1, "Read of indirect block %jd failed", (intmax_t)blkno); + last = howmany(lastlbn - lbn, blksperindir) < NINDIR(fs) ? + howmany(lastlbn - lbn, blksperindir) : NINDIR(fs); if (blksperindir == 1) { for (i = 0; i < last; i++) { - if (sbp->fs_magic == FS_UFS1_MAGIC) + if (fs->fs_magic == FS_UFS1_MAGIC) blkno = ((ufs1_daddr_t *)indir)[i]; else blkno = ((ufs2_daddr_t *)indir)[i]; - printblk(lbn + i, blkno, sbp->fs_frag, lastlbn); + printblk(fs, lbn + i, blkno, fs->fs_frag, lastlbn); } return; } for (i = 0; i < last; i++) { - if (sbp->fs_magic == FS_UFS1_MAGIC) + if (fs->fs_magic == FS_UFS1_MAGIC) blkno = ((ufs1_daddr_t *)indir)[i]; else blkno = ((ufs2_daddr_t *)indir)[i]; - indirprt(level - 1, blksperindir / NINDIR(sbp), + indirprt(disk, level - 1, blksperindir / NINDIR(fs), lbn + blksperindir * i, blkno, lastlbn); } } -char * -distance(lastblk, firstblk) +static char * +distance(fs, lastblk, firstblk) + struct fs *fs; daddr_t lastblk; daddr_t firstblk; { @@ -219,22 +149,23 @@ distance(lastblk, firstblk) if (lastblk == 0) return (""); delta = firstblk - lastblk - 1; - firstcg = dtog(sbp, firstblk); - lastcg = dtog(sbp, lastblk); + firstcg = dtog(fs, firstblk); + lastcg = dtog(fs, lastblk); if (firstcg == lastcg) { snprintf(buf, 100, " distance %jd", (intmax_t)delta); return (&buf[0]); } snprintf(buf, 100, " cg %d blk %jd to cg %d blk %jd", - lastcg, dtogd(sbp, lastblk), firstcg, dtogd(sbp, firstblk)); + lastcg, dtogd(fs, lastblk), firstcg, dtogd(fs, firstblk)); return (&buf[0]); } -char *indirname[UFS_NIADDR] = { "First", "Second", "Third" }; +static char *indirname[UFS_NIADDR] = { "First", "Second", "Third" }; -void -printblk(lbn, blkno, numblks, lastlbn) +static void +printblk(fs, lbn, blkno, numblks, lastlbn) + struct fs *fs; int lbn; ufs2_daddr_t blkno; int numblks; @@ -282,19 +213,19 @@ flush: } else if (seq == 1) { if (numblks == 1) printf("\tlbn %d blkno %jd%s\n", lbn - seq, - (intmax_t)firstblk, distance(lastblk, firstblk)); + (intmax_t)firstblk, distance(fs, lastblk, firstblk)); else printf("\tlbn %d blkno %jd-%jd%s\n", lbn - seq, (intmax_t)firstblk, (intmax_t)(firstblk + numblks - 1), - distance(lastblk, firstblk)); + distance(fs, lastblk, firstblk)); lastblk = firstblk + numblks - 1; } else { printf("\tlbn %d-%d blkno %jd-%jd%s\n", lbn - seq, lbn - 1, (intmax_t)firstblk, (intmax_t)(firstblk + - (seq - 1) * sbp->fs_frag + numblks - 1), - distance(lastblk, firstblk)); - lastblk = firstblk + (seq - 1) * sbp->fs_frag + numblks - 1; + (seq - 1) * fs->fs_frag + numblks - 1), + distance(fs, lastblk, firstblk)); + lastblk = firstblk + (seq - 1) * fs->fs_frag + numblks - 1; } if (lastlbn > 0 || blkno == 0) { seq = 1; @@ -302,13 +233,13 @@ flush: return; } prtindir: - if (seq != 0 && (sbp->fs_metaspace == 0 || lastindirblk == 0)) + if (seq != 0 && (fs->fs_metaspace == 0 || lastindirblk == 0)) lastindirblk = lastblk; printf("%s-level indirect, blkno %jd-%jd%s\n", indirname[-lastlbn], (intmax_t)blkno, (intmax_t)(blkno + numblks - 1), - distance(lastindirblk, blkno)); + distance(fs, lastindirblk, blkno)); lastindirblk = blkno + numblks - 1; - if (sbp->fs_metaspace == 0) + if (fs->fs_metaspace == 0) lastblk = lastindirblk; seq = 0; } From owner-svn-src-head@freebsd.org Sun Apr 8 06:59:43 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 536F1F88BEE; Sun, 8 Apr 2018 06:59:43 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 05C747A349; Sun, 8 Apr 2018 06:59:43 +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 00AE846C3; Sun, 8 Apr 2018 06:59:43 +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 w386xgtH003947; Sun, 8 Apr 2018 06:59:42 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w386xgPc003946; Sun, 8 Apr 2018 06:59:42 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201804080659.w386xgPc003946@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sun, 8 Apr 2018 06:59:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332266 - head/lib/libufs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/lib/libufs X-SVN-Commit-Revision: 332266 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 06:59:43 -0000 Author: mckusick Date: Sun Apr 8 06:59:42 2018 New Revision: 332266 URL: https://svnweb.freebsd.org/changeset/base/332266 Log: The ufs_disk_write() function is used to upgrade a read-only descriptor to a read-write descriptor. Do not close the read-only descriptor until the read-write is successfully obtained. Before this fix, a failed upgrade left no usable descriptor with which to work. Modified: head/lib/libufs/type.c Modified: head/lib/libufs/type.c ============================================================================== --- head/lib/libufs/type.c Sun Apr 8 06:52:58 2018 (r332265) +++ head/lib/libufs/type.c Sun Apr 8 06:59:42 2018 (r332266) @@ -60,6 +60,7 @@ ufs_disk_close(struct uufsd *disk) { ERROR(disk, NULL); close(disk->d_fd); + disk->d_fd = -1; if (disk->d_inoblock != NULL) { free(disk->d_inoblock); disk->d_inoblock = NULL; @@ -181,19 +182,21 @@ again: if ((ret = stat(name, &st)) < 0) { int ufs_disk_write(struct uufsd *disk) { + int fd; + ERROR(disk, NULL); if (disk->d_mine & MINE_WRITE) return (0); - close(disk->d_fd); - - disk->d_fd = open(disk->d_name, O_RDWR); - if (disk->d_fd < 0) { + fd = open(disk->d_name, O_RDWR); + if (fd < 0) { ERROR(disk, "failed to open disk for writing"); return (-1); } + close(disk->d_fd); + disk->d_fd = fd; disk->d_mine |= MINE_WRITE; return (0); From owner-svn-src-head@freebsd.org Sun Apr 8 07:06:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C649DF892E0; Sun, 8 Apr 2018 07:06:12 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7AA497DBC9; Sun, 8 Apr 2018 07:06:12 +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 758844858; Sun, 8 Apr 2018 07:06:12 +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 w3876CEr008777; Sun, 8 Apr 2018 07:06:12 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3876Cmv008775; Sun, 8 Apr 2018 07:06:12 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201804080706.w3876Cmv008775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sun, 8 Apr 2018 07:06:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332267 - head/sbin/fsdb X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sbin/fsdb X-SVN-Commit-Revision: 332267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 07:06:13 -0000 Author: mckusick Date: Sun Apr 8 07:06:12 2018 New Revision: 332267 URL: https://svnweb.freebsd.org/changeset/base/332267 Log: When using the fsdb `blocks' command, replace the long and ugly list of blocks with the much more concise and readable block list shown by the prtblknos() function imported from tools/diag/prtblknos. Modified: head/sbin/fsdb/Makefile head/sbin/fsdb/fsdbutil.c Modified: head/sbin/fsdb/Makefile ============================================================================== --- head/sbin/fsdb/Makefile Sun Apr 8 06:59:42 2018 (r332266) +++ head/sbin/fsdb/Makefile Sun Apr 8 07:06:12 2018 (r332267) @@ -7,10 +7,11 @@ PROG= fsdb MAN= fsdb.8 SRCS= fsdb.c fsdbutil.c \ dir.c ea.c fsutil.c inode.c pass1.c pass1b.c pass2.c pass3.c pass4.c \ - pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c globs.c + pass5.c setup.c utilities.c ffs_subr.c ffs_tables.c globs.c prtblknos.c CFLAGS+= -I${.CURDIR:H}/fsck_ffs WARNS?= 2 LIBADD= edit ufs -.PATH: ${.CURDIR:H}/fsck_ffs ${SRCTOP}/sys/ufs/ffs +.PATH: ${.CURDIR:H}/fsck_ffs ${SRCTOP}/sys/ufs/ffs \ + ${SRCTOP}/tools/diag/prtblknos .include Modified: head/sbin/fsdb/fsdbutil.c ============================================================================== --- head/sbin/fsdb/fsdbutil.c Sun Apr 8 06:59:42 2018 (r332266) +++ head/sbin/fsdb/fsdbutil.c Sun Apr 8 07:06:12 2018 (r332267) @@ -53,9 +53,7 @@ static const char rcsid[] = #include "fsdb.h" #include "fsck.h" -static int charsperline(void); -static void printindir(ufs2_daddr_t blk, int level, char *bufp); -static void printblocks(ino_t inum, union dinode *dp); +void prtblknos(struct uufsd *disk, union dinode *dp); char ** crack(char *line, int *argc) @@ -200,127 +198,6 @@ printstat(const char *cp, ino_t inum, union dinode *dp } -/* - * Determine the number of characters in a - * single line. - */ - -static int -charsperline(void) -{ - int columns; - char *cp; - struct winsize ws; - - columns = 0; - if (ioctl(0, TIOCGWINSZ, &ws) != -1) - columns = ws.ws_col; - if (columns == 0 && (cp = getenv("COLUMNS"))) - columns = atoi(cp); - if (columns == 0) - columns = 80; /* last resort */ - return (columns); -} - - -/* - * Recursively print a list of indirect blocks. - */ -static void -printindir(ufs2_daddr_t blk, int level, char *bufp) -{ - struct bufarea buf, *bp; - char tempbuf[32]; /* enough to print an ufs2_daddr_t */ - int i, j, cpl, charssofar; - ufs2_daddr_t blkno; - - if (blk == 0) - return; - printf("%jd (%d) =>\n", (intmax_t)blk, level); - if (level == 0) { - /* for the final indirect level, don't use the cache */ - bp = &buf; - bp->b_un.b_buf = bufp; - initbarea(bp, BT_UNKNOWN); - - getblk(bp, blk, sblock.fs_bsize); - } else - bp = getdatablk(blk, sblock.fs_bsize, BT_UNKNOWN); - - cpl = charsperline(); - for (i = charssofar = 0; i < NINDIR(&sblock); i++) { - if (sblock.fs_magic == FS_UFS1_MAGIC) - blkno = bp->b_un.b_indir1[i]; - else - blkno = bp->b_un.b_indir2[i]; - if (blkno == 0) - continue; - j = sprintf(tempbuf, "%jd", (intmax_t)blkno); - if (level == 0) { - charssofar += j; - if (charssofar >= cpl - 2) { - putchar('\n'); - charssofar = j; - } - } - fputs(tempbuf, stdout); - if (level == 0) { - printf(", "); - charssofar += 2; - } else { - printf(" =>\n"); - printindir(blkno, level - 1, bufp); - printf("\n"); - charssofar = 0; - } - } - if (level == 0) - putchar('\n'); - return; -} - - -/* - * Print the block pointers for one inode. - */ -static void -printblocks(ino_t inum, union dinode *dp) -{ - char *bufp; - int i, nfrags; - long ndb, offset; - ufs2_daddr_t blkno; - - printf("Blocks for inode %ju:\n", (uintmax_t)inum); - printf("Direct blocks:\n"); - ndb = howmany(DIP(dp, di_size), sblock.fs_bsize); - for (i = 0; i < UFS_NDADDR && i < ndb; i++) { - if (i > 0) - printf(", "); - blkno = DIP(dp, di_db[i]); - printf("%jd", (intmax_t)blkno); - } - if (ndb <= UFS_NDADDR) { - offset = blkoff(&sblock, DIP(dp, di_size)); - if (offset != 0) { - nfrags = numfrags(&sblock, fragroundup(&sblock, offset)); - printf(" (%d frag%s)", nfrags, nfrags > 1? "s": ""); - } - } - putchar('\n'); - if (ndb <= UFS_NDADDR) - return; - - bufp = malloc((unsigned int)sblock.fs_bsize); - if (bufp == NULL) - errx(EEXIT, "cannot allocate indirect block buffer"); - printf("Indirect blocks:\n"); - for (i = 0; i < UFS_NIADDR; i++) - printindir(DIP(dp, di_ib[i]), i, bufp); - free(bufp); -} - - int checkactive(void) { @@ -359,7 +236,7 @@ printactive(int doblocks) case IFSOCK: case IFIFO: if (doblocks) - printblocks(curinum, curinode); + prtblknos(&disk, curinode); else printstat("current inode", curinum, curinode); break; From owner-svn-src-head@freebsd.org Sun Apr 8 07:18:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78FEEF89E27; Sun, 8 Apr 2018 07:18:30 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2B682845F6; Sun, 8 Apr 2018 07:18:30 +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 237E249EE; Sun, 8 Apr 2018 07:18:30 +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 w387IUwL014139; Sun, 8 Apr 2018 07:18:30 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w387IULU014138; Sun, 8 Apr 2018 07:18:30 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201804080718.w387IULU014138@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Sun, 8 Apr 2018 07:18:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332268 - head/tools/diag/prtblknos X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/tools/diag/prtblknos X-SVN-Commit-Revision: 332268 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 07:18:30 -0000 Author: mckusick Date: Sun Apr 8 07:18:29 2018 New Revision: 332268 URL: https://svnweb.freebsd.org/changeset/base/332268 Log: Add (intmax_t) type casts to some printf parameters to keep i386 happy. Modified: head/tools/diag/prtblknos/prtblknos.c Modified: head/tools/diag/prtblknos/prtblknos.c ============================================================================== --- head/tools/diag/prtblknos/prtblknos.c Sun Apr 8 07:06:12 2018 (r332267) +++ head/tools/diag/prtblknos/prtblknos.c Sun Apr 8 07:18:29 2018 (r332268) @@ -156,7 +156,8 @@ distance(fs, lastblk, firstblk) return (&buf[0]); } snprintf(buf, 100, " cg %d blk %jd to cg %d blk %jd", - lastcg, dtogd(fs, lastblk), firstcg, dtogd(fs, firstblk)); + lastcg, (intmax_t)dtogd(fs, lastblk), firstcg, + (intmax_t)dtogd(fs, firstblk)); return (&buf[0]); } From owner-svn-src-head@freebsd.org Sun Apr 8 11:37:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 92A24F9BDE4; Sun, 8 Apr 2018 11:37:01 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4225C68E69; Sun, 8 Apr 2018 11:37:01 +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 3BA467494; Sun, 8 Apr 2018 11:37:01 +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 w38Bb1Kd046914; Sun, 8 Apr 2018 11:37:01 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38Bb1sL046913; Sun, 8 Apr 2018 11:37:01 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804081137.w38Bb1sL046913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 8 Apr 2018 11:37:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332269 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 332269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 11:37:01 -0000 Author: tuexen Date: Sun Apr 8 11:37:00 2018 New Revision: 332269 URL: https://svnweb.freebsd.org/changeset/base/332269 Log: Fix a signed/unsigned warning showing up for the userland stack on some platforms. Thanks to Felix Weinrank for reporting the issue. MFC after:i 3 days Modified: head/sys/netinet/sctp_input.c Modified: head/sys/netinet/sctp_input.c ============================================================================== --- head/sys/netinet/sctp_input.c Sun Apr 8 07:18:29 2018 (r332268) +++ head/sys/netinet/sctp_input.c Sun Apr 8 11:37:00 2018 (r332269) @@ -2616,7 +2616,7 @@ sctp_handle_cookie_echo(struct mbuf *m, int iphlen, in (sizeof(uint32_t)))); diff = now; timevalsub(&diff, &time_expires); - if (diff.tv_sec > UINT32_MAX / 1000000) { + if ((uint32_t)diff.tv_sec > UINT32_MAX / 1000000) { staleness = UINT32_MAX; } else { staleness = diff.tv_sec * 1000000; From owner-svn-src-head@freebsd.org Sun Apr 8 11:39:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F05A1F9C07C; Sun, 8 Apr 2018 11:39:27 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A726F6A407; Sun, 8 Apr 2018 11:39:27 +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 9ED3D7499; Sun, 8 Apr 2018 11:39:27 +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 w38BdR6m047039; Sun, 8 Apr 2018 11:39:27 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38BdR0t047036; Sun, 8 Apr 2018 11:39:27 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201804081139.w38BdR0t047036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 8 Apr 2018 11:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332270 - head/stand/forth X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/forth X-SVN-Commit-Revision: 332270 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 11:39:28 -0000 Author: tsoome Date: Sun Apr 8 11:39:27 2018 New Revision: 332270 URL: https://svnweb.freebsd.org/changeset/base/332270 Log: loader: include efi.4th only if we do have uefi Also simplify efi.4th. Modified: head/stand/forth/efi.4th head/stand/forth/loader.4th head/stand/forth/loader.rc Modified: head/stand/forth/efi.4th ============================================================================== --- head/stand/forth/efi.4th Sun Apr 8 11:37:00 2018 (r332269) +++ head/stand/forth/efi.4th Sun Apr 8 11:39:27 2018 (r332270) @@ -26,16 +26,5 @@ only forth definitions -: efiboot? ( -- flag ) - s" efi-version" getenv -1 <> dup if - swap drop ( c-addr flag -- flag ) - then -; - -: maybe-efi-resizecons - efiboot? if - s" efi-autoresizecons" evaluate - then -; - +s" efi-autoresizecons" evaluate .( EFI boot environment) cr Modified: head/stand/forth/loader.4th ============================================================================== --- head/stand/forth/loader.4th Sun Apr 8 11:37:00 2018 (r332269) +++ head/stand/forth/loader.4th Sun Apr 8 11:39:27 2018 (r332270) @@ -46,6 +46,9 @@ include /boot/support.4th include /boot/color.4th include /boot/delay.4th include /boot/check-password.4th +s" efi-version" getenv? [if] + include /boot/forth/efi.4th +[then] only forth definitions Modified: head/stand/forth/loader.rc ============================================================================== --- head/stand/forth/loader.rc Sun Apr 8 11:37:00 2018 (r332269) +++ head/stand/forth/loader.rc Sun Apr 8 11:39:27 2018 (r332270) @@ -6,14 +6,11 @@ \ \ Includes additional commands include /boot/loader.4th -include /boot/efi.4th try-include /boot/loader.rc.local \ Reads and processes loader.conf variables \ NOTE: Change to `initialize' if you enable the below boot menu start - -maybe-efi-resizecons \ Tests for password -- executes autoboot first if a password was defined check-password From owner-svn-src-head@freebsd.org Sun Apr 8 11:50:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 103ABF9CD79; Sun, 8 Apr 2018 11:50:07 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B47EA7020A; Sun, 8 Apr 2018 11:50:06 +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 AC1A57644; Sun, 8 Apr 2018 11:50:06 +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 w38Bo6H3051846; Sun, 8 Apr 2018 11:50:06 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38Bo6FP051845; Sun, 8 Apr 2018 11:50:06 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804081150.w38Bo6FP051845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 8 Apr 2018 11:50:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332271 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 332271 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 11:50:07 -0000 Author: tuexen Date: Sun Apr 8 11:50:06 2018 New Revision: 332271 URL: https://svnweb.freebsd.org/changeset/base/332271 Log: Small cleanup, no functional change. MFC after: 3 days Modified: head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sun Apr 8 11:39:27 2018 (r332270) +++ head/sys/netinet/sctp_usrreq.c Sun Apr 8 11:50:06 2018 (r332271) @@ -705,22 +705,10 @@ sctp_disconnect(struct socket *so) if (SCTP_GET_STATE(asoc) != SCTP_STATE_COOKIE_WAIT) { /* Left with Data unread */ - struct mbuf *err; + struct mbuf *op_err; - err = sctp_get_mbuf_for_msg(sizeof(struct sctp_paramhdr), 0, M_NOWAIT, 1, MT_DATA); - if (err) { - /* - * Fill in the user - * initiated abort - */ - struct sctp_paramhdr *ph; - - ph = mtod(err, struct sctp_paramhdr *); - SCTP_BUF_LEN(err) = sizeof(struct sctp_paramhdr); - ph->param_type = htons(SCTP_CAUSE_USER_INITIATED_ABT); - ph->param_length = htons(SCTP_BUF_LEN(err)); - } - sctp_send_abort_tcb(stcb, err, SCTP_SO_LOCKED); + op_err = sctp_generate_cause(SCTP_CAUSE_USER_INITIATED_ABT, ""); + sctp_send_abort_tcb(stcb, op_err, SCTP_SO_LOCKED); SCTP_STAT_INCR_COUNTER32(sctps_aborted); } SCTP_INP_RUNLOCK(inp); From owner-svn-src-head@freebsd.org Sun Apr 8 11:55:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D834FF9D47B; Sun, 8 Apr 2018 11:55:27 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8B4AF73211; Sun, 8 Apr 2018 11:55:27 +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 8650577D8; Sun, 8 Apr 2018 11:55:27 +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 w38BtR3F056447; Sun, 8 Apr 2018 11:55:27 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38BtR1K056446; Sun, 8 Apr 2018 11:55:27 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201804081155.w38BtR1K056446@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 8 Apr 2018 11:55:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332272 - head/stand/forth X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/forth X-SVN-Commit-Revision: 332272 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 11:55:28 -0000 Author: tsoome Date: Sun Apr 8 11:55:27 2018 New Revision: 332272 URL: https://svnweb.freebsd.org/changeset/base/332272 Log: loader: 332270 did use wrong path for efi.4th The correct path is still /boot/efi.4th Modified: head/stand/forth/loader.4th Modified: head/stand/forth/loader.4th ============================================================================== --- head/stand/forth/loader.4th Sun Apr 8 11:50:06 2018 (r332271) +++ head/stand/forth/loader.4th Sun Apr 8 11:55:27 2018 (r332272) @@ -47,7 +47,7 @@ include /boot/color.4th include /boot/delay.4th include /boot/check-password.4th s" efi-version" getenv? [if] - include /boot/forth/efi.4th + include /boot/efi.4th [then] only forth definitions From owner-svn-src-head@freebsd.org Sun Apr 8 12:08:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0212EF9E87E; Sun, 8 Apr 2018 12:08:22 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 672BA7A3A4; Sun, 8 Apr 2018 12:08:21 +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 5FCD7798A; Sun, 8 Apr 2018 12:08:21 +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 w38C8LQu061824; Sun, 8 Apr 2018 12:08:21 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38C8LFt061822; Sun, 8 Apr 2018 12:08:21 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804081208.w38C8LFt061822@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Sun, 8 Apr 2018 12:08:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332273 - 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: 332273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 12:08:22 -0000 Author: tuexen Date: Sun Apr 8 12:08:20 2018 New Revision: 332273 URL: https://svnweb.freebsd.org/changeset/base/332273 Log: Fix a logical inversion bug. Thanks to Irene Ruengeler for finding and reporting this bug. MFC after: 3 days Modified: head/sys/netinet/sctp_usrreq.c head/sys/netinet6/sctp6_usrreq.c Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Sun Apr 8 11:55:27 2018 (r332272) +++ head/sys/netinet/sctp_usrreq.c Sun Apr 8 12:08:20 2018 (r332273) @@ -204,7 +204,7 @@ sctp_notify(struct sctp_inpcb *inp, #endif /* no need to unlock here, since the TCB is gone */ } else if (icmp_code == ICMP_UNREACH_NEEDFRAG) { - if ((net->dest_state & SCTP_ADDR_NO_PMTUD) == 0) { + if (net->dest_state & SCTP_ADDR_NO_PMTUD) { SCTP_TCB_UNLOCK(stcb); return; } Modified: head/sys/netinet6/sctp6_usrreq.c ============================================================================== --- head/sys/netinet6/sctp6_usrreq.c Sun Apr 8 11:55:27 2018 (r332272) +++ head/sys/netinet6/sctp6_usrreq.c Sun Apr 8 12:08:20 2018 (r332273) @@ -223,7 +223,7 @@ sctp6_notify(struct sctp_inpcb *inp, } break; case ICMP6_PACKET_TOO_BIG: - if ((net->dest_state & SCTP_ADDR_NO_PMTUD) == 0) { + if (net->dest_state & SCTP_ADDR_NO_PMTUD) { SCTP_TCB_UNLOCK(stcb); break; } From owner-svn-src-head@freebsd.org Sun Apr 8 12:20:09 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6ED30F9F6FC; Sun, 8 Apr 2018 12:20:09 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D301380CA2; Sun, 8 Apr 2018 12:20:07 +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 A099B7B2C; Sun, 8 Apr 2018 12:20:07 +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 w38CK7lg067559; Sun, 8 Apr 2018 12:20:07 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38CK6YD067551; Sun, 8 Apr 2018 12:20:06 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201804081220.w38CK6YD067551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 8 Apr 2018 12:20:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332274 - in head/sys: arm/mv dev/fdt X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: in head/sys: arm/mv dev/fdt X-SVN-Commit-Revision: 332274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 12:20:09 -0000 Author: andrew Date: Sun Apr 8 12:20:06 2018 New Revision: 332274 URL: https://svnweb.freebsd.org/changeset/base/332274 Log: Move fdt_is_type to be a Marvell specific function. It's not used by any other SoCs. Sponsored by: DARPA, AFRL Modified: head/sys/arm/mv/armv5_machdep.c head/sys/arm/mv/mv_armv7_machdep.c head/sys/arm/mv/mv_common.c head/sys/arm/mv/mv_pci.c head/sys/arm/mv/mvvar.h head/sys/dev/fdt/fdt_common.c head/sys/dev/fdt/fdt_common.h Modified: head/sys/arm/mv/armv5_machdep.c ============================================================================== --- head/sys/arm/mv/armv5_machdep.c Sun Apr 8 12:08:20 2018 (r332273) +++ head/sys/arm/mv/armv5_machdep.c Sun Apr 8 12:20:06 2018 (r332274) @@ -377,7 +377,8 @@ platform_devmap_init(void) * PCI range(s) and localbus. */ for (child = OF_child(root); child != 0; child = OF_peer(child)) { - if (fdt_is_type(child, "pci") || fdt_is_type(child, "pciep")) { + if (mv_fdt_is_type(child, "pci") || + mv_fdt_is_type(child, "pciep")) { /* * Check space: each PCI node will consume 2 devmap * entries. Modified: head/sys/arm/mv/mv_armv7_machdep.c ============================================================================== --- head/sys/arm/mv/mv_armv7_machdep.c Sun Apr 8 12:08:20 2018 (r332273) +++ head/sys/arm/mv/mv_armv7_machdep.c Sun Apr 8 12:20:06 2018 (r332274) @@ -397,7 +397,8 @@ mv_a38x_platform_devmap_init(platform_t plat) * PCI range(s) and localbus. */ for (child = OF_child(root); child != 0; child = OF_peer(child)) { - if (fdt_is_type(child, "pci") || fdt_is_type(child, "pciep")) { + if (mv_fdt_is_type(child, "pci") || + mv_fdt_is_type(child, "pciep")) { /* * Check space: each PCI node will consume 2 devmap * entries. Modified: head/sys/arm/mv/mv_common.c ============================================================================== --- head/sys/arm/mv/mv_common.c Sun Apr 8 12:08:20 2018 (r332273) +++ head/sys/arm/mv/mv_common.c Sun Apr 8 12:20:06 2018 (r332274) @@ -484,6 +484,26 @@ pm_disable_device(int mask) } int +mv_fdt_is_type(phandle_t node, const char *typestr) +{ +#define FDT_TYPE_LEN 64 + char type[FDT_TYPE_LEN]; + + if (OF_getproplen(node, "device_type") <= 0) + return (0); + + if (OF_getprop(node, "device_type", type, FDT_TYPE_LEN) < 0) + return (0); + + if (strncasecmp(type, typestr, FDT_TYPE_LEN) == 0) + /* This fits. */ + return (1); + + return (0); +#undef FDT_TYPE_LEN +} + +int mv_fdt_pm(phandle_t node) { uint32_t cpu_pm_ctrl; Modified: head/sys/arm/mv/mv_pci.c ============================================================================== --- head/sys/arm/mv/mv_pci.c Sun Apr 8 12:08:20 2018 (r332273) +++ head/sys/arm/mv/mv_pci.c Sun Apr 8 12:20:06 2018 (r332274) @@ -420,7 +420,7 @@ mv_pcib_probe(device_t self) phandle_t node; node = ofw_bus_get_node(self); - if (!fdt_is_type(node, "pci")) + if (!mv_fdt_is_type(node, "pci")) return (ENXIO); if (!(ofw_bus_is_compatible(self, "mrvl,pcie") || Modified: head/sys/arm/mv/mvvar.h ============================================================================== --- head/sys/arm/mv/mvvar.h Sun Apr 8 12:08:20 2018 (r332273) +++ head/sys/arm/mv/mvvar.h Sun Apr 8 12:20:06 2018 (r332274) @@ -141,6 +141,7 @@ int mv_pci_devmap(phandle_t, struct devmap_entry *, vm int fdt_localbus_devmap(phandle_t, struct devmap_entry *, int, int *); enum soc_family mv_check_soc_family(void); +int mv_fdt_is_type(phandle_t, const char *); int mv_fdt_pm(phandle_t); uint32_t get_tclk_armadaxp(void); Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Sun Apr 8 12:08:20 2018 (r332273) +++ head/sys/dev/fdt/fdt_common.c Sun Apr 8 12:20:06 2018 (r332274) @@ -59,7 +59,6 @@ __FBSDID("$FreeBSD$"); #endif #define FDT_COMPAT_LEN 255 -#define FDT_TYPE_LEN 64 #define FDT_REG_CELLS 4 #define FDT_RANGES_SIZE 48 @@ -331,24 +330,6 @@ fdt_depth_search_compatible(phandle_t start, const cha if (child != 0) return (child); } - return (0); -} - -int -fdt_is_type(phandle_t node, const char *typestr) -{ - char type[FDT_TYPE_LEN]; - - if (OF_getproplen(node, "device_type") <= 0) - return (0); - - if (OF_getprop(node, "device_type", type, FDT_TYPE_LEN) < 0) - return (0); - - if (strncasecmp(type, typestr, FDT_TYPE_LEN) == 0) - /* This fits. */ - return (1); - return (0); } Modified: head/sys/dev/fdt/fdt_common.h ============================================================================== --- head/sys/dev/fdt/fdt_common.h Sun Apr 8 12:08:20 2018 (r332273) +++ head/sys/dev/fdt/fdt_common.h Sun Apr 8 12:20:06 2018 (r332274) @@ -91,7 +91,6 @@ int fdt_get_range(phandle_t, int, u_long *, u_long *); int fdt_immr_addr(vm_offset_t); int fdt_regsize(phandle_t, u_long *, u_long *); int fdt_is_compatible_strict(phandle_t, const char *); -int fdt_is_type(phandle_t, const char *); int fdt_parent_addr_cells(phandle_t); int fdt_get_chosen_bootargs(char *bootargs, size_t max_size); From owner-svn-src-head@freebsd.org Sun Apr 8 13:40:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3B0D2F82628; Sun, 8 Apr 2018 13:40:39 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DFA0F6D010; Sun, 8 Apr 2018 13:40:38 +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 D70EB108E0; Sun, 8 Apr 2018 13:40:38 +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 w38Dec95007501; Sun, 8 Apr 2018 13:40:38 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38DecUO007500; Sun, 8 Apr 2018 13:40:38 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201804081340.w38DecUO007500@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sun, 8 Apr 2018 13:40:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332275 - head/stand/i386/loader X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/i386/loader X-SVN-Commit-Revision: 332275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 13:40:39 -0000 Author: tsoome Date: Sun Apr 8 13:40:38 2018 New Revision: 332275 URL: https://svnweb.freebsd.org/changeset/base/332275 Log: loader: 332270 did left out stand/i386/loader/loader.rc we have 2 instances of loader.rc... Modified: head/stand/i386/loader/loader.rc Modified: head/stand/i386/loader/loader.rc ============================================================================== --- head/stand/i386/loader/loader.rc Sun Apr 8 12:20:06 2018 (r332274) +++ head/stand/i386/loader/loader.rc Sun Apr 8 13:40:38 2018 (r332275) @@ -3,13 +3,10 @@ \ \ Includes additional commands include /boot/loader.4th -include /boot/efi.4th try-include /boot/loader.rc.local \ Reads and processes loader.conf variables initialize - -maybe-efi-resizecons \ Tests for password -- executes autoboot first if a password was defined check-password From owner-svn-src-head@freebsd.org Sun Apr 8 14:24:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D01BF854BC; Sun, 8 Apr 2018 14:24:03 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass DE-2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A6EB984DAE; Sun, 8 Apr 2018 14:24:02 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from thor.intern.walstatt.dynvpn.de ([78.55.165.26]) by mail.gmx.com (mrgmx101 [212.227.17.168]) with ESMTPSA (Nemesis) id 0M9fLX-1fCZdX1dN9-00CzFK; Sun, 08 Apr 2018 16:24:00 +0200 Date: Sun, 8 Apr 2018 16:23:27 +0200 From: "O. Hartmann" To: Toomas Soome Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332272 - head/stand/forth Message-ID: <20180408162354.7985909a@thor.intern.walstatt.dynvpn.de> In-Reply-To: <201804081155.w38BtR1K056446@repo.freebsd.org> References: <201804081155.w38BtR1K056446@repo.freebsd.org> Organization: WALSTATT User-Agent: OutScare 3.1415926 X-Operating-System: ImNotAnOperatingSystem 3.141592527 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: base64 X-Provags-ID: V03:K1:gLxQ+9H2RiyipWEz5tWgbByKn6x8l8tZhyYwRU88bvI5qMYD/7k laeOJp/LG/7jfxW6LCAsj8Dr8BCT5Nc2ub0Ph7bAWXbg2etTHC1u5/ohMOf7vX6l/H9P4jl xksBKaRGspnxn55lZ2UbD4mxahsao6A7oCU7pIJtBjzXKu2UbnD2oHP6gXjw8kkcvTpThzn myoQzV9q2k8dZgEA9KV/g== X-UI-Out-Filterresults: notjunk:1;V01:K0:tbI1f6JDokg=:207xVUAIGFsFgDaXETv+MP k7S7pIcH9UYzX47y0AXzp/rFVsmV+S1C0oYzeNmC8e/0zsGJUDElv+tdox9RGYbcevaNfdcTp j/Ti2+xWQwgMv+GphXz6GOzu8wyHlialmCCbqnsv/9hYAzqxPjYvyQp1hWjQUvRYdhdWxhkGX IOXUl9dr+S//j5WChCfqnP7mFZLi+wQSW1FAE4s3ogeUeDEBkcFQHTRnR00Y8DbZntzQ5EMOJ V3camUrL4j0E+diAdMt4kIuTYLRfB1bD9cOksdDztNN2ZVfGHWm8mE40guUlEU98IT2y5f3A/ caFAwKpjShp2nfnpB0f9ZH7Vv/fuy/Ajy6Lt+5AuUqUeOpnIvV7l7OK19ny46FVvZCp3rcmct FcxpdbJwEwXAN4ktz82sVyuvsWQDdDiIIwwKSrTXtM+G9mr2IOFExsQ3OPWaM89T48lkjM+zU LrXXFM0G6TBFhO4vZ6J3GeXFg3wed268UeV/SBVLWUELuEH1h1AUbH4iMLOXToBKpC7aoPEKG YU9+tqM3FCOCmhyrdLtEI6PDKDuOgkjUz32djPG4BoSCBfJ0gs0s82pG6P4v/lbGqsg4f416J uxnnxXsbb2ZLDq9xQjAiaQXuaPio8E6GB1HP/yHokmApk7jBwxnyay+Q93CMJ7ggkvlZ2Ysbx ZH6dwkZr6atnzaEiPUzpY6vucsQfFXLNLo9DiCRXxEerjwvbibw8JK2f2noSHglKfcfex35eT YMjGI9cBGY0ykTk9l08/AaJSiHla/cEyopWGgmipzRDfbFopPQgJbUGqVVM0D0cspXKq7oG0j sSLye66XWNpG/uRxb1UatT/sn9Na3x7beSlR6CxKjTbQ2HRMyY= X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 14:24:03 -0000 LS0tLS1CRUdJTiBQR1AgU0lHTkVEIE1FU1NBR0UtLS0tLQ0KSGFzaDogU0hBNTEyDQoNCkFtIFN1 biwgOCBBcHIgMjAxOCAxMTo1NToyNyArMDAwMCAoVVRDKQ0KVG9vbWFzIFNvb21lIDx0c29vbWVA RnJlZUJTRC5vcmc+IHNjaHJpZWI6DQoNCj4gQXV0aG9yOiB0c29vbWUNCj4gRGF0ZTogU3VuIEFw ciAgOCAxMTo1NToyNyAyMDE4DQo+IE5ldyBSZXZpc2lvbjogMzMyMjcyDQo+IFVSTDogaHR0cHM6 Ly9zdm53ZWIuZnJlZWJzZC5vcmcvY2hhbmdlc2V0L2Jhc2UvMzMyMjcyDQo+IA0KPiBMb2c6DQo+ ICAgbG9hZGVyOiAzMzIyNzAgZGlkIHVzZSB3cm9uZyBwYXRoIGZvciBlZmkuNHRoDQo+ICAgDQo+ ICAgVGhlIGNvcnJlY3QgIHBhdGggaXMgc3RpbGwgL2Jvb3QvZWZpLjR0aA0KPiANCj4gTW9kaWZp ZWQ6DQo+ICAgaGVhZC9zdGFuZC9mb3J0aC9sb2FkZXIuNHRoDQo+IA0KPiBNb2RpZmllZDogaGVh ZC9zdGFuZC9mb3J0aC9sb2FkZXIuNHRoDQo+ID09PT09PT09PT09PT09PT09PT09PT09PT09PT09 PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PT09PQ0KPiAtLS0g aGVhZC9zdGFuZC9mb3J0aC9sb2FkZXIuNHRoCVN1biBBcHIgIDggMTE6NTA6MDYgMjAxOAkocjMz MjI3MSkNCj4gKysrIGhlYWQvc3RhbmQvZm9ydGgvbG9hZGVyLjR0aAlTdW4gQXByICA4IDExOjU1 OjI3IDIwMTgJKHIzMzIyNzIpDQo+IEBAIC00Nyw3ICs0Nyw3IEBAIGluY2x1ZGUgL2Jvb3QvY29s b3IuNHRoDQo+ICBpbmNsdWRlIC9ib290L2RlbGF5LjR0aA0KPiAgaW5jbHVkZSAvYm9vdC9jaGVj ay1wYXNzd29yZC40dGgNCj4gIHMiIGVmaS12ZXJzaW9uIiBnZXRlbnY/IFtpZl0NCj4gLQlpbmNs dWRlIC9ib290L2ZvcnRoL2VmaS40dGgNCj4gKwlpbmNsdWRlIC9ib290L2VmaS40dGgNCj4gIFt0 aGVuXQ0KPiAgDQo+ICBvbmx5IGZvcnRoIGRlZmluaXRpb25zDQo+IF9fX19fX19fX19fX19fX19f X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fDQo+IHN2bi1zcmMtaGVhZEBmcmVlYnNkLm9y ZyBtYWlsaW5nIGxpc3QNCj4gaHR0cHM6Ly9saXN0cy5mcmVlYnNkLm9yZy9tYWlsbWFuL2xpc3Rp bmZvL3N2bi1zcmMtaGVhZA0KPiBUbyB1bnN1YnNjcmliZSwgc2VuZCBhbnkgbWFpbCB0byAic3Zu LXNyYy1oZWFkLXVuc3Vic2NyaWJlQGZyZWVic2Qub3JnIg0KDQpSZWNlbnQgQ1VSUkVOVCAoMzMy Mjc0KSBmYWlscyB0byBib290IG9uIE5hbm9CU0Qgd2l0aCA6DQpbLi4uXQ0KZWZpLWF1dG9yZXNp emVjb25zIG5vdCBmb3VuZA0KRXJyb3Igd2hpbGUgaW5jbHVkaW5nIC9ib290L2VmaS40dGgsDQoN CkdvdCB0aGlzIHRlc3RlZCBhbnl3YXk/DQoNCi0gLS0gDQpPLiBIYXJ0bWFubg0KDQpJY2ggd2lk ZXJzcHJlY2hlIGRlciBOdXR6dW5nIG9kZXIgw5xiZXJtaXR0bHVuZyBtZWluZXIgRGF0ZW4gZsO8 cg0KV2VyYmV6d2Vja2Ugb2RlciBmw7xyIGRpZSBNYXJrdC0gb2RlciBNZWludW5nc2ZvcnNjaHVu ZyAowqcgMjggQWJzLiA0IEJEU0cpLg0KLS0tLS1CRUdJTiBQR1AgU0lHTkFUVVJFLS0tLS0NCg0K aUxVRUFSTUtBQjBXSVFRWlZaTXpBdHdDMlQvODZUclM1MjhmeUZoWWxBVUNXc29sK2dBS0NSRFM1 MjhmeUZoWQ0KbEdFL0Fmd0pld0dEY21mVU9mVkFReE9xMnQxSUJFZkM5dkxJNEg2a3BkU2RpeEJN eUFUKzhtand0SytDYXpmUg0KYkE2UVJBcUpLZVdRMEtOK3NTWDdOVmZhR0lrbkFnQ296bHA1S2JE TnIvL1k2QStjRUhoYUdlU3pINUFWQ0txeA0KQWZXRXV6T2RYWDQ5U3h4a0Y0TFMzNXVaR3U1VTc1 eThwcElnSVRYeStYbU1MWUFRSzB4QQ0KPTlPeGENCi0tLS0tRU5EIFBHUCBTSUdOQVRVUkUtLS0t LQ0K From owner-svn-src-head@freebsd.org Sun Apr 8 15:09:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 032C6F88C99; Sun, 8 Apr 2018 15:09:25 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 797F47DFEF; Sun, 8 Apr 2018 15:09:24 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w38F9LwV013755; Sun, 8 Apr 2018 08:09:21 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w38F9LEk013754; Sun, 8 Apr 2018 08:09:21 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201804081509.w38F9LEk013754@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r332265 - head/tools/diag/prtblknos In-Reply-To: <201804080652.w386qwvo003663@repo.freebsd.org> To: Kirk McKusick Date: Sun, 8 Apr 2018 08:09:21 -0700 (PDT) CC: 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-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 15:09:25 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: mckusick > Date: Sun Apr 8 06:52:58 2018 > New Revision: 332265 > URL: https://svnweb.freebsd.org/changeset/base/332265 > > Log: > Split tools/diag/prtblknos into two parts: > main.c - opens disk and processes the argument list > of inodes to be printed > prtblknos.c - prints out the list of blocks used by an inode > > This change allows the fsdb program to import prtblknos() to use when > printing out the set of blocks used by an inode. YEA!!! Oh thank you Kirk! ... -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Apr 8 15:12:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 374F1F891A5; Sun, 8 Apr 2018 15:12:37 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E10977FE66; Sun, 8 Apr 2018 15:12:36 +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 DC12811965; Sun, 8 Apr 2018 15:12:36 +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 w38FCatJ056962; Sun, 8 Apr 2018 15:12:36 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38FCaDO056961; Sun, 8 Apr 2018 15:12:36 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201804081512.w38FCaDO056961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 8 Apr 2018 15:12:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332277 - head/sys/dev/fdt X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/fdt X-SVN-Commit-Revision: 332277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 15:12:37 -0000 Author: andrew Date: Sun Apr 8 15:12:36 2018 New Revision: 332277 URL: https://svnweb.freebsd.org/changeset/base/332277 Log: Replace calls to fdt_is_compatible with ofw_bus_node_is_compatible. These are almost identical so there is no need to keep the former around. Sponsored by: DARPA, AFRL Modified: head/sys/dev/fdt/fdt_common.c Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Sun Apr 8 14:09:27 2018 (r332276) +++ head/sys/dev/fdt/fdt_common.c Sun Apr 8 15:12:36 2018 (r332277) @@ -71,8 +71,6 @@ vm_offset_t fdt_immr_size; struct fdt_ic_list fdt_ic_list_head = SLIST_HEAD_INITIALIZER(fdt_ic_list_head); -static int fdt_is_compatible(phandle_t, const char *); - static int fdt_get_range_by_busaddr(phandle_t node, u_long addr, u_long *base, u_long *size) @@ -205,77 +203,6 @@ fdt_get_range(phandle_t node, int range_id, u_long *ba } int -fdt_immr_addr(vm_offset_t immr_va) -{ - phandle_t node; - u_long base, size; - int r; - - /* - * Try to access the SOC node directly i.e. through /aliases/. - */ - if ((node = OF_finddevice("soc")) != -1) - if (fdt_is_compatible(node, "simple-bus")) - goto moveon; - /* - * Find the node the long way. - */ - if ((node = OF_finddevice("/")) == -1) - return (ENXIO); - - if ((node = fdt_find_compatible(node, "simple-bus", 0)) == 0) - return (ENXIO); - -moveon: - if ((r = fdt_get_range(node, 0, &base, &size)) == 0) { - fdt_immr_pa = base; - fdt_immr_va = immr_va; - fdt_immr_size = size; - } - - return (r); -} - -/* - * This routine is an early-usage version of the ofw_bus_is_compatible() when - * the ofw_bus I/F is not available (like early console routines and similar). - * Note the buffer has to be on the stack since malloc() is usually not - * available in such cases either. - */ -static int -fdt_is_compatible(phandle_t node, const char *compatstr) -{ - char buf[FDT_COMPAT_LEN]; - char *compat; - int len, onelen, l, rv; - - if ((len = OF_getproplen(node, "compatible")) <= 0) - return (0); - - compat = (char *)&buf; - bzero(compat, FDT_COMPAT_LEN); - - if (OF_getprop(node, "compatible", compat, FDT_COMPAT_LEN) < 0) - return (0); - - onelen = strlen(compatstr); - rv = 0; - while (len > 0) { - if (strncasecmp(compat, compatstr, onelen) == 0) { - /* Found it. */ - rv = 1; - break; - } - /* Slide to the next sub-string. */ - l = strlen(compat) + 1; - compat += l; - len -= l; - } - - return (rv); -} - -int fdt_is_compatible_strict(phandle_t node, const char *compatible) { char compat[FDT_COMPAT_LEN]; @@ -303,7 +230,7 @@ fdt_find_compatible(phandle_t start, const char *compa * matching 'compatible' property. */ for (child = OF_child(start); child != 0; child = OF_peer(child)) - if (fdt_is_compatible(child, compat)) { + if (ofw_bus_node_is_compatible(child, compat)) { if (strict) if (!fdt_is_compatible_strict(child, compat)) continue; @@ -322,7 +249,7 @@ fdt_depth_search_compatible(phandle_t start, const cha * matching 'compatible' property. */ for (node = OF_child(start); node != 0; node = OF_peer(node)) { - if (fdt_is_compatible(node, compat) && + if (ofw_bus_node_is_compatible(node, compat) && (strict == 0 || fdt_is_compatible_strict(node, compat))) { return (node); } From owner-svn-src-head@freebsd.org Sun Apr 8 15:21:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48416F89B4C; Sun, 8 Apr 2018 15:21:13 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F1321849C7; Sun, 8 Apr 2018 15:21:12 +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 EC37811999; Sun, 8 Apr 2018 15:21:12 +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 w38FLCHF058044; Sun, 8 Apr 2018 15:21:12 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38FLCJ2058043; Sun, 8 Apr 2018 15:21:12 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201804081521.w38FLCJ2058043@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 8 Apr 2018 15:21:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332278 - head/sys/dev/fdt X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/fdt X-SVN-Commit-Revision: 332278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 15:21:13 -0000 Author: andrew Date: Sun Apr 8 15:21:12 2018 New Revision: 332278 URL: https://svnweb.freebsd.org/changeset/base/332278 Log: Revert r332277, it contained an unintended extra change Modified: head/sys/dev/fdt/fdt_common.c Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Sun Apr 8 15:12:36 2018 (r332277) +++ head/sys/dev/fdt/fdt_common.c Sun Apr 8 15:21:12 2018 (r332278) @@ -71,6 +71,8 @@ vm_offset_t fdt_immr_size; struct fdt_ic_list fdt_ic_list_head = SLIST_HEAD_INITIALIZER(fdt_ic_list_head); +static int fdt_is_compatible(phandle_t, const char *); + static int fdt_get_range_by_busaddr(phandle_t node, u_long addr, u_long *base, u_long *size) @@ -203,6 +205,77 @@ fdt_get_range(phandle_t node, int range_id, u_long *ba } int +fdt_immr_addr(vm_offset_t immr_va) +{ + phandle_t node; + u_long base, size; + int r; + + /* + * Try to access the SOC node directly i.e. through /aliases/. + */ + if ((node = OF_finddevice("soc")) != -1) + if (fdt_is_compatible(node, "simple-bus")) + goto moveon; + /* + * Find the node the long way. + */ + if ((node = OF_finddevice("/")) == -1) + return (ENXIO); + + if ((node = fdt_find_compatible(node, "simple-bus", 0)) == 0) + return (ENXIO); + +moveon: + if ((r = fdt_get_range(node, 0, &base, &size)) == 0) { + fdt_immr_pa = base; + fdt_immr_va = immr_va; + fdt_immr_size = size; + } + + return (r); +} + +/* + * This routine is an early-usage version of the ofw_bus_is_compatible() when + * the ofw_bus I/F is not available (like early console routines and similar). + * Note the buffer has to be on the stack since malloc() is usually not + * available in such cases either. + */ +static int +fdt_is_compatible(phandle_t node, const char *compatstr) +{ + char buf[FDT_COMPAT_LEN]; + char *compat; + int len, onelen, l, rv; + + if ((len = OF_getproplen(node, "compatible")) <= 0) + return (0); + + compat = (char *)&buf; + bzero(compat, FDT_COMPAT_LEN); + + if (OF_getprop(node, "compatible", compat, FDT_COMPAT_LEN) < 0) + return (0); + + onelen = strlen(compatstr); + rv = 0; + while (len > 0) { + if (strncasecmp(compat, compatstr, onelen) == 0) { + /* Found it. */ + rv = 1; + break; + } + /* Slide to the next sub-string. */ + l = strlen(compat) + 1; + compat += l; + len -= l; + } + + return (rv); +} + +int fdt_is_compatible_strict(phandle_t node, const char *compatible) { char compat[FDT_COMPAT_LEN]; @@ -230,7 +303,7 @@ fdt_find_compatible(phandle_t start, const char *compa * matching 'compatible' property. */ for (child = OF_child(start); child != 0; child = OF_peer(child)) - if (ofw_bus_node_is_compatible(child, compat)) { + if (fdt_is_compatible(child, compat)) { if (strict) if (!fdt_is_compatible_strict(child, compat)) continue; @@ -249,7 +322,7 @@ fdt_depth_search_compatible(phandle_t start, const cha * matching 'compatible' property. */ for (node = OF_child(start); node != 0; node = OF_peer(node)) { - if (ofw_bus_node_is_compatible(node, compat) && + if (fdt_is_compatible(node, compat) && (strict == 0 || fdt_is_compatible_strict(node, compat))) { return (node); } From owner-svn-src-head@freebsd.org Sun Apr 8 15:29:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1303FF8A25A; Sun, 8 Apr 2018 15:29:15 +0000 (UTC) (envelope-from tsoome@me.com) Received: from st13p35im-asmtp001.me.com (st13p35im-asmtp001.me.com [17.164.199.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id AC98B691FE; Sun, 8 Apr 2018 15:29:14 +0000 (UTC) (envelope-from tsoome@me.com) Received: from process-dkim-sign-daemon.st13p35im-asmtp001.me.com by st13p35im-asmtp001.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) id <0P6V00900EN2M900@st13p35im-asmtp001.me.com>; Sun, 08 Apr 2018 14:28:52 +0000 (GMT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=me.com; s=04042017; t=1523197732; bh=AoToFNdQwfoKDzALTLp1V8NT5eW5GZoGoMcO94n+OG8=; h=From:Message-id:Content-type:MIME-version:Subject:Date:To; b=FIfNBgXQ0VaROeZOg0YFIv3fGm/zzwUryTUF5Yvv+VOK1PlJ9cYLB3Vtu3sp8M/C7 i3Tmr+A57QA89jvsnWqd5451r4uxUMN1ValJIrJd9c+SWqJHfN+MG8xswVxL49dBdS r1c13/hh+QoS7s4LZ0/g7kni4Aj7K8x+9QTqUeWMnV5jL4Sl34UQ3AlWYeZbQp/h0o kvNhPUhlzM9fDul0El+vr/nnBL9pPTafyRt0dARNS/7nw8kX2MtlFegdbVaztJxHfl CAffgoCugZgSu+gKVWazB758dMPRLOh8AroGWTkKKRqOpdjU15k5JmV6cFT0huKq6l yfJWRy3KLB7qQ== Received: from icloud.com ([127.0.0.1]) by st13p35im-asmtp001.me.com (Oracle Communications Messaging Server 8.0.1.2.20170607 64bit (built Jun 7 2017)) with ESMTPSA id <0P6V003USEVZ4J00@st13p35im-asmtp001.me.com>; Sun, 08 Apr 2018 14:28:52 +0000 (GMT) X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:,, definitions=2018-04-08_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 spamscore=0 clxscore=1011 suspectscore=8 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1707230000 definitions=main-1804080157 From: Toomas Soome Message-id: <39953A88-34F1-4FA4-A852-9859841E1356@me.com> MIME-version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: svn commit: r332272 - head/stand/forth Date: Sun, 08 Apr 2018 17:28:46 +0300 In-reply-to: <20180408162354.7985909a@thor.intern.walstatt.dynvpn.de> Cc: Toomas Soome , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: "O. Hartmann" References: <201804081155.w38BtR1K056446@repo.freebsd.org> <20180408162354.7985909a@thor.intern.walstatt.dynvpn.de> X-Mailer: Apple Mail (2.3445.6.18) Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 15:29:15 -0000 > On 8 Apr 2018, at 17:23, O. Hartmann wrote: >=20 > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA512 >=20 > Am Sun, 8 Apr 2018 11:55:27 +0000 (UTC) > Toomas Soome schrieb: >=20 >> Author: tsoome >> Date: Sun Apr 8 11:55:27 2018 >> New Revision: 332272 >> URL: https://svnweb.freebsd.org/changeset/base/332272 >>=20 >> Log: >> loader: 332270 did use wrong path for efi.4th >>=20 >> The correct path is still /boot/efi.4th >>=20 >> Modified: >> head/stand/forth/loader.4th >>=20 >> Modified: head/stand/forth/loader.4th >> = =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/stand/forth/loader.4th Sun Apr 8 11:50:06 2018 = (r332271) >> +++ head/stand/forth/loader.4th Sun Apr 8 11:55:27 2018 = (r332272) >> @@ -47,7 +47,7 @@ include /boot/color.4th >> include /boot/delay.4th >> include /boot/check-password.4th >> s" efi-version" getenv? [if] >> - include /boot/forth/efi.4th >> + include /boot/efi.4th >> [then] >>=20 >> only forth definitions >> _______________________________________________ >> 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" >=20 > Recent CURRENT (332274) fails to boot on NanoBSD with : > [...] > efi-autoresizecons not found > Error while including /boot/efi.4th, >=20 > Got this tested anyway? >=20 I'm sorry, you need r332275 - I totally did miss the i386 subdir has = another loader.rc.=20 rgds, toomas From owner-svn-src-head@freebsd.org Sun Apr 8 16:34:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1284FF8EA8D; Sun, 8 Apr 2018 16:34: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B77B76DB88; Sun, 8 Apr 2018 16:34:10 +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 AF1D112697; Sun, 8 Apr 2018 16:34: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 w38GYArJ097151; Sun, 8 Apr 2018 16:34:10 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38GYA8N097150; Sun, 8 Apr 2018 16:34:10 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201804081634.w38GYA8N097150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sun, 8 Apr 2018 16:34:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332285 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 332285 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 16:34:11 -0000 Author: mjg Date: Sun Apr 8 16:34:10 2018 New Revision: 332285 URL: https://svnweb.freebsd.org/changeset/base/332285 Log: locks: tweak backoff a little bit Previous limits were chosen when locking primitives had spurious lock accesses. Flipping the starting point to 1 (or rather 2 as the first call shifts it) provides a modest win when mild contention is seen while not hurting worse cases. Tested on a bunch of one, two and four socket old and new systems (Westmere, Skylake, Threadreaper and others) by doing concurrent page faults, buildkernel/buildworld and other stuff (although not all systems got all the tests). Another thing is the upper limit. It is semi-arbitrarily chosen as it was getting out of hand for slightly less small systems (e.g. a 128-thread one). Note that backoff is fundamentally a speculative bandaid and this change just makes it fit a little bit better. It remains completely oblivious to the hardware topology or the contention pattern. This is being experimented with. Modified: head/sys/kern/subr_lock.c Modified: head/sys/kern/subr_lock.c ============================================================================== --- head/sys/kern/subr_lock.c Sun Apr 8 16:29:24 2018 (r332284) +++ head/sys/kern/subr_lock.c Sun Apr 8 16:34:10 2018 (r332285) @@ -156,8 +156,10 @@ void lock_delay_default_init(struct lock_delay_config *lc) { - lc->base = lock_roundup_2(mp_ncpus) / 4; - lc->max = lc->base * 1024; + lc->base = 1; + lc->max = lock_roundup_2(mp_ncpus) * 256; + if (lc->max > 32678) + lc->max = 32678; } #ifdef DDB From owner-svn-src-head@freebsd.org Sun Apr 8 16:43:57 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15757F8F3D4; Sun, 8 Apr 2018 16:43:57 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB761734C6; Sun, 8 Apr 2018 16:43:56 +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 B660812831; Sun, 8 Apr 2018 16:43:56 +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 w38Ghulf002765; Sun, 8 Apr 2018 16:43:56 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38GhuSN002764; Sun, 8 Apr 2018 16:43:56 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201804081643.w38GhuSN002764@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 8 Apr 2018 16:43:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332286 - head/sys/powerpc/ofw X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/ofw X-SVN-Commit-Revision: 332286 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 16:43:57 -0000 Author: jhibbits Date: Sun Apr 8 16:43:56 2018 New Revision: 332286 URL: https://svnweb.freebsd.org/changeset/base/332286 Log: powerpc/ofw: Fix malloc inside lock Summary: Currently ofw_real_bounce_alloc() is requesting memory, using WAITOK, holding a non-sleepable locks, called 'OF Bounce Page'. Fix this by allocating the pages outside of the lock, and only updating the global variables while holding the lock. Submitted by: Breno Leitao Differential Revision: https://reviews.freebsd.org/D14955 Modified: head/sys/powerpc/ofw/ofw_real.c Modified: head/sys/powerpc/ofw/ofw_real.c ============================================================================== --- head/sys/powerpc/ofw/ofw_real.c Sun Apr 8 16:34:10 2018 (r332285) +++ head/sys/powerpc/ofw/ofw_real.c Sun Apr 8 16:43:56 2018 (r332286) @@ -197,6 +197,8 @@ ofw_real_stop(void) static void ofw_real_bounce_alloc(void *junk) { + caddr_t temp; + /* * Check that ofw_real is actually in use before allocating wads * of memory. Do this by checking if our mutex has been set up. @@ -208,12 +210,15 @@ ofw_real_bounce_alloc(void *junk) * Allocate a page of contiguous, wired physical memory that can * fit into a 32-bit address space and accessed from real mode. */ + temp = contigmalloc(4 * PAGE_SIZE, M_OFWREAL, 0, 0, + ulmin(platform_real_maxaddr(), BUS_SPACE_MAXADDR_32BIT), PAGE_SIZE, + 4 * PAGE_SIZE); + if (temp == NULL) + panic("%s: Not able to allocated contiguous memory\n", __func__); mtx_lock(&of_bounce_mtx); - of_bounce_virt = contigmalloc(4 * PAGE_SIZE, M_OFWREAL, 0, 0, - ulmin(platform_real_maxaddr(), BUS_SPACE_MAXADDR_32BIT), PAGE_SIZE, - 4 * PAGE_SIZE); + of_bounce_virt = temp; of_bounce_phys = vtophys(of_bounce_virt); of_bounce_size = 4 * PAGE_SIZE; From owner-svn-src-head@freebsd.org Sun Apr 8 16:46:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74D5AF8F702; Sun, 8 Apr 2018 16:46:25 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2674B74B09; Sun, 8 Apr 2018 16:46:25 +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 217031283B; Sun, 8 Apr 2018 16:46:25 +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 w38GkPqK002914; Sun, 8 Apr 2018 16:46:25 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38GkOY6002912; Sun, 8 Apr 2018 16:46:24 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201804081646.w38GkOY6002912@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 8 Apr 2018 16:46:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332287 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 332287 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 16:46:25 -0000 Author: jhibbits Date: Sun Apr 8 16:46:24 2018 New Revision: 332287 URL: https://svnweb.freebsd.org/changeset/base/332287 Log: powerpc64: Avoid calling isync twice Summary: It is not necessary to call isync() after calling mtmsr() function, mainly because the mtmsr() calls 'isync' internally to synchronize the machine state register. Other than that, isync() just calls the 'isync' instruction, thus, the 'isync' instruction is being called twice, and that seems to be unnecessary. This patch just remove the unecessary calls to isync() after mtmsr(). Submitted by: Breno Leitao Differential Revision: https://reviews.freebsd.org/D14583 Modified: head/sys/powerpc/powerpc/altivec.c head/sys/powerpc/powerpc/cpu.c head/sys/powerpc/powerpc/fpu.c Modified: head/sys/powerpc/powerpc/altivec.c ============================================================================== --- head/sys/powerpc/powerpc/altivec.c Sun Apr 8 16:43:56 2018 (r332286) +++ head/sys/powerpc/powerpc/altivec.c Sun Apr 8 16:46:24 2018 (r332287) @@ -58,7 +58,6 @@ save_vec_int(struct thread *td) */ msr = mfmsr(); mtmsr(msr | PSL_VEC); - isync(); /* * Save the vector registers and VSCR to the PCB @@ -120,7 +119,6 @@ enable_vec(struct thread *td) */ msr = mfmsr(); mtmsr(msr | PSL_VEC); - isync(); /* * Restore VSCR by first loading it into a vector and then into VSCR. Modified: head/sys/powerpc/powerpc/cpu.c ============================================================================== --- head/sys/powerpc/powerpc/cpu.c Sun Apr 8 16:43:56 2018 (r332286) +++ head/sys/powerpc/powerpc/cpu.c Sun Apr 8 16:46:24 2018 (r332287) @@ -710,7 +710,6 @@ cpu_idle_60x(sbintime_t sbt) default: powerpc_sync(); mtmsr(msr | PSL_POW); - isync(); break; } #endif @@ -739,7 +738,6 @@ cpu_idle_booke(sbintime_t sbt) default: powerpc_sync(); mtmsr(msr | PSL_WE); - isync(); break; } #endif Modified: head/sys/powerpc/powerpc/fpu.c ============================================================================== --- head/sys/powerpc/powerpc/fpu.c Sun Apr 8 16:43:56 2018 (r332286) +++ head/sys/powerpc/powerpc/fpu.c Sun Apr 8 16:46:24 2018 (r332287) @@ -87,7 +87,6 @@ enable_fpu(struct thread *td) mtmsr(msr | PSL_FP | PSL_VSX); else mtmsr(msr | PSL_FP); - isync(); /* * Load the floating point registers and FPSCR from the PCB. @@ -143,7 +142,6 @@ save_fpu(struct thread *td) mtmsr(msr | PSL_FP | PSL_VSX); else mtmsr(msr | PSL_FP); - isync(); /* * Save the floating-point registers and FPSCR to the PCB From owner-svn-src-head@freebsd.org Sun Apr 8 16:55:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE4D9F9028B; Sun, 8 Apr 2018 16:55:28 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8FD8D79E94; Sun, 8 Apr 2018 16:55:28 +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 89DAE129F1; Sun, 8 Apr 2018 16:55:28 +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 w38GtS4A007923; Sun, 8 Apr 2018 16:55:28 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38GtSr1007922; Sun, 8 Apr 2018 16:55:28 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201804081655.w38GtSr1007922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 8 Apr 2018 16:55:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332289 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 332289 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 16:55:29 -0000 Author: jhibbits Date: Sun Apr 8 16:55:28 2018 New Revision: 332289 URL: https://svnweb.freebsd.org/changeset/base/332289 Log: powerpc64: Print current MSR on printtrap() Summary: Print current MSR on printtrap(). Currently, printtrap just prints srr1, which contains part of the MSR prior to the exception. I find useful to dump the current value of the MSR, since it changes when there is an interruption. With this patch, this is the new printtrap model: handled user trap: exception = 0x700 (program) srr0 = 0x100008a0 (0x100008a0) srr1 = 0x800000000002f032 current msr = 0x8000000000009032 lr = 0x1000089c (0x1000089c) curthread = 0x7a50000 pid = 714, comm = ttrap2 Submitted by: Breno Leitao Reviewed by: nwhitehorn Differential Revision: https://reviews.freebsd.org/D14600 Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Sun Apr 8 16:54:07 2018 (r332288) +++ head/sys/powerpc/powerpc/trap.c Sun Apr 8 16:55:28 2018 (r332289) @@ -507,6 +507,7 @@ printtrap(u_int vector, struct trapframe *frame, int i printf(" srr0 = 0x%" PRIxPTR " (0x%" PRIxPTR ")\n", frame->srr0, frame->srr0 - (register_t)(__startkernel - KERNBASE)); printf(" srr1 = 0x%lx\n", (u_long)frame->srr1); + printf(" current msr = 0x%" PRIxPTR "\n", mfmsr()); printf(" lr = 0x%" PRIxPTR " (0x%" PRIxPTR ")\n", frame->lr, frame->lr - (register_t)(__startkernel - KERNBASE)); printf(" curthread = %p\n", curthread); From owner-svn-src-head@freebsd.org Sun Apr 8 17:06:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 08978F9156D; Sun, 8 Apr 2018 17:06:31 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A855880221; Sun, 8 Apr 2018 17:06:30 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D84012BA6; Sun, 8 Apr 2018 17:06:30 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w38H6Uvi014224; Sun, 8 Apr 2018 17:06:30 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38H6UPH014223; Sun, 8 Apr 2018 17:06:30 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201804081706.w38H6UPH014223@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Sun, 8 Apr 2018 17:06:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332292 - head/sys/dev/spibus X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/dev/spibus X-SVN-Commit-Revision: 332292 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 17:06:31 -0000 Author: ian Date: Sun Apr 8 17:06:30 2018 New Revision: 332292 URL: https://svnweb.freebsd.org/changeset/base/332292 Log: Allow hinted attachment on FDT-based systems. Instead of returning ENXIO when the FDT data doesn't enable the device instance, return BUS_PROBE_NOWILDCARD, the same as for non-FDT systems. Modified: head/sys/dev/spibus/spigen.c Modified: head/sys/dev/spibus/spigen.c ============================================================================== --- head/sys/dev/spibus/spigen.c Sun Apr 8 17:03:39 2018 (r332291) +++ head/sys/dev/spibus/spigen.c Sun Apr 8 17:06:30 2018 (r332292) @@ -79,16 +79,19 @@ spigen_probe(device_t dev) { int rv; -#ifdef FDT - if (!ofw_bus_status_okay(dev)) - return (ENXIO); - - if (!ofw_bus_is_compatible(dev, "freebsd,spigen")) - return (ENXIO); - rv = BUS_PROBE_DEFAULT; -#else + /* + * By default we only bid to attach if specifically added by our parent + * (usually via hint.spigen.#.at=busname). On FDT systems we bid as the + * default driver based on being configured in the FDT data. + */ rv = BUS_PROBE_NOWILDCARD; + +#ifdef FDT + if (ofw_bus_status_okay(dev) && + ofw_bus_is_compatible(dev, "freebsd,spigen")) + rv = BUS_PROBE_DEFAULT; #endif + device_set_desc(dev, "SPI Generic IO"); return (rv); From owner-svn-src-head@freebsd.org Sun Apr 8 17:10:33 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E851F91A02; Sun, 8 Apr 2018 17:10:33 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D64F782590; Sun, 8 Apr 2018 17:10:32 +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 CCD6C12BAC; Sun, 8 Apr 2018 17:10:32 +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 w38HAWr6014440; Sun, 8 Apr 2018 17:10:32 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38HAWMS014439; Sun, 8 Apr 2018 17:10:32 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201804081710.w38HAWMS014439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Sun, 8 Apr 2018 17:10:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332293 - head/sys/amd64/linux32 X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/amd64/linux32 X-SVN-Commit-Revision: 332293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 17:10:33 -0000 Author: brooks Date: Sun Apr 8 17:10:32 2018 New Revision: 332293 URL: https://svnweb.freebsd.org/changeset/base/332293 Log: Fix LINT (and static COMPAT_LINUX32) after r332122. Modified: head/sys/amd64/linux32/linux32_machdep.c Modified: head/sys/amd64/linux32/linux32_machdep.c ============================================================================== --- head/sys/amd64/linux32/linux32_machdep.c Sun Apr 8 17:06:30 2018 (r332292) +++ head/sys/amd64/linux32/linux32_machdep.c Sun Apr 8 17:10:32 2018 (r332293) @@ -33,6 +33,8 @@ #include __FBSDID("$FreeBSD$"); +#include "opt_compat.h" + #include #include #include From owner-svn-src-head@freebsd.org Sun Apr 8 17:16:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E0267F92270; Sun, 8 Apr 2018 17:16:11 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 6574085BF7; Sun, 8 Apr 2018 17:16:11 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w38HG9GG014295; Sun, 8 Apr 2018 10:16:09 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w38HG9ih014294; Sun, 8 Apr 2018 10:16:09 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201804081716.w38HG9ih014294@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r332293 - head/sys/amd64/linux32 In-Reply-To: <201804081710.w38HAWMS014439@repo.freebsd.org> To: Brooks Davis Date: Sun, 8 Apr 2018 10:16:09 -0700 (PDT) CC: 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-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 17:16:12 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: brooks > Date: Sun Apr 8 17:10:32 2018 > New Revision: 332293 > URL: https://svnweb.freebsd.org/changeset/base/332293 > > Log: > Fix LINT (and static COMPAT_LINUX32) after r332122. FYI last time I tried LINT on 11/stable it had issues with kbd_mux stuff. This was about 2 weeks ago. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Apr 8 19:06:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2B741F9A861 for ; Sun, 8 Apr 2018 19:06:59 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: from mail-wr0-x231.google.com (mail-wr0-x231.google.com [IPv6:2a00:1450:400c:c0c::231]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9403D83430 for ; Sun, 8 Apr 2018 19:06:58 +0000 (UTC) (envelope-from steven.hartland@multiplay.co.uk) Received: by mail-wr0-x231.google.com with SMTP id n2so6509485wrj.7 for ; Sun, 08 Apr 2018 12:06:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=multiplay-co-uk.20150623.gappssmtp.com; s=20150623; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-language; bh=EDy6D5dJ9csYO9WdnDSyscrBurNC5Zh+IjGY7AO7Bo8=; b=tKmioO21gP453PEBoOrp8yP/LF+LL7QbwvZRLYeoGKF9nxSPsNoNA81h3ZSdfdDO6H y5hVBQwL7wh8wBWw/iqj+zLbtz3/4pFSrOzpnFn1sb3c5stRjn3ZL55he1ps5o9dwP6h tRVTgYjNmE9tCuHTn9aOVoLYGc3B5RH36T+PHU+jKzvfTsdBHOT9+kWrNQKvvGPo3AaY OWe0cXS4DumHqB+HnAcRbTDvTKWmRciAxv1KfLA/PcjU1wZbl277FW6SmSANmDOivSim egwFbdc0K7wnFWCfX0qvzMB40NEZENur+mq8B5+sMIG9qAcpwIB7jZMsXDakVmdPi0BH 9wSA== 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:message-id:date :user-agent:mime-version:in-reply-to:content-language; bh=EDy6D5dJ9csYO9WdnDSyscrBurNC5Zh+IjGY7AO7Bo8=; b=FciEEcF9jDRDw7gu34R1nB7PyffsFCo+Yia5m8OR9TVQ6fZVx8cmz+ZXdvayblAgEC +NpQ9REKI1wCsGnSZI7JjWsn1firLr8e+YRN992kxGFNWaikbr97qiMvpNinIwBD8y8U HD+qFRu+7VJLqfnA63f6ld68E9HbDTLQNitC5I3HmTUSfVUAnpK6b3mnAvWKKiUeeTID duVNRxcWeE9i9tGs/CFc54tat6qGkv4VH32tw10y3mr8NCLmpUvwwmInkLH3MEWMYavv xo9mRW5hsbPflv62ykZB6jUcYQAycfArrue0SZYEeqqmd4spR/JIuVTmrjH2n7PTcFuZ mXwQ== X-Gm-Message-State: AElRT7HCuWELGODpDjcaLbB0SbKBqIksX+MnOP45DaWLq91KJcsnjwFN +3hPiT/+28nFT17qxQT9BK6iH6xw0zE= X-Google-Smtp-Source: AIpwx4/wVn2glAnN/IkT8Ifu1d1ek9tfZlrUo4tqb3H4DRz8yn++lqRdalIAFKQxwbkvHmr98eIuOA== X-Received: by 10.223.219.1 with SMTP id s1mr22574137wri.125.1523214417113; Sun, 08 Apr 2018 12:06:57 -0700 (PDT) Received: from [10.10.1.111] ([185.97.61.1]) by smtp.gmail.com with ESMTPSA id v22sm9911462wra.91.2018.04.08.12.06.55 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 08 Apr 2018 12:06:56 -0700 (PDT) Subject: Re: svn commit: r332285 - head/sys/kern To: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201804081634.w38GYA8N097150@repo.freebsd.org> From: Steven Hartland Message-ID: Date: Sun, 8 Apr 2018 20:06:55 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <201804081634.w38GYA8N097150@repo.freebsd.org> Content-Language: en-US Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 19:06:59 -0000 Worth making the sysctls so they can be tuned the the HW / use case? On 08/04/2018 17:34, Mateusz Guzik wrote: > Author: mjg > Date: Sun Apr 8 16:34:10 2018 > New Revision: 332285 > URL: https://svnweb.freebsd.org/changeset/base/332285 > > Log: > locks: tweak backoff a little bit > > Previous limits were chosen when locking primitives had spurious lock > accesses. > > Flipping the starting point to 1 (or rather 2 as the first call shifts it) > provides a modest win when mild contention is seen while not hurting worse > cases. Tested on a bunch of one, two and four socket old and new systems > (Westmere, Skylake, Threadreaper and others) by doing concurrent page faults, > buildkernel/buildworld and other stuff (although not all systems got all the > tests). > > Another thing is the upper limit. It is semi-arbitrarily chosen as it was > getting out of hand for slightly less small systems (e.g. a 128-thread one). > > Note that backoff is fundamentally a speculative bandaid and this change just > makes it fit a little bit better. It remains completely oblivious to the > hardware topology or the contention pattern. This is being experimented with. > > Modified: > head/sys/kern/subr_lock.c > > Modified: head/sys/kern/subr_lock.c > ============================================================================== > --- head/sys/kern/subr_lock.c Sun Apr 8 16:29:24 2018 (r332284) > +++ head/sys/kern/subr_lock.c Sun Apr 8 16:34:10 2018 (r332285) > @@ -156,8 +156,10 @@ void > lock_delay_default_init(struct lock_delay_config *lc) > { > > - lc->base = lock_roundup_2(mp_ncpus) / 4; > - lc->max = lc->base * 1024; > + lc->base = 1; > + lc->max = lock_roundup_2(mp_ncpus) * 256; > + if (lc->max > 32678) > + lc->max = 32678; > } > > #ifdef DDB > From owner-svn-src-head@freebsd.org Sun Apr 8 19:11:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B54C7F9AC8B; Sun, 8 Apr 2018 19:11:26 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 65C0F85D7F; Sun, 8 Apr 2018 19:11:26 +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 60BA113FCC; Sun, 8 Apr 2018 19:11:26 +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 w38JBQ27082820; Sun, 8 Apr 2018 19:11:26 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38JBQmF082818; Sun, 8 Apr 2018 19:11:26 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201804081911.w38JBQmF082818@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 8 Apr 2018 19:11:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332296 - in head/sys/powerpc: include powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys/powerpc: include powerpc X-SVN-Commit-Revision: 332296 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 19:11:27 -0000 Author: jhibbits Date: Sun Apr 8 19:11:25 2018 New Revision: 332296 URL: https://svnweb.freebsd.org/changeset/base/332296 Log: Powerpc64: Add the facility unavailable trap subsystem Summary: This code adds the basic infrastructure for the facility subsystem. A facility trap is raised when an unavailable instruction is executed. One example is executing a Hardware Transactional Memory instruction while the MSR[TM] is disabled. In the past, there was a specific interrupt for it (FP, VEC), but the new instructions seem to be multiplexed on this facility interrupt. The root cause of the trap is provided on Facility Status and Control Register (FSCR) register. Submitted by: Breno Leitao Reviewed by: nwhitehorn Differential Revision: https://reviews.freebsd.org/D14566 Modified: head/sys/powerpc/include/spr.h head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Sun Apr 8 17:23:33 2018 (r332295) +++ head/sys/powerpc/include/spr.h Sun Apr 8 19:11:25 2018 (r332296) @@ -120,6 +120,20 @@ #define SPR_EIE 0x050 /* ..8 Exception Interrupt ??? */ #define SPR_EID 0x051 /* ..8 Exception Interrupt ??? */ #define SPR_NRI 0x052 /* ..8 Exception Interrupt ??? */ +#define SPR_FSCR 0x099 /* Facility Status and Control Register */ +#define FSCR_IC_MASK 0xFF00000000000000ULL /* FSCR[0:7] is Interrupt Cause */ +#define FSCR_IC_FP 0x0000000000000000ULL /* FP unavailable */ +#define FSCR_IC_VSX 0x0100000000000000ULL /* VSX unavailable */ +#define FSCR_IC_DSCR 0x0200000000000000ULL /* Access to the DSCR at SPRs 3 or 17 */ +#define FSCR_IC_PM 0x0300000000000000ULL /* Read or write access of a Performance Monitor SPR in group A */ +#define FSCR_IC_BHRB 0x0400000000000000ULL /* Execution of a BHRB Instruction */ +#define FSCR_IC_HTM 0x0500000000000000ULL /* Access to a Transactional Memory */ +/* Reserved 0x0500000000000000ULL */ +#define FSCR_IC_EBB 0x0700000000000000ULL /* Access to Event-Based Branch */ +#define FSCR_IC_TAR 0x0800000000000000ULL /* Access to Target Address Register */ +#define FSCR_IC_STOP 0x0900000000000000ULL /* Access to the 'stop' instruction in privileged non-hypervisor state */ +#define FSCR_IC_MSG 0x0A00000000000000ULL /* Access to 'msgsndp' or 'msgclrp' instructions */ +#define FSCR_IC_SCV 0x0C00000000000000ULL /* Execution of a 'scv' instruction */ #define SPR_USPRG0 0x100 /* 4.. User SPR General 0 */ #define SPR_VRSAVE 0x100 /* .6. AltiVec VRSAVE */ #define SPR_SPRG0 0x110 /* 468 SPR General 0 */ Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Sun Apr 8 17:23:33 2018 (r332295) +++ head/sys/powerpc/powerpc/trap.c Sun Apr 8 19:11:25 2018 (r332296) @@ -204,6 +204,7 @@ trap(struct trapframe *frame) int sig, type, user; u_int ucode; ksiginfo_t ksi; + register_t fscr; VM_CNT_INC(v_trap); @@ -294,6 +295,13 @@ trap(struct trapframe *frame) break; case EXC_FAC: + fscr = mfspr(SPR_FSCR); + if ((fscr & FSCR_IC_MASK) == FSCR_IC_HTM) { + CTR0(KTR_TRAP, "Hardware Transactional Memory subsystem disabled"); + } + sig = SIGILL; + ucode = ILL_ILLOPC; + break; case EXC_HEA: sig = SIGILL; ucode = ILL_ILLOPC; From owner-svn-src-head@freebsd.org Sun Apr 8 19:23:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 283F4F9BB48; Sun, 8 Apr 2018 19:23:52 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D1C5C6CB24; Sun, 8 Apr 2018 19:23:51 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC5A6142D7; Sun, 8 Apr 2018 19:23:51 +0000 (UTC) (envelope-from phk@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w38JNpHh090980; Sun, 8 Apr 2018 19:23:51 GMT (envelope-from phk@FreeBSD.org) Received: (from phk@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38JNp6t090973; Sun, 8 Apr 2018 19:23:51 GMT (envelope-from phk@FreeBSD.org) Message-Id: <201804081923.w38JNp6t090973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: phk set sender to phk@FreeBSD.org using -f From: Poul-Henning Kamp Date: Sun, 8 Apr 2018 19:23:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332297 - in head/sys/teken: . libteken X-SVN-Group: head X-SVN-Commit-Author: phk X-SVN-Commit-Paths: in head/sys/teken: . libteken X-SVN-Commit-Revision: 332297 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 19:23:52 -0000 Author: phk Date: Sun Apr 8 19:23:50 2018 New Revision: 332297 URL: https://svnweb.freebsd.org/changeset/base/332297 Log: Pedantic polishing of code to please FlexeLint. Approved by: ed Modified: head/sys/teken/libteken/teken.3 head/sys/teken/teken.c head/sys/teken/teken.h head/sys/teken/teken_scs.h head/sys/teken/teken_subr.h head/sys/teken/teken_subr_compat.h head/sys/teken/teken_wcwidth.h Modified: head/sys/teken/libteken/teken.3 ============================================================================== --- head/sys/teken/libteken/teken.3 Sun Apr 8 19:11:25 2018 (r332296) +++ head/sys/teken/libteken/teken.3 Sun Apr 8 19:23:50 2018 (r332297) @@ -43,25 +43,25 @@ .Ft void .Fn teken_set_winsize "teken_t *t" "const teken_pos_t *size" .Ft const teken_pos_t * -.Fn teken_get_cursor "teken_t *t" +.Fn teken_get_cursor "const teken_t *t" .Ft void .Fn teken_set_cursor "teken_t *t" "const teken_pos_t *pos" .Ft const teken_attr_t * -.Fn teken_get_curattr "teken_t *t" +.Fn teken_get_curattr "const teken_t *t" .Ft void .Fn teken_set_curattr "teken_t *t" "const teken_attr_t *attr" .Ft const teken_attr_t * -.Fn teken_get_defattr "teken_t *t" +.Fn teken_get_defattr "const teken_t *t" .Ft void .Fn teken_set_defattr "teken_t *t" "const teken_attr_t *attr" .Ft const char * -.Fn teken_get_sequence "teken_t *t" "unsigned int id" +.Fn teken_get_sequence "const teken_t *t" "unsigned int id" .Ft teken_color_t .Fn teken_256to16 "teken_color_t color" .Ft teken_color_t .Fn teken_256to8 "teken_color_t color" .Ft void -.Fn teken_get_defattr_cons25 "teken_t *t" "int *fg" "int *bg" +.Fn teken_get_defattr_cons25 "const teken_t *t" "int *fg" "int *bg" .Ft void .Fn teken_set_8bit "teken_t *t" .Ft void Modified: head/sys/teken/teken.c ============================================================================== --- head/sys/teken/teken.c Sun Apr 8 19:11:25 2018 (r332296) +++ head/sys/teken/teken.c Sun Apr 8 19:23:50 2018 (r332297) @@ -73,35 +73,38 @@ static teken_state_t teken_state_init; */ static inline void -teken_funcs_bell(teken_t *t) +teken_funcs_bell(const teken_t *t) { + teken_assert(t->t_funcs->tf_bell != NULL); t->t_funcs->tf_bell(t->t_softc); } static inline void -teken_funcs_cursor(teken_t *t) +teken_funcs_cursor(const teken_t *t) { teken_assert(t->t_cursor.tp_row < t->t_winsize.tp_row); teken_assert(t->t_cursor.tp_col < t->t_winsize.tp_col); + teken_assert(t->t_funcs->tf_cursor != NULL); t->t_funcs->tf_cursor(t->t_softc, &t->t_cursor); } static inline void -teken_funcs_putchar(teken_t *t, const teken_pos_t *p, teken_char_t c, +teken_funcs_putchar(const teken_t *t, const teken_pos_t *p, teken_char_t c, const teken_attr_t *a) { teken_assert(p->tp_row < t->t_winsize.tp_row); teken_assert(p->tp_col < t->t_winsize.tp_col); + teken_assert(t->t_funcs->tf_putchar != NULL); t->t_funcs->tf_putchar(t->t_softc, p, c, a); } static inline void -teken_funcs_fill(teken_t *t, const teken_rect_t *r, +teken_funcs_fill(const teken_t *t, const teken_rect_t *r, const teken_char_t c, const teken_attr_t *a) { @@ -110,11 +113,12 @@ teken_funcs_fill(teken_t *t, const teken_rect_t *r, teken_assert(r->tr_end.tp_col > r->tr_begin.tp_col); teken_assert(r->tr_end.tp_col <= t->t_winsize.tp_col); + teken_assert(t->t_funcs->tf_fill != NULL); t->t_funcs->tf_fill(t->t_softc, r, c, a); } static inline void -teken_funcs_copy(teken_t *t, const teken_rect_t *r, const teken_pos_t *p) +teken_funcs_copy(const teken_t *t, const teken_rect_t *r, const teken_pos_t *p) { teken_assert(r->tr_end.tp_row > r->tr_begin.tp_row); @@ -124,20 +128,23 @@ teken_funcs_copy(teken_t *t, const teken_rect_t *r, co teken_assert(p->tp_row + (r->tr_end.tp_row - r->tr_begin.tp_row) <= t->t_winsize.tp_row); teken_assert(p->tp_col + (r->tr_end.tp_col - r->tr_begin.tp_col) <= t->t_winsize.tp_col); + teken_assert(t->t_funcs->tf_copy != NULL); t->t_funcs->tf_copy(t->t_softc, r, p); } static inline void -teken_funcs_param(teken_t *t, int cmd, unsigned int value) +teken_funcs_param(const teken_t *t, int cmd, unsigned int value) { + teken_assert(t->t_funcs->tf_param != NULL); t->t_funcs->tf_param(t->t_softc, cmd, value); } static inline void -teken_funcs_respond(teken_t *t, const void *buf, size_t len) +teken_funcs_respond(const teken_t *t, const void *buf, size_t len) { + teken_assert(t->t_funcs->tf_respond != NULL); t->t_funcs->tf_respond(t->t_softc, buf, len); } @@ -290,7 +297,7 @@ teken_input(teken_t *t, const void *buf, size_t len) } const teken_pos_t * -teken_get_cursor(teken_t *t) +teken_get_cursor(const teken_t *t) { return (&t->t_cursor); @@ -308,7 +315,7 @@ teken_set_cursor(teken_t *t, const teken_pos_t *p) } const teken_attr_t * -teken_get_curattr(teken_t *t) +teken_get_curattr(const teken_t *t) { return (&t->t_curattr); @@ -322,7 +329,7 @@ teken_set_curattr(teken_t *t, const teken_attr_t *a) } const teken_attr_t * -teken_get_defattr(teken_t *t) +teken_get_defattr(const teken_t *t) { return (&t->t_defattr); @@ -336,7 +343,7 @@ teken_set_defattr(teken_t *t, const teken_attr_t *a) } const teken_pos_t * -teken_get_winsize(teken_t *t) +teken_get_winsize(const teken_t *t) { return (&t->t_winsize); @@ -693,7 +700,7 @@ static const char * const special_strings_normal[] = { }; const char * -teken_get_sequence(teken_t *t, unsigned int k) +teken_get_sequence(const teken_t *t, unsigned int k) { /* Cons25 mode. */ Modified: head/sys/teken/teken.h ============================================================================== --- head/sys/teken/teken.h Sun Apr 8 19:11:25 2018 (r332296) +++ head/sys/teken/teken.h Sun Apr 8 19:23:50 2018 (r332297) @@ -118,7 +118,7 @@ typedef struct { tf_respond_t *tf_respond; } teken_funcs_t; -typedef teken_char_t teken_scs_t(teken_t *, teken_char_t); +typedef teken_char_t teken_scs_t(const teken_t *, teken_char_t); /* * Terminal state. @@ -166,11 +166,11 @@ void teken_init(teken_t *, const teken_funcs_t *, void void teken_input(teken_t *, const void *, size_t); /* Get/set teken attributes. */ -const teken_pos_t *teken_get_cursor(teken_t *); -const teken_attr_t *teken_get_curattr(teken_t *); -const teken_attr_t *teken_get_defattr(teken_t *); -void teken_get_defattr_cons25(teken_t *, int *, int *); -const teken_pos_t *teken_get_winsize(teken_t *); +const teken_pos_t *teken_get_cursor(const teken_t *); +const teken_attr_t *teken_get_curattr(const teken_t *); +const teken_attr_t *teken_get_defattr(const teken_t *); +void teken_get_defattr_cons25(const teken_t *, int *, int *); +const teken_pos_t *teken_get_winsize(const teken_t *); void teken_set_cursor(teken_t *, const teken_pos_t *); void teken_set_curattr(teken_t *, const teken_attr_t *); void teken_set_defattr(teken_t *, const teken_attr_t *); @@ -202,7 +202,7 @@ void teken_set_winsize_noreset(teken_t *, const teken_ #define TKEY_F10 0x13 #define TKEY_F11 0x14 #define TKEY_F12 0x15 -const char *teken_get_sequence(teken_t *, unsigned int); +const char *teken_get_sequence(const teken_t *, unsigned int); /* Legacy features. */ void teken_set_8bit(teken_t *); Modified: head/sys/teken/teken_scs.h ============================================================================== --- head/sys/teken/teken_scs.h Sun Apr 8 19:11:25 2018 (r332296) +++ head/sys/teken/teken_scs.h Sun Apr 8 19:23:50 2018 (r332297) @@ -29,7 +29,7 @@ */ static inline teken_char_t -teken_scs_process(teken_t *t, teken_char_t c) +teken_scs_process(const teken_t *t, teken_char_t c) { return (t->t_scs[t->t_curscs](t, c)); @@ -52,7 +52,7 @@ static const uint8_t teken_boxdrawing_8bit[31] = { }; static teken_char_t -teken_scs_special_graphics(teken_t *t, teken_char_t c) +teken_scs_special_graphics(const teken_t *t, teken_char_t c) { /* Box drawing. */ @@ -64,7 +64,7 @@ teken_scs_special_graphics(teken_t *t, teken_char_t c) } static teken_char_t -teken_scs_uk_national(teken_t *t, teken_char_t c) +teken_scs_uk_national(const teken_t *t, teken_char_t c) { /* Pound sign. */ @@ -74,9 +74,10 @@ teken_scs_uk_national(teken_t *t, teken_char_t c) } static teken_char_t -teken_scs_us_ascii(teken_t *t __unused, teken_char_t c) +teken_scs_us_ascii(const teken_t *t, teken_char_t c) { /* No processing. */ + (void)t; return (c); } Modified: head/sys/teken/teken_subr.h ============================================================================== --- head/sys/teken/teken_subr.h Sun Apr 8 19:11:25 2018 (r332296) +++ head/sys/teken/teken_subr.h Sun Apr 8 19:23:50 2018 (r332297) @@ -29,13 +29,13 @@ */ static void teken_subr_cursor_up(teken_t *, unsigned int); -static void teken_subr_erase_line(teken_t *, unsigned int); +static void teken_subr_erase_line(const teken_t *, unsigned int); static void teken_subr_regular_character(teken_t *, teken_char_t); static void teken_subr_reset_to_initial_state(teken_t *); static void teken_subr_save_cursor(teken_t *); static inline int -teken_tab_isset(teken_t *t, unsigned int col) +teken_tab_isset(const teken_t *t, unsigned int col) { unsigned int b, o; @@ -45,7 +45,7 @@ teken_tab_isset(teken_t *t, unsigned int col) b = col / (sizeof(unsigned int) * 8); o = col % (sizeof(unsigned int) * 8); - return (t->t_tabstops[b] & (1 << o)); + return (t->t_tabstops[b] & (1U << o)); } static inline void @@ -59,7 +59,7 @@ teken_tab_clear(teken_t *t, unsigned int col) b = col / (sizeof(unsigned int) * 8); o = col % (sizeof(unsigned int) * 8); - t->t_tabstops[b] &= ~(1 << o); + t->t_tabstops[b] &= ~(1U << o); } static inline void @@ -73,7 +73,7 @@ teken_tab_set(teken_t *t, unsigned int col) b = col / (sizeof(unsigned int) * 8); o = col % (sizeof(unsigned int) * 8); - t->t_tabstops[b] |= 1 << o; + t->t_tabstops[b] |= 1U << o; } static void @@ -81,14 +81,14 @@ teken_tab_default(teken_t *t) { unsigned int i; - memset(&t->t_tabstops, 0, T_NUMCOL / 8); + memset(t->t_tabstops, 0, T_NUMCOL / 8); for (i = 8; i < T_NUMCOL; i += 8) teken_tab_set(t, i); } static void -teken_subr_do_scroll(teken_t *t, int amount) +teken_subr_do_scroll(const teken_t *t, int amount) { teken_rect_t tr; teken_pos_t tp; @@ -149,7 +149,7 @@ teken_subr_do_scroll(teken_t *t, int amount) } static ssize_t -teken_subr_do_cpr(teken_t *t, unsigned int cmd, char response[16]) +teken_subr_do_cpr(const teken_t *t, unsigned int cmd, char response[16]) { switch (cmd) { @@ -225,7 +225,7 @@ teken_subr_backspace(teken_t *t) } static void -teken_subr_bell(teken_t *t) +teken_subr_bell(const teken_t *t) { teken_funcs_bell(t); @@ -326,7 +326,7 @@ static void teken_subr_cursor_position(teken_t *t, unsigned int row, unsigned int col) { - row = row - 1 + t->t_originreg.ts_begin; + row = (row - 1) + t->t_originreg.ts_begin; t->t_cursor.tp_row = row < t->t_originreg.ts_end ? row : t->t_originreg.ts_end - 1; @@ -339,7 +339,7 @@ teken_subr_cursor_position(teken_t *t, unsigned int ro } static void -teken_subr_cursor_position_report(teken_t *t, unsigned int cmd) +teken_subr_cursor_position_report(const teken_t *t, unsigned int cmd) { char response[18] = "\x1B["; ssize_t len; @@ -372,7 +372,7 @@ teken_subr_cursor_up(teken_t *t, unsigned int nrows) } static void -teken_subr_delete_character(teken_t *t, unsigned int ncols) +teken_subr_delete_character(const teken_t *t, unsigned int ncols) { teken_rect_t tr; @@ -395,7 +395,7 @@ teken_subr_delete_character(teken_t *t, unsigned int n } static void -teken_subr_delete_line(teken_t *t, unsigned int nrows) +teken_subr_delete_line(const teken_t *t, unsigned int nrows) { teken_rect_t tr; @@ -435,7 +435,7 @@ teken_subr_device_control_string(teken_t *t) } static void -teken_subr_device_status_report(teken_t *t, unsigned int cmd) +teken_subr_device_status_report(const teken_t *t, unsigned int cmd) { char response[19] = "\x1B[?"; ssize_t len; @@ -448,21 +448,23 @@ teken_subr_device_status_report(teken_t *t, unsigned i } static void -teken_subr_double_height_double_width_line_top(teken_t *t __unused) +teken_subr_double_height_double_width_line_top(const teken_t *t) { + (void)t; teken_printf("double height double width top\n"); } static void -teken_subr_double_height_double_width_line_bottom(teken_t *t __unused) +teken_subr_double_height_double_width_line_bottom(const teken_t *t) { + (void)t; teken_printf("double height double width bottom\n"); } static void -teken_subr_erase_character(teken_t *t, unsigned int ncols) +teken_subr_erase_character(const teken_t *t, unsigned int ncols) { teken_rect_t tr; @@ -478,7 +480,7 @@ teken_subr_erase_character(teken_t *t, unsigned int nc } static void -teken_subr_erase_display(teken_t *t, unsigned int mode) +teken_subr_erase_display(const teken_t *t, unsigned int mode) { teken_rect_t r; @@ -514,7 +516,7 @@ teken_subr_erase_display(teken_t *t, unsigned int mode } static void -teken_subr_erase_line(teken_t *t, unsigned int mode) +teken_subr_erase_line(const teken_t *t, unsigned int mode) { teken_rect_t r; @@ -540,42 +542,42 @@ teken_subr_erase_line(teken_t *t, unsigned int mode) } static void -teken_subr_g0_scs_special_graphics(teken_t *t __unused) +teken_subr_g0_scs_special_graphics(teken_t *t) { t->t_scs[0] = teken_scs_special_graphics; } static void -teken_subr_g0_scs_uk_national(teken_t *t __unused) +teken_subr_g0_scs_uk_national(teken_t *t) { t->t_scs[0] = teken_scs_uk_national; } static void -teken_subr_g0_scs_us_ascii(teken_t *t __unused) +teken_subr_g0_scs_us_ascii(teken_t *t) { t->t_scs[0] = teken_scs_us_ascii; } static void -teken_subr_g1_scs_special_graphics(teken_t *t __unused) +teken_subr_g1_scs_special_graphics(teken_t *t) { t->t_scs[1] = teken_scs_special_graphics; } static void -teken_subr_g1_scs_uk_national(teken_t *t __unused) +teken_subr_g1_scs_uk_national(teken_t *t) { t->t_scs[1] = teken_scs_uk_national; } static void -teken_subr_g1_scs_us_ascii(teken_t *t __unused) +teken_subr_g1_scs_us_ascii(teken_t *t) { t->t_scs[1] = teken_scs_us_ascii; @@ -621,7 +623,7 @@ teken_subr_index(teken_t *t) } static void -teken_subr_insert_character(teken_t *t, unsigned int ncols) +teken_subr_insert_character(const teken_t *t, unsigned int ncols) { teken_rect_t tr; @@ -647,7 +649,7 @@ teken_subr_insert_character(teken_t *t, unsigned int n } static void -teken_subr_insert_line(teken_t *t, unsigned int nrows) +teken_subr_insert_line(const teken_t *t, unsigned int nrows) { teken_rect_t tr; @@ -679,14 +681,14 @@ teken_subr_insert_line(teken_t *t, unsigned int nrows) } static void -teken_subr_keypad_application_mode(teken_t *t) +teken_subr_keypad_application_mode(const teken_t *t) { teken_funcs_param(t, TP_KEYPADAPP, 1); } static void -teken_subr_keypad_numeric_mode(teken_t *t) +teken_subr_keypad_numeric_mode(const teken_t *t) { teken_funcs_param(t, TP_KEYPADAPP, 0); @@ -748,21 +750,21 @@ teken_subr_operating_system_command(teken_t *t) } static void -teken_subr_pan_down(teken_t *t, unsigned int nrows) +teken_subr_pan_down(const teken_t *t, unsigned int nrows) { teken_subr_do_scroll(t, (int)nrows); } static void -teken_subr_pan_up(teken_t *t, unsigned int nrows) +teken_subr_pan_up(const teken_t *t, unsigned int nrows) { teken_subr_do_scroll(t, -(int)nrows); } static void -teken_subr_primary_device_attributes(teken_t *t, unsigned int request) +teken_subr_primary_device_attributes(const teken_t *t, unsigned int request) { if (request == 0) { @@ -775,7 +777,7 @@ teken_subr_primary_device_attributes(teken_t *t, unsig } static void -teken_subr_do_putchar(teken_t *t, const teken_pos_t *tp, teken_char_t c, +teken_subr_do_putchar(const teken_t *t, const teken_pos_t *tp, teken_char_t c, int width) { @@ -1042,7 +1044,7 @@ teken_subr_save_cursor(teken_t *t) } static void -teken_subr_secondary_device_attributes(teken_t *t, unsigned int request) +teken_subr_secondary_device_attributes(const teken_t *t, unsigned int request) { if (request == 0) { @@ -1121,7 +1123,7 @@ teken_subr_set_mode(teken_t *t, unsigned int cmd) static void teken_subr_set_graphic_rendition(teken_t *t, unsigned int ncmds, - unsigned int cmds[]) + const unsigned int cmds[]) { unsigned int i, n; @@ -1208,7 +1210,7 @@ teken_subr_set_graphic_rendition(teken_t *t, unsigned case 95: /* Set bright foreground color: magenta */ case 96: /* Set bright foreground color: cyan */ case 97: /* Set bright foreground color: white */ - t->t_curattr.ta_fgcolor = n - 90 + 8; + t->t_curattr.ta_fgcolor = (n - 90) + 8; break; case 100: /* Set bright background color: black */ case 101: /* Set bright background color: red */ @@ -1218,7 +1220,7 @@ teken_subr_set_graphic_rendition(teken_t *t, unsigned case 105: /* Set bright background color: magenta */ case 106: /* Set bright background color: cyan */ case 107: /* Set bright background color: white */ - t->t_curattr.ta_bgcolor = n - 100 + 8; + t->t_curattr.ta_bgcolor = (n - 100) + 8; break; default: teken_printf("unsupported attribute %u\n", n); @@ -1258,23 +1260,26 @@ teken_subr_set_top_and_bottom_margins(teken_t *t, unsi } static void -teken_subr_single_height_double_width_line(teken_t *t __unused) +teken_subr_single_height_double_width_line(const teken_t *t) { + (void)t; teken_printf("single height double width???\n"); } static void -teken_subr_single_height_single_width_line(teken_t *t __unused) +teken_subr_single_height_single_width_line(const teken_t *t) { + (void)t; teken_printf("single height single width???\n"); } static void -teken_subr_string_terminator(teken_t *t __unused) +teken_subr_string_terminator(const teken_t *t) { + (void)t; /* * Strings are already terminated in teken_input_char() when ^[ * is inserted. @@ -1290,8 +1295,10 @@ teken_subr_tab_clear(teken_t *t, unsigned int cmd) teken_tab_clear(t, t->t_cursor.tp_col); break; case 3: - memset(&t->t_tabstops, 0, T_NUMCOL / 8); + memset(t->t_tabstops, 0, T_NUMCOL / 8); break; + default: + break; } } @@ -1299,7 +1306,7 @@ static void teken_subr_vertical_position_absolute(teken_t *t, unsigned int row) { - row = row - 1 + t->t_originreg.ts_begin; + row = (row - 1) + t->t_originreg.ts_begin; t->t_cursor.tp_row = row < t->t_originreg.ts_end ? row : t->t_originreg.ts_end - 1; Modified: head/sys/teken/teken_subr_compat.h ============================================================================== --- head/sys/teken/teken_subr_compat.h Sun Apr 8 19:11:25 2018 (r332296) +++ head/sys/teken/teken_subr_compat.h Sun Apr 8 19:23:50 2018 (r332297) @@ -29,15 +29,15 @@ */ static void -teken_subr_cons25_set_border(teken_t *t, unsigned int c) +teken_subr_cons25_set_border(const teken_t *t, unsigned int c) { teken_funcs_param(t, TP_SETBORDER, c); } static void -teken_subr_cons25_set_global_cursor_shape(teken_t *t, unsigned int ncmds, - unsigned int cmds[]) +teken_subr_cons25_set_global_cursor_shape(const teken_t *t, unsigned int ncmds, + const unsigned int cmds[]) { unsigned int code, i; @@ -58,7 +58,7 @@ teken_subr_cons25_set_global_cursor_shape(teken_t *t, } static void -teken_subr_cons25_set_local_cursor_type(teken_t *t, unsigned int type) +teken_subr_cons25_set_local_cursor_type(const teken_t *t, unsigned int type) { teken_funcs_param(t, TP_SETLOCALCURSOR, type); @@ -86,7 +86,7 @@ teken_subr_cons25_set_default_foreground(teken_t *t, u static const teken_color_t cons25_revcolors[8] = { 0, 4, 2, 6, 1, 5, 3, 7 }; void -teken_get_defattr_cons25(teken_t *t, int *fg, int *bg) +teken_get_defattr_cons25(const teken_t *t, int *fg, int *bg) { *fg = cons25_revcolors[teken_256to8(t->t_defattr.ta_fgcolor)]; @@ -96,14 +96,14 @@ teken_get_defattr_cons25(teken_t *t, int *fg, int *bg) } static void -teken_subr_cons25_switch_virtual_terminal(teken_t *t, unsigned int vt) +teken_subr_cons25_switch_virtual_terminal(const teken_t *t, unsigned int vt) { teken_funcs_param(t, TP_SWITCHVT, vt); } static void -teken_subr_cons25_set_bell_pitch_duration(teken_t *t, unsigned int pitch, +teken_subr_cons25_set_bell_pitch_duration(const teken_t *t, unsigned int pitch, unsigned int duration) { @@ -113,9 +113,10 @@ teken_subr_cons25_set_bell_pitch_duration(teken_t *t, static void teken_subr_cons25_set_graphic_rendition(teken_t *t, unsigned int cmd, - unsigned int param __unused) + unsigned int param) { + (void)param; switch (cmd) { case 0: /* Reset. */ t->t_curattr = t->t_defattr; @@ -135,6 +136,8 @@ teken_subr_cons25_set_terminal_mode(teken_t *t, unsign break; case 1: /* Switch terminal to cons25. */ t->t_stateflags |= TS_CONS25; + break; + default: break; } } Modified: head/sys/teken/teken_wcwidth.h ============================================================================== --- head/sys/teken/teken_wcwidth.h Sun Apr 8 19:11:25 2018 (r332296) +++ head/sys/teken/teken_wcwidth.h Sun Apr 8 19:23:50 2018 (r332297) @@ -103,7 +103,7 @@ static int teken_wcwidth(teken_char_t ucs) /* if we arrive here, ucs is not a combining or C0/C1 control character */ - return 1 + + return 1 + (ucs >= 0x1100 && (ucs <= 0x115f || /* Hangul Jamo init. consonants */ ucs == 0x2329 || ucs == 0x232a || From owner-svn-src-head@freebsd.org Sun Apr 8 19:24:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CDF5AF9BC51; Sun, 8 Apr 2018 19:24:50 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E8B36D449; Sun, 8 Apr 2018 19:24:50 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 793FD142D8; Sun, 8 Apr 2018 19:24:50 +0000 (UTC) (envelope-from rgrimes@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w38JOoTT091064; Sun, 8 Apr 2018 19:24:50 GMT (envelope-from rgrimes@FreeBSD.org) Received: (from rgrimes@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38JOnX1091052; Sun, 8 Apr 2018 19:24:49 GMT (envelope-from rgrimes@FreeBSD.org) Message-Id: <201804081924.w38JOnX1091052@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rgrimes set sender to rgrimes@FreeBSD.org using -f From: "Rodney W. Grimes" Date: Sun, 8 Apr 2018 19:24:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332298 - in head: lib/libvmmapi sys/amd64/include sys/amd64/vmm usr.sbin/bhyve usr.sbin/bhyvectl X-SVN-Group: head X-SVN-Commit-Author: rgrimes X-SVN-Commit-Paths: in head: lib/libvmmapi sys/amd64/include sys/amd64/vmm usr.sbin/bhyve usr.sbin/bhyvectl X-SVN-Commit-Revision: 332298 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 19:24:51 -0000 Author: rgrimes Date: Sun Apr 8 19:24:49 2018 New Revision: 332298 URL: https://svnweb.freebsd.org/changeset/base/332298 Log: Add the ability to control the CPU topology of created VMs from userland without the need to use sysctls, it allows the old sysctls to continue to function, but deprecates them at FreeBSD_version 1200060 (Relnotes for deprecate). The command line of bhyve is maintained in a backwards compatible way. The API of libvmmapi is maintained in a backwards compatible way. The sysctl's are maintained in a backwards compatible way. Added command option looks like: bhyve -c [[cpus=]n][,sockets=n][,cores=n][,threads=n][,maxcpus=n] The optional parts can be specified in any order, but only a single integer invokes the backwards compatible parse. [,maxcpus=n] is hidden by #ifdef until kernel support is added, though the api is put in place. bhyvectl --get-cpu-topology option added. Reviewed by: grehan (maintainer, earlier version), Reviewed by: bcr (manpages) Approved by: bde (mentor), phk (mentor) Tested by: Oleg Ginzburg (cbsd) MFC after: 1 week Relnotes: Y Differential Revision: https://reviews.freebsd.org/D9930 Modified: head/lib/libvmmapi/vmmapi.c head/lib/libvmmapi/vmmapi.h head/sys/amd64/include/vmm.h head/sys/amd64/include/vmm_dev.h head/sys/amd64/vmm/vmm.c head/sys/amd64/vmm/vmm_dev.c head/sys/amd64/vmm/x86.c head/usr.sbin/bhyve/bhyve.8 head/usr.sbin/bhyve/bhyverun.c head/usr.sbin/bhyvectl/bhyvectl.c Modified: head/lib/libvmmapi/vmmapi.c ============================================================================== --- head/lib/libvmmapi/vmmapi.c Sun Apr 8 19:23:50 2018 (r332297) +++ head/lib/libvmmapi/vmmapi.c Sun Apr 8 19:24:49 2018 (r332298) @@ -1506,6 +1506,38 @@ vm_restart_instruction(void *arg, int vcpu) } int +vm_set_topology(struct vmctx *ctx, + uint16_t sockets, uint16_t cores, uint16_t threads, uint16_t maxcpus) +{ + struct vm_cpu_topology topology; + + bzero(&topology, sizeof (struct vm_cpu_topology)); + topology.sockets = sockets; + topology.cores = cores; + topology.threads = threads; + topology.maxcpus = maxcpus; + return (ioctl(ctx->fd, VM_SET_TOPOLOGY, &topology)); +} + +int +vm_get_topology(struct vmctx *ctx, + uint16_t *sockets, uint16_t *cores, uint16_t *threads, uint16_t *maxcpus) +{ + struct vm_cpu_topology topology; + int error; + + bzero(&topology, sizeof (struct vm_cpu_topology)); + error = ioctl(ctx->fd, VM_GET_TOPOLOGY, &topology); + if (error == 0) { + *sockets = topology.sockets; + *cores = topology.cores; + *threads = topology.threads; + *maxcpus = topology.maxcpus; + } + return (error); +} + +int vm_get_device_fd(struct vmctx *ctx) { @@ -1535,7 +1567,7 @@ vm_get_ioctls(size_t *len) VM_ACTIVATE_CPU, VM_GET_CPUS, VM_SUSPEND_CPU, VM_RESUME_CPU, VM_SET_INTINFO, VM_GET_INTINFO, VM_RTC_WRITE, VM_RTC_READ, VM_RTC_SETTIME, VM_RTC_GETTIME, - VM_RESTART_INSTRUCTION }; + VM_RESTART_INSTRUCTION, VM_SET_TOPOLOGY, VM_GET_TOPOLOGY }; if (len == NULL) { cmds = malloc(sizeof(vm_ioctl_cmds)); Modified: head/lib/libvmmapi/vmmapi.h ============================================================================== --- head/lib/libvmmapi/vmmapi.h Sun Apr 8 19:23:50 2018 (r332297) +++ head/lib/libvmmapi/vmmapi.h Sun Apr 8 19:24:49 2018 (r332298) @@ -221,6 +221,12 @@ int vm_activate_cpu(struct vmctx *ctx, int vcpu); int vm_suspend_cpu(struct vmctx *ctx, int vcpu); int vm_resume_cpu(struct vmctx *ctx, int vcpu); +/* CPU topology */ +int vm_set_topology(struct vmctx *ctx, uint16_t sockets, uint16_t cores, + uint16_t threads, uint16_t maxcpus); +int vm_get_topology(struct vmctx *ctx, uint16_t *sockets, uint16_t *cores, + uint16_t *threads, uint16_t *maxcpus); + /* * FreeBSD specific APIs */ Modified: head/sys/amd64/include/vmm.h ============================================================================== --- head/sys/amd64/include/vmm.h Sun Apr 8 19:23:50 2018 (r332297) +++ head/sys/amd64/include/vmm.h Sun Apr 8 19:24:49 2018 (r332298) @@ -181,6 +181,10 @@ int vm_create(const char *name, struct vm **retvm); void vm_destroy(struct vm *vm); int vm_reinit(struct vm *vm); const char *vm_name(struct vm *vm); +void vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores, + uint16_t *threads, uint16_t *maxcpus); +int vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, + uint16_t threads, uint16_t maxcpus); /* * APIs that modify the guest memory map require all vcpus to be frozen. Modified: head/sys/amd64/include/vmm_dev.h ============================================================================== --- head/sys/amd64/include/vmm_dev.h Sun Apr 8 19:23:50 2018 (r332297) +++ head/sys/amd64/include/vmm_dev.h Sun Apr 8 19:24:49 2018 (r332298) @@ -226,6 +226,13 @@ struct vm_rtc_data { uint8_t value; }; +struct vm_cpu_topology { + uint16_t sockets; + uint16_t cores; + uint16_t threads; + uint16_t maxcpus; +}; + enum { /* general routines */ IOCNUM_ABIVERS = 0, @@ -284,6 +291,10 @@ enum { IOCNUM_GET_X2APIC_STATE = 61, IOCNUM_GET_HPET_CAPABILITIES = 62, + /* CPU Topology */ + IOCNUM_SET_TOPOLOGY = 63, + IOCNUM_GET_TOPOLOGY = 64, + /* legacy interrupt injection */ IOCNUM_ISA_ASSERT_IRQ = 80, IOCNUM_ISA_DEASSERT_IRQ = 81, @@ -379,6 +390,10 @@ enum { _IOWR('v', IOCNUM_GET_X2APIC_STATE, struct vm_x2apic) #define VM_GET_HPET_CAPABILITIES \ _IOR('v', IOCNUM_GET_HPET_CAPABILITIES, struct vm_hpet_cap) +#define VM_SET_TOPOLOGY \ + _IOW('v', IOCNUM_SET_TOPOLOGY, struct vm_cpu_topology) +#define VM_GET_TOPOLOGY \ + _IOR('v', IOCNUM_GET_TOPOLOGY, struct vm_cpu_topology) #define VM_GET_GPA_PMAP \ _IOWR('v', IOCNUM_GET_GPA_PMAP, struct vm_gpa_pte) #define VM_GLA2GPA \ Modified: head/sys/amd64/vmm/vmm.c ============================================================================== --- head/sys/amd64/vmm/vmm.c Sun Apr 8 19:23:50 2018 (r332297) +++ head/sys/amd64/vmm/vmm.c Sun Apr 8 19:24:49 2018 (r332298) @@ -166,6 +166,11 @@ struct vm { struct vmspace *vmspace; /* (o) guest's address space */ char name[VM_MAX_NAMELEN]; /* (o) virtual machine name */ struct vcpu vcpu[VM_MAXCPU]; /* (i) guest vcpus */ + /* The following describe the vm cpu topology */ + uint16_t sockets; /* (o) num of sockets */ + uint16_t cores; /* (o) num of cores/socket */ + uint16_t threads; /* (o) num of threads/core */ + uint16_t maxcpus; /* (o) max pluggable cpus */ }; static int vmm_initialized; @@ -425,6 +430,12 @@ vm_init(struct vm *vm, bool create) vcpu_init(vm, i, create); } +/* + * The default CPU topology is a single thread per package. + */ +u_int cores_per_package = 1; +u_int threads_per_core = 1; + int vm_create(const char *name, struct vm **retvm) { @@ -450,10 +461,41 @@ vm_create(const char *name, struct vm **retvm) vm->vmspace = vmspace; mtx_init(&vm->rendezvous_mtx, "vm rendezvous lock", 0, MTX_DEF); + vm->sockets = 1; + vm->cores = cores_per_package; /* XXX backwards compatibility */ + vm->threads = threads_per_core; /* XXX backwards compatibility */ + vm->maxcpus = 0; /* XXX not implemented */ + vm_init(vm, true); *retvm = vm; return (0); +} + +void +vm_get_topology(struct vm *vm, uint16_t *sockets, uint16_t *cores, + uint16_t *threads, uint16_t *maxcpus) +{ + *sockets = vm->sockets; + *cores = vm->cores; + *threads = vm->threads; + *maxcpus = vm->maxcpus; +} + +int +vm_set_topology(struct vm *vm, uint16_t sockets, uint16_t cores, + uint16_t threads, uint16_t maxcpus) +{ + if (maxcpus != 0) + return (EINVAL); /* XXX remove when supported */ + if ((sockets * cores * threads) > VM_MAXCPU) + return (EINVAL); + /* XXX need to check sockets * cores * threads == vCPU, how? */ + vm->sockets = sockets; + vm->cores = cores; + vm->threads = threads; + vm->maxcpus = maxcpus; + return(0); } static void Modified: head/sys/amd64/vmm/vmm_dev.c ============================================================================== --- head/sys/amd64/vmm/vmm_dev.c Sun Apr 8 19:23:50 2018 (r332297) +++ head/sys/amd64/vmm/vmm_dev.c Sun Apr 8 19:24:49 2018 (r332298) @@ -346,6 +346,7 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da struct vm_rtc_time *rtctime; struct vm_rtc_data *rtcdata; struct vm_memmap *mm; + struct vm_cpu_topology *topology; uint64_t *regvals; int *regnums; @@ -736,6 +737,17 @@ vmmdev_ioctl(struct cdev *cdev, u_long cmd, caddr_t da break; case VM_RESTART_INSTRUCTION: error = vm_restart_instruction(sc->vm, vcpu); + break; + case VM_SET_TOPOLOGY: + topology = (struct vm_cpu_topology *)data; + error = vm_set_topology(sc->vm, topology->sockets, + topology->cores, topology->threads, topology->maxcpus); + break; + case VM_GET_TOPOLOGY: + topology = (struct vm_cpu_topology *)data; + vm_get_topology(sc->vm, &topology->sockets, &topology->cores, + &topology->threads, &topology->maxcpus); + error = 0; break; default: error = ENOTTY; Modified: head/sys/amd64/vmm/x86.c ============================================================================== --- head/sys/amd64/vmm/x86.c Sun Apr 8 19:23:50 2018 (r332297) +++ head/sys/amd64/vmm/x86.c Sun Apr 8 19:24:49 2018 (r332298) @@ -60,16 +60,15 @@ static uint64_t bhyve_xcpuids; SYSCTL_ULONG(_hw_vmm, OID_AUTO, bhyve_xcpuids, CTLFLAG_RW, &bhyve_xcpuids, 0, "Number of times an unknown cpuid leaf was accessed"); -/* - * The default CPU topology is a single thread per package. - */ -static u_int threads_per_core = 1; +#if __FreeBSD_version < 1200060 /* Remove after 11 EOL helps MFCing */ +extern u_int threads_per_core; SYSCTL_UINT(_hw_vmm_topology, OID_AUTO, threads_per_core, CTLFLAG_RDTUN, &threads_per_core, 0, NULL); -static u_int cores_per_package = 1; +extern u_int cores_per_package; SYSCTL_UINT(_hw_vmm_topology, OID_AUTO, cores_per_package, CTLFLAG_RDTUN, &cores_per_package, 0, NULL); +#endif static int cpuid_leaf_b = 1; SYSCTL_INT(_hw_vmm_topology, OID_AUTO, cpuid_leaf_b, CTLFLAG_RDTUN, @@ -95,6 +94,7 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, int error, enable_invpcid, level, width, x2apic_id; unsigned int func, regs[4], logical_cpus; enum x2apic_state x2apic_state; + uint16_t cores, maxcpus, sockets, threads; VCPU_CTR2(vm, vcpu_id, "cpuid %#x,%#x", *eax, *ecx); @@ -142,11 +142,11 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, * * However this matches the logical cpus as * advertised by leaf 0x1 and will work even - * if the 'threads_per_core' tunable is set - * incorrectly on an AMD host. + * if threads is set incorrectly on an AMD host. */ - logical_cpus = threads_per_core * - cores_per_package; + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); + logical_cpus = threads * cores; regs[2] = logical_cpus - 1; } break; @@ -305,7 +305,9 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, */ regs[3] |= (CPUID_MCA | CPUID_MCE | CPUID_MTRR); - logical_cpus = threads_per_core * cores_per_package; + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); + logical_cpus = threads * cores; regs[1] &= ~CPUID_HTT_CORES; regs[1] |= (logical_cpus & 0xff) << 16; regs[3] |= CPUID_HTT; @@ -315,8 +317,10 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, cpuid_count(*eax, *ecx, regs); if (regs[0] || regs[1] || regs[2] || regs[3]) { + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); regs[0] &= 0x3ff; - regs[0] |= (cores_per_package - 1) << 26; + regs[0] |= (cores - 1) << 26; /* * Cache topology: * - L1 and L2 are shared only by the logical @@ -324,10 +328,10 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, * - L3 and above are shared by all logical * processors in the package. */ - logical_cpus = threads_per_core; + logical_cpus = threads; level = (regs[0] >> 5) & 0x7; if (level >= 3) - logical_cpus *= cores_per_package; + logical_cpus *= cores; regs[0] |= (logical_cpus - 1) << 14; } break; @@ -389,16 +393,17 @@ x86_emulate_cpuid(struct vm *vm, int vcpu_id, /* * Processor topology enumeration */ + vm_get_topology(vm, &sockets, &cores, &threads, + &maxcpus); if (*ecx == 0) { - logical_cpus = threads_per_core; + logical_cpus = threads; width = log2(logical_cpus); level = CPUID_TYPE_SMT; x2apic_id = vcpu_id; } if (*ecx == 1) { - logical_cpus = threads_per_core * - cores_per_package; + logical_cpus = threads * cores; width = log2(logical_cpus); level = CPUID_TYPE_CORE; x2apic_id = vcpu_id; Modified: head/usr.sbin/bhyve/bhyve.8 ============================================================================== --- head/usr.sbin/bhyve/bhyve.8 Sun Apr 8 19:23:50 2018 (r332297) +++ head/usr.sbin/bhyve/bhyve.8 Sun Apr 8 19:24:49 2018 (r332298) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 2, 2017 +.Dd April 6, 2018 .Dt BHYVE 8 .Os .Sh NAME @@ -33,7 +33,16 @@ .Sh SYNOPSIS .Nm .Op Fl abehuwxACHPSWY -.Op Fl c Ar numcpus +.Oo +.Fl c\~ Ns +.Oo +.Op Ar cpus= Ns +.Ar numcpus Ns +.Oc Ns +.Op Ar ,sockets=n Ns +.Op Ar ,cores=n Ns +.Op Ar ,threads=n +.Oc .Op Fl g Ar gdbport .Op Fl l Ar lpcdev Ns Op , Ns Ar conf .Op Fl m Ar memsize Ns Op Ar K|k|M|m|G|g|T|t @@ -77,9 +86,30 @@ Enable a low-level console device supported by kernels compiled with .Cd "device bvmconsole" . This option will be deprecated in a future version. -.It Fl c Ar numcpus -Number of guest virtual CPUs. -The default is 1 and the maximum is 16. +.It Fl c Op Ar setting ... +Number of guest virtual CPUs +and/or the CPU topology. +The default value for each of +.Ar numcpus , +.Ar sockets , +.Ar cores , +and +.Ar threads +is 1. +The current maximum number of guest virtual CPUs is 16. +If +.Ar numcpus +is not specified then it will be calculated from the other arguments. +The topology must be consistent in that the +.Ar numcpus +must equal the product of +.Ar sockets , +.Ar cores , +and +.Ar threads . +If a +.Ar setting +is specified more than once the last one has precedence. .It Fl C Include guest memory in core file. .It Fl e Modified: head/usr.sbin/bhyve/bhyverun.c ============================================================================== --- head/usr.sbin/bhyve/bhyverun.c Sun Apr 8 19:23:50 2018 (r332297) +++ head/usr.sbin/bhyve/bhyverun.c Sun Apr 8 19:24:49 2018 (r332298) @@ -57,6 +57,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #ifndef WITHOUT_CAPSICUM @@ -93,6 +94,8 @@ extern int vmexit_task_switch(struct vmctx *, struct v char *vmname; int guest_ncpus; +uint16_t cores, maxcpus, sockets, threads; + char *guest_uuid_str; static int guest_vmexit_on_hlt, guest_vmexit_on_pause; @@ -137,11 +140,13 @@ usage(int code) { fprintf(stderr, - "Usage: %s [-abehuwxACHPSWY] [-c vcpus] [-g ] [-l ]\n" + "Usage: %s [-abehuwxACHPSWY]\n" + " %*s [-c [[cpus=]numcpus][,sockets=n][,cores=n][,threads=n]]\n" + " %*s [-g ] [-l ]\n" " %*s [-m mem] [-p vcpu:hostcpu] [-s ] [-U uuid] \n" " -a: local apic is in xAPIC mode (deprecated)\n" " -A: create ACPI tables\n" - " -c: # cpus (default 1)\n" + " -c: number of cpus and/or topology specification" " -C: include guest memory in core file\n" " -e: exit on unhandled I/O access\n" " -g: gdb port\n" @@ -159,12 +164,92 @@ usage(int code) " -W: force virtio to use single-vector MSI\n" " -x: local apic is in x2APIC mode\n" " -Y: disable MPtable generation\n", - progname, (int)strlen(progname), ""); + progname, (int)strlen(progname), "", (int)strlen(progname), "", + (int)strlen(progname), ""); exit(code); } +/* + * XXX This parser is known to have the following issues: + * 1. It accepts null key=value tokens ",,". + * 2. It accepts whitespace after = and before value. + * 3. Values out of range of INT are silently wrapped. + * 4. It doesn't check non-final values. + * 5. The apparently bogus limits of UINT16_MAX are for future expansion. + * + * The acceptance of a null specification ('-c ""') is by design to match the + * manual page syntax specification, this results in a topology of 1 vCPU. + */ static int +topology_parse(const char *opt) +{ + uint64_t ncpus; + int c, chk, n, s, t, tmp; + char *cp, *str; + bool ns, scts; + + c = 1, n = 1, s = 1, t = 1; + ns = false, scts = false; + str = strdup(opt); + + while ((cp = strsep(&str, ",")) != NULL) { + if (sscanf(cp, "%i%n", &tmp, &chk) == 1) { + n = tmp; + ns = true; + } else if (sscanf(cp, "cpus=%i%n", &tmp, &chk) == 1) { + n = tmp; + ns = true; + } else if (sscanf(cp, "sockets=%i%n", &tmp, &chk) == 1) { + s = tmp; + scts = true; + } else if (sscanf(cp, "cores=%i%n", &tmp, &chk) == 1) { + c = tmp; + scts = true; + } else if (sscanf(cp, "threads=%i%n", &tmp, &chk) == 1) { + t = tmp; + scts = true; +#ifdef notyet /* Do not expose this until vmm.ko implements it */ + } else if (sscanf(cp, "maxcpus=%i%n", &tmp, &chk) == 1) { + m = tmp; +#endif + /* Skip the empty argument case from -c "" */ + } else if (cp[0] == '\0') + continue; + else + return (-1); + /* Any trailing garbage causes an error */ + if (cp[chk] != '\0') + return (-1); + } + /* + * Range check 1 <= n <= UINT16_MAX all values + */ + if (n < 1 || s < 1 || c < 1 || t < 1 || + n > UINT16_MAX || s > UINT16_MAX || c > UINT16_MAX || + t > UINT16_MAX) + return (-1); + + /* If only the cpus was specified, use that as sockets */ + if (!scts) + s = n; + /* + * Compute sockets * cores * threads avoiding overflow + * The range check above insures these are 16 bit values + * If n was specified check it against computed ncpus + */ + ncpus = (uint64_t)s * c * t; + if (ncpus > UINT16_MAX || (ns && n != ncpus)) + return (-1); + + guest_ncpus = ncpus; + sockets = s; + cores = c; + threads = t; + return(0); +} + +static int pincpu_parse(const char *opt) { int vcpu, pcpu; @@ -783,6 +868,9 @@ do_open(const char *vmname) exit(1); } } + error = vm_set_topology(ctx, sockets, cores, threads, maxcpus); + if (error) + errx(EX_OSERR, "vm_set_topology"); return (ctx); } @@ -801,6 +889,8 @@ main(int argc, char *argv[]) progname = basename(argv[0]); gdb_port = 0; guest_ncpus = 1; + sockets = cores = threads = 1; + maxcpus = 0; memsize = 256 * MB; mptgen = 1; rtc_localtime = 1; @@ -825,7 +915,10 @@ main(int argc, char *argv[]) } break; case 'c': - guest_ncpus = atoi(optarg); + if (topology_parse(optarg) != 0) { + errx(EX_USAGE, "invalid cpu topology " + "'%s'", optarg); + } break; case 'C': memflags |= VM_MEM_F_INCORE; @@ -902,11 +995,6 @@ main(int argc, char *argv[]) vmname = argv[0]; ctx = do_open(vmname); - - if (guest_ncpus < 1) { - fprintf(stderr, "Invalid guest vCPUs (%d)\n", guest_ncpus); - exit(1); - } max_vcpus = num_vcpus_allowed(ctx); if (guest_ncpus > max_vcpus) { Modified: head/usr.sbin/bhyvectl/bhyvectl.c ============================================================================== --- head/usr.sbin/bhyvectl/bhyvectl.c Sun Apr 8 19:23:50 2018 (r332297) +++ head/usr.sbin/bhyvectl/bhyvectl.c Sun Apr 8 19:24:49 2018 (r332298) @@ -191,7 +191,8 @@ usage(bool cpu_intel) " [--get-msr-bitmap]\n" " [--get-msr-bitmap-address]\n" " [--get-guest-sysenter]\n" - " [--get-exit-reason]\n", + " [--get-exit-reason]\n" + " [--get-cpu-topology]\n", progname); if (cpu_intel) { @@ -285,6 +286,7 @@ static int set_x2apic_state, get_x2apic_state; enum x2apic_state x2apic_state; static int unassign_pptdev, bus, slot, func; static int run; +static int get_cpu_topology; /* * VMCB specific. @@ -1456,6 +1458,7 @@ setup_options(bool cpu_intel) { "get-active-cpus", NO_ARG, &get_active_cpus, 1 }, { "get-suspended-cpus", NO_ARG, &get_suspended_cpus, 1 }, { "get-intinfo", NO_ARG, &get_intinfo, 1 }, + { "get-cpu-topology", NO_ARG, &get_cpu_topology, 1 }, }; const struct option intel_opts[] = { @@ -2310,6 +2313,14 @@ main(int argc, char *argv[]) printf("%-40s\t%ld\n", desc, stats[i]); } } + } + + if (!error && (get_cpu_topology || get_all)) { + uint16_t sockets, cores, threads, maxcpus; + + vm_get_topology(ctx, &sockets, &cores, &threads, &maxcpus); + printf("cpu_topology:\tsockets=%hu, cores=%hu, threads=%hu, " + "maxcpus=%hu\n", sockets, cores, threads, maxcpus); } if (!error && run) { From owner-svn-src-head@freebsd.org Sun Apr 8 19:33:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CBAAAF9C699; Sun, 8 Apr 2018 19:33:05 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7E38871E5A; Sun, 8 Apr 2018 19:33:05 +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 793E71448E; Sun, 8 Apr 2018 19:33:05 +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 w38JX5HB095975; Sun, 8 Apr 2018 19:33:05 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38JX5fl095974; Sun, 8 Apr 2018 19:33:05 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201804081933.w38JX5fl095974@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 8 Apr 2018 19:33:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332299 - head/sys/powerpc/include X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/include X-SVN-Commit-Revision: 332299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 19:33:06 -0000 Author: jhibbits Date: Sun Apr 8 19:33:05 2018 New Revision: 332299 URL: https://svnweb.freebsd.org/changeset/base/332299 Log: Fix typo Reserved cause is 6, not 5. Reported by: cem Modified: head/sys/powerpc/include/spr.h Modified: head/sys/powerpc/include/spr.h ============================================================================== --- head/sys/powerpc/include/spr.h Sun Apr 8 19:24:49 2018 (r332298) +++ head/sys/powerpc/include/spr.h Sun Apr 8 19:33:05 2018 (r332299) @@ -128,7 +128,7 @@ #define FSCR_IC_PM 0x0300000000000000ULL /* Read or write access of a Performance Monitor SPR in group A */ #define FSCR_IC_BHRB 0x0400000000000000ULL /* Execution of a BHRB Instruction */ #define FSCR_IC_HTM 0x0500000000000000ULL /* Access to a Transactional Memory */ -/* Reserved 0x0500000000000000ULL */ +/* Reserved 0x0600000000000000ULL */ #define FSCR_IC_EBB 0x0700000000000000ULL /* Access to Event-Based Branch */ #define FSCR_IC_TAR 0x0800000000000000ULL /* Access to Target Address Register */ #define FSCR_IC_STOP 0x0900000000000000ULL /* Access to the 'stop' instruction in privileged non-hypervisor state */ From owner-svn-src-head@freebsd.org Sun Apr 8 20:53:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E56D5FA22F7; Sun, 8 Apr 2018 20:53:01 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 96DA87DE47; Sun, 8 Apr 2018 20:53:01 +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 90593151B2; Sun, 8 Apr 2018 20:53:01 +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 w38Kr1M8036203; Sun, 8 Apr 2018 20:53:01 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38Kr12X036199; Sun, 8 Apr 2018 20:53:01 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804082053.w38Kr12X036199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sun, 8 Apr 2018 20:53:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332305 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 332305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 20:53:02 -0000 Author: gonzo Date: Sun Apr 8 20:53:00 2018 New Revision: 332305 URL: https://svnweb.freebsd.org/changeset/base/332305 Log: Document ofw_bus_subr helpers "compatible" and "status" properties Add documentation for following functions: - ofw_bus_is_compatible - ofw_bus_is_compatible_strict - ofw_bus_node_is_compatible - ofw_bus_search_compatible - ofw_bus_get_status - ofw_bus_status_okay - ofw_bus_node_status_okay MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14724 Added: head/share/man/man9/ofw_bus_is_compatible.9 (contents, props changed) head/share/man/man9/ofw_bus_status_okay.9 (contents, props changed) Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Sun Apr 8 20:52:09 2018 (r332304) +++ head/share/man/man9/Makefile Sun Apr 8 20:53:00 2018 (r332305) @@ -208,6 +208,8 @@ MAN= accept_filter.9 \ namei.9 \ netisr.9 \ nv.9 \ + ofw_bus_is_compatible.9 \ + ofw_bus_status_okay.9 \ osd.9 \ owll.9 \ own.9 \ @@ -1525,6 +1527,11 @@ MLINKS+=nv.9 libnv.9 \ nv.9 nvlist_take_string_array.9 \ nv.9 nvlist_unpack.9 \ nv.9 nvlist_xfer.9 +MLINKS+=ofw_bus_is_compatible.9 ofw_bus_is_compatible_strict.9 \ + ofw_bus_is_compatible.9 ofw_bus_node_is_compatible.9 \ + ofw_bus_is_compatible.9 ofw_bus_search_compatible.9 +MLINKS+= ofw_bus_status_okay.9 ofw_bus_get_status.9 \ + ofw_bus_status_okay.9 ofw_bus_node_status_okay.9 MLINKS+=osd.9 osd_call.9 \ osd.9 osd_del.9 \ osd.9 osd_deregister.9 \ Added: head/share/man/man9/ofw_bus_is_compatible.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/ofw_bus_is_compatible.9 Sun Apr 8 20:53:00 2018 (r332305) @@ -0,0 +1,147 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 2018 Oleksandr Tymoshenko +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 8, 2018 +.Dt ofw_bus_is_compatible 9 +.Os +.Sh NAME +.Nm ofw_bus_is_compatible +.Nm ofw_bus_is_compatible_strict +.Nm ofw_bus_node_is_compatible +.Nm ofw_bus_search_compatible +.Nd check device tree nodes for compatibility with drivers +.Sh SYNOPSIS +.In dev/ofw/openfirm.h +.In dev/ofw/ofw_bus.h +.In dev/ofw/ofw_bus_subr.h +.Ft int +.Fn ofw_bus_is_compatible "device_t dev" "const char *compatstr" +.Ft int +.Fn ofw_bus_is_compatible_strict "device_t dev" "const char *compatstr" +.Ft int +.Fn ofw_bus_node_is_compatible "phandle_t node" "const char *compatstr" +.Ft const struct ofw_compat_data * +.Fn ofw_bus_search_compatible "device_t dev" "const struct ofw_compat_data *compat" +.Sh DESCRIPTION +.Pp +The "compatible" property of the device tree node is used to +identify the type of the device the node represents. +The property is a list of one or more strings that represent +hardware types the device is compatible with. +The common format for such strings is "vendor,hardware" +where "vendor" is an abbreviated name of the manufacturer +and "hardware" is a device identifier, for instance, "fsl" +for "Freescale" and "imx6ul-i2c" for the I2C controller. +More than one string is required for compatibility with +older revisions of the driver. +If hardware revision B is backward compatible with revision +A device tree node can signal this compatibility by +providing both "vndr,hrdwrA" and "vndr,hrdwrB" strings in +the "compatibile" property value. +This way older driver can use features available only in +revision A, and the new version of the driver can take +advantage of revision B feature set. +.Pp +.Fn ofw_bus_is_compatible +returns 1 if the +.Fa compatstr +value occurs in the "compatible" property list of the device +tree node associated with the device +.Fa dev , +and 0 otherwise. +.Pp +.Fn ofw_bus_is_compatible_strict +return 1 if the "compatible" +property of the device tree node associated with the device +.Fa dev +consists of only one string and this string is equal to +.Fa compatstr , +and 0 otherwise. +.Pp +.Fn ofw_bus_node_is_compatible +returns 1 if the +.Fa compatstr +value occurs in the "compatible" property list of the device +tree node +.Fa node , +and 0 otherwise. +.Pp +.Fn ofw_bus_search_compatible +returns pointer to the first entry of the +.Fa compat +table whose ocd_str field occurs in "compatible" property of +the device tree node associated with the device +.Fa dev . +The +.Fa compat +table is an array of struct ofw_compat_data elements defined as follows: +.Bd -literal -offset indent +struct ofw_compat_data { + const char *ocd_str; + uintptr_t ocd_data; +}; +.Ed +The +.Fa compat +table must be terminated by the entry with ocd_str set to NULL. +If the device tree node is not compatible with any of +the entries, the function returns the pointer to the +terminating entry. +.Sh EXAMPLES +.Bd -literal -offset indent +static struct ofw_compat_data compat_data[] = { + {"arm,hrdwrA", FEATURE_A}, + {"arm,hrdwrB", FEATURE_A | FEATURE_B}, + {NULL, 0} +}; + +static int +hrdwr_probe(device_t dev) +{ + ... + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + ... +} + +static int +hrdwr_attach(device_t dev) +{ + ... + sc = device_get_softc(dev); + sc->sc_features = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + ... +} +.Ed +.Sh SEE ALSO +.Xr ofw_bus_find_compatible 9 +.Sh AUTHORS +This manual page was written by +.An Oleksandr Tymoshenko . Added: head/share/man/man9/ofw_bus_status_okay.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/ofw_bus_status_okay.9 Sun Apr 8 20:53:00 2018 (r332305) @@ -0,0 +1,77 @@ +.\" -*- nroff -*- +.\" +.\" Copyright (c) 2018 Oleksandr Tymoshenko +.\" +.\" All rights reserved. +.\" +.\" This program is free software. +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 8, 2018 +.Dt ofw_bus_status_okay 9 +.Os +.Sh NAME +.Nm ofw_bus_get_status +.Nm ofw_bus_status_okay +.Nm ofw_bus_node_status_okay +.Nd check status of the device tree node +.Sh SYNOPSIS +.In dev/ofw/openfirm.h +.In dev/ofw/ofw_bus.h +.In dev/ofw/ofw_bus_subr.h +.Ft const char * +.Fn ofw_bus_get_status "device_t dev" +.Ft int +.Fn ofw_bus_status_okay "device_t dev" +.Ft int +.Fn ofw_bus_node_status_okay "phandle_t node" +.Sh DESCRIPTION +.Pp +The "status" property of the device tree node indicates whether the device is +enabled or not. +Multiple hardware versions might be built using the same base System-on-Chip +but with a different set of blocks enabled. +It is common to use SoC device tree and only enable/disable device nodes for +the derivative boards. +The device tree node is considered enabled only if it has "status" property +with the value set to either "ok" or "okay". +.Pp +.Fn ofw_bus_get_status +returns the value of the "status" property of the device tree node associated with the device +.Fa dev . +If the node does not have "status" property or there is no node associated with +the device the function returns NULL. +.Pp +.Fn ofw_bus_status_okay +returns 1 if the device tree node associated with the device +.Fa dev +has "status" property and its value is either "ok" or "okay". +.Pp +.Fn ofw_bus_node_status_okay +returns 1 if the device tree node +.Fa node +has "status" property and its value is either "ok" or "okay". +.Sh AUTHORS +This manual page was written by +.An Oleksandr Tymoshenko . From owner-svn-src-head@freebsd.org Sun Apr 8 21:31:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 19647F81BF0; Sun, 8 Apr 2018 21:31:47 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-qt0-x241.google.com (mail-qt0-x241.google.com [IPv6:2607:f8b0:400d:c0d::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9AADB73E46; Sun, 8 Apr 2018 21:31:46 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-qt0-x241.google.com with SMTP id z23so7096518qti.5; Sun, 08 Apr 2018 14:31:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=altA39wFAls7sHkx5MSV0COyhUiux9zMIqTG2cJq6JU=; b=qKo9bsgk7XTowvmtEoWAlIEqjvFRDs6CZI8VkVwRYjwvdZw9S3LE4EljijAfMcg3Qr IzaAtgoRFs5GQ822zf3AY+b29h0w3NEQ8I0sgV17yb5CoK+I1+ePCchg/Z13+Wduno0X niuVLePvj8QQ0mL1rmfY2gAa5LJ3r3VZ8T08hsJHbUh04lxte997FgERJ2YftuhLXwQp WaNsGZMFeIZkiSKAUzsE2Nei5T7N6l/7bEbOLWDDsTWJRhVvfaNgFGM01iZztGOGkeIr 8k0aMRk991ANQEaotCLwoSCcLFgR6LCYX//MCD1UJ1JSlhhNNTziPT8+nq+dZseL+UK+ JOHA== 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=altA39wFAls7sHkx5MSV0COyhUiux9zMIqTG2cJq6JU=; b=iY2/QLm3N2XWpceRiO5ZzI1dJkJMJlNrnAM/6CROl1ZFY6ed2tCXzw9AOY75piTUv7 6Dhqfj8vL3wMyeyXG/1pW8IlgW0rK8J7czpoJqwYxBPoNdmECbSvghqCIbjBPmoPETKV jPdlQfm/wVCBsuAZd9yzUw1YOiPVNo7rbsV59I5EsxxwOjRhuPpcCBoQFnVYRERCcIoO z0xlbQOvxk3DKGeDMvFMouWfi8FT+yKhDnlsirZnxAm/6S2fSCiE7kknRNeAwahFlAMr oRakgle2zWV1QFWqu3uxqGEB2ujwBMnLhlWQBPMWvYiFjlX34j2vLqxZwFjrzs4kdmyV 2IjQ== X-Gm-Message-State: ALQs6tBT5xwnixkvw8LzVdXk/lasVsCL8CU8Ecml529teZLg/O2Fq6eu U26/riK2JzsSBMKsA0gi1dHdoBk6yW3BXqfnllpsNg== X-Google-Smtp-Source: AIpwx48v45y4yKmXbGXpvDdARs7Xraz5drBZ/Jxp3I8JzMqQpUMibQeiAAt6AE0pkpFT6LFMHnKrO+BzbJ/sRhBYWJc= X-Received: by 10.200.67.4 with SMTP id z4mr47454137qtm.196.1523223106247; Sun, 08 Apr 2018 14:31:46 -0700 (PDT) MIME-Version: 1.0 Received: by 10.200.36.52 with HTTP; Sun, 8 Apr 2018 14:31:45 -0700 (PDT) In-Reply-To: References: <201804081634.w38GYA8N097150@repo.freebsd.org> From: Mateusz Guzik Date: Sun, 8 Apr 2018 23:31:45 +0200 Message-ID: Subject: Re: svn commit: r332285 - head/sys/kern To: Steven Hartland Cc: Mateusz Guzik , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 21:31:47 -0000 On Sun, Apr 8, 2018 at 9:06 PM, Steven Hartland < steven.hartland@multiplay.co.uk> wrote: > Worth making the sysctls so they can be tuned the the HW / use case? > they already are, see: sysctl debug.mtx debug.mtx_spin debug.rwlock debug.sx -- Mateusz Guzik From owner-svn-src-head@freebsd.org Sun Apr 8 22:07:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C17B2F847CE; Sun, 8 Apr 2018 22:07:07 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 713FB87793; Sun, 8 Apr 2018 22:07:07 +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 6BC3115D7A; Sun, 8 Apr 2018 22:07:07 +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 w38M77t8071635; Sun, 8 Apr 2018 22:07:07 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38M77sN071634; Sun, 8 Apr 2018 22:07:07 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201804082207.w38M77sN071634@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 8 Apr 2018 22:07:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332309 - head/sys/dev/fdt X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/fdt X-SVN-Commit-Revision: 332309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 22:07:08 -0000 Author: andrew Date: Sun Apr 8 22:07:06 2018 New Revision: 332309 URL: https://svnweb.freebsd.org/changeset/base/332309 Log: Replace calls to fdt_is_compatible with ofw_bus_node_is_compatible. These are almost identical so there is no need to keep the former around. Sponsored by: DARPA, AFRL Modified: head/sys/dev/fdt/fdt_common.c Modified: head/sys/dev/fdt/fdt_common.c ============================================================================== --- head/sys/dev/fdt/fdt_common.c Sun Apr 8 21:56:35 2018 (r332308) +++ head/sys/dev/fdt/fdt_common.c Sun Apr 8 22:07:06 2018 (r332309) @@ -71,8 +71,6 @@ vm_offset_t fdt_immr_size; struct fdt_ic_list fdt_ic_list_head = SLIST_HEAD_INITIALIZER(fdt_ic_list_head); -static int fdt_is_compatible(phandle_t, const char *); - static int fdt_get_range_by_busaddr(phandle_t node, u_long addr, u_long *base, u_long *size) @@ -215,7 +213,7 @@ fdt_immr_addr(vm_offset_t immr_va) * Try to access the SOC node directly i.e. through /aliases/. */ if ((node = OF_finddevice("soc")) != -1) - if (fdt_is_compatible(node, "simple-bus")) + if (ofw_bus_node_is_compatible(node, "simple-bus")) goto moveon; /* * Find the node the long way. @@ -236,45 +234,6 @@ moveon: return (r); } -/* - * This routine is an early-usage version of the ofw_bus_is_compatible() when - * the ofw_bus I/F is not available (like early console routines and similar). - * Note the buffer has to be on the stack since malloc() is usually not - * available in such cases either. - */ -static int -fdt_is_compatible(phandle_t node, const char *compatstr) -{ - char buf[FDT_COMPAT_LEN]; - char *compat; - int len, onelen, l, rv; - - if ((len = OF_getproplen(node, "compatible")) <= 0) - return (0); - - compat = (char *)&buf; - bzero(compat, FDT_COMPAT_LEN); - - if (OF_getprop(node, "compatible", compat, FDT_COMPAT_LEN) < 0) - return (0); - - onelen = strlen(compatstr); - rv = 0; - while (len > 0) { - if (strncasecmp(compat, compatstr, onelen) == 0) { - /* Found it. */ - rv = 1; - break; - } - /* Slide to the next sub-string. */ - l = strlen(compat) + 1; - compat += l; - len -= l; - } - - return (rv); -} - int fdt_is_compatible_strict(phandle_t node, const char *compatible) { @@ -303,7 +262,7 @@ fdt_find_compatible(phandle_t start, const char *compa * matching 'compatible' property. */ for (child = OF_child(start); child != 0; child = OF_peer(child)) - if (fdt_is_compatible(child, compat)) { + if (ofw_bus_node_is_compatible(child, compat)) { if (strict) if (!fdt_is_compatible_strict(child, compat)) continue; @@ -322,7 +281,7 @@ fdt_depth_search_compatible(phandle_t start, const cha * matching 'compatible' property. */ for (node = OF_child(start); node != 0; node = OF_peer(node)) { - if (fdt_is_compatible(node, compat) && + if (ofw_bus_node_is_compatible(node, compat) && (strict == 0 || fdt_is_compatible_strict(node, compat))) { return (node); } From owner-svn-src-head@freebsd.org Sun Apr 8 22:59:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AC32EF88642; Sun, 8 Apr 2018 22:59: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5B3AE8404D; Sun, 8 Apr 2018 22:59: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 53FED165B4; Sun, 8 Apr 2018 22:59:40 +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 w38MxeVk096345; Sun, 8 Apr 2018 22:59:40 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38MxZQG096292; Sun, 8 Apr 2018 22:59:35 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804082259.w38MxZQG096292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sun, 8 Apr 2018 22:59:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332310 - in head/sys: arm/allwinner arm/amlogic/aml8726 arm/broadcom/bcm2835 arm/freescale/vybrid arm/mv arm/nvidia arm/nvidia/tegra124 arm/ti arm/ti/cpsw arm/ti/usb dev/altera/avgen d... X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in head/sys: arm/allwinner arm/amlogic/aml8726 arm/broadcom/bcm2835 arm/freescale/vybrid arm/mv arm/nvidia arm/nvidia/tegra124 arm/ti arm/ti/cpsw arm/ti/usb dev/altera/avgen dev/atkbdc dev/etherswitch... X-SVN-Commit-Revision: 332310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 22:59:41 -0000 Author: gonzo Date: Sun Apr 8 22:59:34 2018 New Revision: 332310 URL: https://svnweb.freebsd.org/changeset/base/332310 Log: Clean up OF_getprop_alloc API OF_getprop_alloc takes element size argument and returns number of elements in the property. There are valid use cases for such behavior but mostly API consumers pass 1 as element size to get string properties. What API users would expect from OF_getprop_alloc is to be a combination of malloc + OF_getprop with the same semantic of return value. This patch modifies API signature to match these expectations. For the valid use cases with element size != 1 and to reduce modification scope new OF_getprop_alloc_multi function has been introduced that behaves the same way OF_getprop_alloc behaved prior to this patch. Reviewed by: ian, manu Differential Revision: https://reviews.freebsd.org/D14850 Modified: head/sys/arm/allwinner/aw_gpio.c head/sys/arm/allwinner/aw_if_dwc.c head/sys/arm/allwinner/if_awg.c head/sys/arm/amlogic/aml8726/aml8726_ccm.c head/sys/arm/amlogic/aml8726/aml8726_mmc.c head/sys/arm/amlogic/aml8726/aml8726_pinctrl.c head/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c head/sys/arm/freescale/vybrid/vf_ccm.c head/sys/arm/mv/mv_localbus.c head/sys/arm/nvidia/as3722_gpio.c head/sys/arm/nvidia/as3722_regulators.c head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c head/sys/arm/nvidia/tegra_pinmux.c head/sys/arm/nvidia/tegra_usbphy.c head/sys/arm/ti/cpsw/if_cpsw.c head/sys/arm/ti/ti_hwmods.c head/sys/arm/ti/usb/omap_host.c head/sys/dev/altera/avgen/altera_avgen_fdt.c head/sys/dev/atkbdc/atkbdc_ebus.c head/sys/dev/etherswitch/e6000sw/e6000sw.c head/sys/dev/extres/regulator/regulator.c head/sys/dev/fdt/fdt_pinctrl.c head/sys/dev/fdt/fdt_slicer.c head/sys/dev/gpio/gpiokeys.c head/sys/dev/gpio/gpioled_fdt.c head/sys/dev/iicbus/adt746x.c head/sys/dev/le/lebuffer_sbus.c head/sys/dev/neta/if_mvneta_fdt.c head/sys/dev/ofw/ofw_bus_subr.c head/sys/dev/ofw/openfirm.c head/sys/dev/ofw/openfirm.h head/sys/dev/usb/controller/ehci_fsl.c head/sys/dev/vnic/thunder_bgx_fdt.c head/sys/mips/mediatek/mtk_pinctrl.c head/sys/powerpc/mpc85xx/fsl_diu.c head/sys/powerpc/powermac/macio.c head/sys/powerpc/powermac/uninorth.c head/sys/powerpc/psim/iobus.c head/sys/sparc64/central/central.c head/sys/sparc64/ebus/ebus.c head/sys/sparc64/fhc/fhc.c head/sys/sparc64/isa/isa.c head/sys/sparc64/pci/ofw_pci.c head/sys/sparc64/sbus/dma_sbus.c head/sys/sparc64/sbus/sbus.c head/sys/sparc64/sparc64/nexus.c head/sys/sparc64/sparc64/upa.c Modified: head/sys/arm/allwinner/aw_gpio.c ============================================================================== --- head/sys/arm/allwinner/aw_gpio.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/allwinner/aw_gpio.c Sun Apr 8 22:59:34 2018 (r332310) @@ -559,10 +559,10 @@ aw_gpio_parse_function(phandle_t node) { char *function; - if (OF_getprop_alloc(node, "function", sizeof(*function), + if (OF_getprop_alloc(node, "function", (void **)&function) != -1) return (function); - if (OF_getprop_alloc(node, "allwinner,function", sizeof(*function), + if (OF_getprop_alloc(node, "allwinner,function", (void **)&function) != -1) return (function); Modified: head/sys/arm/allwinner/aw_if_dwc.c ============================================================================== --- head/sys/arm/allwinner/aw_if_dwc.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/allwinner/aw_if_dwc.c Sun Apr 8 22:59:34 2018 (r332310) @@ -72,7 +72,7 @@ a20_if_dwc_init(device_t dev) node = ofw_bus_get_node(dev); /* Configure PHY for MII or RGMII mode */ - if (OF_getprop_alloc(node, "phy-mode", 1, (void **)&phy_type)) { + if (OF_getprop_alloc(node, "phy-mode", (void **)&phy_type)) { error = clk_get_by_ofw_name(dev, 0, "allwinner_gmac_tx", &clk_tx); if (error != 0) { device_printf(dev, "could not get tx clk\n"); Modified: head/sys/arm/allwinner/if_awg.c ============================================================================== --- head/sys/arm/allwinner/if_awg.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/allwinner/if_awg.c Sun Apr 8 22:59:34 2018 (r332310) @@ -1233,7 +1233,7 @@ awg_setup_phy(device_t dev) node = ofw_bus_get_node(dev); use_syscon = false; - if (OF_getprop_alloc(node, "phy-mode", 1, (void **)&phy_type) == 0) + if (OF_getprop_alloc(node, "phy-mode", (void **)&phy_type) == 0) return (0); if (sc->syscon != NULL || sc->res[_RES_SYSCON] != NULL) Modified: head/sys/arm/amlogic/aml8726/aml8726_ccm.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_ccm.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/amlogic/aml8726/aml8726_ccm.c Sun Apr 8 22:59:34 2018 (r332310) @@ -87,7 +87,7 @@ aml8726_ccm_configure_gates(struct aml8726_ccm_softc * node = ofw_bus_get_node(sc->dev); - len = OF_getprop_alloc(node, "functions", sizeof(char), + len = OF_getprop_alloc(node, "functions", (void **)&functions); if (len < 0) { Modified: head/sys/arm/amlogic/aml8726/aml8726_mmc.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_mmc.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/amlogic/aml8726/aml8726_mmc.c Sun Apr 8 22:59:34 2018 (r332310) @@ -585,7 +585,7 @@ aml8726_mmc_attach(device_t dev) } len = OF_getprop_alloc(OF_node_from_xref(prop[0]), "amlogic,function", - sizeof(char), (void **)&function_name); + (void **)&function_name); if (len < 0) { device_printf(dev, @@ -635,7 +635,7 @@ aml8726_mmc_attach(device_t dev) } len = OF_getprop_alloc(node, "mmc-voltages", - sizeof(char), (void **)&voltages); + (void **)&voltages); if (len < 0) { device_printf(dev, "missing mmc-voltages attribute in FDT\n"); Modified: head/sys/arm/amlogic/aml8726/aml8726_pinctrl.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_pinctrl.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/amlogic/aml8726/aml8726_pinctrl.c Sun Apr 8 22:59:34 2018 (r332310) @@ -194,7 +194,7 @@ aml8726_pinctrl_configure_pins(device_t dev, phandle_t node = OF_node_from_xref(cfgxref); len = OF_getprop_alloc(node, "amlogic,function", - sizeof(char), (void **)&function_name); + (void **)&function_name); if (len < 0) { device_printf(dev, @@ -216,7 +216,7 @@ aml8726_pinctrl_configure_pins(device_t dev, phandle_t OF_prop_free(function_name); len = OF_getprop_alloc(node, "amlogic,pull", - sizeof(char), (void **)&pull); + (void **)&pull); pm = aml8726_unknown_pm; @@ -257,7 +257,7 @@ aml8726_pinctrl_configure_pins(device_t dev, phandle_t } len = OF_getprop_alloc(node, "amlogic,pins", - sizeof(char), (void **)&pins); + (void **)&pins); if (len < 0) { device_printf(dev, "missing amlogic,pins attribute in FDT\n"); Modified: head/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/amlogic/aml8726/aml8726_sdxc-m8.c Sun Apr 8 22:59:34 2018 (r332310) @@ -796,7 +796,7 @@ aml8726_sdxc_attach(device_t dev) } len = OF_getprop_alloc(node, "mmc-voltages", - sizeof(char), (void **)&voltages); + (void **)&voltages); if (len < 0) { device_printf(dev, "missing mmc-voltages attribute in FDT\n"); Modified: head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c Sun Apr 8 22:59:34 2018 (r332310) @@ -126,7 +126,7 @@ aml8726_usb_phy_mode(const char *dwcotg_path, uint32_t *mode = 0; len = OF_getprop_alloc(node, "dr_mode", - sizeof(char), (void **)&usb_mode); + (void **)&usb_mode); if (len <= 0) return (0); Modified: head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c Sun Apr 8 22:59:34 2018 (r332310) @@ -154,7 +154,7 @@ aml8726_usb_phy_attach(device_t dev) node = ofw_bus_get_node(dev); len = OF_getprop_alloc(node, "force-aca", - sizeof(char), (void **)&force_aca); + (void **)&force_aca); sc->force_aca = FALSE; Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Sun Apr 8 22:59:34 2018 (r332310) @@ -677,7 +677,7 @@ bcm_gpio_get_reserved_pins(struct bcm_gpio_softc *sc) reserved = 0; node = OF_child(gpio); while ((node != 0) && (reserved == 0)) { - len = OF_getprop_alloc(node, "name", 1, (void **)&name); + len = OF_getprop_alloc(node, "name", (void **)&name); if (len == -1) return (-1); if (strcmp(name, "reserved") == 0) Modified: head/sys/arm/freescale/vybrid/vf_ccm.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_ccm.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/freescale/vybrid/vf_ccm.c Sun Apr 8 22:59:34 2018 (r332310) @@ -419,7 +419,7 @@ ccm_fdt_set(struct ccm_softc *sc) if ((len = OF_getproplen(child, "clock_names")) > 0) { len = OF_getproplen(child, "clock_names"); - OF_getprop_alloc(child, "clock_names", 1, + OF_getprop_alloc(child, "clock_names", (void **)&fdt_config); while (len > 0) { Modified: head/sys/arm/mv/mv_localbus.c ============================================================================== --- head/sys/arm/mv/mv_localbus.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/mv/mv_localbus.c Sun Apr 8 22:59:34 2018 (r332310) @@ -175,7 +175,7 @@ fdt_localbus_reg_decode(phandle_t node, struct localbu return (ENXIO); tuple_size = sizeof(pcell_t) * (addr_cells + size_cells); - tuples = OF_getprop_alloc(node, "reg", tuple_size, (void **)®); + tuples = OF_getprop_alloc_multi(node, "reg", tuple_size, (void **)®); debugf("addr_cells = %d, size_cells = %d\n", addr_cells, size_cells); debugf("tuples = %d, tuple size = %d\n", tuples, tuple_size); if (tuples <= 0) Modified: head/sys/arm/nvidia/as3722_gpio.c ============================================================================== --- head/sys/arm/nvidia/as3722_gpio.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/nvidia/as3722_gpio.c Sun Apr 8 22:59:34 2018 (r332310) @@ -212,12 +212,12 @@ as3722_pinmux_read_node(struct as3722_softc *sc, phand { int rv, i; - *lpins = OF_getprop_alloc(node, "pins", 1, (void **)pins); + *lpins = OF_getprop_alloc(node, "pins", (void **)pins); if (*lpins <= 0) return (ENOENT); /* Read function (mux) settings. */ - rv = OF_getprop_alloc(node, "function", 1, (void **)&cfg->function); + rv = OF_getprop_alloc(node, "function", (void **)&cfg->function); if (rv <= 0) cfg->function = NULL; Modified: head/sys/arm/nvidia/as3722_regulators.c ============================================================================== --- head/sys/arm/nvidia/as3722_regulators.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/nvidia/as3722_regulators.c Sun Apr 8 22:59:34 2018 (r332310) @@ -542,7 +542,7 @@ struct as3722_regnode_init_def *init_def) if (rv <= 0) return; supply_node = OF_node_from_xref(supply_node); - rv = OF_getprop_alloc(supply_node, "regulator-name", 1, + rv = OF_getprop_alloc(supply_node, "regulator-name", (void **)&init_def->reg_init_def.parent_name); if (rv <= 0) init_def->reg_init_def.parent_name = NULL; Modified: head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c ============================================================================== --- head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/nvidia/tegra124/tegra124_xusbpadctl.c Sun Apr 8 22:59:34 2018 (r332310) @@ -874,7 +874,7 @@ process_lane(struct padctl_softc *sc, phandle_t node, name = NULL; function = NULL; - rv = OF_getprop_alloc(node, "name", 1, (void **)&name); + rv = OF_getprop_alloc(node, "name", (void **)&name); if (rv <= 0) { device_printf(sc->dev, "Cannot read lane name.\n"); return (ENXIO); @@ -888,7 +888,7 @@ process_lane(struct padctl_softc *sc, phandle_t node, } /* Read function (mux) settings. */ - rv = OF_getprop_alloc(node, "nvidia,function", 1, (void **)&function); + rv = OF_getprop_alloc(node, "nvidia,function", (void **)&function); if (rv <= 0) { device_printf(sc->dev, "Cannot read lane function.\n"); rv = ENXIO; @@ -947,7 +947,7 @@ process_pad(struct padctl_softc *sc, phandle_t node) int rv; name = NULL; - rv = OF_getprop_alloc(node, "name", 1, (void **)&name); + rv = OF_getprop_alloc(node, "name", (void **)&name); if (rv <= 0) { device_printf(sc->dev, "Cannot read pad name.\n"); return (ENXIO); @@ -992,7 +992,7 @@ process_port(struct padctl_softc *sc, phandle_t node) int rv; name = NULL; - rv = OF_getprop_alloc(node, "name", 1, (void **)&name); + rv = OF_getprop_alloc(node, "name", (void **)&name); if (rv <= 0) { device_printf(sc->dev, "Cannot read port name.\n"); return (ENXIO); Modified: head/sys/arm/nvidia/tegra_pinmux.c ============================================================================== --- head/sys/arm/nvidia/tegra_pinmux.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/nvidia/tegra_pinmux.c Sun Apr 8 22:59:34 2018 (r332310) @@ -648,12 +648,12 @@ pinmux_read_node(struct pinmux_softc *sc, phandle_t no { int rv, i; - *lpins = OF_getprop_alloc(node, "nvidia,pins", 1, (void **)pins); + *lpins = OF_getprop_alloc(node, "nvidia,pins", (void **)pins); if (*lpins <= 0) return (ENOENT); /* Read function (mux) settings. */ - rv = OF_getprop_alloc(node, "nvidia,function", 1, + rv = OF_getprop_alloc(node, "nvidia,function", (void **)&cfg->function); if (rv <= 0) cfg->function = NULL; Modified: head/sys/arm/nvidia/tegra_usbphy.c ============================================================================== --- head/sys/arm/nvidia/tegra_usbphy.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/nvidia/tegra_usbphy.c Sun Apr 8 22:59:34 2018 (r332310) @@ -593,7 +593,7 @@ usb_get_ifc_mode(device_t dev, phandle_t node, char *n int rv; enum usb_ifc_type ret; - rv = OF_getprop_alloc(node, name, 1, (void **)&tmpstr); + rv = OF_getprop_alloc(node, name, (void **)&tmpstr); if (rv <= 0) return (USB_IFC_TYPE_UNKNOWN); @@ -615,7 +615,7 @@ usb_get_dr_mode(device_t dev, phandle_t node, char *na int rv; enum usb_dr_mode ret; - rv = OF_getprop_alloc(node, name, 1, (void **)&tmpstr); + rv = OF_getprop_alloc(node, name, (void **)&tmpstr); if (rv <= 0) return (USB_DR_MODE_UNKNOWN); Modified: head/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- head/sys/arm/ti/cpsw/if_cpsw.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/ti/cpsw/if_cpsw.c Sun Apr 8 22:59:34 2018 (r332310) @@ -746,7 +746,7 @@ cpsw_get_fdt_data(struct cpsw_softc *sc, int port) phy = -1; vlan = -1; for (child = OF_child(sc->node); child != 0; child = OF_peer(child)) { - if (OF_getprop_alloc(child, "name", 1, (void **)&name) < 0) + if (OF_getprop_alloc(child, "name", (void **)&name) < 0) continue; if (sscanf(name, "slave@%lx", &mdio_child_addr) != 1) { OF_prop_free(name); Modified: head/sys/arm/ti/ti_hwmods.c ============================================================================== --- head/sys/arm/ti/ti_hwmods.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/ti/ti_hwmods.c Sun Apr 8 22:59:34 2018 (r332310) @@ -110,7 +110,7 @@ ti_hwmods_get_clock(device_t dev) if ((node = ofw_bus_get_node(dev)) == 0) return (INVALID_CLK_IDENT); - if ((len = OF_getprop_alloc(node, "ti,hwmods", 1, (void**)&name)) <= 0) + if ((len = OF_getprop_alloc(node, "ti,hwmods", (void**)&name)) <= 0) return (INVALID_CLK_IDENT); buf = name; @@ -148,7 +148,7 @@ int ti_hwmods_contains(device_t dev, const char *hwmod if ((node = ofw_bus_get_node(dev)) == 0) return (0); - if ((len = OF_getprop_alloc(node, "ti,hwmods", 1, (void**)&name)) <= 0) + if ((len = OF_getprop_alloc(node, "ti,hwmods", (void**)&name)) <= 0) return (0); buf = name; @@ -182,7 +182,7 @@ ti_hwmods_get_unit(device_t dev, const char *hwmod) if ((node = ofw_bus_get_node(dev)) == 0) return (0); - if ((len = OF_getprop_alloc(node, "ti,hwmods", 1, (void**)&name)) <= 0) + if ((len = OF_getprop_alloc(node, "ti,hwmods", (void**)&name)) <= 0) return (0); buf = name; Modified: head/sys/arm/ti/usb/omap_host.c ============================================================================== --- head/sys/arm/ti/usb/omap_host.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/arm/ti/usb/omap_host.c Sun Apr 8 22:59:34 2018 (r332310) @@ -392,7 +392,7 @@ omap_uhh_attach(device_t dev) snprintf(propname, sizeof(propname), "port%d-mode", i+1); - if (OF_getprop_alloc(node, propname, 1, (void**)&mode) <= 0) + if (OF_getprop_alloc(node, propname, (void**)&mode) <= 0) continue; if (strcmp(mode, "ehci-phy") == 0) isc->port_mode[i] = EHCI_HCD_OMAP_MODE_PHY; Modified: head/sys/dev/altera/avgen/altera_avgen_fdt.c ============================================================================== --- head/sys/dev/altera/avgen/altera_avgen_fdt.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/altera/avgen/altera_avgen_fdt.c Sun Apr 8 22:59:34 2018 (r332310) @@ -100,13 +100,13 @@ altera_avgen_fdt_attach(device_t dev) node = ofw_bus_get_node(dev); if (OF_getprop(node, "sri-cambridge,width", &cell, sizeof(cell)) > 0) sc->avg_width = cell; - (void)OF_getprop_alloc(node, "sri-cambridge,fileio", sizeof(char), + (void)OF_getprop_alloc(node, "sri-cambridge,fileio", (void **)&str_fileio); - (void)OF_getprop_alloc(node, "sri-cambridge,geomio", sizeof(char), + (void)OF_getprop_alloc(node, "sri-cambridge,geomio", (void **)&str_geomio); - (void)OF_getprop_alloc(node, "sri-cambridge,mmapio", sizeof(char), + (void)OF_getprop_alloc(node, "sri-cambridge,mmapio", (void **)&str_mmapio); - (void)OF_getprop_alloc(node, "sri-cambridge,devname", sizeof(char), + (void)OF_getprop_alloc(node, "sri-cambridge,devname", (void **)&str_devname); if (OF_getprop(node, "sri-cambridge,devunit", &cell, sizeof(cell)) > 0) devunit = cell; Modified: head/sys/dev/atkbdc/atkbdc_ebus.c ============================================================================== --- head/sys/dev/atkbdc/atkbdc_ebus.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/atkbdc/atkbdc_ebus.c Sun Apr 8 22:59:34 2018 (r332310) @@ -238,7 +238,7 @@ atkbdc_ebus_attach(device_t dev) children = 0; for (child = OF_child(ofw_bus_get_node(dev)); child != 0; child = OF_peer(child)) { - if ((OF_getprop_alloc(child, "name", 1, (void **)&cname)) == -1) + if ((OF_getprop_alloc(child, "name", (void **)&cname)) == -1) continue; if (children >= 2) { device_printf(dev, Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c ============================================================================== --- head/sys/dev/etherswitch/e6000sw/e6000sw.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/etherswitch/e6000sw/e6000sw.c Sun Apr 8 22:59:34 2018 (r332310) @@ -276,7 +276,7 @@ e6000sw_parse_child_fdt(e6000sw_softc_t *sc, phandle_t return (ENXIO); *pport = port; - if (OF_getprop_alloc(child, "label", 1, (void **)&portlabel) > 0) { + if (OF_getprop_alloc(child, "label", (void **)&portlabel) > 0) { if (strncmp(portlabel, "cpu", 3) == 0) { device_printf(sc->dev, "CPU port at %d\n", port); sc->cpuports_mask |= (1 << port); @@ -287,7 +287,7 @@ e6000sw_parse_child_fdt(e6000sw_softc_t *sc, phandle_t fixed_link = OF_child(child); if (fixed_link != 0 && - OF_getprop_alloc(fixed_link, "name", 1, (void **)&name) > 0) { + OF_getprop_alloc(fixed_link, "name", (void **)&name) > 0) { if (strncmp(name, "fixed-link", 10) == 0) { /* Assume defaults: 1g - full-duplex. */ sc->fixed_mask |= (1 << port); Modified: head/sys/dev/extres/regulator/regulator.c ============================================================================== --- head/sys/dev/extres/regulator/regulator.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/extres/regulator/regulator.c Sun Apr 8 22:59:34 2018 (r332310) @@ -1007,7 +1007,7 @@ regulator_parse_ofw_stdparam(device_t pdev, phandle_t int rv; par = &def->std_param; - rv = OF_getprop_alloc(node, "regulator-name", 1, + rv = OF_getprop_alloc(node, "regulator-name", (void **)&def->name); if (rv <= 0) { device_printf(pdev, "%s: Missing regulator name\n", @@ -1057,7 +1057,7 @@ regulator_parse_ofw_stdparam(device_t pdev, phandle_t rv = OF_getencprop(node, "vin-supply", &supply_xref, sizeof(supply_xref)); if (rv >= 0) { - rv = OF_getprop_alloc(supply_xref, "regulator-name", 1, + rv = OF_getprop_alloc(supply_xref, "regulator-name", (void **)&def->parent_name); if (rv <= 0) def->parent_name = NULL; Modified: head/sys/dev/fdt/fdt_pinctrl.c ============================================================================== --- head/sys/dev/fdt/fdt_pinctrl.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/fdt/fdt_pinctrl.c Sun Apr 8 22:59:34 2018 (r332310) @@ -67,7 +67,7 @@ fdt_pinctrl_configure_by_name(device_t client, const c int i, offset, nameslen; nameslen = OF_getprop_alloc(ofw_bus_get_node(client), "pinctrl-names", - sizeof(*names), (void **)&names); + (void **)&names); if (nameslen <= 0) return (ENOENT); for (i = 0, offset = 0; offset < nameslen; i++) { Modified: head/sys/dev/fdt/fdt_slicer.c ============================================================================== --- head/sys/dev/fdt/fdt_slicer.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/fdt/fdt_slicer.c Sun Apr 8 22:59:34 2018 (r332310) @@ -94,12 +94,12 @@ fdt_flash_fill_slices(device_t dev, const char *provid /* * Retrieve label. */ - name_len = OF_getprop_alloc(dt_child, "label", sizeof(char), + name_len = OF_getprop_alloc(dt_child, "label", (void **)&slice_name); if (name_len <= 0) { /* Use node name if no label defined */ name_len = OF_getprop_alloc(dt_child, "name", - sizeof(char), (void **)&slice_name); + (void **)&slice_name); if (name_len <= 0) { debugf("slice i=%d with no name\n", i); slice_name = NULL; Modified: head/sys/dev/gpio/gpiokeys.c ============================================================================== --- head/sys/dev/gpio/gpiokeys.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/gpio/gpiokeys.c Sun Apr 8 22:59:34 2018 (r332310) @@ -271,8 +271,8 @@ gpiokeys_attach_key(struct gpiokeys_softc *sc, phandle callout_init_mtx(&key->repeat_callout, &key->mtx, 0); name = NULL; - if (OF_getprop_alloc(node, "label", 1, (void **)&name) == -1) - OF_getprop_alloc(node, "name", 1, (void **)&name); + if (OF_getprop_alloc(node, "label", (void **)&name) == -1) + OF_getprop_alloc(node, "name", (void **)&name); if (name != NULL) key_name = name; Modified: head/sys/dev/gpio/gpioled_fdt.c ============================================================================== --- head/sys/dev/gpio/gpioled_fdt.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/gpio/gpioled_fdt.c Sun Apr 8 22:59:34 2018 (r332310) @@ -89,7 +89,7 @@ gpioleds_attach_led(struct gpioleds_softc *sc, phandle state = 0; if (OF_getprop_alloc(node, "default-state", - sizeof(char), (void **)&default_state) != -1) { + (void **)&default_state) != -1) { if (strcasecmp(default_state, "on") == 0) state = 1; else if (strcasecmp(default_state, "off") == 0) @@ -105,8 +105,8 @@ gpioleds_attach_led(struct gpioleds_softc *sc, phandle } name = NULL; - if (OF_getprop_alloc(node, "label", 1, (void **)&name) == -1) - OF_getprop_alloc(node, "name", 1, (void **)&name); + if (OF_getprop_alloc(node, "label", (void **)&name) == -1) + OF_getprop_alloc(node, "name", (void **)&name); if (name == NULL) { device_printf(sc->sc_dev, Modified: head/sys/dev/iicbus/adt746x.c ============================================================================== --- head/sys/dev/iicbus/adt746x.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/iicbus/adt746x.c Sun Apr 8 22:59:34 2018 (r332310) @@ -360,8 +360,8 @@ adt746x_fill_fan_prop(device_t dev) child = ofw_bus_get_node(dev); /* Fill the fan location property. */ - location_len = OF_getprop_alloc(child, "hwctrl-location", 1, (void **)&location); - id_len = OF_getprop_alloc(child, "hwctrl-id", sizeof(cell_t), (void **)&id); + location_len = OF_getprop_alloc(child, "hwctrl-location", (void **)&location); + id_len = OF_getprop_alloc_multi(child, "hwctrl-id", sizeof(cell_t), (void **)&id); if (location_len == -1 || id_len == -1) { OF_prop_free(location); OF_prop_free(id); Modified: head/sys/dev/le/lebuffer_sbus.c ============================================================================== --- head/sys/dev/le/lebuffer_sbus.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/le/lebuffer_sbus.c Sun Apr 8 22:59:34 2018 (r332310) @@ -183,7 +183,7 @@ lebuffer_setup_dinfo(device_t dev, phandle_t node) } resource_list_init(&ldi->ldi_rl); slot = -1; - nreg = OF_getprop_alloc(node, "reg", sizeof(*reg), (void **)®); + nreg = OF_getprop_alloc_multi(node, "reg", sizeof(*reg), (void **)®); if (nreg == -1) { device_printf(dev, "<%s>: incomplete\n", ldi->ldi_obdinfo.obd_name); @@ -217,7 +217,7 @@ lebuffer_setup_dinfo(device_t dev, phandle_t node) /* * The `interrupts' property contains the SBus interrupt level. */ - nintr = OF_getprop_alloc(node, "interrupts", sizeof(*intr), + nintr = OF_getprop_alloc_multi(node, "interrupts", sizeof(*intr), (void **)&intr); if (nintr != -1) { for (i = 0; i < nintr; i++) { Modified: head/sys/dev/neta/if_mvneta_fdt.c ============================================================================== --- head/sys/dev/neta/if_mvneta_fdt.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/neta/if_mvneta_fdt.c Sun Apr 8 22:59:34 2018 (r332310) @@ -159,7 +159,7 @@ mvneta_fdt_phy_acquire(device_t dev) /* Test for fixed-link (present i.e. in 388-gp) */ for (child = OF_child(node); child != 0; child = OF_peer(child)) { if (OF_getprop_alloc(child, - "name", 1, (void **)&name) <= 0) { + "name", (void **)&name) <= 0) { continue; } if (strncmp(name, "fixed-link", 10) == 0) { Modified: head/sys/dev/ofw/ofw_bus_subr.c ============================================================================== --- head/sys/dev/ofw/ofw_bus_subr.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/ofw/ofw_bus_subr.c Sun Apr 8 22:59:34 2018 (r332310) @@ -57,12 +57,12 @@ ofw_bus_gen_setup_devinfo(struct ofw_bus_devinfo *obd, if (obd == NULL) return (ENOMEM); /* The 'name' property is considered mandatory. */ - if ((OF_getprop_alloc(node, "name", 1, (void **)&obd->obd_name)) == -1) + if ((OF_getprop_alloc(node, "name", (void **)&obd->obd_name)) == -1) return (EINVAL); - OF_getprop_alloc(node, "compatible", 1, (void **)&obd->obd_compat); - OF_getprop_alloc(node, "device_type", 1, (void **)&obd->obd_type); - OF_getprop_alloc(node, "model", 1, (void **)&obd->obd_model); - OF_getprop_alloc(node, "status", 1, (void **)&obd->obd_status); + OF_getprop_alloc(node, "compatible", (void **)&obd->obd_compat); + OF_getprop_alloc(node, "device_type", (void **)&obd->obd_type); + OF_getprop_alloc(node, "model", (void **)&obd->obd_model); + OF_getprop_alloc(node, "status", (void **)&obd->obd_status); obd->obd_node = node; return (0); } @@ -502,7 +502,7 @@ ofw_bus_reg_to_rl_helper(device_t dev, phandle_t node, * This may be just redundant when having ofw_bus_devinfo * but makes this routine independent of it. */ - ret = OF_getprop_alloc(node, "name", sizeof(*name), (void **)&name); + ret = OF_getprop_alloc(node, "name", (void **)&name); if (ret == -1) name = NULL; @@ -720,7 +720,7 @@ ofw_bus_find_child(phandle_t start, const char *child_ phandle_t child; for (child = OF_child(start); child != 0; child = OF_peer(child)) { - ret = OF_getprop_alloc(child, "name", sizeof(*name), (void **)&name); + ret = OF_getprop_alloc(child, "name", (void **)&name); if (ret == -1) continue; if (strcmp(name, child_name) == 0) { @@ -916,7 +916,7 @@ ofw_bus_find_string_index(phandle_t node, const char * int rv, i, cnt, nelems; elems = NULL; - nelems = OF_getprop_alloc(node, list_name, 1, (void **)&elems); + nelems = OF_getprop_alloc(node, list_name, (void **)&elems); if (nelems <= 0) return (ENOENT); @@ -947,7 +947,7 @@ ofw_bus_string_list_to_array(phandle_t node, const cha int i, cnt, nelems, len; elems = NULL; - nelems = OF_getprop_alloc(node, list_name, 1, (void **)&elems); + nelems = OF_getprop_alloc(node, list_name, (void **)&elems); if (nelems <= 0) return (nelems); Modified: head/sys/dev/ofw/openfirm.c ============================================================================== --- head/sys/dev/ofw/openfirm.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/ofw/openfirm.c Sun Apr 8 22:59:34 2018 (r332310) @@ -440,11 +440,35 @@ OF_searchencprop(phandle_t node, const char *propname, /* * Store the value of a property of a package into newly allocated memory + * (using the M_OFWPROP malloc pool and M_WAITOK). + */ +ssize_t +OF_getprop_alloc(phandle_t package, const char *propname, void **buf) +{ + int len; + + *buf = NULL; + if ((len = OF_getproplen(package, propname)) == -1) + return (-1); + + if (len > 0) { + *buf = malloc(len, M_OFWPROP, M_WAITOK); + if (OF_getprop(package, propname, *buf, len) == -1) { + free(*buf, M_OFWPROP); + *buf = NULL; + return (-1); + } + } + return (len); +} + +/* + * Store the value of a property of a package into newly allocated memory * (using the M_OFWPROP malloc pool and M_WAITOK). elsz is the size of a * single element, the number of elements is return in number. */ ssize_t -OF_getprop_alloc(phandle_t package, const char *propname, int elsz, void **buf) +OF_getprop_alloc_multi(phandle_t package, const char *propname, int elsz, void **buf) { int len; @@ -453,15 +477,18 @@ OF_getprop_alloc(phandle_t package, const char *propna len % elsz != 0) return (-1); - *buf = malloc(len, M_OFWPROP, M_WAITOK); - if (OF_getprop(package, propname, *buf, len) == -1) { - free(*buf, M_OFWPROP); - *buf = NULL; - return (-1); + if (len > 0) { + *buf = malloc(len, M_OFWPROP, M_WAITOK); + if (OF_getprop(package, propname, *buf, len) == -1) { + free(*buf, M_OFWPROP); + *buf = NULL; + return (-1); + } } return (len / elsz); } + ssize_t OF_getencprop_alloc(phandle_t package, const char *name, int elsz, void **buf) { @@ -469,7 +496,7 @@ OF_getencprop_alloc(phandle_t package, const char *nam pcell_t *cell; int i; - retval = OF_getprop_alloc(package, name, elsz, buf); + retval = OF_getprop_alloc_multi(package, name, elsz, buf); if (retval == -1) return (-1); if (retval * elsz % 4 != 0) { Modified: head/sys/dev/ofw/openfirm.h ============================================================================== --- head/sys/dev/ofw/openfirm.h Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/ofw/openfirm.h Sun Apr 8 22:59:34 2018 (r332310) @@ -116,6 +116,8 @@ ssize_t OF_searchprop(phandle_t node, const char *pro ssize_t OF_searchencprop(phandle_t node, const char *propname, void *buf, size_t len); ssize_t OF_getprop_alloc(phandle_t node, const char *propname, + void **buf); +ssize_t OF_getprop_alloc_multi(phandle_t node, const char *propname, int elsz, void **buf); ssize_t OF_getencprop_alloc(phandle_t node, const char *propname, int elsz, void **buf); Modified: head/sys/dev/usb/controller/ehci_fsl.c ============================================================================== --- head/sys/dev/usb/controller/ehci_fsl.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/usb/controller/ehci_fsl.c Sun Apr 8 22:59:34 2018 (r332310) @@ -175,7 +175,7 @@ enable_usb(device_t dev, bus_space_tag_t iot, bus_spac node = ofw_bus_get_node(dev); if ((node != 0) && - (OF_getprop_alloc(node, "phy_type", 1, (void **)&phy_type) > 0)) { + (OF_getprop_alloc(node, "phy_type", (void **)&phy_type) > 0)) { if (strncasecmp(phy_type, "utmi", strlen("utmi")) == 0) tmp |= UTMI_PHY_EN; OF_prop_free(phy_type); Modified: head/sys/dev/vnic/thunder_bgx_fdt.c ============================================================================== --- head/sys/dev/vnic/thunder_bgx_fdt.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/dev/vnic/thunder_bgx_fdt.c Sun Apr 8 22:59:34 2018 (r332310) @@ -396,7 +396,7 @@ bgx_fdt_init_phy(struct bgx *bgx) continue; } } else { - len = OF_getprop_alloc(child, "name", 1, + len = OF_getprop_alloc(child, "name", (void **)&node_name); if (len <= 0) { continue; Modified: head/sys/mips/mediatek/mtk_pinctrl.c ============================================================================== --- head/sys/mips/mediatek/mtk_pinctrl.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/mips/mediatek/mtk_pinctrl.c Sun Apr 8 22:59:34 2018 (r332310) @@ -136,7 +136,7 @@ mtk_pinctrl_process_node(device_t dev, struct mtk_pin_ if (num_groups <= 0) return (ENOENT); - if (OF_getprop_alloc(node, "ralink,function", sizeof(*pin_function), + if (OF_getprop_alloc_multi(node, "ralink,function", sizeof(*pin_function), (void **)&pin_function) == -1) { ret = ENOENT; goto out; Modified: head/sys/powerpc/mpc85xx/fsl_diu.c ============================================================================== --- head/sys/powerpc/mpc85xx/fsl_diu.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/powerpc/mpc85xx/fsl_diu.c Sun Apr 8 22:59:34 2018 (r332310) @@ -362,7 +362,7 @@ diu_attach(device_t dev) } /* TODO: Eventually, allow EDID to be dynamically provided. */ - if (OF_getprop_alloc(node, "edid", 1, &edid_cells) <= 0) { + if (OF_getprop_alloc(node, "edid", &edid_cells) <= 0) { /* * u-boot uses the environment variable name 'video-mode', so * just use the same name here. Should allow another variable Modified: head/sys/powerpc/powermac/macio.c ============================================================================== --- head/sys/powerpc/powermac/macio.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/powerpc/powermac/macio.c Sun Apr 8 22:59:34 2018 (r332310) @@ -203,10 +203,10 @@ macio_add_intr(phandle_t devnode, struct macio_devinfo return; } - nintr = OF_getprop_alloc(devnode, "interrupts", sizeof(*intr), + nintr = OF_getprop_alloc_multi(devnode, "interrupts", sizeof(*intr), (void **)&intr); if (nintr == -1) { - nintr = OF_getprop_alloc(devnode, "AAPL,interrupts", + nintr = OF_getprop_alloc_multi(devnode, "AAPL,interrupts", sizeof(*intr), (void **)&intr); if (nintr == -1) return; @@ -243,7 +243,7 @@ macio_add_reg(phandle_t devnode, struct macio_devinfo char buf[8]; int i, layout_id = 0, nreg, res; - nreg = OF_getprop_alloc(devnode, "reg", sizeof(*reg), (void **)®); + nreg = OF_getprop_alloc_multi(devnode, "reg", sizeof(*reg), (void **)®); if (nreg == -1) return; @@ -269,7 +269,7 @@ macio_add_reg(phandle_t devnode, struct macio_devinfo sizeof(layout_id)); if (res > 0 && (layout_id == 36 || layout_id == 76)) { - res = OF_getprop_alloc(OF_parent(devnode), "reg", + res = OF_getprop_alloc_multi(OF_parent(devnode), "reg", sizeof(*regp), (void **)®p); reg[0] = regp[0]; reg[1].mr_base = regp[1].mr_base; Modified: head/sys/powerpc/powermac/uninorth.c ============================================================================== --- head/sys/powerpc/powermac/uninorth.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/powerpc/powermac/uninorth.c Sun Apr 8 22:59:34 2018 (r332310) @@ -164,10 +164,10 @@ unin_chip_add_intr(phandle_t devnode, struct unin_chip return; } - nintr = OF_getprop_alloc(devnode, "interrupts", sizeof(*intr), + nintr = OF_getprop_alloc_multi(devnode, "interrupts", sizeof(*intr), (void **)&intr); if (nintr == -1) { - nintr = OF_getprop_alloc(devnode, "AAPL,interrupts", + nintr = OF_getprop_alloc_multi(devnode, "AAPL,interrupts", sizeof(*intr), (void **)&intr); if (nintr == -1) return; @@ -207,7 +207,7 @@ unin_chip_add_reg(phandle_t devnode, struct unin_chip_ struct unin_chip_reg *reg; int i, nreg; - nreg = OF_getprop_alloc(devnode, "reg", sizeof(*reg), (void **)®); + nreg = OF_getprop_alloc_multi(devnode, "reg", sizeof(*reg), (void **)®); if (nreg == -1) return; Modified: head/sys/powerpc/psim/iobus.c ============================================================================== --- head/sys/powerpc/psim/iobus.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/powerpc/psim/iobus.c Sun Apr 8 22:59:34 2018 (r332310) @@ -221,7 +221,7 @@ iobus_attach(device_t dev) root = sc->sc_node; for (child = OF_child(root); child != 0; child = OF_peer(child)) { - OF_getprop_alloc(child, "name", 1, (void **)&name); + OF_getprop_alloc(child, "name", (void **)&name); cdev = device_add_child(dev, NULL, -1); if (cdev != NULL) { Modified: head/sys/sparc64/central/central.c ============================================================================== --- head/sys/sparc64/central/central.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/sparc64/central/central.c Sun Apr 8 22:59:34 2018 (r332310) @@ -140,7 +140,7 @@ central_attach(device_t dev) sc = device_get_softc(dev); node = ofw_bus_get_node(dev); - sc->sc_nrange = OF_getprop_alloc(node, "ranges", + sc->sc_nrange = OF_getprop_alloc_multi(node, "ranges", sizeof(*sc->sc_ranges), (void **)&sc->sc_ranges); if (sc->sc_nrange == -1) { device_printf(dev, "can't get ranges\n"); @@ -153,7 +153,7 @@ central_attach(device_t dev) free(cdi, M_DEVBUF); continue; } - nreg = OF_getprop_alloc(child, "reg", sizeof(*reg), + nreg = OF_getprop_alloc_multi(child, "reg", sizeof(*reg), (void **)®); if (nreg == -1) { device_printf(dev, "<%s>: incomplete\n", Modified: head/sys/sparc64/ebus/ebus.c ============================================================================== --- head/sys/sparc64/ebus/ebus.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/sparc64/ebus/ebus.c Sun Apr 8 22:59:34 2018 (r332310) @@ -292,7 +292,7 @@ ebus_nexus_attach(device_t dev) } #endif - sc->sc_nrange = OF_getprop_alloc(node, "ranges", + sc->sc_nrange = OF_getprop_alloc_multi(node, "ranges", sizeof(struct ebus_nexus_ranges), &sc->sc_range); if (sc->sc_nrange == -1) { device_printf(dev, "could not get ranges property\n"); @@ -321,7 +321,7 @@ ebus_pci_attach(device_t dev) pci_write_config(dev, PCIR_LATTIMER, 64 /* 64 PCI cycles */, 1); node = ofw_bus_get_node(dev); - sc->sc_nrange = OF_getprop_alloc(node, "ranges", + sc->sc_nrange = OF_getprop_alloc_multi(node, "ranges", sizeof(struct isa_ranges), &sc->sc_range); if (sc->sc_nrange == -1) { device_printf(dev, "could not get ranges property\n"); @@ -660,7 +660,7 @@ ebus_setup_dinfo(device_t dev, struct ebus_softc *sc, return (NULL); } resource_list_init(&edi->edi_rl); - nreg = OF_getprop_alloc(node, "reg", sizeof(*regs), (void **)®s); + nreg = OF_getprop_alloc_multi(node, "reg", sizeof(*regs), (void **)®s); if (nreg == -1) { device_printf(dev, "<%s>: incomplete\n", edi->edi_obdinfo.obd_name); @@ -674,7 +674,7 @@ ebus_setup_dinfo(device_t dev, struct ebus_softc *sc, } OF_prop_free(regs); - nintr = OF_getprop_alloc(node, "interrupts", sizeof(*intrs), + nintr = OF_getprop_alloc_multi(node, "interrupts", sizeof(*intrs), (void **)&intrs); if (nintr == -1) return (edi); Modified: head/sys/sparc64/fhc/fhc.c ============================================================================== --- head/sys/sparc64/fhc/fhc.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/sparc64/fhc/fhc.c Sun Apr 8 22:59:34 2018 (r332310) @@ -205,7 +205,7 @@ fhc_attach(device_t dev) } device_printf(dev, "board %d, ", board); - if (OF_getprop_alloc(node, "board-model", 1, (void **)&name) != -1) { + if (OF_getprop_alloc(node, "board-model", (void **)&name) != -1) { printf("model %s\n", name); OF_prop_free(name); } else @@ -227,7 +227,7 @@ fhc_attach(device_t dev) bus_write_4(sc->sc_memres[FHC_INTERNAL], FHC_CTRL, ctrl); (void)bus_read_4(sc->sc_memres[FHC_INTERNAL], FHC_CTRL); - sc->sc_nrange = OF_getprop_alloc(node, "ranges", + sc->sc_nrange = OF_getprop_alloc_multi(node, "ranges", sizeof(*sc->sc_ranges), (void **)&sc->sc_ranges); if (sc->sc_nrange == -1) { device_printf(dev, "cannot get ranges\n"); @@ -285,7 +285,7 @@ fhc_attach(device_t dev) free(fdi, M_DEVBUF); continue; } - i = OF_getprop_alloc(child, "reg", sizeof(*reg), + i = OF_getprop_alloc_multi(child, "reg", sizeof(*reg), (void **)®); if (i == -1) { device_printf(dev, "<%s>: incomplete\n", @@ -301,7 +301,7 @@ fhc_attach(device_t dev) reg[j].sbr_size, reg[j].sbr_size); OF_prop_free(reg); if (central == 1) { - i = OF_getprop_alloc(child, "interrupts", + i = OF_getprop_alloc_multi(child, "interrupts", sizeof(*intr), (void **)&intr); if (i != -1) { for (j = 0; j < i; j++) { Modified: head/sys/sparc64/isa/isa.c ============================================================================== --- head/sys/sparc64/isa/isa.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/sparc64/isa/isa.c Sun Apr 8 22:59:34 2018 (r332310) @@ -92,7 +92,7 @@ isa_init(device_t dev) /* The parent of the bus must be a PCI-ISA bridge. */ bridge = device_get_parent(dev); isab_node = ofw_bus_get_node(bridge); - isab_nrange = OF_getprop_alloc(isab_node, "ranges", + isab_nrange = OF_getprop_alloc_multi(isab_node, "ranges", sizeof(*isab_ranges), (void **)&isab_ranges); if (isab_nrange <= 0) panic("isa_init: cannot get bridge range property"); @@ -162,7 +162,7 @@ isa_setup_children(device_t dev, phandle_t parent) * allow for an isa_activate_resource(). */ for (node = OF_child(parent); node != 0; node = OF_peer(node)) { - if ((OF_getprop_alloc(node, "name", 1, (void **)&name)) == -1) + if ((OF_getprop_alloc(node, "name", (void **)&name)) == -1) continue; /* @@ -192,7 +192,7 @@ isa_setup_children(device_t dev, phandle_t parent) isa_set_vendorid(cdev, ofw_isa_pnp_map[i].id); rl = BUS_GET_RESOURCE_LIST(dev, cdev); - nreg = OF_getprop_alloc(node, "reg", sizeof(*regs), + nreg = OF_getprop_alloc_multi(node, "reg", sizeof(*regs), (void **)®s); for (i = 0; i < nreg; i++) { start = ISA_REG_PHYS(®s[i]); @@ -211,12 +211,12 @@ isa_setup_children(device_t dev, phandle_t parent) * the set of registers of the parent device like * with the nodes hanging off of the `8042' node. */ - nregidx = OF_getprop_alloc(node, "reg", sizeof(*regidx), + nregidx = OF_getprop_alloc_multi(node, "reg", sizeof(*regidx), (void **)®idx); if (nregidx > 2) panic("isa_setup_children: impossible number " "of register indices"); - if (nregidx != -1 && (nreg = OF_getprop_alloc(parent, + if (nregidx != -1 && (nreg = OF_getprop_alloc_multi(parent, "reg", sizeof(*regs), (void **)®s)) >= nregidx) { for (i = 0; i < nregidx; i++) { start = ISA_REG_PHYS(®s[regidx[i]]); @@ -237,7 +237,7 @@ isa_setup_children(device_t dev, phandle_t parent) if (regs != NULL) OF_prop_free(regs); - nintr = OF_getprop_alloc(node, "interrupts", sizeof(*intrs), + nintr = OF_getprop_alloc_multi(node, "interrupts", sizeof(*intrs), (void **)&intrs); for (i = 0; i < nintr; i++) { if (intrs[i] > 7) @@ -255,7 +255,7 @@ isa_setup_children(device_t dev, phandle_t parent) if (intrs != NULL) OF_prop_free(intrs); - ndrq = OF_getprop_alloc(node, "dma-channel", sizeof(*drqs), + ndrq = OF_getprop_alloc_multi(node, "dma-channel", sizeof(*drqs), (void **)&drqs); for (i = 0; i < ndrq; i++) bus_set_resource(cdev, SYS_RES_DRQ, i, drqs[i], 1); Modified: head/sys/sparc64/pci/ofw_pci.c ============================================================================== --- head/sys/sparc64/pci/ofw_pci.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/sparc64/pci/ofw_pci.c Sun Apr 8 22:59:34 2018 (r332310) @@ -93,7 +93,7 @@ ofw_pci_attach_common(device_t dev, bus_dma_tag_t dmat * start addresses of the ranges are the configuration, I/O and * memory handles. There should not be multiple ones of one kind. */ - nrange = OF_getprop_alloc(node, "ranges", sizeof(*range), + nrange = OF_getprop_alloc_multi(node, "ranges", sizeof(*range), (void **)&range); for (i = 0; i < nrange; i++) { j = OFW_PCI_RANGE_CS(&range[i]); Modified: head/sys/sparc64/sbus/dma_sbus.c ============================================================================== --- head/sys/sparc64/sbus/dma_sbus.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/sparc64/sbus/dma_sbus.c Sun Apr 8 22:59:34 2018 (r332310) @@ -209,7 +209,7 @@ dma_attach(device_t dev) * the user can change it via a "media" option to ifconfig. */ csr = L64854_GCSR(lsc); - if ((OF_getprop_alloc(node, "cable-selection", 1, + if ((OF_getprop_alloc(node, "cable-selection", (void **)&cabletype)) == -1) { /* assume TP if nothing there */ csr |= E_TP_AUI; @@ -295,7 +295,7 @@ dma_setup_dinfo(device_t dev, struct dma_softc *dsc, p } resource_list_init(&ddi->ddi_rl); slot = -1; - nreg = OF_getprop_alloc(node, "reg", sizeof(*reg), (void **)®); + nreg = OF_getprop_alloc_multi(node, "reg", sizeof(*reg), (void **)®); if (nreg == -1) { device_printf(dev, "<%s>: incomplete\n", ddi->ddi_obdinfo.obd_name); @@ -329,7 +329,7 @@ dma_setup_dinfo(device_t dev, struct dma_softc *dsc, p /* * The `interrupts' property contains the SBus interrupt level. */ - nintr = OF_getprop_alloc(node, "interrupts", sizeof(*intr), + nintr = OF_getprop_alloc_multi(node, "interrupts", sizeof(*intr), (void **)&intr); if (nintr != -1) { for (i = 0; i < nintr; i++) { Modified: head/sys/sparc64/sbus/sbus.c ============================================================================== --- head/sys/sparc64/sbus/sbus.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/sparc64/sbus/sbus.c Sun Apr 8 22:59:34 2018 (r332310) @@ -299,7 +299,7 @@ sbus_attach(device_t dev) /* * Collect address translations from the OBP. */ - if ((sc->sc_nrange = OF_getprop_alloc(node, "ranges", + if ((sc->sc_nrange = OF_getprop_alloc_multi(node, "ranges", sizeof(*range), (void **)&range)) == -1) { panic("%s: error getting ranges property", __func__); } @@ -478,7 +478,7 @@ sbus_setup_dinfo(device_t dev, struct sbus_softc *sc, } resource_list_init(&sdi->sdi_rl); slot = -1; - nreg = OF_getprop_alloc(node, "reg", sizeof(*reg), (void **)®); + nreg = OF_getprop_alloc_multi(node, "reg", sizeof(*reg), (void **)®); if (nreg == -1) { if (sdi->sdi_obdinfo.obd_type == NULL || strcmp(sdi->sdi_obdinfo.obd_type, "hierarchical") != 0) { @@ -512,7 +512,7 @@ sbus_setup_dinfo(device_t dev, struct sbus_softc *sc, /* * The `interrupts' property contains the SBus interrupt level. */ - nintr = OF_getprop_alloc(node, "interrupts", sizeof(*intr), + nintr = OF_getprop_alloc_multi(node, "interrupts", sizeof(*intr), (void **)&intr); if (nintr != -1) { for (i = 0; i < nintr; i++) { Modified: head/sys/sparc64/sparc64/nexus.c ============================================================================== --- head/sys/sparc64/sparc64/nexus.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/sparc64/sparc64/nexus.c Sun Apr 8 22:59:34 2018 (r332310) @@ -545,7 +545,7 @@ nexus_setup_dinfo(device_t dev, phandle_t node) return (NULL); } resource_list_init(&ndi->ndi_rl); - nreg = OF_getprop_alloc(node, "reg", sizeof(*reg), (void **)®); + nreg = OF_getprop_alloc_multi(node, "reg", sizeof(*reg), (void **)®); if (nreg == -1) { device_printf(dev, "<%s>: incomplete\n", ndi->ndi_obdinfo.obd_name); @@ -561,7 +561,7 @@ nexus_setup_dinfo(device_t dev, phandle_t node) } OF_prop_free(reg); - nintr = OF_getprop_alloc(node, "interrupts", sizeof(*intr), + nintr = OF_getprop_alloc_multi(node, "interrupts", sizeof(*intr), (void **)&intr); if (nintr > 0) { if (OF_getprop(node, PCPU_GET(impl) < CPU_IMPL_ULTRASPARCIII ? Modified: head/sys/sparc64/sparc64/upa.c ============================================================================== --- head/sys/sparc64/sparc64/upa.c Sun Apr 8 22:07:06 2018 (r332309) +++ head/sys/sparc64/sparc64/upa.c Sun Apr 8 22:59:34 2018 (r332310) @@ -285,7 +285,7 @@ upa_attach(device_t dev) goto fail; } - sc->sc_nrange = OF_getprop_alloc(node, "ranges", sizeof(*sc->sc_ranges), *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Apr 8 23:17:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB9E1F899F7; Sun, 8 Apr 2018 23:17:51 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8652C6E0CB; Sun, 8 Apr 2018 23:17:51 +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 7B55A168F1; Sun, 8 Apr 2018 23:17:51 +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 w38NHp6u006411; Sun, 8 Apr 2018 23:17:51 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w38NHp1N006410; Sun, 8 Apr 2018 23:17:51 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804082317.w38NHp1N006410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Sun, 8 Apr 2018 23:17:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332311 - head/sys/arm64/coresight X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/arm64/coresight X-SVN-Commit-Revision: 332311 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 08 Apr 2018 23:17:52 -0000 Author: gonzo Date: Sun Apr 8 23:17:51 2018 New Revision: 332311 URL: https://svnweb.freebsd.org/changeset/base/332311 Log: Fix one more OF_getprop_alloc instance missed in r332310 X-MFC-With: r332310 Modified: head/sys/arm64/coresight/coresight.c Modified: head/sys/arm64/coresight/coresight.c ============================================================================== --- head/sys/arm64/coresight/coresight.c Sun Apr 8 22:59:34 2018 (r332310) +++ head/sys/arm64/coresight/coresight.c Sun Apr 8 23:17:51 2018 (r332311) @@ -68,7 +68,7 @@ coresight_get_ports(phandle_t dev_node, node = dev_node; for (child = OF_child(node); child != 0; child = OF_peer(child)) { - ret = OF_getprop_alloc(child, "name", sizeof(*name), (void **)&name); + ret = OF_getprop_alloc(child, "name", (void **)&name); if (ret == -1) continue; From owner-svn-src-head@freebsd.org Mon Apr 9 00:38:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3047AF8FCEE; Mon, 9 Apr 2018 00:38:25 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D780D7A190; Mon, 9 Apr 2018 00:38:24 +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 D12741763A; Mon, 9 Apr 2018 00:38:24 +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 w390cOjH045806; Mon, 9 Apr 2018 00:38:24 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w390cO4x045804; Mon, 9 Apr 2018 00:38:24 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804090038.w390cO4x045804@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 9 Apr 2018 00:38:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332312 - head/sys/dev/ofw X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/dev/ofw X-SVN-Commit-Revision: 332312 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 00:38:25 -0000 Author: gonzo Date: Mon Apr 9 00:38:24 2018 New Revision: 332312 URL: https://svnweb.freebsd.org/changeset/base/332312 Log: Make OF_searchencprop signature consistent with OF_getencprop Use pcell_t* as a destination buffer argument instead of void pointer to be consistent with OF_getencprop signature. Modified: head/sys/dev/ofw/openfirm.c head/sys/dev/ofw/openfirm.h Modified: head/sys/dev/ofw/openfirm.c ============================================================================== --- head/sys/dev/ofw/openfirm.c Sun Apr 8 23:17:51 2018 (r332311) +++ head/sys/dev/ofw/openfirm.c Mon Apr 9 00:38:24 2018 (r332312) @@ -428,7 +428,7 @@ OF_searchprop(phandle_t node, const char *propname, vo } ssize_t -OF_searchencprop(phandle_t node, const char *propname, void *buf, size_t len) +OF_searchencprop(phandle_t node, const char *propname, pcell_t *buf, size_t len) { ssize_t rv; Modified: head/sys/dev/ofw/openfirm.h ============================================================================== --- head/sys/dev/ofw/openfirm.h Sun Apr 8 23:17:51 2018 (r332311) +++ head/sys/dev/ofw/openfirm.h Mon Apr 9 00:38:24 2018 (r332312) @@ -114,7 +114,7 @@ int OF_hasprop(phandle_t node, const char *propname); ssize_t OF_searchprop(phandle_t node, const char *propname, void *buf, size_t len); ssize_t OF_searchencprop(phandle_t node, const char *propname, - void *buf, size_t len); + pcell_t *buf, size_t len); ssize_t OF_getprop_alloc(phandle_t node, const char *propname, void **buf); ssize_t OF_getprop_alloc_multi(phandle_t node, const char *propname, From owner-svn-src-head@freebsd.org Mon Apr 9 05:48:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D641AF82E83; Mon, 9 Apr 2018 05:48:12 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8815B7E08A; Mon, 9 Apr 2018 05:48:12 +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 829821A964; Mon, 9 Apr 2018 05:48:12 +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 w395mCYK099969; Mon, 9 Apr 2018 05:48:12 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w395mC59099968; Mon, 9 Apr 2018 05:48:12 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804090548.w395mC59099968@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 9 Apr 2018 05:48:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332317 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 332317 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 05:48:13 -0000 Author: gonzo Date: Mon Apr 9 05:48:12 2018 New Revision: 332317 URL: https://svnweb.freebsd.org/changeset/base/332317 Log: [man] Fix return type of BUS_ADD_CHILD(9) Fix return type of BUS_ADD_CHILD(9) in SYNOPSYS section, it should be device_t, not int PR: 207389 MFC after: 3 days Modified: head/share/man/man9/BUS_ADD_CHILD.9 Modified: head/share/man/man9/BUS_ADD_CHILD.9 ============================================================================== --- head/share/man/man9/BUS_ADD_CHILD.9 Mon Apr 9 05:43:30 2018 (r332316) +++ head/share/man/man9/BUS_ADD_CHILD.9 Mon Apr 9 05:48:12 2018 (r332317) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 28, 2015 +.Dd April 8, 2018 .Dt BUS_ADD_CHILD 9 .Os .Sh NAME @@ -37,7 +37,7 @@ .Sh SYNOPSIS .In sys/param.h .In sys/bus.h -.Ft int +.Ft device_t .Fn BUS_ADD_CHILD "device_t dev" "int order" "const char *name" "int unit" .Sh DESCRIPTION The From owner-svn-src-head@freebsd.org Mon Apr 9 08:36:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9AFACF8F522; Mon, 9 Apr 2018 08:36:00 +0000 (UTC) (envelope-from royger@gmail.com) Received: from mail-wm0-x236.google.com (mail-wm0-x236.google.com [IPv6:2a00:1450:400c:c09::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1D18B7A2A8; Mon, 9 Apr 2018 08:36:00 +0000 (UTC) (envelope-from royger@gmail.com) Received: by mail-wm0-x236.google.com with SMTP id r191so17027532wmg.4; Mon, 09 Apr 2018 01:36:00 -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=mIeL8MStg/IyrwzX3MbeAknLDcJgxaEKI5uGo6XNYZI=; b=lxQhu3mIU5/WImTpwMfgVR+WSlsCtHRHBYUWfPMjQmyAFMwDkzopfLBcm3spojn/G4 zZj+tLrQ4fDejZAImes6/lblgxni7DydQXqr7tawjniwJIma1ew+XRtUddP2oD1TxEFc ASxkoU3A6qRoJc6ua+m1UWw5ZEFjmc+Qysh6waHmnPc0XyBhMhINR7q3UuQ8vZJ8TsKh Z/zasuSW3yG0Km2Karj1Xk93qMPcLvoPc3ZR74ccCDZW9FGfW8NxuePQVLaVQ4mPrcsb qnyRyS68crgQXo4dAS0iV/lBSBoq19IEHXNsXN5q+ww4fUWqlg6FrMUimGrXVmbL65EU tmWQ== 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=mIeL8MStg/IyrwzX3MbeAknLDcJgxaEKI5uGo6XNYZI=; b=mrYZ/ucn5cFrkNEewjlIKoEp372Sjkqs2qS4EDOk4dMX4dNqiShjeNihOVr+dVskCh lXkcDbu7oqdM/UnkyN6msX7ewrhvvsTk20zUGKpa5xLdJfpEPwp7+az1Kph8v4FHd3/Q ah0ZVyCxS2dKcgivCLon1CjSfVbcA5fb0dMTz1ifWa+2Rz39qzfo26tIPuZ9c/zf+VIv jOIm/81GgGnO8MrSYNGLhGG6Rf5HyLk+bg8EVYFh2GSOpuIPfYCaHEf67Hg/xyVKn99/ NiXDQNS/9ZFj3xxwpLBVwM2GCFMAzTQSje2IV56klbudPSUHxalXtm1wz+52yOUZ/YV7 71Rw== X-Gm-Message-State: ALQs6tC4UcIrQaREWDLOJfFa+fB3cMibA+s49HAlXFTJP2g/r3q4azbS VtqOletT9uLdDIVWXN9Gs3CKgg== X-Google-Smtp-Source: AIpwx4+YaIS90HJpJKh5irpIy7af40sdbgvqideGlUwdATxKWFZy1AwWqLsuh6A+ssjVZMuvP/TEDw== X-Received: by 10.80.179.92 with SMTP id r28mr9892284edd.145.1523262958354; Mon, 09 Apr 2018 01:35:58 -0700 (PDT) Received: from localhost (default-46-102-197-194.interdsl.co.uk. [46.102.197.194]) by smtp.gmail.com with ESMTPSA id q19sm74948edd.39.2018.04.09.01.35.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 01:35:57 -0700 (PDT) Sender: =?UTF-8?Q?Roger_Pau_Monn=C3=A9?= Date: Mon, 9 Apr 2018 09:35:54 +0100 From: Roger Pau =?utf-8?B?TW9ubsOp?= To: rgrimes@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332092 - in head/sys: amd64/amd64 sys x86/x86 Message-ID: <20180409083554.k34hfijxiztwdne6@MacBook-Pro-de-Roger.local> References: <201804061120.w36BK6s6074635@repo.freebsd.org> <201804061617.w36GH9sw003442@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201804061617.w36GH9sw003442@pdx.rh.CN85.dnsmgr.net> User-Agent: NeoMutt/20180323 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 08:36:00 -0000 On Fri, Apr 06, 2018 at 09:17:09AM -0700, Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] > > Author: royger > > Date: Fri Apr 6 11:20:06 2018 > > New Revision: 332092 > > URL: https://svnweb.freebsd.org/changeset/base/332092 > > > > Log: > > remove GiB/MiB macros from param.h > > > > And instead define them in the files where they are used. > > It would of been better to "revert" your prior change and > make a seperate new commit. It is rarely desireable to combine > a revert of a change with anything. A plain revert of r332072 would have left the tree in a broken state, because r332073 depends on those macros. IMO it's better to have a buildable tree at all times in order for it to be bisectable. Roger. From owner-svn-src-head@freebsd.org Mon Apr 9 09:24:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DF41FF92CBB; Mon, 9 Apr 2018 09:24:27 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5F22774930; Mon, 9 Apr 2018 09:24:27 +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 51EE51CD62; Mon, 9 Apr 2018 09:24:27 +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 w399OR2D009314; Mon, 9 Apr 2018 09:24:27 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w399OQiQ009301; Mon, 9 Apr 2018 09:24:26 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201804090924.w399OQiQ009301@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Mon, 9 Apr 2018 09:24:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332319 - in head/sys: dev/netmap net X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in head/sys: dev/netmap net X-SVN-Commit-Revision: 332319 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 09:24:28 -0000 Author: vmaffione Date: Mon Apr 9 09:24:26 2018 New Revision: 332319 URL: https://svnweb.freebsd.org/changeset/base/332319 Log: netmap: align codebase to upstream version v11.4 Changelist: - remove unused nkr_slot_flags - new nm_intr adapter callback to enable/disable interrupts - remove unused sysctls and document the other sysctls - new infrastructure to support NS_MOREFRAG for NIC ports - support for external memory allocator (for now linux-only), including linux-specific changes in common headers - optimizations within netmap pipes datapath - improvements on VALE control API - new nm_parse() helper function in netmap_user.h - various bug fixes and code clean up Approved by: hrs (mentor) Modified: head/sys/dev/netmap/if_em_netmap.h head/sys/dev/netmap/if_igb_netmap.h head/sys/dev/netmap/if_ixl_netmap.h head/sys/dev/netmap/if_lem_netmap.h head/sys/dev/netmap/if_ptnet.c head/sys/dev/netmap/if_re_netmap.h head/sys/dev/netmap/if_vtnet_netmap.h head/sys/dev/netmap/ixgbe_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_generic.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_mem2.c head/sys/dev/netmap/netmap_mem2.h head/sys/dev/netmap/netmap_monitor.c head/sys/dev/netmap/netmap_offloadings.c head/sys/dev/netmap/netmap_pipe.c head/sys/dev/netmap/netmap_pt.c head/sys/dev/netmap/netmap_vale.c head/sys/net/netmap.h head/sys/net/netmap_user.h head/sys/net/netmap_virt.h Modified: head/sys/dev/netmap/if_em_netmap.h ============================================================================== --- head/sys/dev/netmap/if_em_netmap.h Mon Apr 9 08:25:29 2018 (r332318) +++ head/sys/dev/netmap/if_em_netmap.h Mon Apr 9 09:24:26 2018 (r332319) @@ -235,8 +235,6 @@ em_netmap_rxsync(struct netmap_kring *kring, int flags * First part: import newly received packets. */ if (netmap_no_pendintr || force_update) { - uint16_t slot_flags = kring->nkr_slot_flags; - nic_i = rxr->next_to_check; nm_i = netmap_idx_n2k(kring, nic_i); @@ -247,7 +245,7 @@ em_netmap_rxsync(struct netmap_kring *kring, int flags if ((staterr & E1000_RXD_STAT_DD) == 0) break; ring->slot[nm_i].len = le16toh(curr->wb.upper.length); - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; bus_dmamap_sync(rxr->rxtag, rxr->rx_buffers[nic_i].map, BUS_DMASYNC_POSTREAD); nm_i = nm_next(nm_i, lim); Modified: head/sys/dev/netmap/if_igb_netmap.h ============================================================================== --- head/sys/dev/netmap/if_igb_netmap.h Mon Apr 9 08:25:29 2018 (r332318) +++ head/sys/dev/netmap/if_igb_netmap.h Mon Apr 9 09:24:26 2018 (r332319) @@ -217,8 +217,6 @@ igb_netmap_rxsync(struct netmap_kring *kring, int flag * First part: import newly received packets. */ if (netmap_no_pendintr || force_update) { - uint16_t slot_flags = kring->nkr_slot_flags; - nic_i = rxr->next_to_check; nm_i = netmap_idx_n2k(kring, nic_i); @@ -229,7 +227,7 @@ igb_netmap_rxsync(struct netmap_kring *kring, int flag if ((staterr & E1000_RXD_STAT_DD) == 0) break; ring->slot[nm_i].len = le16toh(curr->wb.upper.length); - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; bus_dmamap_sync(rxr->ptag, rxr->rx_buffers[nic_i].pmap, BUS_DMASYNC_POSTREAD); nm_i = nm_next(nm_i, lim); Modified: head/sys/dev/netmap/if_ixl_netmap.h ============================================================================== --- head/sys/dev/netmap/if_ixl_netmap.h Mon Apr 9 08:25:29 2018 (r332318) +++ head/sys/dev/netmap/if_ixl_netmap.h Mon Apr 9 09:24:26 2018 (r332319) @@ -331,7 +331,6 @@ ixl_netmap_rxsync(struct netmap_kring *kring, int flag */ if (netmap_no_pendintr || force_update) { int crclen = ixl_crcstrip ? 0 : 4; - uint16_t slot_flags = kring->nkr_slot_flags; nic_i = rxr->next_check; // or also k2n(kring->nr_hwtail) nm_i = netmap_idx_n2k(kring, nic_i); @@ -346,7 +345,7 @@ ixl_netmap_rxsync(struct netmap_kring *kring, int flag break; ring->slot[nm_i].len = ((qword & I40E_RXD_QW1_LENGTH_PBUF_MASK) >> I40E_RXD_QW1_LENGTH_PBUF_SHIFT) - crclen; - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; bus_dmamap_sync(rxr->ptag, rxr->buffers[nic_i].pmap, BUS_DMASYNC_POSTREAD); nm_i = nm_next(nm_i, lim); Modified: head/sys/dev/netmap/if_lem_netmap.h ============================================================================== --- head/sys/dev/netmap/if_lem_netmap.h Mon Apr 9 08:25:29 2018 (r332318) +++ head/sys/dev/netmap/if_lem_netmap.h Mon Apr 9 09:24:26 2018 (r332319) @@ -216,8 +216,6 @@ lem_netmap_rxsync(struct netmap_kring *kring, int flag * First part: import newly received packets. */ if (netmap_no_pendintr || force_update) { - uint16_t slot_flags = kring->nkr_slot_flags; - nic_i = adapter->next_rx_desc_to_check; nm_i = netmap_idx_n2k(kring, nic_i); @@ -234,7 +232,7 @@ lem_netmap_rxsync(struct netmap_kring *kring, int flag len = 0; } ring->slot[nm_i].len = len; - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; bus_dmamap_sync(adapter->rxtag, adapter->rx_buffer_area[nic_i].map, BUS_DMASYNC_POSTREAD); Modified: head/sys/dev/netmap/if_ptnet.c ============================================================================== --- head/sys/dev/netmap/if_ptnet.c Mon Apr 9 08:25:29 2018 (r332318) +++ head/sys/dev/netmap/if_ptnet.c Mon Apr 9 09:24:26 2018 (r332319) @@ -216,6 +216,7 @@ static void ptnet_update_vnet_hdr(struct ptnet_softc * static int ptnet_nm_register(struct netmap_adapter *na, int onoff); static int ptnet_nm_txsync(struct netmap_kring *kring, int flags); static int ptnet_nm_rxsync(struct netmap_kring *kring, int flags); +static void ptnet_nm_intr(struct netmap_adapter *na, int onoff); static void ptnet_tx_intr(void *opaque); static void ptnet_rx_intr(void *opaque); @@ -477,6 +478,7 @@ ptnet_attach(device_t dev) na_arg.nm_krings_create = ptnet_nm_krings_create; na_arg.nm_krings_delete = ptnet_nm_krings_delete; na_arg.nm_dtor = ptnet_nm_dtor; + na_arg.nm_intr = ptnet_nm_intr; na_arg.nm_register = ptnet_nm_register; na_arg.nm_txsync = ptnet_nm_txsync; na_arg.nm_rxsync = ptnet_nm_rxsync; @@ -1296,6 +1298,18 @@ ptnet_nm_rxsync(struct netmap_kring *kring, int flags) } return 0; +} + +static void +ptnet_nm_intr(struct netmap_adapter *na, int onoff) +{ + struct ptnet_softc *sc = if_getsoftc(na->ifp); + int i; + + for (i = 0; i < sc->num_rings; i++) { + struct ptnet_queue *pq = sc->queues + i; + pq->ptgh->guest_need_kick = onoff; + } } static void Modified: head/sys/dev/netmap/if_re_netmap.h ============================================================================== --- head/sys/dev/netmap/if_re_netmap.h Mon Apr 9 08:25:29 2018 (r332318) +++ head/sys/dev/netmap/if_re_netmap.h Mon Apr 9 09:24:26 2018 (r332319) @@ -201,7 +201,6 @@ re_netmap_rxsync(struct netmap_kring *kring, int flags * is to stop right before nm_hwcur. */ if (netmap_no_pendintr || force_update) { - uint16_t slot_flags = kring->nkr_slot_flags; uint32_t stop_i = nm_prev(kring->nr_hwcur, lim); nic_i = sc->rl_ldata.rl_rx_prodidx; /* next pkt to check */ @@ -218,7 +217,7 @@ re_netmap_rxsync(struct netmap_kring *kring, int flags /* XXX subtract crc */ total_len = (total_len < 4) ? 0 : total_len - 4; ring->slot[nm_i].len = total_len; - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; /* sync was in re_newbuf() */ bus_dmamap_sync(sc->rl_ldata.rl_rx_mtag, rxd[nic_i].rx_dmamap, BUS_DMASYNC_POSTREAD); Modified: head/sys/dev/netmap/if_vtnet_netmap.h ============================================================================== --- head/sys/dev/netmap/if_vtnet_netmap.h Mon Apr 9 08:25:29 2018 (r332318) +++ head/sys/dev/netmap/if_vtnet_netmap.h Mon Apr 9 09:24:26 2018 (r332319) @@ -122,6 +122,7 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int fl struct SOFTC_T *sc = ifp->if_softc; struct vtnet_txq *txq = &sc->vtnet_txqs[ring_nr]; struct virtqueue *vq = txq->vtntx_vq; + int interrupts = !(kring->nr_kflags & NKR_NOINTR); /* * First part: process new packets to send. @@ -179,7 +180,9 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int fl ring->head, ring->tail, virtqueue_nused(vq), (virtqueue_dump(vq), 1)); virtqueue_notify(vq); - virtqueue_enable_intr(vq); // like postpone with 0 + if (interrupts) { + virtqueue_enable_intr(vq); // like postpone with 0 + } } @@ -209,7 +212,7 @@ vtnet_netmap_txsync(struct netmap_kring *kring, int fl if (nm_i != kring->nr_hwtail /* && vtnet_txq_below_threshold(txq) == 0*/) { ND(3, "disable intr, hwcur %d", nm_i); virtqueue_disable_intr(vq); - } else { + } else if (interrupts) { ND(3, "enable intr, hwcur %d", nm_i); virtqueue_postpone_intr(vq, VQ_POSTPONE_SHORT); } @@ -277,6 +280,7 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl u_int const lim = kring->nkr_num_slots - 1; u_int const head = kring->rhead; int force_update = (flags & NAF_FORCE_READ) || kring->nr_kflags & NKR_PENDINTR; + int interrupts = !(kring->nr_kflags & NKR_NOINTR); /* device-specific */ struct SOFTC_T *sc = ifp->if_softc; @@ -297,7 +301,6 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl * and vtnet_netmap_init_buffers(). */ if (netmap_no_pendintr || force_update) { - uint16_t slot_flags = kring->nkr_slot_flags; struct netmap_adapter *token; nm_i = kring->nr_hwtail; @@ -309,7 +312,7 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl break; if (likely(token == (void *)rxq)) { ring->slot[nm_i].len = len; - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; nm_i = nm_next(nm_i, lim); n++; } else { @@ -334,7 +337,9 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl kring->nr_hwcur = err; virtqueue_notify(vq); /* After draining the queue may need an intr from the hypervisor */ - vtnet_rxq_enable_intr(rxq); + if (interrupts) { + vtnet_rxq_enable_intr(rxq); + } } ND("[C] h %d c %d t %d hwcur %d hwtail %d", @@ -345,6 +350,28 @@ vtnet_netmap_rxsync(struct netmap_kring *kring, int fl } +/* Enable/disable interrupts on all virtqueues. */ +static void +vtnet_netmap_intr(struct netmap_adapter *na, int onoff) +{ + struct SOFTC_T *sc = na->ifp->if_softc; + int i; + + for (i = 0; i < sc->vtnet_max_vq_pairs; i++) { + struct vtnet_rxq *rxq = &sc->vtnet_rxqs[i]; + struct vtnet_txq *txq = &sc->vtnet_txqs[i]; + struct virtqueue *txvq = txq->vtntx_vq; + + if (onoff) { + vtnet_rxq_enable_intr(rxq); + virtqueue_enable_intr(txvq); + } else { + vtnet_rxq_disable_intr(rxq); + virtqueue_disable_intr(txvq); + } + } +} + /* Make RX virtqueues buffers pointing to netmap buffers. */ static int vtnet_netmap_init_rx_buffers(struct SOFTC_T *sc) @@ -417,6 +444,7 @@ vtnet_netmap_attach(struct SOFTC_T *sc) na.nm_txsync = vtnet_netmap_txsync; na.nm_rxsync = vtnet_netmap_rxsync; na.nm_config = vtnet_netmap_config; + na.nm_intr = vtnet_netmap_intr; na.num_tx_rings = na.num_rx_rings = sc->vtnet_max_vq_pairs; D("max rings %d", sc->vtnet_max_vq_pairs); netmap_attach(&na); Modified: head/sys/dev/netmap/ixgbe_netmap.h ============================================================================== --- head/sys/dev/netmap/ixgbe_netmap.h Mon Apr 9 08:25:29 2018 (r332318) +++ head/sys/dev/netmap/ixgbe_netmap.h Mon Apr 9 09:24:26 2018 (r332319) @@ -397,7 +397,6 @@ ixgbe_netmap_rxsync(struct netmap_kring *kring, int fl */ if (netmap_no_pendintr || force_update) { int crclen = (ix_crcstrip || IXGBE_IS_VF(adapter) ) ? 0 : 4; - uint16_t slot_flags = kring->nkr_slot_flags; nic_i = rxr->next_to_check; // or also k2n(kring->nr_hwtail) nm_i = netmap_idx_n2k(kring, nic_i); @@ -409,7 +408,7 @@ ixgbe_netmap_rxsync(struct netmap_kring *kring, int fl if ((staterr & IXGBE_RXD_STAT_DD) == 0) break; ring->slot[nm_i].len = le16toh(curr->wb.upper.length) - crclen; - ring->slot[nm_i].flags = slot_flags; + ring->slot[nm_i].flags = 0; bus_dmamap_sync(rxr->ptag, rxr->rx_buffers[nic_i].pmap, BUS_DMASYNC_POSTREAD); nm_i = nm_next(nm_i, lim); Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Mon Apr 9 08:25:29 2018 (r332318) +++ head/sys/dev/netmap/netmap.c Mon Apr 9 09:24:26 2018 (r332319) @@ -482,10 +482,8 @@ ports attached to the switch) int netmap_verbose; static int netmap_no_timestamp; /* don't timestamp on rxsync */ -int netmap_mitigate = 1; int netmap_no_pendintr = 1; int netmap_txsync_retry = 2; -int netmap_flags = 0; /* debug flags */ static int netmap_fwd = 0; /* force transparent forwarding */ /* @@ -515,7 +513,9 @@ int netmap_generic_mit = 100*1000; * Anyway users looking for the best performance should * use native adapters. */ +#ifdef linux int netmap_generic_txqdisc = 1; +#endif /* Default number of slots and queues for generic adapters. */ int netmap_generic_ringsize = 1024; @@ -539,21 +539,32 @@ SYSCTL_INT(_dev_netmap, OID_AUTO, verbose, CTLFLAG_RW, &netmap_verbose, 0, "Verbose mode"); SYSCTL_INT(_dev_netmap, OID_AUTO, no_timestamp, CTLFLAG_RW, &netmap_no_timestamp, 0, "no_timestamp"); -SYSCTL_INT(_dev_netmap, OID_AUTO, mitigate, CTLFLAG_RW, &netmap_mitigate, 0, ""); -SYSCTL_INT(_dev_netmap, OID_AUTO, no_pendintr, - CTLFLAG_RW, &netmap_no_pendintr, 0, "Always look for new received packets."); +SYSCTL_INT(_dev_netmap, OID_AUTO, no_pendintr, CTLFLAG_RW, &netmap_no_pendintr, + 0, "Always look for new received packets."); SYSCTL_INT(_dev_netmap, OID_AUTO, txsync_retry, CTLFLAG_RW, - &netmap_txsync_retry, 0 , "Number of txsync loops in bridge's flush."); + &netmap_txsync_retry, 0, "Number of txsync loops in bridge's flush."); -SYSCTL_INT(_dev_netmap, OID_AUTO, flags, CTLFLAG_RW, &netmap_flags, 0 , ""); -SYSCTL_INT(_dev_netmap, OID_AUTO, fwd, CTLFLAG_RW, &netmap_fwd, 0 , ""); -SYSCTL_INT(_dev_netmap, OID_AUTO, admode, CTLFLAG_RW, &netmap_admode, 0 , ""); -SYSCTL_INT(_dev_netmap, OID_AUTO, generic_mit, CTLFLAG_RW, &netmap_generic_mit, 0 , ""); -SYSCTL_INT(_dev_netmap, OID_AUTO, generic_ringsize, CTLFLAG_RW, &netmap_generic_ringsize, 0 , ""); -SYSCTL_INT(_dev_netmap, OID_AUTO, generic_rings, CTLFLAG_RW, &netmap_generic_rings, 0 , ""); -SYSCTL_INT(_dev_netmap, OID_AUTO, generic_txqdisc, CTLFLAG_RW, &netmap_generic_txqdisc, 0 , ""); -SYSCTL_INT(_dev_netmap, OID_AUTO, ptnet_vnet_hdr, CTLFLAG_RW, &ptnet_vnet_hdr, 0 , ""); -SYSCTL_INT(_dev_netmap, OID_AUTO, ptnetmap_tx_workers, CTLFLAG_RW, &ptnetmap_tx_workers, 0 , ""); +SYSCTL_INT(_dev_netmap, OID_AUTO, fwd, CTLFLAG_RW, &netmap_fwd, 0, + "Force NR_FORWARD mode"); +SYSCTL_INT(_dev_netmap, OID_AUTO, admode, CTLFLAG_RW, &netmap_admode, 0, + "Adapter mode. 0 selects the best option available," + "1 forces native adapter, 2 forces emulated adapter"); +SYSCTL_INT(_dev_netmap, OID_AUTO, generic_mit, CTLFLAG_RW, &netmap_generic_mit, + 0, "RX notification interval in nanoseconds"); +SYSCTL_INT(_dev_netmap, OID_AUTO, generic_ringsize, CTLFLAG_RW, + &netmap_generic_ringsize, 0, + "Number of per-ring slots for emulated netmap mode"); +SYSCTL_INT(_dev_netmap, OID_AUTO, generic_rings, CTLFLAG_RW, + &netmap_generic_rings, 0, + "Number of TX/RX queues for emulated netmap adapters"); +#ifdef linux +SYSCTL_INT(_dev_netmap, OID_AUTO, generic_txqdisc, CTLFLAG_RW, + &netmap_generic_txqdisc, 0, "Use qdisc for generic adapters"); +#endif +SYSCTL_INT(_dev_netmap, OID_AUTO, ptnet_vnet_hdr, CTLFLAG_RW, &ptnet_vnet_hdr, + 0, "Allow ptnet devices to use virtio-net headers"); +SYSCTL_INT(_dev_netmap, OID_AUTO, ptnetmap_tx_workers, CTLFLAG_RW, + &ptnetmap_tx_workers, 0, "Use worker threads for pnetmap TX processing"); SYSEND; @@ -912,8 +923,20 @@ netmap_hw_krings_delete(struct netmap_adapter *na) netmap_krings_delete(na); } +static void +netmap_mem_drop(struct netmap_adapter *na) +{ + int last = netmap_mem_deref(na->nm_mem, na); + /* if the native allocator had been overrided on regif, + * restore it now and drop the temporary one + */ + if (last && na->nm_mem_prev) { + netmap_mem_put(na->nm_mem); + na->nm_mem = na->nm_mem_prev; + na->nm_mem_prev = NULL; + } +} - /* * Undo everything that was done in netmap_do_regif(). In particular, * call nm_register(ifp,0) to stop netmap mode on the interface and @@ -980,7 +1003,7 @@ netmap_do_unregif(struct netmap_priv_d *priv) /* delete the nifp */ netmap_mem_if_delete(na, priv->np_nifp); /* drop the allocator */ - netmap_mem_deref(na->nm_mem, na); + netmap_mem_drop(na); /* mark the priv as unregistered */ priv->np_na = NULL; priv->np_nifp = NULL; @@ -1289,7 +1312,7 @@ netmap_rxsync_from_host(struct netmap_kring *kring, in D("%s", nm_dump_buf(NMB(na, slot),len, 128, NULL)); slot->len = len; - slot->flags = kring->nkr_slot_flags; + slot->flags = 0; nm_i = nm_next(nm_i, lim); mbq_enqueue(&fq, m); } @@ -1409,7 +1432,7 @@ netmap_get_hw_na(struct ifnet *ifp, struct netmap_mem_ assign_mem: if (nmd != NULL && !((*na)->na_flags & NAF_MEM_OWNER) && (*na)->active_fds == 0 && ((*na)->nm_mem != nmd)) { - netmap_mem_put((*na)->nm_mem); + (*na)->nm_mem_prev = (*na)->nm_mem; (*na)->nm_mem = netmap_mem_get(nmd); } @@ -1896,7 +1919,8 @@ netmap_krings_get(struct netmap_priv_d *priv) int excl = (priv->np_flags & NR_EXCLUSIVE); enum txrx t; - ND("%s: grabbing tx [%d, %d) rx [%d, %d)", + if (netmap_verbose) + D("%s: grabbing tx [%d, %d) rx [%d, %d)", na->name, priv->np_qfirst[NR_TX], priv->np_qlast[NR_TX], @@ -2059,10 +2083,58 @@ netmap_do_regif(struct netmap_priv_d *priv, struct net if (na->active_fds == 0) { /* * If this is the first registration of the adapter, - * create the in-kernel view of the netmap rings, - * the netmap krings. + * perform sanity checks and create the in-kernel view + * of the netmap rings (the netmap krings). */ + if (na->ifp) { + /* This netmap adapter is attached to an ifnet. */ + unsigned nbs = netmap_mem_bufsize(na->nm_mem); + unsigned mtu = nm_os_ifnet_mtu(na->ifp); + /* The maximum amount of bytes that a single + * receive or transmit NIC descriptor can hold. */ + unsigned hw_max_slot_len = 4096; + if (mtu <= hw_max_slot_len) { + /* The MTU fits a single NIC slot. We only + * Need to check that netmap buffers are + * large enough to hold an MTU. NS_MOREFRAG + * cannot be used in this case. */ + if (nbs < mtu) { + nm_prerr("error: netmap buf size (%u) " + "< device MTU (%u)", nbs, mtu); + error = EINVAL; + goto err_drop_mem; + } + } else { + /* More NIC slots may be needed to receive + * or transmit a single packet. Check that + * the adapter supports NS_MOREFRAG and that + * netmap buffers are large enough to hold + * the maximum per-slot size. */ + if (!(na->na_flags & NAF_MOREFRAG)) { + nm_prerr("error: large MTU (%d) needed " + "but %s does not support " + "NS_MOREFRAG", mtu, + na->ifp->if_xname); + error = EINVAL; + goto err_drop_mem; + } else if (nbs < hw_max_slot_len) { + nm_prerr("error: using NS_MOREFRAG on " + "%s requires netmap buf size " + ">= %u", na->ifp->if_xname, + hw_max_slot_len); + error = EINVAL; + goto err_drop_mem; + } else { + nm_prinf("info: netmap application on " + "%s needs to support " + "NS_MOREFRAG " + "(MTU=%u,netmap_buf_size=%u)", + na->ifp->if_xname, mtu, nbs); + } + } + } + /* * Depending on the adapter, this may also create * the netmap rings themselves @@ -2128,15 +2200,15 @@ err_put_lut: memset(&na->na_lut, 0, sizeof(na->na_lut)); err_del_if: netmap_mem_if_delete(na, nifp); -err_rel_excl: - netmap_krings_put(priv); err_del_rings: netmap_mem_rings_delete(na); +err_rel_excl: + netmap_krings_put(priv); err_del_krings: if (na->active_fds == 0) na->nm_krings_delete(na); err_drop_mem: - netmap_mem_deref(na->nm_mem, na); + netmap_mem_drop(na); err: priv->np_na = NULL; return error; @@ -2224,6 +2296,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c do { /* memsize is always valid */ u_int memflags; + uint64_t memsize; if (nmr->nr_name[0] != '\0') { @@ -2243,10 +2316,11 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c } } - error = netmap_mem_get_info(nmd, &nmr->nr_memsize, &memflags, + error = netmap_mem_get_info(nmd, &memsize, &memflags, &nmr->nr_arg2); if (error) break; + nmr->nr_memsize = (uint32_t)memsize; if (na == NULL) /* only memory info */ break; nmr->nr_offset = 0; @@ -2304,6 +2378,17 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c } NMG_UNLOCK(); break; + } else if (i == NETMAP_POOLS_CREATE) { + nmd = netmap_mem_ext_create(nmr, &error); + if (nmd == NULL) + break; + /* reset the fields used by POOLS_CREATE to + * avoid confusing the rest of the code + */ + nmr->nr_cmd = 0; + nmr->nr_arg1 = 0; + nmr->nr_arg2 = 0; + nmr->nr_arg3 = 0; } else if (i != 0) { D("nr_cmd must be 0 not %d", i); error = EINVAL; @@ -2314,7 +2399,7 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c NMG_LOCK(); do { u_int memflags; - struct ifnet *ifp; + uint64_t memsize; if (priv->np_nifp != NULL) { /* thread already registered */ error = EBUSY; @@ -2356,12 +2441,13 @@ netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, c nmr->nr_tx_rings = na->num_tx_rings; nmr->nr_rx_slots = na->num_rx_desc; nmr->nr_tx_slots = na->num_tx_desc; - error = netmap_mem_get_info(na->nm_mem, &nmr->nr_memsize, &memflags, + error = netmap_mem_get_info(na->nm_mem, &memsize, &memflags, &nmr->nr_arg2); if (error) { netmap_do_unregif(priv); break; } + nmr->nr_memsize = (uint32_t)memsize; if (memflags & NETMAP_MEM_PRIVATE) { *(uint32_t *)(uintptr_t)&nifp->ni_flags |= NI_PRIV_MEM; } @@ -2533,7 +2619,6 @@ netmap_poll(struct netmap_priv_d *priv, int events, NM #define want_tx want[NR_TX] #define want_rx want[NR_RX] struct mbq q; /* packets from RX hw queues to host stack */ - enum txrx t; /* * In order to avoid nested locks, we need to "double check" @@ -2585,14 +2670,15 @@ netmap_poll(struct netmap_priv_d *priv, int events, NM check_all_tx = nm_si_user(priv, NR_TX); check_all_rx = nm_si_user(priv, NR_RX); +#ifdef __FreeBSD__ /* * We start with a lock free round which is cheap if we have * slots available. If this fails, then lock and call the sync - * routines. + * routines. We can't do this on Linux, as the contract says + * that we must call nm_os_selrecord() unconditionally. */ -#if 1 /* new code- call rx if any of the ring needs to release or read buffers */ if (want_tx) { - t = NR_TX; + enum txrx t = NR_TX; for (i = priv->np_qfirst[t]; want[t] && i < priv->np_qlast[t]; i++) { kring = &NMR(na, t)[i]; /* XXX compare ring->cur and kring->tail */ @@ -2603,8 +2689,8 @@ netmap_poll(struct netmap_priv_d *priv, int events, NM } } if (want_rx) { + enum txrx t = NR_RX; want_rx = 0; /* look for a reason to run the handlers */ - t = NR_RX; for (i = priv->np_qfirst[t]; i < priv->np_qlast[t]; i++) { kring = &NMR(na, t)[i]; if (kring->ring->cur == kring->ring->tail /* try fetch new buffers */ @@ -2615,24 +2701,20 @@ netmap_poll(struct netmap_priv_d *priv, int events, NM if (!want_rx) revents |= events & (POLLIN | POLLRDNORM); /* we have data */ } -#else /* old code */ - for_rx_tx(t) { - for (i = priv->np_qfirst[t]; want[t] && i < priv->np_qlast[t]; i++) { - kring = &NMR(na, t)[i]; - /* XXX compare ring->cur and kring->tail */ - if (!nm_ring_empty(kring->ring)) { - revents |= want[t]; - want[t] = 0; /* also breaks the loop */ - } - } - } -#endif /* old code */ +#endif +#ifdef linux + /* The selrecord must be unconditional on linux. */ + nm_os_selrecord(sr, check_all_tx ? + &na->si[NR_TX] : &na->tx_rings[priv->np_qfirst[NR_TX]].si); + nm_os_selrecord(sr, check_all_rx ? + &na->si[NR_RX] : &na->rx_rings[priv->np_qfirst[NR_RX]].si); +#endif /* linux */ + /* * If we want to push packets out (priv->np_txpoll) or * want_tx is still set, we must issue txsync calls * (on all rings, to avoid that the tx rings stall). - * XXX should also check cur != hwcur on the tx rings. * Fortunately, normal tx mode has np_txpoll set. */ if (priv->np_txpoll || want_tx) { @@ -2649,6 +2731,12 @@ flush_tx: kring = &na->tx_rings[i]; ring = kring->ring; + /* + * Don't try to txsync this TX ring if we already found some + * space in some of the TX rings (want_tx == 0) and there are no + * TX slots in this ring that need to be flushed to the NIC + * (cur == hwcur). + */ if (!send_down && !want_tx && ring->cur == kring->nr_hwcur) continue; @@ -2676,14 +2764,18 @@ flush_tx: if (found) { /* notify other listeners */ revents |= want_tx; want_tx = 0; +#ifndef linux kring->nm_notify(kring, 0); +#endif /* linux */ } } /* if there were any packet to forward we must have handled them by now */ send_down = 0; if (want_tx && retry_tx && sr) { +#ifndef linux nm_os_selrecord(sr, check_all_tx ? &na->si[NR_TX] : &na->tx_rings[priv->np_qfirst[NR_TX]].si); +#endif /* !linux */ retry_tx = 0; goto flush_tx; } @@ -2734,14 +2826,18 @@ do_retry_rx: if (found) { revents |= want_rx; retry_rx = 0; +#ifndef linux kring->nm_notify(kring, 0); +#endif /* linux */ } } +#ifndef linux if (retry_rx && sr) { nm_os_selrecord(sr, check_all_rx ? &na->si[NR_RX] : &na->rx_rings[priv->np_qfirst[NR_RX]].si); } +#endif /* !linux */ if (send_down || retry_rx) { retry_rx = 0; if (send_down) @@ -2766,7 +2862,45 @@ do_retry_rx: #undef want_rx } +int +nma_intr_enable(struct netmap_adapter *na, int onoff) +{ + bool changed = false; + enum txrx t; + int i; + for_rx_tx(t) { + for (i = 0; i < nma_get_nrings(na, t); i++) { + struct netmap_kring *kring = &NMR(na, t)[i]; + int on = !(kring->nr_kflags & NKR_NOINTR); + + if (!!onoff != !!on) { + changed = true; + } + if (onoff) { + kring->nr_kflags &= ~NKR_NOINTR; + } else { + kring->nr_kflags |= NKR_NOINTR; + } + } + } + + if (!changed) { + return 0; /* nothing to do */ + } + + if (!na->nm_intr) { + D("Cannot %s interrupts for %s", onoff ? "enable" : "disable", + na->name); + return -1; + } + + na->nm_intr(na, onoff); + + return 0; +} + + /*-------------------- driver support routines -------------------*/ /* default notify callback */ @@ -2804,6 +2938,7 @@ netmap_attach_common(struct netmap_adapter *na) if (na->na_flags & NAF_HOST_RINGS && na->ifp) { na->if_input = na->ifp->if_input; /* for netmap_send_up */ } + na->pdev = na; /* make sure netmap_mem_map() is called */ #endif /* __FreeBSD__ */ if (na->nm_krings_create == NULL) { /* we assume that we have been called by a driver, @@ -2832,22 +2967,6 @@ netmap_attach_common(struct netmap_adapter *na) return 0; } - -/* standard cleanup, called by all destructors */ -void -netmap_detach_common(struct netmap_adapter *na) -{ - if (na->tx_rings) { /* XXX should not happen */ - D("freeing leftover tx_rings"); - na->nm_krings_delete(na); - } - netmap_pipe_dealloc(na); - if (na->nm_mem) - netmap_mem_put(na->nm_mem); - bzero(na, sizeof(*na)); - nm_os_free(na); -} - /* Wrapper for the register callback provided netmap-enabled * hardware drivers. * nm_iszombie(na) means that the driver module has been @@ -2900,7 +3019,7 @@ netmap_hw_dtor(struct netmap_adapter *na) * Return 0 on success, ENOMEM otherwise. */ int -netmap_attach_ext(struct netmap_adapter *arg, size_t size) +netmap_attach_ext(struct netmap_adapter *arg, size_t size, int override_reg) { struct netmap_hw_adapter *hwna = NULL; struct ifnet *ifp = NULL; @@ -2912,15 +3031,27 @@ netmap_attach_ext(struct netmap_adapter *arg, size_t s if (arg == NULL || arg->ifp == NULL) goto fail; + ifp = arg->ifp; + if (NA(ifp) && !NM_NA_VALID(ifp)) { + /* If NA(ifp) is not null but there is no valid netmap + * adapter it means that someone else is using the same + * pointer (e.g. ax25_ptr on linux). This happens for + * instance when also PF_RING is in use. */ + D("Error: netmap adapter hook is busy"); + return EBUSY; + } + hwna = nm_os_malloc(size); if (hwna == NULL) goto fail; hwna->up = *arg; hwna->up.na_flags |= NAF_HOST_RINGS | NAF_NATIVE; strncpy(hwna->up.name, ifp->if_xname, sizeof(hwna->up.name)); - hwna->nm_hw_register = hwna->up.nm_register; - hwna->up.nm_register = netmap_hw_reg; + if (override_reg) { + hwna->nm_hw_register = hwna->up.nm_register; + hwna->up.nm_register = netmap_hw_reg; + } if (netmap_attach_common(&hwna->up)) { nm_os_free(hwna); goto fail; @@ -2939,6 +3070,7 @@ netmap_attach_ext(struct netmap_adapter *arg, size_t s #endif /* NETMAP_LINUX_HAVE_NETDEV_OPS */ } hwna->nm_ndo.ndo_start_xmit = linux_netmap_start_xmit; + hwna->nm_ndo.ndo_change_mtu = linux_netmap_change_mtu; if (ifp->ethtool_ops) { hwna->nm_eto = *ifp->ethtool_ops; } @@ -2968,7 +3100,8 @@ fail: int netmap_attach(struct netmap_adapter *arg) { - return netmap_attach_ext(arg, sizeof(struct netmap_hw_adapter)); + return netmap_attach_ext(arg, sizeof(struct netmap_hw_adapter), + 1 /* override nm_reg */); } @@ -2996,7 +3129,15 @@ NM_DBG(netmap_adapter_put)(struct netmap_adapter *na) if (na->nm_dtor) na->nm_dtor(na); - netmap_detach_common(na); + if (na->tx_rings) { /* XXX should not happen */ + D("freeing leftover tx_rings"); + na->nm_krings_delete(na); + } + netmap_pipe_dealloc(na); + if (na->nm_mem) + netmap_mem_put(na->nm_mem); + bzero(na, sizeof(*na)); + nm_os_free(na); return 1; } @@ -3029,15 +3170,14 @@ netmap_detach(struct ifnet *ifp) NMG_LOCK(); netmap_set_all_rings(na, NM_KR_LOCKED); - na->na_flags |= NAF_ZOMBIE; /* * if the netmap adapter is not native, somebody * changed it, so we can not release it here. * The NAF_ZOMBIE flag will notify the new owner that * the driver is gone. */ - if (na->na_flags & NAF_NATIVE) { - netmap_adapter_put(na); + if (!(na->na_flags & NAF_NATIVE) || !netmap_adapter_put(na)) { + na->na_flags |= NAF_ZOMBIE; } /* give active users a chance to notice that NAF_ZOMBIE has been * turned on, so that they can stop and return an error to userspace. @@ -3116,9 +3256,9 @@ netmap_transmit(struct ifnet *ifp, struct mbuf *m) */ mbq_lock(q); - busy = kring->nr_hwtail - kring->nr_hwcur; - if (busy < 0) - busy += kring->nkr_num_slots; + busy = kring->nr_hwtail - kring->nr_hwcur; + if (busy < 0) + busy += kring->nkr_num_slots; if (busy + mbq_len(q) >= kring->nkr_num_slots - 1) { RD(2, "%s full hwcur %d hwtail %d qlen %d", na->name, kring->nr_hwcur, kring->nr_hwtail, mbq_len(q)); @@ -3216,16 +3356,6 @@ netmap_reset(struct netmap_adapter *na, enum txrx tx, kring->nr_hwtail -= lim + 1; } -#if 0 // def linux - /* XXX check that the mappings are correct */ - /* need ring_nr, adapter->pdev, direction */ - buffer_info->dma = dma_map_single(&pdev->dev, addr, adapter->rx_buffer_len, DMA_FROM_DEVICE); - if (dma_mapping_error(&adapter->pdev->dev, buffer_info->dma)) { - D("error mapping rx netmap buffer %d", i); - // XXX fix error handling - } - -#endif /* linux */ /* * Wakeup on the individual and global selwait * We do the wakeup here, but the ring is not yet reconfigured. Modified: head/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- head/sys/dev/netmap/netmap_freebsd.c Mon Apr 9 08:25:29 2018 (r332318) +++ head/sys/dev/netmap/netmap_freebsd.c Mon Apr 9 09:24:26 2018 (r332319) @@ -173,6 +173,16 @@ nm_os_ifnet_fini(void) nm_ifnet_dh_tag); } +unsigned +nm_os_ifnet_mtu(struct ifnet *ifp) +{ +#if __FreeBSD_version < 1100030 + return ifp->if_data.ifi_mtu; +#else /* __FreeBSD_version >= 1100030 */ + return ifp->if_mtu; +#endif +} + rawsum_t nm_os_csum_raw(uint8_t *data, size_t len, rawsum_t cur_sum) { @@ -294,24 +304,30 @@ nm_os_catch_rx(struct netmap_generic_adapter *gna, int { struct netmap_adapter *na = &gna->up.up; struct ifnet *ifp = na->ifp; + int ret = 0; + nm_os_ifnet_lock(); if (intercept) { if (gna->save_if_input) { D("cannot intercept again"); - return EINVAL; /* already set */ + ret = EINVAL; /* already set */ + goto out; } gna->save_if_input = ifp->if_input; ifp->if_input = freebsd_generic_rx_handler; } else { if (!gna->save_if_input){ D("cannot restore"); - return EINVAL; /* not saved */ + ret = EINVAL; /* not saved */ + goto out; } ifp->if_input = gna->save_if_input; gna->save_if_input = NULL; } +out: + nm_os_ifnet_unlock(); - return 0; + return ret; } @@ -327,12 +343,14 @@ nm_os_catch_tx(struct netmap_generic_adapter *gna, int struct netmap_adapter *na = &gna->up.up; struct ifnet *ifp = netmap_generic_getifp(gna); + nm_os_ifnet_lock(); if (intercept) { na->if_transmit = ifp->if_transmit; ifp->if_transmit = netmap_transmit; } else { ifp->if_transmit = na->if_transmit; } + nm_os_ifnet_unlock(); return 0; } Modified: head/sys/dev/netmap/netmap_generic.c ============================================================================== --- head/sys/dev/netmap/netmap_generic.c Mon Apr 9 08:25:29 2018 (r332318) +++ head/sys/dev/netmap/netmap_generic.c Mon Apr 9 09:24:26 2018 (r332319) @@ -86,8 +86,6 @@ __FBSDID("$FreeBSD$"); #include #include -#define rtnl_lock() ND("rtnl_lock called") -#define rtnl_unlock() ND("rtnl_unlock called") #define MBUF_RXQ(m) ((m)->m_pkthdr.flowid) #define smp_mb() @@ -168,7 +166,13 @@ nm_os_get_mbuf(struct ifnet *ifp, int len) * has a KASSERT(), checking that the mbuf dtor function is not NULL. */ +#if __FreeBSD_version <= 1200050 +static void void_mbuf_dtor(struct mbuf *m, void *arg1, void *arg2) { } +#else /* __FreeBSD_version >= 1200051 */ +/* The arg1 and arg2 pointers argument were removed by r324446, which + * in included since version 1200051. */ static void void_mbuf_dtor(struct mbuf *m) { } +#endif /* __FreeBSD_version >= 1200051 */ #define SET_MBUF_DESTRUCTOR(m, fn) do { \ (m)->m_ext.ext_free = (fn != NULL) ? \ @@ -200,8 +204,6 @@ nm_os_get_mbuf(struct ifnet *ifp, int len) #include "win_glue.h" -#define rtnl_lock() ND("rtnl_lock called") -#define rtnl_unlock() ND("rtnl_unlock called") #define MBUF_TXQ(m) 0//((m)->m_pkthdr.flowid) #define MBUF_RXQ(m) 0//((m)->m_pkthdr.flowid) #define smp_mb() //XXX: to be correctly defined @@ -210,7 +212,6 @@ nm_os_get_mbuf(struct ifnet *ifp, int len) #include "bsd_glue.h" -#include /* rtnl_[un]lock() */ #include /* struct ethtool_ops, get_ringparam */ #include @@ -339,17 +340,13 @@ generic_netmap_unregister(struct netmap_adapter *na) int i, r; if (na->active_fds == 0) { - rtnl_lock(); - na->na_flags &= ~NAF_NETMAP_ON; - /* Release packet steering control. */ - nm_os_catch_tx(gna, 0); - /* Stop intercepting packets on the RX path. */ nm_os_catch_rx(gna, 0); - rtnl_unlock(); + /* Release packet steering control. */ + nm_os_catch_tx(gna, 0); } for_each_rx_kring_h(r, kring, na) { @@ -510,24 +507,20 @@ generic_netmap_register(struct netmap_adapter *na, int } if (na->active_fds == 0) { - rtnl_lock(); - /* Prepare to intercept incoming traffic. */ error = nm_os_catch_rx(gna, 1); if (error) { D("nm_os_catch_rx(1) failed (%d)", error); - goto register_handler; + goto free_tx_pools; } - /* Make netmap control the packet steering. */ + /* Let netmap control the packet steering. */ error = nm_os_catch_tx(gna, 1); if (error) { D("nm_os_catch_tx(1) failed (%d)", error); goto catch_rx; } *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Mon Apr 9 13:32:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 74BF1F80C15; Mon, 9 Apr 2018 13:32:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 21AD47CB3D; Mon, 9 Apr 2018 13:32:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1C4F91F5B3; Mon, 9 Apr 2018 13:32:13 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w39DWC59034299; Mon, 9 Apr 2018 13:32:12 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w39DWC1Y034298; Mon, 9 Apr 2018 13:32:12 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201804091332.w39DWC1Y034298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Mon, 9 Apr 2018 13:32:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332326 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 332326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 13:32:13 -0000 Author: trasz Date: Mon Apr 9 13:32:12 2018 New Revision: 332326 URL: https://svnweb.freebsd.org/changeset/base/332326 Log: cfumass(4) no longer requires iscsi(4). MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/share/man/man4/cfumass.4 Modified: head/share/man/man4/cfumass.4 ============================================================================== --- head/share/man/man4/cfumass.4 Mon Apr 9 13:01:43 2018 (r332325) +++ head/share/man/man4/cfumass.4 Mon Apr 9 13:32:12 2018 (r332326) @@ -26,7 +26,7 @@ .\" SUCH DAMAGE. .\" .\" $FreeBSD$ -.Dd January 27, 2017 +.Dd April 9, 2018 .Dt CFUMASS 4 .Os .Sh NAME @@ -38,7 +38,6 @@ the kernel configuration file: .Bd -ragged -offset indent .Cd "device usb" .Cd "device usb_template" -.Cd "device iscsi" .Cd "device ctl" .Cd "device cfumass" .Ed From owner-svn-src-head@freebsd.org Mon Apr 9 13:37:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 322BAF81165; Mon, 9 Apr 2018 13:37:20 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D65807F878; Mon, 9 Apr 2018 13:37:19 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 8E73A140ED; Mon, 9 Apr 2018 13:37:19 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Date: Mon, 9 Apr 2018 13:37:17 +0000 From: Glen Barber To: Benno Rice Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331843 - in head/usr.sbin/makefs: . cd9660 Message-ID: <20180409133717.GB82598@FreeBSD.org> References: <201803311504.w2VF4gxR024784@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jy6Sn24JjFx/iggw" Content-Disposition: inline In-Reply-To: <201803311504.w2VF4gxR024784@repo.freebsd.org> User-Agent: Mutt/1.9.1 (2017-09-22) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 13:37:20 -0000 --jy6Sn24JjFx/iggw Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, Mar 31, 2018 at 03:04:42PM +0000, Benno Rice wrote: > Author: benno > Date: Sat Mar 31 15:04:41 2018 > New Revision: 331843 > URL: https://svnweb.freebsd.org/changeset/base/331843 >=20 > Log: > Synchronise with NetBSD's version of EFI handling for El Torito images. > =20 > When I implemented my EFI support I failed to check if the upstream ver= sion > of makefs in NetBSD had done the same. Override my version with theirs = to > make it easier to stay in sync with them in the future. > =20 > Reviewed by: imp, mav > Obtained from: NetBSD > MFC after: 1 week > Sponsored by: iXsystems, Inc. > Differential Revision: https://reviews.freebsd.org/D14913 >=20 > Modified: > head/usr.sbin/makefs/cd9660.c > head/usr.sbin/makefs/cd9660/cd9660_eltorito.c > head/usr.sbin/makefs/cd9660/cd9660_eltorito.h > head/usr.sbin/makefs/makefs.8 >=20 > Modified: head/usr.sbin/makefs/cd9660.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/usr.sbin/makefs/cd9660.c Sat Mar 31 13:19:27 2018 (r331842) > +++ head/usr.sbin/makefs/cd9660.c Sat Mar 31 15:04:41 2018 (r331843) > @@ -309,6 +309,7 @@ cd9660_prep_opts(fsinfo_t *fsopts) > OPT_STR('\0', "no-boot", "No boot support"), > OPT_STR('\0', "hard-disk-boot", "Boot from hard disk"), > OPT_STR('\0', "boot-load-segment", "Boot load segment"), > + OPT_STR('\0', "platformid", "Section Header Platform ID"), > =20 > { .name =3D NULL } > }; > @@ -444,7 +445,8 @@ cd9660_parse_opts(const char *option, fsinfo_t *fsopts > /* RRIP */ > cd9660_eltorito_add_boot_option(diskStructure, name, 0); > rv =3D 1; > - } else if (strcmp(name, "boot-load-segment") =3D=3D 0) { > + } else if (strcmp(name, "boot-load-segment") =3D=3D 0 || > + strcmp(name, "platformid") =3D=3D 0) { > if (buf[0] =3D=3D '\0') { > warnx("Option `%s' doesn't contain a value", > name); >=20 > Modified: head/usr.sbin/makefs/cd9660/cd9660_eltorito.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/usr.sbin/makefs/cd9660/cd9660_eltorito.c Sat Mar 31 13:19:27 201= 8 (r331842) > +++ head/usr.sbin/makefs/cd9660/cd9660_eltorito.c Sat Mar 31 15:04:41 201= 8 (r331843) > @@ -1,4 +1,4 @@ > -/* $NetBSD: cd9660_eltorito.c,v 1.17 2011/06/23 02:35:56 enami Exp $ */ > +/* $NetBSD: cd9660_eltorito.c,v 1.23 2018/03/28 06:48:55 nonaka Exp $ */ > =20 > /*- > * SPDX-License-Identifier: BSD-2-Clause-NetBSD > @@ -47,16 +47,19 @@ __FBSDID("$FreeBSD$"); > #define ELTORITO_DPRINTF(__x) > #endif > =20 > +#include > + > static struct boot_catalog_entry *cd9660_init_boot_catalog_entry(void); > static struct boot_catalog_entry *cd9660_boot_setup_validation_entry(cha= r); > static struct boot_catalog_entry *cd9660_boot_setup_default_entry( > struct cd9660_boot_image *); > static struct boot_catalog_entry *cd9660_boot_setup_section_head(char); > -static struct boot_catalog_entry *cd9660_boot_setup_validation_entry(cha= r); > #if 0 > static u_char cd9660_boot_get_system_type(struct cd9660_boot_image *); > #endif > =20 > +static struct cd9660_boot_image *default_boot_image; > + > int > cd9660_add_boot_disk(iso9660_disk *diskStructure, const char *boot_info) > { > @@ -104,12 +107,9 @@ cd9660_add_boot_disk(iso9660_disk *diskStructure, co= ns > else if (strcmp(sysname, "macppc") =3D=3D 0 || > strcmp(sysname, "mac68k") =3D=3D 0) > new_image->system =3D ET_SYS_MAC; > - else if (strcmp(sysname, "efi") =3D=3D 0 || > - strcmp(sysname, "uefi") =3D=3D 0) > - new_image->system =3D ET_SYS_UEFI; > else { > warnx("boot disk system must be " > - "efi, i386, powerpc, macppc, mac68k"); > + "i386, powerpc, macppc, or mac68k"); > free(temp); > free(new_image); > return 0; It appears this part has broken creating disc1.iso (and other ISO images) for amd64. I see the following error: sh /usr/src/release/amd64/mkisoimages.sh -b 12_0_CURRENT_amd64_CD disc1.is= o disc1=20 200+0 records in 200+0 records out 819200 bytes transferred in 0.004175 secs (196222290 bytes/sec) newfs_msdos: cannot get number of sectors per track: Operation not support= ed newfs_msdos: cannot get number of heads: Operation not supported /dev/md3: 1557 sectors in 1557 FAT12 clusters (512 bytes/cluster) BytesPerSec=3D512 SecPerClust=3D1 ResSectors=3D1 FATs=3D2 RootDirEnts=3D51= 2 Sectors=3D1600 Media=3D0xf8 FATsecs=3D5 SecPerTrack=3D63 Heads=3D1 Hidden= Secs=3D0 makefs: boot disk system must be i386, powerpc, macppc, or mac68k Usage: makefs [-xZ] [-B endian] [-b free-blocks] [-d debug-mask] [-F mtree-specfile] [-f free-files] [-M minimum-size] [-m maximum-= size] [-N userdb-dir] [-O offset] [-o fs-options] [-R roundup-size] [-S sector-size] [-s image-size] [-T ] [-t fs-type] image-file directory | manifest [extra-directory ...] =20 cd9660 specific options: l, isolevel ISO Level v, verbose Turns on verbose output h, help Show help message S, follow-symlinks Resolve symlinks in pathnames R, rockridge Enable Rock-Ridge extensions C, chrp-boot Enable CHRP boot K, keep-bad-images Keep bad images D, allow-deep-trees Allow trees more than 8 levels a, allow-max-name Allow 37 char filenames (unimplemented) i, allow-illegal-chars Allow illegal characters in filenames m, allow-multidot Allow multiple periods in filenames o,omit-trailing-period Omit trailing periods in filenames allow-lowercase Allow lowercase characters in filenames archimedes Enable Archimedes structure no-trailing-padding Include padding areas A, applicationid Application Identifier P, publisher Publisher Identifier p, preparer Preparer Identifier L, label Disk Label V, volumeid Volume Set Identifier B, bootimage Boot image parameter G, generic-bootimage Generic boot image param bootimagedir Boot image directory no-emul-boot No boot emulation no-boot No boot support hard-disk-boot Boot from hard disk boot-load-segment Boot load segment platformid Section Header Platform ID Glen --jy6Sn24JjFx/iggw Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAlrLbI0ACgkQAxRYpUeP 4pN2KA//YS6DybQM7naJlv0iF88oKo8e8M7dYxi0MgLekVO/+pRStjaWEkp5AEHh RAz/N8wBlXRbn2d8Eku8p59KcL4+xOS6+PfOpjXPN1LbGXQjUCysOsVnK8+4tukU wRn2e6F6DdT6p3qTubGjO+cZPr9PzOw1wmMB3QGhjIKWdzkOWcFPdYsY3BCYCk0C tOIwQ2NCgs8xjnbKG+n5nJlfr/uXwjnz/vw83jLXbPkevLV1MaOHtDZ69VSoX+cQ i3WA0EwjDKHnx2eDwif1RxMkklrLmmGyRtO5ox+feNmYdb44CF50dvxjMSaX69G4 uVS6GndB0Cx/6H26Yt7TPr487q1sTITuz/8idYg6S4r5lqz8HqHRtOuvxZBdE8Wu zZ9Gkw4MFeWwVwh1L48tSPuNmD8vkmHKrft+CofRc7oyiUIQYoOJRRwIpkAssaN1 aw2ZwELixcopJGQ4LE4YgnCINSECmyRtzu2QlIlKj0Gx0d2Dwv90MDZf7NHI+9JO 0FJHZ/nzSo2ntMv0GY9YZYJm8R3TLo8n0KSVLdFtaL2IHsnFnIcA5viaOCiBPOYH uoVxXk3c+8OZ70rRqDQzJbHC1OodGnlma02TXeWU4euQUXPNn9g/HqLLLpM55uri 5g2AVuZlALyotYwpbumaFyjJEQPv2cXp0joHQMhil4eyOecbcAU= =BJNc -----END PGP SIGNATURE----- --jy6Sn24JjFx/iggw-- From owner-svn-src-head@freebsd.org Mon Apr 9 14:05:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A34E3F830C9; Mon, 9 Apr 2018 14:05: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DF9B6FBFC; Mon, 9 Apr 2018 14:05: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 409AC1FAA4; Mon, 9 Apr 2018 14:05:44 +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 w39E5ipD049358; Mon, 9 Apr 2018 14:05:44 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w39E5in8049357; Mon, 9 Apr 2018 14:05:44 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804091405.w39E5in8049357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 9 Apr 2018 14:05:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332327 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 332327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 14:05:44 -0000 Author: kevans Date: Mon Apr 9 14:05:43 2018 New Revision: 332327 URL: https://svnweb.freebsd.org/changeset/base/332327 Log: if_awg: Add support for allwinner,{tx,rx}-delay-ps bindings Split out delay parsing into a separate function; we'll support both {tx,rx}-delay as well as the new versions. While here, validate that they're within the expected range and fail to attach if they are not. Assuming that we can clamp the delay is a bad idea that might result in a non-working awg anyways, so we'll fail early to make it easier to catch. This version also unsets the tx and rx delay registers unconditionally and then sets them if we read a non-zero delay. These delay properties should default to 0 if not specified, as declared in the binding documentation. Presumably the delays will be set via hardware configuration if they're not explicitly set in FDT. Modified: head/sys/arm/allwinner/if_awg.c Modified: head/sys/arm/allwinner/if_awg.c ============================================================================== --- head/sys/arm/allwinner/if_awg.c Mon Apr 9 13:32:12 2018 (r332326) +++ head/sys/arm/allwinner/if_awg.c Mon Apr 9 14:05:43 2018 (r332327) @@ -221,6 +221,8 @@ static struct resource_spec awg_spec[] = { static void awg_txeof(struct awg_softc *sc); +static int awg_parse_delay(device_t dev, uint32_t *tx_delay, + uint32_t *rx_delay); static uint32_t syscon_read_emac_clk_reg(device_t dev); static void syscon_write_emac_clk_reg(device_t dev, uint32_t val); static phandle_t awg_get_phy_node(device_t dev); @@ -1218,6 +1220,50 @@ awg_has_internal_phy(device_t dev) } static int +awg_parse_delay(device_t dev, uint32_t *tx_delay, uint32_t *rx_delay) +{ + phandle_t node; + uint32_t delay; + + if (tx_delay == NULL || rx_delay == NULL) + return (EINVAL); + *tx_delay = *rx_delay = 0; + node = ofw_bus_get_node(dev); + + if (OF_getencprop(node, "tx-delay", &delay, sizeof(delay)) >= 0) + *tx_delay = delay; + else if (OF_getencprop(node, "allwinner,tx-delay-ps", &delay, + sizeof(delay)) >= 0) { + if ((delay % 100) != 0) { + device_printf(dev, "tx-delay-ps is not a multiple of 100\n"); + return (EDOM); + } + *tx_delay = delay / 100; + } + if (*tx_delay > 7) { + device_printf(dev, "tx-delay out of range\n"); + return (ERANGE); + } + + if (OF_getencprop(node, "rx-delay", &delay, sizeof(delay)) >= 0) + *rx_delay = delay; + else if (OF_getencprop(node, "allwinner,rx-delay-ps", &delay, + sizeof(delay)) >= 0) { + if ((delay % 100) != 0) { + device_printf(dev, "rx-delay-ps is not within documented domain\n"); + return (EDOM); + } + *rx_delay = delay / 100; + } + if (*rx_delay > 31) { + device_printf(dev, "rx-delay out of range\n"); + return (ERANGE); + } + + return (0); +} + +static int awg_setup_phy(device_t dev) { struct awg_softc *sc; @@ -1260,16 +1306,22 @@ awg_setup_phy(device_t dev) else reg |= EMAC_CLK_PIT_MII | EMAC_CLK_SRC_MII; - if (OF_getencprop(node, "tx-delay", &tx_delay, - sizeof(tx_delay)) > 0) { - reg &= ~EMAC_CLK_ETXDC; + /* + * Fail attach if we fail to parse either of the delay + * parameters. If we don't have the proper delay to write to + * syscon, then awg likely won't function properly anyways. + * Lack of delay is not an error! + */ + error = awg_parse_delay(dev, &tx_delay, &rx_delay); + if (error != 0) + goto fail; + + /* Default to 0 and we'll increase it if we need to. */ + reg &= ~(EMAC_CLK_ETXDC | EMAC_CLK_ERXDC); + if (tx_delay > 0) reg |= (tx_delay << EMAC_CLK_ETXDC_SHIFT); - } - if (OF_getencprop(node, "rx-delay", &rx_delay, - sizeof(rx_delay)) > 0) { - reg &= ~EMAC_CLK_ERXDC; + if (rx_delay > 0) reg |= (rx_delay << EMAC_CLK_ERXDC_SHIFT); - } if (sc->type == EMAC_H3) { if (awg_has_internal_phy(dev)) { From owner-svn-src-head@freebsd.org Mon Apr 9 14:08:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EA587F83292; Mon, 9 Apr 2018 14:08:00 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: from mail-lf0-f42.google.com (mail-lf0-f42.google.com [209.85.215.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5583571063; Mon, 9 Apr 2018 14:08:00 +0000 (UTC) (envelope-from byond.lenox@gmail.com) Received: by mail-lf0-f42.google.com with SMTP id u3-v6so6767181lff.5; Mon, 09 Apr 2018 07:08:00 -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:in-reply-to:references:from:date :message-id:subject:to:cc; bh=oCGYrwQHHJ0IFmJbbht60KlBdEywmFujRzQDamoDZkc=; b=jU1bjweif2Kd3yllgiPT4+B74VbHWU/mPaR3/MLkPKyrEEErDdrYi0afhYHLrOqTjX +Y8X9sXP6+vqW75O6LfXTVne1jJADEwfXR9xg5auFd3visID+yb2Wr4x9mWI/1gCOudR eolnZGoZ3QRR4/H8amD8eJM2QINARGMpjJIJHN+4lCBdkBgbeD0jgX6IXluYPNoku+MQ b4Xi93ODDZH+2wsb2NDvYPgmBQZvN9HPuuTeMWxR0+pSsRCAtXI8dJ5YgXJmNBo9LmSo 8OxIu033ZajVjnIdg8cv1IZbLuXnfkFzlXD//ecACzZ8LQJiFnZMTtn8ZdoiEsIEPuW/ 3Sww== X-Gm-Message-State: ALQs6tBFU2QbMEA4UEdLIW87QbmdNLxXmxIcFLAoK0sMNnyR4DLV8G2J hCT3T5YHV4NcPpWpCGEr6b8SsFxC X-Google-Smtp-Source: AIpwx48rlwWtzsoXAH4GZtDCi9BSpazvmGajPyl5fLNXYA4uUENDesTM80RxRP+ap6FpT3MCdMDTRw== X-Received: by 10.46.77.80 with SMTP id a77mr22499836ljb.91.1523282872576; Mon, 09 Apr 2018 07:07:52 -0700 (PDT) Received: from mail-lf0-f43.google.com (mail-lf0-f43.google.com. [209.85.215.43]) by smtp.gmail.com with ESMTPSA id y22sm81223ljy.70.2018.04.09.07.07.52 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Apr 2018 07:07:52 -0700 (PDT) Received: by mail-lf0-f43.google.com with SMTP id d20-v6so911233lfe.3; Mon, 09 Apr 2018 07:07:52 -0700 (PDT) X-Received: by 10.46.155.204 with SMTP id w12mr20724015ljj.76.1523282872326; Mon, 09 Apr 2018 07:07:52 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Mon, 9 Apr 2018 07:07:31 -0700 (PDT) In-Reply-To: <201804091405.w39E5in8049357@repo.freebsd.org> References: <201804091405.w39E5in8049357@repo.freebsd.org> From: Kyle Evans Date: Mon, 9 Apr 2018 09:07:31 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r332327 - head/sys/arm/allwinner To: Kyle Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 14:08:01 -0000 On Mon, Apr 9, 2018 at 9:05 AM, Kyle Evans wrote: > Author: kevans > Date: Mon Apr 9 14:05:43 2018 > New Revision: 332327 > URL: https://svnweb.freebsd.org/changeset/base/332327 > > Log: > if_awg: Add support for allwinner,{tx,rx}-delay-ps bindings > > Split out delay parsing into a separate function; we'll support both > {tx,rx}-delay as well as the new versions. > > While here, validate that they're within the expected range and fail to > attach if they are not. Assuming that we can clamp the delay is a bad idea > that might result in a non-working awg anyways, so we'll fail early to make > it easier to catch. > > This version also unsets the tx and rx delay registers unconditionally and > then sets them if we read a non-zero delay. These delay properties should > default to 0 if not specified, as declared in the binding documentation. > Presumably the delays will be set via hardware configuration if they're not > explicitly set in FDT. > Ugh, I dropped these: Reviewed by: manu Differential Revision: https://reviews.freebsd.org/D15008 From owner-svn-src-head@freebsd.org Mon Apr 9 14:17:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1296F83CB0; Mon, 9 Apr 2018 14:17:37 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 3480F76509; Mon, 9 Apr 2018 14:17:36 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w39EHXJh018894; Mon, 9 Apr 2018 07:17:33 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w39EHXUH018893; Mon, 9 Apr 2018 07:17:33 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201804091417.w39EHXUH018893@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r332092 - in head/sys: amd64/amd64 sys x86/x86 In-Reply-To: <20180409083554.k34hfijxiztwdne6@MacBook-Pro-de-Roger.local> To: "Roger Pau Monn?" Date: Mon, 9 Apr 2018 07:17:33 -0700 (PDT) CC: rgrimes@freebsd.org, 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-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 14:17:37 -0000 > On Fri, Apr 06, 2018 at 09:17:09AM -0700, Rodney W. Grimes wrote: > > [ Charset UTF-8 unsupported, converting... ] > > > Author: royger > > > Date: Fri Apr 6 11:20:06 2018 > > > New Revision: 332092 > > > URL: https://svnweb.freebsd.org/changeset/base/332092 > > > > > > Log: > > > remove GiB/MiB macros from param.h > > > > > > And instead define them in the files where they are used. > > > > It would of been better to "revert" your prior change and > > make a seperate new commit. It is rarely desireable to combine > > a revert of a change with anything. > > A plain revert of r332072 would have left the tree in a broken state, > because r332073 depends on those macros. IMO it's better to have a > buildable tree at all times in order for it to be bisectable. Well a revert of r332073 could of been combined leaving the tree building, and in the state before the attempt to do {MG}iB() macros. -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Mon Apr 9 16:44:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 792F4F8E07D; Mon, 9 Apr 2018 16:44:37 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x22f.google.com (mail-it0-x22f.google.com [IPv6:2607:f8b0:4001:c0b::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EBDB0692A8; Mon, 9 Apr 2018 16:44:36 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x22f.google.com with SMTP id f6-v6so11920239ita.2; Mon, 09 Apr 2018 09:44:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=p0gpY3NnHoBEkt/FCRadBmxICtkGC+paXkggQiXUUqI=; b=dpBTzDqutjLF2w7nUOL4ScyH7BCGbusCy9H7j4En4FubeaAG3JpeqVBbznXzDl2jpu BpnybzwewuK3k+CoyuP6wKxg9rWBN9WllDxemAeiiOGm7IPLysGMqB2Vv3nl4SleRZrZ OT9pCkDPZPrXyfnwR447I5cvbQPhcf4hIpleAYxSpKeyZIIOI+qbjEsx2I3oIYrMAcE+ pNrBBYKpBYIdGP1uJv6rd4REy5hAj/wenvAlz/tbT9sROYKQpu7ciZc7WGNcrMOX3oki o24a5BLMas+7WY4yTa4wJYcgor6H6B/6p1E3Aqjkh65VJAUFZi5gS9WiKoXsilrossTs kvMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=p0gpY3NnHoBEkt/FCRadBmxICtkGC+paXkggQiXUUqI=; b=qwAuB3SvDiTp8M2siMGs4UZhJEIO9gRiEAbeK1X4tXU1gj4E7Fg82g63syjykDo88P EY8RDnUveUD5gtPPd3KdVVTWOPoepRHkR13oCTMlD1EDNQWYofcvqD2ZIKwEdvyy+3RD Kg1VsEKrckGhjF4qgUhUG+oMwe7zbqL1uVqNYR+WZOywKm664rD/Uepsv5XoIDhyCRMH 2PTXJQiLEu9+QCcMnmkIMgOP600XAuTEBNOMvxlo2nySHj6V8WIJ+PC8r1E6VIRgwpze OdDFFwVJ4n2uyoC0JvFqzKGeHVOsR5ICSHJqCSpTRo2dwIkObmcw01kkEj/MWRSwz5AH bS5g== X-Gm-Message-State: ALQs6tCq/BsbNshEbdH3J0iD0p5/Gl0ZLqXztHV75bHFi4oC9T9aoymt RrMOypGVqmjmEhoK6RktaKr5RrvqzykNM4NoLKV7Qkfc X-Google-Smtp-Source: AIpwx4+Emhn6SDQK930NI+A/XgU/Rkt+QvDPc/WgCEc89nY+PbVwRUKYiVNfB215N3Dv9gMlSGsORi4trWU3SpK/QzQ= X-Received: by 2002:a24:a0c6:: with SMTP id o189-v6mr805084ite.52.1523292275783; Mon, 09 Apr 2018 09:44:35 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.130.197 with HTTP; Mon, 9 Apr 2018 09:44:15 -0700 (PDT) In-Reply-To: <8352524.sDEuJtqkT0@ralph.baldwin.cx> References: <201804060257.w362vwi3023158@repo.freebsd.org> <8352524.sDEuJtqkT0@ralph.baldwin.cx> From: Ed Maste Date: Mon, 9 Apr 2018 12:44:15 -0400 X-Google-Sender-Auth: 2BQI0ILmFKYUc2PRYKGVRCEg5G4 Message-ID: Subject: Re: svn commit: r332090 - head/stand/i386 To: John Baldwin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 16:44:37 -0000 On 6 April 2018 at 13:54, John Baldwin wrote: > On Friday, April 06, 2018 02:57:58 AM Ed Maste wrote: >> Author: emaste >> Date: Fri Apr 6 02:57:58 2018 >> New Revision: 332090 >> URL: https://svnweb.freebsd.org/changeset/base/332090 >> >> Log: >> stand: pass --no-rosegment for i386 bits when linking with lld >> > > Maybe we should support LDFLAGS.${LINKER_TYPE} as we do for CFLAGS, etc.? I don't anticipate LINKER_TYPE tests proliferating, but a good point nonetheless. Change proposed in review D14998. From owner-svn-src-head@freebsd.org Mon Apr 9 17:02:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C6710F8F24E for ; Mon, 9 Apr 2018 17:02:04 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-io0-x232.google.com (mail-io0-x232.google.com [IPv6:2607:f8b0:4001:c06::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2394372C84 for ; Mon, 9 Apr 2018 17:02:03 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-io0-x232.google.com with SMTP id b20so10441387iof.5 for ; Mon, 09 Apr 2018 10:02:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=6tmpR9PXoFXNciwsKQoZOKoO6bxno+YwlBtfKrzQVjg=; b=ni6Xp4VI1LxVzwTryyplkGM6dGIuWd0yo0avrM7VXv0HP6QsY5nAaKYJZ/VnUW3lrt vUTojxjspt5J6J41M+XCJ5s10l+R+8H+PmrmxmM74u1KdE0zc8DNlqjNhXFUBtYx+GcX V6iCFPBqgIxXMsgUm23RAdYHYIODwPIVB4VkYeUIcdN0dtQlyOEDQjugqXuAvXW67Nuh ABWIqxfQobP4MFckxIdA8MFNBhPfVjv6DOv9vqrIvKLcO1f7ryastd9tFett9xvZM7uI JIn1GeE8ZqbX77xvPxf9FIsT/zRg+vVcIhUWLoykV8OGYd5o1SXSqlj48m7S6dc+XwW9 QPiA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=6tmpR9PXoFXNciwsKQoZOKoO6bxno+YwlBtfKrzQVjg=; b=PuaRJ82EKWZQqJxL6WqU4xOqzAZZDyOISJe1rFY3tET9VA431nDoDxsLus4a2Qp122 a3E1TThqnaA0rShSvhHrvCYJHFzCu36oNd8LljT92KzJWxYEU/CMEDpPjkQgE2vzmBKW BOEhKo6QnW7Ud2X7gEjp2YC39HVwGzmzLxwjaJasbiSDbWQyeYEorvoFteRSAJAxzKnq L7SatR/pSAmTsCguNys1Vz9m4n/73Lc8dTqtEs0EWjGSdZO0390lVKyPAb/GidOeq7/T NgJYq1J/shZx1GugtI3Xp7R42FxNuCAhnqp7OWt7osB7okBtij5htKC2luOwQ/z3puTG Pzog== X-Gm-Message-State: ALQs6tCtfeSXivOSaekmKKZW5rp3Dj3Z/l5txNZ028MmVNCl9wuc0aE2 msjonuW+GXX25u1/TQKI+euGJonja+/qup8SyLZHsw== X-Google-Smtp-Source: AIpwx48lHjAUiXKvYJGTJUoz3ulloips1g9Z7hiroUdMx1aAKbPHWqITf7HHd6nNX1tsLKcnoFrimc0zhlriNJSq1FI= X-Received: by 10.107.18.162 with SMTP id 34mr34563971ios.168.1523293322334; Mon, 09 Apr 2018 10:02:02 -0700 (PDT) MIME-Version: 1.0 Sender: wlosh@bsdimp.com Received: by 10.79.228.135 with HTTP; Mon, 9 Apr 2018 10:02:01 -0700 (PDT) X-Originating-IP: [50.227.106.226] In-Reply-To: References: <201804060257.w362vwi3023158@repo.freebsd.org> <8352524.sDEuJtqkT0@ralph.baldwin.cx> From: Warner Losh Date: Mon, 9 Apr 2018 11:02:01 -0600 X-Google-Sender-Auth: Z4dKwHiryGAQLuBCAioSmgj1TAc Message-ID: Subject: Re: svn commit: r332090 - head/stand/i386 To: Ed Maste Cc: John Baldwin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 17:02:05 -0000 On Mon, Apr 9, 2018 at 10:44 AM, Ed Maste wrote: > On 6 April 2018 at 13:54, John Baldwin wrote: > > On Friday, April 06, 2018 02:57:58 AM Ed Maste wrote: > >> Author: emaste > >> Date: Fri Apr 6 02:57:58 2018 > >> New Revision: 332090 > >> URL: https://svnweb.freebsd.org/changeset/base/332090 > >> > >> Log: > >> stand: pass --no-rosegment for i386 bits when linking with lld > >> > > > > Maybe we should support LDFLAGS.${LINKER_TYPE} as we do for CFLAGS, etc.? > > I don't anticipate LINKER_TYPE tests proliferating, but a good point > nonetheless. Change proposed in review D14998. > We only really support two compilers. This lets us have fewer .if statements which historically people have messed often enough that we've move to constructs that avoid them. Warner From owner-svn-src-head@freebsd.org Mon Apr 9 17:24:02 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 75721F90BB6; Mon, 9 Apr 2018 17:24:02 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 266B57EF91; Mon, 9 Apr 2018 17:24:02 +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 1F47921B6E; Mon, 9 Apr 2018 17:24:02 +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 w39HO2rB050655; Mon, 9 Apr 2018 17:24:02 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w39HO1eX050650; Mon, 9 Apr 2018 17:24:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804091724.w39HO1eX050650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 9 Apr 2018 17:24:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332333 - in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/sys: amd64/linux amd64/linux32 compat/linux i386/linux X-SVN-Commit-Revision: 332333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 17:24:02 -0000 Author: emaste Date: Mon Apr 9 17:24:01 2018 New Revision: 332333 URL: https://svnweb.freebsd.org/changeset/base/332333 Log: linuxulator: deduplicate linux_exec_imgact_try Previously linuxulator had three identical copies of linux_exec_imgact_try. Deduplicate before adding another arch to linuxulator. Sponsored by: Turing Robotic Industries Inc Differential Revision: https://reviews.freebsd.org/D14856 Modified: head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/compat/linux/linux_emul.c head/sys/compat/linux/linux_emul.h head/sys/i386/linux/linux_sysvec.c Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Mon Apr 9 16:32:49 2018 (r332332) +++ head/sys/amd64/linux/linux_sysvec.c Mon Apr 9 17:24:01 2018 (r332333) @@ -86,12 +86,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux64, 1); -#if BYTE_ORDER == LITTLE_ENDIAN -#define SHELLMAGIC 0x2123 /* #! */ -#else -#define SHELLMAGIC 0x2321 -#endif - #if defined(DEBUG) SYSCTL_PROC(_compat_linux, OID_AUTO, debug, CTLTYPE_STRING | CTLFLAG_RW, @@ -125,7 +119,6 @@ static void linux_vdso_install(void *param); static void linux_vdso_deinstall(void *param); static void linux_set_syscall_retval(struct thread *td, int error); static int linux_fetch_syscall_args(struct thread *td); -static int linux_exec_imgact_try(struct image_params *iparams); static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); static int linux_vsyscall(struct thread *td); @@ -661,42 +654,6 @@ linux_rt_sendsig(sig_t catcher, ksiginfo_t *ksi, sigse set_pcb_flags(td->td_pcb, PCB_FULL_IRET); PROC_LOCK(p); mtx_lock(&psp->ps_mtx); -} - -/* - * If a Linux binary is exec'ing something, try this image activator - * first. We override standard shell script execution in order to - * be able to modify the interpreter path. We only do this if a Linux - * binary is doing the exec, so we do not create an EXEC module for it. - */ -static int -linux_exec_imgact_try(struct image_params *imgp) -{ - const char *head = (const char *)imgp->image_header; - char *rpath; - int error = -1; - - /* - * The interpreter for shell scripts run from a Linux binary needs - * to be located in /compat/linux if possible in order to recursively - * maintain Linux path emulation. - */ - if (((const short *)head)[0] == SHELLMAGIC) { - /* - * Run our normal shell image activator. If it succeeds then - * attempt to use the alternate path for the interpreter. If - * an alternate path is found, use our stringspace to store it. - */ - if ((error = exec_shell_imgact(imgp)) == 0) { - linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), - imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, - AT_FDCWD); - if (rpath != NULL) - imgp->args->fname_buf = - imgp->interpreter_name = rpath; - } - } - return (error); } #define LINUX_VSYSCALL_START (-10UL << 20) Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Mon Apr 9 16:32:49 2018 (r332332) +++ head/sys/amd64/linux32/linux32_sysvec.c Mon Apr 9 17:24:01 2018 (r332333) @@ -95,12 +95,6 @@ MODULE_VERSION(linux, 1); suword32(pos++, val); \ } while (0) -#if BYTE_ORDER == LITTLE_ENDIAN -#define SHELLMAGIC 0x2123 /* #! */ -#else -#define SHELLMAGIC 0x2321 -#endif - /* * Allow the sendsig functions to use the ldebug() facility even though they * are not syscalls themselves. Map them to syscall 0. This is slightly less @@ -124,7 +118,6 @@ static int linux_fixup_elf(register_t **stack_base, struct image_params *iparams); static register_t *linux_copyout_strings(struct image_params *imgp); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); -static int linux_exec_imgact_try(struct image_params *iparams); static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); static void linux32_fixlimit(struct rlimit *rl, int which); @@ -715,42 +708,6 @@ linux32_fetch_syscall_args(struct thread *td) td->td_retval[1] = frame->tf_rdx; return (0); -} - -/* - * If a Linux binary is exec'ing something, try this image activator - * first. We override standard shell script execution in order to - * be able to modify the interpreter path. We only do this if a Linux - * binary is doing the exec, so we do not create an EXEC module for it. - */ -static int -linux_exec_imgact_try(struct image_params *imgp) -{ - const char *head = (const char *)imgp->image_header; - char *rpath; - int error = -1; - - /* - * The interpreter for shell scripts run from a Linux binary needs - * to be located in /compat/linux if possible in order to recursively - * maintain Linux path emulation. - */ - if (((const short *)head)[0] == SHELLMAGIC) { - /* - * Run our normal shell image activator. If it succeeds then - * attempt to use the alternate path for the interpreter. If - * an alternate path is found, use our stringspace to store it. - */ - if ((error = exec_shell_imgact(imgp)) == 0) { - linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), - imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, - AT_FDCWD); - if (rpath != NULL) - imgp->args->fname_buf = - imgp->interpreter_name = rpath; - } - } - return (error); } /* Modified: head/sys/compat/linux/linux_emul.c ============================================================================== --- head/sys/compat/linux/linux_emul.c Mon Apr 9 16:32:49 2018 (r332332) +++ head/sys/compat/linux/linux_emul.c Mon Apr 9 17:24:01 2018 (r332333) @@ -1,6 +1,7 @@ /*- * SPDX-License-Identifier: BSD-2-Clause-FreeBSD * + * Copyright (c) 1994-1996 Søren Schmidt * Copyright (c) 2006 Roman Divacky * Copyright (c) 2013 Dmitry Chagin * All rights reserved. @@ -32,6 +33,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -48,6 +50,11 @@ __FBSDID("$FreeBSD$"); #include #include +#if BYTE_ORDER == LITTLE_ENDIAN +#define SHELLMAGIC 0x2123 /* #! */ +#else +#define SHELLMAGIC 0x2321 +#endif /* * This returns reference to the thread emuldata entry (if found) @@ -166,6 +173,42 @@ linux_proc_exit(void *arg __unused, struct proc *p) sx_destroy(&pem->pem_sx); free(pem, M_LINUX); +} + +/* + * If a Linux binary is exec'ing something, try this image activator + * first. We override standard shell script execution in order to + * be able to modify the interpreter path. We only do this if a Linux + * binary is doing the exec, so we do not create an EXEC module for it. + */ +int +linux_exec_imgact_try(struct image_params *imgp) +{ + const char *head = (const char *)imgp->image_header; + char *rpath; + int error = -1; + + /* + * The interpreter for shell scripts run from a Linux binary needs + * to be located in /compat/linux if possible in order to recursively + * maintain Linux path emulation. + */ + if (((const short *)head)[0] == SHELLMAGIC) { + /* + * Run our normal shell image activator. If it succeeds attempt + * to use the alternate path for the interpreter. If an + * alternate path is found, use our stringspace to store it. + */ + if ((error = exec_shell_imgact(imgp)) == 0) { + linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), + imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, + AT_FDCWD); + if (rpath != NULL) + imgp->args->fname_buf = + imgp->interpreter_name = rpath; + } + } + return (error); } int Modified: head/sys/compat/linux/linux_emul.h ============================================================================== --- head/sys/compat/linux/linux_emul.h Mon Apr 9 16:32:49 2018 (r332332) +++ head/sys/compat/linux/linux_emul.h Mon Apr 9 17:24:01 2018 (r332333) @@ -49,6 +49,7 @@ struct linux_emuldata { struct linux_emuldata *em_find(struct thread *); +int linux_exec_imgact_try(struct image_params *); void linux_proc_init(struct thread *, struct thread *, int); void linux_proc_exit(void *, struct proc *); void linux_schedtail(struct thread *); Modified: head/sys/i386/linux/linux_sysvec.c ============================================================================== --- head/sys/i386/linux/linux_sysvec.c Mon Apr 9 16:32:49 2018 (r332332) +++ head/sys/i386/linux/linux_sysvec.c Mon Apr 9 17:24:01 2018 (r332333) @@ -77,12 +77,6 @@ __FBSDID("$FreeBSD$"); MODULE_VERSION(linux, 1); -#if BYTE_ORDER == LITTLE_ENDIAN -#define SHELLMAGIC 0x2123 /* #! */ -#else -#define SHELLMAGIC 0x2321 -#endif - #if defined(DEBUG) SYSCTL_PROC(_compat_linux, OID_AUTO, debug, CTLTYPE_STRING | CTLFLAG_RW, 0, 0, linux_sysctl_debug, "A", "Linux debugging control"); @@ -113,7 +107,6 @@ static int linux_fixup(register_t **stack_base, static int linux_fixup_elf(register_t **stack_base, struct image_params *iparams); static void linux_sendsig(sig_t catcher, ksiginfo_t *ksi, sigset_t *mask); -static int linux_exec_imgact_try(struct image_params *iparams); static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack); static register_t *linux_copyout_strings(struct image_params *imgp); @@ -813,42 +806,6 @@ linux_fetch_syscall_args(struct thread *td) td->td_retval[1] = frame->tf_edx; return (0); -} - -/* - * If a Linux binary is exec'ing something, try this image activator - * first. We override standard shell script execution in order to - * be able to modify the interpreter path. We only do this if a Linux - * binary is doing the exec, so we do not create an EXEC module for it. - */ -static int -linux_exec_imgact_try(struct image_params *imgp) -{ - const char *head = (const char *)imgp->image_header; - char *rpath; - int error = -1; - - /* - * The interpreter for shell scripts run from a Linux binary needs - * to be located in /compat/linux if possible in order to recursively - * maintain Linux path emulation. - */ - if (((const short *)head)[0] == SHELLMAGIC) { - /* - * Run our normal shell image activator. If it succeeds then - * attempt to use the alternate path for the interpreter. If - * an alternate path is found, use our stringspace to store it. - */ - if ((error = exec_shell_imgact(imgp)) == 0) { - linux_emul_convpath(FIRST_THREAD_IN_PROC(imgp->proc), - imgp->interpreter_name, UIO_SYSSPACE, &rpath, 0, - AT_FDCWD); - if (rpath != NULL) - imgp->args->fname_buf = - imgp->interpreter_name = rpath; - } - } - return (error); } /* From owner-svn-src-head@freebsd.org Mon Apr 9 17:30:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 38E2BF91208; Mon, 9 Apr 2018 17:30:31 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DC2A08288D; Mon, 9 Apr 2018 17:30:30 +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 B95FF21B7A; Mon, 9 Apr 2018 17:30:30 +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 w39HUU9r051042; Mon, 9 Apr 2018 17:30:30 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w39HUUxw051037; Mon, 9 Apr 2018 17:30:30 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804091730.w39HUUxw051037@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 9 Apr 2018 17:30:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332334 - in head: share/man/man4 sys/conf sys/geom X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/geom X-SVN-Commit-Revision: 332334 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 17:30:31 -0000 Author: kevans Date: Mon Apr 9 17:30:30 2018 New Revision: 332334 URL: https://svnweb.freebsd.org/changeset/base/332334 Log: Retire the geom_aes class It's had a good life, but it's not really configurable and not really used. Obtained from: opBSD (with some changes) Differential Revision: https://reviews.freebsd.org/D14991 Deleted: head/sys/geom/geom_aes.c Modified: head/share/man/man4/geom.4 head/sys/conf/NOTES head/sys/conf/files head/sys/conf/options Modified: head/share/man/man4/geom.4 ============================================================================== --- head/share/man/man4/geom.4 Mon Apr 9 17:24:01 2018 (r332333) +++ head/share/man/man4/geom.4 Mon Apr 9 17:30:30 2018 (r332334) @@ -34,14 +34,13 @@ .\" .\" $FreeBSD$ .\" -.Dd August 9, 2017 +.Dd April 9, 2018 .Dt GEOM 4 .Os .Sh NAME .Nm GEOM .Nd "modular disk I/O request transformation framework" .Sh SYNOPSIS -.Cd options GEOM_AES .Cd options GEOM_BDE .Cd options GEOM_CACHE .Cd options GEOM_CONCAT Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Mon Apr 9 17:24:01 2018 (r332333) +++ head/sys/conf/NOTES Mon Apr 9 17:30:30 2018 (r332334) @@ -145,7 +145,6 @@ options INCLUDE_CONFIG_FILE # Include this file i options BOOTVERBOSE=1 options BOOTHOWTO=RB_MULTIPLE -options GEOM_AES # Don't use, use GEOM_BDE options GEOM_BDE # Disk encryption. options GEOM_BSD # BSD disklabels (obsolete, gone in 12) options GEOM_CACHE # Disk cache. Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Apr 9 17:24:01 2018 (r332333) +++ head/sys/conf/files Mon Apr 9 17:30:30 2018 (r332334) @@ -3658,7 +3658,6 @@ geom/eli/g_eli_key_cache.c optional geom_eli geom/eli/g_eli_privacy.c optional geom_eli geom/eli/pkcs5v2.c optional geom_eli geom/gate/g_gate.c optional geom_gate -geom/geom_aes.c optional geom_aes geom/geom_bsd.c optional geom_bsd geom/geom_bsd_enc.c optional geom_bsd | geom_part_bsd geom/geom_ccd.c optional ccd | geom_ccd Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Mon Apr 9 17:24:01 2018 (r332333) +++ head/sys/conf/options Mon Apr 9 17:30:30 2018 (r332334) @@ -104,7 +104,6 @@ FULL_PREEMPTION opt_sched.h GZIO opt_gzio.h IMAGACT_BINMISC opt_dontuse.h IPI_PREEMPTION opt_sched.h -GEOM_AES opt_geom.h GEOM_BDE opt_geom.h GEOM_BSD opt_geom.h GEOM_CACHE opt_geom.h From owner-svn-src-head@freebsd.org Mon Apr 9 19:11:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9F470F9AEEA; Mon, 9 Apr 2018 19:11:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 06C888D91C; Mon, 9 Apr 2018 19:11:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01E5B22C50; Mon, 9 Apr 2018 19:11:25 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w39JBOLk006250; Mon, 9 Apr 2018 19:11:24 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w39JBOIi006249; Mon, 9 Apr 2018 19:11:24 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804091911.w39JBOIi006249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 9 Apr 2018 19:11:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332335 - head/sys/amd64/linux32 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/amd64/linux32 X-SVN-Commit-Revision: 332335 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 19:11:26 -0000 Author: emaste Date: Mon Apr 9 19:11:24 2018 New Revision: 332335 URL: https://svnweb.freebsd.org/changeset/base/332335 Log: linuxulator: add else case braces to reduce diffs between archs Sponsored by: Turing Robotic Industries Inc. Modified: head/sys/amd64/linux32/linux32_sysvec.c Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Mon Apr 9 17:30:30 2018 (r332334) +++ head/sys/amd64/linux32/linux32_sysvec.c Mon Apr 9 19:11:24 2018 (r332335) @@ -805,13 +805,14 @@ linux_copyout_strings(struct image_params *imgp) imgp->args->envc + 2 + imgp->auxarg_size) * sizeof(u_int32_t)); - } else + } else { /* * The '+ 2' is for the null pointers at the end of each of * the arg and env vector sets */ vectp = (u_int32_t *)(destp - (imgp->args->argc + imgp->args->envc + 2) * sizeof(u_int32_t)); + } /* vectp also becomes our initial stack base. */ stack_base = vectp; From owner-svn-src-head@freebsd.org Mon Apr 9 19:52:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A78DF9E294; Mon, 9 Apr 2018 19:52:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id D343E6EB81; Mon, 9 Apr 2018 19:52:45 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 042CA10AFAD; Mon, 9 Apr 2018 15:52:45 -0400 (EDT) From: John Baldwin To: Warner Losh Cc: Ed Maste , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332090 - head/stand/i386 Date: Mon, 09 Apr 2018 12:28:47 -0700 Message-ID: <3188731.iHBUE9bOzj@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: References: <201804060257.w362vwi3023158@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Mon, 09 Apr 2018 15:52:45 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 19:52:46 -0000 On Monday, April 09, 2018 11:02:01 AM Warner Losh wrote: > On Mon, Apr 9, 2018 at 10:44 AM, Ed Maste wrote: > > > On 6 April 2018 at 13:54, John Baldwin wrote: > > > On Friday, April 06, 2018 02:57:58 AM Ed Maste wrote: > > >> Author: emaste > > >> Date: Fri Apr 6 02:57:58 2018 > > >> New Revision: 332090 > > >> URL: https://svnweb.freebsd.org/changeset/base/332090 > > >> > > >> Log: > > >> stand: pass --no-rosegment for i386 bits when linking with lld > > >> > > > > > > Maybe we should support LDFLAGS.${LINKER_TYPE} as we do for CFLAGS, etc.? > > > > I don't anticipate LINKER_TYPE tests proliferating, but a good point > > nonetheless. Change proposed in review D14998. > > > > We only really support two compilers. This lets us have fewer .if > statements which historically people have messed often enough that we've > move to constructs that avoid them. I do think we are likely to have far fewer conditional LDFLAGS rather than CFLAGS though. I think if we are only going to have 1 or 2 instances in the tree then LDFLAGS.LINKER_TYPE might perhaps be overkill, but if we think there will be several then I think it is more readable. -- John Baldwin From owner-svn-src-head@freebsd.org Mon Apr 9 22:06:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D434F826F7; Mon, 9 Apr 2018 22:06:19 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3DE0770898; Mon, 9 Apr 2018 22:06:19 +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 3592624948; Mon, 9 Apr 2018 22:06:19 +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 w39M6JUS096883; Mon, 9 Apr 2018 22:06:19 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w39M6GwK096856; Mon, 9 Apr 2018 22:06:16 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804092206.w39M6GwK096856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 9 Apr 2018 22:06:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332341 - in head/sys: arm/amlogic/aml8726 arm/annapurna/alpine arm/at91 arm/broadcom/bcm2835 arm/freescale/imx arm/nvidia/drm2 arm/ti dev/cpufreq dev/dpaa dev/extres/clk dev/extres/phy... X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in head/sys: arm/amlogic/aml8726 arm/annapurna/alpine arm/at91 arm/broadcom/bcm2835 arm/freescale/imx arm/nvidia/drm2 arm/ti dev/cpufreq dev/dpaa dev/extres/clk dev/extres/phy dev/extres/regulator dev... X-SVN-Commit-Revision: 332341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 22:06:20 -0000 Author: gonzo Date: Mon Apr 9 22:06:16 2018 New Revision: 332341 URL: https://svnweb.freebsd.org/changeset/base/332341 Log: Align OF_getencprop_alloc API with OF_getencprop and OF_getprop_alloc Change OF_getencprop_alloc semantics to be combination of malloc and OF_getencprop and return size of the property, not number of elements allocated. For the use cases where number of elements is preferred introduce OF_getencprop_alloc_multi helper function that copies semantics of OF_getencprop_alloc prior to this change. This is to make OF_getencprop_alloc and OF_getencprop_alloc_multi function signatures consistent with OF_getencprop_alloc and OF_getencprop_alloc_multi. Functionality-wise this patch is mostly rename of OF_getencprop_alloc to OF_getencprop_alloc_multi except two calls in ofw_bus_setup_iinfo where 1 was used as a block size. Modified: head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c head/sys/arm/annapurna/alpine/alpine_pci_msix.c head/sys/arm/at91/at91_pinctrl.c head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c head/sys/arm/freescale/imx/imx_iomux.c head/sys/arm/nvidia/drm2/tegra_drm_subr.c head/sys/arm/ti/ti_adc.c head/sys/arm/ti/ti_pinmux.c head/sys/dev/cpufreq/cpufreq_dt.c head/sys/dev/dpaa/qman_fdt.c head/sys/dev/extres/clk/clk.c head/sys/dev/extres/phy/phy.c head/sys/dev/extres/regulator/regulator.c head/sys/dev/extres/syscon/syscon.c head/sys/dev/fdt/fdt_clock.c head/sys/dev/fdt/fdt_pinctrl.c head/sys/dev/gpio/gpioregulator.c head/sys/dev/gpio/ofw_gpiobus.c head/sys/dev/ofw/ofw_bus_subr.c head/sys/dev/ofw/openfirm.c head/sys/dev/ofw/openfirm.h head/sys/dev/vnic/thunder_bgx_fdt.c head/sys/mips/ingenic/jz4780_pinctrl.c head/sys/mips/mediatek/fdt_reset.c head/sys/powerpc/mpc85xx/lbc.c Modified: head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m3.c Mon Apr 9 22:06:16 2018 (r332341) @@ -195,7 +195,7 @@ aml8726_usb_phy_attach(device_t dev) err = 0; - len = OF_getencprop_alloc(node, "usb-pwr-en", + len = OF_getencprop_alloc_multi(node, "usb-pwr-en", 3 * sizeof(pcell_t), (void **)&prop); npwr_en = (len > 0) ? len : 0; Modified: head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c ============================================================================== --- head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/arm/amlogic/aml8726/aml8726_usb_phy-m6.c Mon Apr 9 22:06:16 2018 (r332341) @@ -167,7 +167,7 @@ aml8726_usb_phy_attach(device_t dev) err = 0; - len = OF_getencprop_alloc(node, "usb-pwr-en", + len = OF_getencprop_alloc_multi(node, "usb-pwr-en", 3 * sizeof(pcell_t), (void **)&prop); npwr_en = (len > 0) ? len : 0; @@ -188,7 +188,7 @@ aml8726_usb_phy_attach(device_t dev) OF_prop_free(prop); - len = OF_getencprop_alloc(node, "usb-hub-rst", + len = OF_getencprop_alloc_multi(node, "usb-hub-rst", 3 * sizeof(pcell_t), (void **)&prop); if (len > 0) { sc->hub_rst.dev = OF_device_from_xref(prop[0]); Modified: head/sys/arm/annapurna/alpine/alpine_pci_msix.c ============================================================================== --- head/sys/arm/annapurna/alpine/alpine_pci_msix.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/arm/annapurna/alpine/alpine_pci_msix.c Mon Apr 9 22:06:16 2018 (r332341) @@ -188,7 +188,7 @@ al_msix_attach(device_t dev) sc->gic_dev = gic_dev; /* Manually read range of interrupts from DTB */ - nintr = OF_getencprop_alloc(node, "interrupts", sizeof(*intr), + nintr = OF_getencprop_alloc_multi(node, "interrupts", sizeof(*intr), (void **)&intr); if (nintr == 0) { device_printf(dev, "Cannot read interrupts prop from DTB\n"); Modified: head/sys/arm/at91/at91_pinctrl.c ============================================================================== --- head/sys/arm/at91/at91_pinctrl.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/arm/at91/at91_pinctrl.c Mon Apr 9 22:06:16 2018 (r332341) @@ -101,7 +101,8 @@ at91_pinctrl_setup_dinfo(device_t dev, phandle_t node) } resource_list_init(&ndi->rl); - nreg = OF_getencprop_alloc(node, "reg", sizeof(*reg), (void **)®); + nreg = OF_getencprop_alloc_multi(node, "reg", sizeof(*reg), + (void **)®); if (nreg == -1) nreg = 0; if (nreg % (sc->acells + sc->scells) != 0) { @@ -127,7 +128,7 @@ at91_pinctrl_setup_dinfo(device_t dev, phandle_t node) } OF_prop_free(reg); - nintr = OF_getencprop_alloc(node, "interrupts", sizeof(*intr), + nintr = OF_getencprop_alloc_multi(node, "interrupts", sizeof(*intr), (void **)&intr); if (nintr > 0) { if (OF_searchencprop(node, "interrupt-parent", &iparent, @@ -393,7 +394,7 @@ pinctrl_configure_pins(device_t bus, phandle_t cfgxref node = OF_node_from_xref(cfgxref); memset(name, 0, sizeof(name)); OF_getprop(node, "name", name, sizeof(name)); - npins = OF_getencprop_alloc(node, "atmel,pins", sizeof(*cfgdata), + npins = OF_getencprop_alloc_multi(node, "atmel,pins", sizeof(*cfgdata), (void **)&cfgdata); if (npins < 0) { printf("We're doing it wrong %s\n", name); Modified: head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/arm/broadcom/bcm2835/bcm2835_gpio.c Mon Apr 9 22:06:16 2018 (r332341) @@ -623,7 +623,7 @@ bcm_gpio_get_ro_pins(struct bcm_gpio_softc *sc, phandl pcell_t *pins; /* Get the property data. */ - npins = OF_getencprop_alloc(node, propname, sizeof(*pins), + npins = OF_getencprop_alloc_multi(node, propname, sizeof(*pins), (void **)&pins); if (npins < 0) return (-1); @@ -1214,8 +1214,8 @@ bcm_gpio_configure_pins(device_t dev, phandle_t cfgxre cfgnode = OF_node_from_xref(cfgxref); pins = NULL; - pintuples = OF_getencprop_alloc(cfgnode, "brcm,pins", sizeof(*pins), - (void **)&pins); + pintuples = OF_getencprop_alloc_multi(cfgnode, "brcm,pins", + sizeof(*pins), (void **)&pins); char name[32]; OF_getprop(cfgnode, "name", &name, sizeof(name)); @@ -1233,8 +1233,8 @@ bcm_gpio_configure_pins(device_t dev, phandle_t cfgxre } pulls = NULL; - pulltuples = OF_getencprop_alloc(cfgnode, "brcm,pull", sizeof(*pulls), - (void **)&pulls); + pulltuples = OF_getencprop_alloc_multi(cfgnode, "brcm,pull", + sizeof(*pulls), (void **)&pulls); if ((pulls != NULL) && (pulltuples != pintuples)) { OF_prop_free(pins); Modified: head/sys/arm/freescale/imx/imx_iomux.c ============================================================================== --- head/sys/arm/freescale/imx/imx_iomux.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/arm/freescale/imx/imx_iomux.c Mon Apr 9 22:06:16 2018 (r332341) @@ -153,8 +153,8 @@ iomux_configure_pins(device_t dev, phandle_t cfgxref) sc = device_get_softc(dev); cfgnode = OF_node_from_xref(cfgxref); - ntuples = OF_getencprop_alloc(cfgnode, "fsl,pins", sizeof(*cfgtuples), - (void **)&cfgtuples); + ntuples = OF_getencprop_alloc_multi(cfgnode, "fsl,pins", + sizeof(*cfgtuples), (void **)&cfgtuples); if (ntuples < 0) return (ENOENT); if (ntuples == 0) Modified: head/sys/arm/nvidia/drm2/tegra_drm_subr.c ============================================================================== --- head/sys/arm/nvidia/drm2/tegra_drm_subr.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/arm/nvidia/drm2/tegra_drm_subr.c Mon Apr 9 22:06:16 2018 (r332341) @@ -125,7 +125,7 @@ tegra_drm_encoder_attach(struct tegra_drm_encoder *out /* XXX parse output panel here */ - rv = OF_getencprop_alloc(node, "nvidia,edid", 1, + rv = OF_getencprop_alloc(node, "nvidia,edid", (void **)&output->edid); /* EDID exist but have invalid size */ @@ -174,4 +174,4 @@ int tegra_drm_encoder_exit(struct tegra_drm_encoder *o /* detach panel */ } return (0); -} \ No newline at end of file +} Modified: head/sys/arm/ti/ti_adc.c ============================================================================== --- head/sys/arm/ti/ti_adc.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/arm/ti/ti_adc.c Mon Apr 9 22:06:16 2018 (r332341) @@ -777,8 +777,9 @@ ti_adc_attach(device_t dev) if ((OF_getencprop(child, "ti,charge-delay", &cell, sizeof(cell))) > 0) sc->sc_charge_delay = cell; - nwire_configs = OF_getencprop_alloc(child, "ti,wire-config", - sizeof(*wire_configs), (void **)&wire_configs); + nwire_configs = OF_getencprop_alloc_multi(child, + "ti,wire-config", sizeof(*wire_configs), + (void **)&wire_configs); if (nwire_configs != sc->sc_tsc_wires) { device_printf(sc->sc_dev, "invalid number of ti,wire-config: %d (should be %d)\n", @@ -795,8 +796,8 @@ ti_adc_attach(device_t dev) /* Read "adc" node properties */ child = ofw_bus_find_child(node, "adc"); if (child != 0) { - sc->sc_adc_nchannels = OF_getencprop_alloc(child, "ti,adc-channels", - sizeof(*channels), (void **)&channels); + sc->sc_adc_nchannels = OF_getencprop_alloc_multi(child, + "ti,adc-channels", sizeof(*channels), (void **)&channels); if (sc->sc_adc_nchannels > 0) { for (i = 0; i < sc->sc_adc_nchannels; i++) sc->sc_adc_channels[i] = channels[i]; Modified: head/sys/arm/ti/ti_pinmux.c ============================================================================== --- head/sys/arm/ti/ti_pinmux.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/arm/ti/ti_pinmux.c Mon Apr 9 22:06:16 2018 (r332341) @@ -340,8 +340,8 @@ ti_pinmux_configure_pins(device_t dev, phandle_t cfgxr sc = device_get_softc(dev); cfgnode = OF_node_from_xref(cfgxref); - ntuples = OF_getencprop_alloc(cfgnode, "pinctrl-single,pins", sizeof(*cfgtuples), - (void **)&cfgtuples); + ntuples = OF_getencprop_alloc_multi(cfgnode, "pinctrl-single,pins", + sizeof(*cfgtuples), (void **)&cfgtuples); if (ntuples < 0) return (ENOENT); Modified: head/sys/dev/cpufreq/cpufreq_dt.c ============================================================================== --- head/sys/dev/cpufreq/cpufreq_dt.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/cpufreq/cpufreq_dt.c Mon Apr 9 22:06:16 2018 (r332341) @@ -289,7 +289,7 @@ cpufreq_dt_attach(device_t dev) return (ENXIO); } - sc->nopp = OF_getencprop_alloc(node, "operating-points", + sc->nopp = OF_getencprop_alloc_multi(node, "operating-points", sizeof(*sc->opp), (void **)&opp); if (sc->nopp == -1) return (ENXIO); Modified: head/sys/dev/dpaa/qman_fdt.c ============================================================================== --- head/sys/dev/dpaa/qman_fdt.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/dpaa/qman_fdt.c Mon Apr 9 22:06:16 2018 (r332341) @@ -185,7 +185,7 @@ qman_portals_fdt_attach(device_t dev) get_addr_props(ofw_bus_get_node(device_get_parent(dev)), &paddr, &size); get_addr_props(node, &addr, &size); - nrange = OF_getencprop_alloc(node, "ranges", + nrange = OF_getencprop_alloc_multi(node, "ranges", sizeof(*range), (void **)&range); if (nrange < addr + paddr + size) return (ENXIO); Modified: head/sys/dev/extres/clk/clk.c ============================================================================== --- head/sys/dev/extres/clk/clk.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/extres/clk/clk.c Mon Apr 9 22:06:16 2018 (r332341) @@ -1409,7 +1409,7 @@ clk_parse_ofw_out_names(device_t dev, phandle_t node, if (!OF_hasprop(node, "clock-indices")) return (name_items); - rv = OF_getencprop_alloc(node, "clock-indices", sizeof (uint32_t), + rv = OF_getencprop_alloc_multi(node, "clock-indices", sizeof (uint32_t), (void **)indices); if (rv != name_items) { device_printf(dev, " Size of 'clock-output-names' and " Modified: head/sys/dev/extres/phy/phy.c ============================================================================== --- head/sys/dev/extres/phy/phy.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/extres/phy/phy.c Mon Apr 9 22:06:16 2018 (r332341) @@ -563,7 +563,7 @@ phy_get_by_ofw_property(device_t consumer_dev, phandle "%s called on not ofw based device\n", __func__); return (ENXIO); } - ncells = OF_getencprop_alloc(cnode, name, sizeof(pcell_t), + ncells = OF_getencprop_alloc_multi(cnode, name, sizeof(pcell_t), (void **)&cells); if (ncells < 1) return (ENXIO); Modified: head/sys/dev/extres/regulator/regulator.c ============================================================================== --- head/sys/dev/extres/regulator/regulator.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/extres/regulator/regulator.c Mon Apr 9 22:06:16 2018 (r332341) @@ -1085,7 +1085,7 @@ regulator_get_by_ofw_property(device_t cdev, phandle_t } cells = NULL; - ncells = OF_getencprop_alloc(cnode, name, sizeof(*cells), + ncells = OF_getencprop_alloc_multi(cnode, name, sizeof(*cells), (void **)&cells); if (ncells <= 0) return (ENXIO); Modified: head/sys/dev/extres/syscon/syscon.c ============================================================================== --- head/sys/dev/extres/syscon/syscon.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/extres/syscon/syscon.c Mon Apr 9 22:06:16 2018 (r332341) @@ -236,7 +236,7 @@ syscon_get_by_ofw_property(device_t cdev, phandle_t cn "%s called on not ofw based device\n", __func__); return (ENXIO); } - ncells = OF_getencprop_alloc(cnode, name, sizeof(pcell_t), + ncells = OF_getencprop_alloc_multi(cnode, name, sizeof(pcell_t), (void **)&cells); if (ncells < 1) return (ENXIO); Modified: head/sys/dev/fdt/fdt_clock.c ============================================================================== --- head/sys/dev/fdt/fdt_clock.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/fdt/fdt_clock.c Mon Apr 9 22:06:16 2018 (r332341) @@ -58,7 +58,7 @@ enable_disable_all(device_t consumer, boolean_t enable boolean_t anyerrors; cnode = ofw_bus_get_node(consumer); - ncells = OF_getencprop_alloc(cnode, "clocks", sizeof(*clks), + ncells = OF_getencprop_alloc_multi(cnode, "clocks", sizeof(*clks), (void **)&clks); if (enable && ncells < 2) { device_printf(consumer, "Warning: No clocks specified in fdt " @@ -102,7 +102,7 @@ fdt_clock_get_info(device_t consumer, int n, struct fd uint32_t *clks; cnode = ofw_bus_get_node(consumer); - ncells = OF_getencprop_alloc(cnode, "clocks", sizeof(*clks), + ncells = OF_getencprop_alloc_multi(cnode, "clocks", sizeof(*clks), (void **)&clks); if (ncells <= 0) return (ENXIO); Modified: head/sys/dev/fdt/fdt_pinctrl.c ============================================================================== --- head/sys/dev/fdt/fdt_pinctrl.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/fdt/fdt_pinctrl.c Mon Apr 9 22:06:16 2018 (r332341) @@ -46,7 +46,7 @@ fdt_pinctrl_configure(device_t client, u_int index) char name[16]; snprintf(name, sizeof(name), "pinctrl-%u", index); - nconfigs = OF_getencprop_alloc(ofw_bus_get_node(client), name, + nconfigs = OF_getencprop_alloc_multi(ofw_bus_get_node(client), name, sizeof(*configs), (void **)&configs); if (nconfigs < 0) return (ENOENT); @@ -122,7 +122,7 @@ pinctrl_configure_children(device_t pinctrl, phandle_t if (!ofw_bus_node_status_okay(node)) continue; pinctrl_configure_children(pinctrl, node); - nconfigs = OF_getencprop_alloc(node, "pinctrl-0", + nconfigs = OF_getencprop_alloc_multi(node, "pinctrl-0", sizeof(*configs), (void **)&configs); if (nconfigs <= 0) continue; Modified: head/sys/dev/gpio/gpioregulator.c ============================================================================== --- head/sys/dev/gpio/gpioregulator.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/gpio/gpioregulator.c Mon Apr 9 22:06:16 2018 (r332341) @@ -216,7 +216,7 @@ gpioregulator_parse_fdt(struct gpioregulator_softc *sc return (error); /* "states" property (required) */ - len = OF_getencprop_alloc(node, "states", sizeof(*pstates), + len = OF_getencprop_alloc_multi(node, "states", sizeof(*pstates), (void **)&pstates); if (len < 2) { device_printf(sc->dev, "invalid 'states' property\n"); Modified: head/sys/dev/gpio/ofw_gpiobus.c ============================================================================== --- head/sys/dev/gpio/ofw_gpiobus.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/gpio/ofw_gpiobus.c Mon Apr 9 22:06:16 2018 (r332341) @@ -364,7 +364,7 @@ ofw_gpiobus_parse_gpios_impl(device_t consumer, phandl pcell_t *gpios; phandle_t gpio; - ncells = OF_getencprop_alloc(cnode, pname, sizeof(*gpios), + ncells = OF_getencprop_alloc_multi(cnode, pname, sizeof(*gpios), (void **)&gpios); if (ncells == -1) { device_printf(consumer, Modified: head/sys/dev/ofw/ofw_bus_subr.c ============================================================================== --- head/sys/dev/ofw/ofw_bus_subr.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/ofw/ofw_bus_subr.c Mon Apr 9 22:06:16 2018 (r332341) @@ -319,10 +319,10 @@ ofw_bus_setup_iinfo(phandle_t node, struct ofw_bus_iin addrc = 2; ii->opi_addrc = addrc * sizeof(pcell_t); - ii->opi_imapsz = OF_getencprop_alloc(node, "interrupt-map", 1, + ii->opi_imapsz = OF_getencprop_alloc(node, "interrupt-map", (void **)&ii->opi_imap); if (ii->opi_imapsz > 0) { - msksz = OF_getencprop_alloc(node, "interrupt-map-mask", 1, + msksz = OF_getencprop_alloc(node, "interrupt-map-mask", (void **)&ii->opi_imapmsk); /* * Failure to get the mask is ignored; a full mask is used @@ -449,7 +449,8 @@ ofw_bus_msimap(phandle_t node, uint16_t pci_rid, phand int err, i; /* TODO: This should be OF_searchprop_alloc if we had it */ - len = OF_getencprop_alloc(node, "msi-map", sizeof(*map), (void **)&map); + len = OF_getencprop_alloc_multi(node, "msi-map", sizeof(*map), + (void **)&map); if (len < 0) { if (msi_parent != NULL) { *msi_parent = 0; @@ -506,7 +507,8 @@ ofw_bus_reg_to_rl_helper(device_t dev, phandle_t node, if (ret == -1) name = NULL; - ret = OF_getencprop_alloc(node, reg_source, sizeof(*reg), (void **)®); + ret = OF_getencprop_alloc_multi(node, reg_source, sizeof(*reg), + (void **)®); nreg = (ret == -1) ? 0 : ret; if (nreg % (acells + scells) != 0) { @@ -584,7 +586,7 @@ ofw_bus_intr_to_rl(device_t dev, phandle_t node, int err, i, irqnum, nintr, rid; boolean_t extended; - nintr = OF_getencprop_alloc(node, "interrupts", sizeof(*intr), + nintr = OF_getencprop_alloc_multi(node, "interrupts", sizeof(*intr), (void **)&intr); if (nintr > 0) { iparent = ofw_bus_find_iparent(node); @@ -607,7 +609,7 @@ ofw_bus_intr_to_rl(device_t dev, phandle_t node, } extended = false; } else { - nintr = OF_getencprop_alloc(node, "interrupts-extended", + nintr = OF_getencprop_alloc_multi(node, "interrupts-extended", sizeof(*intr), (void **)&intr); if (nintr <= 0) return (0); @@ -650,7 +652,7 @@ ofw_bus_intr_by_rid(device_t dev, phandle_t node, int int err, i, nintr, rid; boolean_t extended; - nintr = OF_getencprop_alloc(node, "interrupts", sizeof(*intr), + nintr = OF_getencprop_alloc_multi(node, "interrupts", sizeof(*intr), (void **)&intr); if (nintr > 0) { iparent = ofw_bus_find_iparent(node); @@ -673,7 +675,7 @@ ofw_bus_intr_by_rid(device_t dev, phandle_t node, int } extended = false; } else { - nintr = OF_getencprop_alloc(node, "interrupts-extended", + nintr = OF_getencprop_alloc_multi(node, "interrupts-extended", sizeof(*intr), (void **)&intr); if (nintr <= 0) return (ESRCH); @@ -821,7 +823,7 @@ ofw_bus_parse_xref_list_internal(phandle_t node, const int rv, i, j, nelems, cnt; elems = NULL; - nelems = OF_getencprop_alloc(node, list_name, sizeof(*elems), + nelems = OF_getencprop_alloc_multi(node, list_name, sizeof(*elems), (void **)&elems); if (nelems <= 0) return (ENOENT); Modified: head/sys/dev/ofw/openfirm.c ============================================================================== --- head/sys/dev/ofw/openfirm.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/ofw/openfirm.c Mon Apr 9 22:06:16 2018 (r332341) @@ -488,9 +488,22 @@ OF_getprop_alloc_multi(phandle_t package, const char * return (len / elsz); } +ssize_t +OF_getencprop_alloc(phandle_t package, const char *name, void **buf) +{ + ssize_t ret; + ret = OF_getencprop_alloc_multi(package, name, sizeof(pcell_t), + buf); + if (ret < 0) + return (ret); + else + return (ret * sizeof(pcell_t)); +} + ssize_t -OF_getencprop_alloc(phandle_t package, const char *name, int elsz, void **buf) +OF_getencprop_alloc_multi(phandle_t package, const char *name, int elsz, + void **buf) { ssize_t retval; pcell_t *cell; @@ -499,11 +512,6 @@ OF_getencprop_alloc(phandle_t package, const char *nam retval = OF_getprop_alloc_multi(package, name, elsz, buf); if (retval == -1) return (-1); - if (retval * elsz % 4 != 0) { - free(*buf, M_OFWPROP); - *buf = NULL; - return (-1); - } cell = *buf; for (i = 0; i < retval * elsz / 4; i++) Modified: head/sys/dev/ofw/openfirm.h ============================================================================== --- head/sys/dev/ofw/openfirm.h Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/ofw/openfirm.h Mon Apr 9 22:06:16 2018 (r332341) @@ -120,6 +120,8 @@ ssize_t OF_getprop_alloc(phandle_t node, const char * ssize_t OF_getprop_alloc_multi(phandle_t node, const char *propname, int elsz, void **buf); ssize_t OF_getencprop_alloc(phandle_t node, const char *propname, + void **buf); +ssize_t OF_getencprop_alloc_multi(phandle_t node, const char *propname, int elsz, void **buf); void OF_prop_free(void *buf); int OF_nextprop(phandle_t node, const char *propname, char *buf, Modified: head/sys/dev/vnic/thunder_bgx_fdt.c ============================================================================== --- head/sys/dev/vnic/thunder_bgx_fdt.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/dev/vnic/thunder_bgx_fdt.c Mon Apr 9 22:06:16 2018 (r332341) @@ -258,7 +258,7 @@ bgx_fdt_traverse_nodes(uint8_t unit, phandle_t start, BGX_NODE_NAME, sizeof(BGX_NODE_NAME) - 1) != 0) continue; /* Get reg */ - err = OF_getencprop_alloc(node, "reg", sizeof(*reg), + err = OF_getencprop_alloc_multi(node, "reg", sizeof(*reg), (void **)®); if (err == -1) { free(reg, M_OFWPROP); Modified: head/sys/mips/ingenic/jz4780_pinctrl.c ============================================================================== --- head/sys/mips/ingenic/jz4780_pinctrl.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/mips/ingenic/jz4780_pinctrl.c Mon Apr 9 22:06:16 2018 (r332341) @@ -196,8 +196,8 @@ jz4780_pinctrl_configure_pins(device_t dev, phandle_t node = OF_node_from_xref(cfgxref); - len = OF_getencprop_alloc(node, "ingenic,pins", sizeof(uint32_t) * 4, - (void **)&value); + len = OF_getencprop_alloc_multi(node, "ingenic,pins", + sizeof(uint32_t) * 4, (void **)&value); if (len < 0) { device_printf(dev, "missing ingenic,pins attribute in FDT\n"); Modified: head/sys/mips/mediatek/fdt_reset.c ============================================================================== --- head/sys/mips/mediatek/fdt_reset.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/mips/mediatek/fdt_reset.c Mon Apr 9 22:06:16 2018 (r332341) @@ -59,7 +59,7 @@ assert_deassert_all(device_t consumer, boolean_t asser boolean_t anyerrors; rnode = ofw_bus_get_node(consumer); - ncells = OF_getencprop_alloc(rnode, "resets", sizeof(*resets), + ncells = OF_getencprop_alloc_multi(rnode, "resets", sizeof(*resets), (void **)&resets); if (!assert && ncells < 2) { device_printf(consumer, "Warning: No resets specified in fdt " Modified: head/sys/powerpc/mpc85xx/lbc.c ============================================================================== --- head/sys/powerpc/mpc85xx/lbc.c Mon Apr 9 21:46:58 2018 (r332340) +++ head/sys/powerpc/mpc85xx/lbc.c Mon Apr 9 22:06:16 2018 (r332341) @@ -374,7 +374,8 @@ fdt_lbc_reg_decode(phandle_t node, struct lbc_softc *s return (ENXIO); tuple_size = sizeof(pcell_t) * (addr_cells + size_cells); - tuples = OF_getencprop_alloc(node, "reg", tuple_size, (void **)®); + tuples = OF_getencprop_alloc_multi(node, "reg", tuple_size, + (void **)®); debugf("addr_cells = %d, size_cells = %d\n", addr_cells, size_cells); debugf("tuples = %d, tuple size = %d\n", tuples, tuple_size); if (tuples <= 0) @@ -545,7 +546,7 @@ lbc_attach(device_t dev) tuple_size = sizeof(pcell_t) * (sc->sc_addr_cells + par_addr_cells + sc->sc_size_cells); - tuples = OF_getencprop_alloc(node, "ranges", tuple_size, + tuples = OF_getencprop_alloc_multi(node, "ranges", tuple_size, (void **)&ranges); if (tuples < 0) { device_printf(dev, "could not retrieve 'ranges' property\n"); From owner-svn-src-head@freebsd.org Mon Apr 9 22:23:46 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 83370F837C9; Mon, 9 Apr 2018 22:23:46 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 31D7174826; Mon, 9 Apr 2018 22:23:46 +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 2CACF24C70; Mon, 9 Apr 2018 22:23:46 +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 w39MNkvi007275; Mon, 9 Apr 2018 22:23:46 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w39MNjp5007268; Mon, 9 Apr 2018 22:23:45 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804092223.w39MNjp5007268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Mon, 9 Apr 2018 22:23:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332342 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 332342 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 22:23:47 -0000 Author: gonzo Date: Mon Apr 9 22:23:45 2018 New Revision: 332342 URL: https://svnweb.freebsd.org/changeset/base/332342 Log: [man] Add documentation for OpenFirmware API Add man pages for following OpenFirmware functions: OF_child, OF_parent, OF_peer, OF_device_from_xref, OF_device_register_xref, OF_xref_from_device, OF_getprop, OF_getencprop, OF_getencprop_alloc, OF_getprop_alloc, OF_getproplen, OF_hasprop, OF_nextprop, OF_prop_free, OF_searchencprop, OF_searchprop, OF_setprop Edited by: wblock MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D14511 Added: head/share/man/man9/OF_child.9 (contents, props changed) head/share/man/man9/OF_device_from_xref.9 (contents, props changed) head/share/man/man9/OF_finddevice.9 (contents, props changed) head/share/man/man9/OF_getprop.9 (contents, props changed) head/share/man/man9/OF_node_from_xref.9 (contents, props changed) head/share/man/man9/OF_package_to_path.9 (contents, props changed) Modified: head/share/man/man9/Makefile Modified: head/share/man/man9/Makefile ============================================================================== --- head/share/man/man9/Makefile Mon Apr 9 22:06:16 2018 (r332341) +++ head/share/man/man9/Makefile Mon Apr 9 22:23:45 2018 (r332342) @@ -208,6 +208,12 @@ MAN= accept_filter.9 \ namei.9 \ netisr.9 \ nv.9 \ + OF_child.9 \ + OF_device_from_xref.9 \ + OF_finddevice.9 \ + OF_getprop.9 \ + OF_node_from_xref.9 \ + OF_package_to_path.9 \ ofw_bus_is_compatible.9 \ ofw_bus_status_okay.9 \ osd.9 \ @@ -1527,6 +1533,21 @@ MLINKS+=nv.9 libnv.9 \ nv.9 nvlist_take_string_array.9 \ nv.9 nvlist_unpack.9 \ nv.9 nvlist_xfer.9 +MLINKS+=OF_child.9 OF_parent.9 \ + OF_child.9 OF_peer.9 +MLINKS+=OF_device_from_xref.9 OF_device_register_xref.9 \ + OF_device_from_xref.9 OF_xref_from_device.9 +MLINKS+=OF_getprop.9 OF_getencprop.9 \ + OF_getprop.9 OF_getencprop_alloc.9 \ + OF_getprop.9 OF_getprop_alloc.9 \ + OF_getprop.9 OF_getproplen.9 \ + OF_getprop.9 OF_hasprop.9 \ + OF_getprop.9 OF_nextprop.9 \ + OF_getprop.9 OF_prop_free.9 \ + OF_getprop.9 OF_searchencprop.9 \ + OF_getprop.9 OF_searchprop.9 \ + OF_getprop.9 OF_setprop.9 +MLINKS+=OF_node_from_xref.9 OF_xref_from_node.9 MLINKS+=ofw_bus_is_compatible.9 ofw_bus_is_compatible_strict.9 \ ofw_bus_is_compatible.9 ofw_bus_node_is_compatible.9 \ ofw_bus_is_compatible.9 ofw_bus_search_compatible.9 Added: head/share/man/man9/OF_child.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/OF_child.9 Mon Apr 9 22:23:45 2018 (r332342) @@ -0,0 +1,76 @@ +.\" +.\" Copyright (c) 2018 Oleksandr Tymoshenko +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 9, 2018 +.Dt OF_CHILD 9 +.Os +.Sh NAME +.Nm OF_child , +.Nm OF_parent , +.Nm OF_peer +.Nd navigate device tree +.Sh SYNOPSIS +.In dev/ofw/ofw_bus.h +.In dev/ofw/ofw_bus_subr.h +.Ft phandle_t +.Fn OF_child "phandle_t node" +.Ft phandle_t +.Fn OF_parent "phandle_t node" +.Ft phandle_t +.Fn OF_peer "phandle_t node" +.Sh DESCRIPTION +.Pp +.Fn OF_child +returns the phandle value of the first child of the +.Fa node . +Zero is returned if there are no child nodes. +.Pp +.Fn OF_parent +returns the phandle for the parent of the +.Fa node . +Zero is returned if +.Fa node +is the root node. +.Pp +.Fn OF_peer +returns the phandle value of the next sibling of the +.Fa node . +Zero is returned if there is no sibling node. +.Sh EXAMPLES +.Bd -literal +phandle_t node, child; + ... +for (child = OF_child(node); child != 0; child = OF_peer(child) { + ... +} +.Ed +.Sh SEE ALSO +.Xr OF_finddevice 9 +.Sh AUTHORS +.An -nosplit +This manual page was written by +.An Oleksandr Tymoshenko Aq Mt gonzo@FreeBSD.org . Added: head/share/man/man9/OF_device_from_xref.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/OF_device_from_xref.9 Mon Apr 9 22:23:45 2018 (r332342) @@ -0,0 +1,91 @@ +.\" +.\" Copyright (c) 2018 Oleksandr Tymoshenko +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 9, 2018 +.Dt OF_DEVICE_FROM_XREF 9 +.Os +.Sh NAME +.Nm OF_device_from_xref , +.Nm OF_xref_from_device, +.Nm OF_device_register_xref +.Nd "manage mappings between xrefs and devices" +.Sh SYNOPSIS +.In dev/ofw/ofw_bus.h +.In dev/ofw/ofw_bus_subr.h +.Ft int +.Fn OF_device_register_xref "phandle_t xref" "device_t dev" +.Ft device_t +.Fn OF_device_from_xref "phandle_t xref" +.Ft phandle_t +.Fn OF_xref_from_device "device_t dev" +.Sh DESCRIPTION +.Pp +When a device tree node references another node, the driver may +need to get a device_t instance associated with the referenced node. +For instance, an Ethernet driver accessing a PHY device. +To make this possible, the kernel maintains a table that +maps effective handles to device_t instances. +.Pp +.Fn OF_device_register_xref +adds a map entry from the effective phandle +.Fa xref +to device +.Fa dev . +If a mapping entry for +.Fa xref +already exists, it is replaced with the new one. +The function always returns 0. +.Pp +.Fn OF_device_from_xref +returns a device_t instance associated with the effective phandle +.Fa xref . +If no such mapping exists, the function returns NULL. +.Pp +.Fn OF_xref_from_device +returns the effective phandle associated with the device +.Fa dev . +If no such mapping exists, the function returns 0. +.Sh EXAMPLES +.Bd -literal + static int + acmephy_attach(device_t dev) + { + phandle_t node; + + /* PHY node is referenced from eth device, register it */ + node = ofw_bus_get_node(dev); + OF_device_register_xref(OF_xref_from_node(node), dev); + + return (0); + } +.Ed +.Sh SEE ALSO +.Xr OF_node_to_xref 9 +.Sh AUTHORS +.An -nosplit +This manual page was written by +.An Oleksandr Tymoshenko Aq Mt gonzo@FreeBSD.org . Added: head/share/man/man9/OF_finddevice.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/OF_finddevice.9 Mon Apr 9 22:23:45 2018 (r332342) @@ -0,0 +1,74 @@ +.\" +.\" Copyright (c) 2018 Oleksandr Tymoshenko +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 9, 2018 +.Dt OF_FINDDEVICE 9 +.Os +.Sh NAME +.Nm OF_finddevice +.Nd find node in device tree +.Sh SYNOPSIS +.In dev/ofw/ofw_bus.h +.In dev/ofw/ofw_bus_subr.h +.Ft phandle_t +.Fn OF_finddevice "const char *path" +.Sh DESCRIPTION +.Pp +.Fn OF_finddevice +returns the phandle for the node specified by the +.Fa path . +Returns -1 if the path cannot be found in the tree. +.Sh CAVEATS +The return value should only be checked with equality +operators (equal to, not equal to) and not relational comparison +(less than, greater than ). +There is a discrepancy between IEEE 1275 standard and +.Fx Ns 's +internal representation of a phandle: IEEE 1275 +requires the return value of this function to be -1 if the path +is not found. +But phandle_t is an unsigned type, so it cannot +be relationally compared with -1 or 0, this comparison +is always true or always false. +.Sh EXAMPLES +.Bd -literal + phandle_t root, i2c; + + root = OF_finddevice("/"); + i2c = OF_finddevice("/soc/axi/i2c@a0e0000"); + if (i2c != -1) { + ... + } +.Ed +.Sh SEE ALSO +.Xr OF_child 9 +.Xr OF_parent 9 +.Xr OF_peer 9 +.Sh AUTHORS +.An -nosplit +This manual page was written by +.An Oleksandr Tymoshenko Aq Mt gonzo@FreeBSD.org . Added: head/share/man/man9/OF_getprop.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/OF_getprop.9 Mon Apr 9 22:23:45 2018 (r332342) @@ -0,0 +1,291 @@ +.\" +.\" Copyright (c) 2018 Oleksandr Tymoshenko +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 9, 2018 +.Dt OF_CHILD 9 +.Os +.Sh NAME +.Nm OF_getprop , +.Nm OF_getproplen , +.Nm OF_getencprop , +.Nm OF_hasprop , +.Nm OF_searchprop , +.Nm OF_searchencprop , +.Nm OF_getprop_alloc , +.Nm OF_getencprop_alloc , +.Nm OF_prop_free , +.Nm OF_nextprop , +.Nm OF_setprop +.Nd access properties of device tree node +.Sh SYNOPSIS +.In dev/ofw/ofw_bus.h +.In dev/ofw/ofw_bus_subr.h +.Ft ssize_t +.Fn OF_getproplen "phandle_t node" "const char *propname" +.Ft ssize_t +.Fn OF_getprop "phandle_t node" "const char *propname" \ +"void *buf" "size_t len" +.Ft ssize_t +.Fn OF_getencprop "phandle_t node" "const char *prop" \ +"pcell_t *buf" "size_t len" +.Ft int +.Fn OF_hasprop "phandle_t node" "const char *propname" +.Ft ssize_t +.Fn OF_searchprop "phandle_t node" "const char *propname" \ +"void *buf" "size_t len" +.Ft ssize_t +.Fn OF_searchencprop "phandle_t node" "const char *propname" \ +"pcell_t *buf" "size_t len" +.Ft ssize_t +.Fn OF_getprop_alloc "phandle_t node" "const char *propname" \ +"void **buf" +.Ft ssize_t +.Fn OF_getencprop_alloc "phandle_t node" "const char *propname" \ +"pcell_t **buf" +.Ft void +.Fn OF_prop_free "void *buf" +.Ft int +.Fn OF_nextprop "phandle_t node" "const char *propname" \ +"char *buf" "size_t len" +.Ft int +.Fn OF_setprop "phandle_t node" "const char *propname" \ +"const void *buf" "size_t len" +.Sh DESCRIPTION +.Pp +Device nodes can have associated properties. +Properties consist of a name and a value. +A name is a human-readable string from 1 to 31 characters long. +A value is an array of zero or more bytes that encode certain +information. +The meaning of that bytes depends on how drivers interpret them. +Properties can encode byte arrays, text strings, unsigned 32-bit +values or any combination of these types. +.Pp +Property with a zero-length value usually represents boolean +information. +If the property is present, it signifies true, otherwise false. +.Pp +A byte array is encoded as a sequence of bytes and represents +values like MAC addresses. +.Pp +A text string is a sequence of n printable characters. +It is encoded as a byte array of length n + 1 bytes with +characters represented as bytes plus a terminating null character. +.Pp +Unsigned 32-bit values, also sometimes called cells, are +encoded as a sequence of 4 bytes in big-endian order. +.Pp +.Fn OF_getproplen +returns either the length of the value associated with the property +.Fa propname +in the node identified by +.Fa node , +or 0 if the property exists but has no associated value. +If +.Fa propname +does not exist, -1 is returned. +.Pp +.Fn OF_getprop +copies a maximum of +.Fa len +bytes from the value associated with the property +.Fa propname +of the device node +.Fa node +into the memory specified by +.Fa buf . +Returns the actual size of the value or -1 if the +property does not exist. +.Pp +.Fn OF_getencprop +copies a maximum of +.Fa len +bytes into memory specified by +.Fa buf , +then converts cell values from big-endian to host byte order. +Returns the actual size of the value in bytes, or -1 +if the property does not exist. +.Fa len +must be a multiple of 4. +.Pp +.Fn OF_hasprop +returns 1 if the device node +.Fa node +has a property specified by +.Fa propname , +and zero if the property does not exist. +.Pp +.Fn OF_searchprop +recursively looks for the property specified by +.Fa propname +starting with the device node +.Fa node +followed by the parent node and up to the root node. +If the property is found, the function copies a maximum of +.Fa len +bytes of the value associated with the property +into the memory specified by +.Fa buf . +Returns the actual size in bytes of the value, +or -1 if the property does not exist. +.Pp +.Fn OF_searchencprop +recursively looks for the property specified by +.Fa propname +starting with the device node +.Fa node +followed by the parent node and up to the root node. +If the property is found, the function copies a maximum of +.Fa len +bytes of the value associated with the property +into the memory specified by +.Fa buf , +then converts cell values from big-endian to host byte order. +Returns the actual size in bytes of the value, +or -1 if the property does not exist. +.Pp +.Fn OF_getprop_alloc +allocates memory large enough to hold the +value associated with the property +.Fa propname +of the device node +.Fa node +and copies the value into the newly allocated memory region. +Returns the actual size of the value and stores +the address of the allocated memory in +.Fa *buf . +If the property has a zero-sized value +.Fa *buf +is set NULL. +Returns -1 if the property does not exist or +memory allocation failed. +Allocated memory should be released when no longer required +by calling +.Fn OF_prop_free . +The function might sleep when allocating memory. +.Pp +.Fn OF_getencprop_alloc +allocates enough memory to hold the +value associated with the property +.Fa propname +of the device node +.Fa node , +copies the value into the newly allocated memory region, and +then converts cell values from big-endian to host byte +order. +The actual size of the value is returned and the +address of allocated memory is stored in +.Fa *buf . +If the property has zero-length value, +.Fa *buf +is set to NULL. +Returns -1 if the property does not exist or +memory allocation failed. +Allocated memory should be released when no longer required +by calling +.Fn OF_prop_free . +The function might sleep when allocating memory. +.Pp +.Fn OF_prop_free +releases memory at +.Fa buf +that was allocated by +.Fn OF_getprop_alloc +or +.Fn OF_getencprop_alloc . +.Pp +.Fn OF_nextprop +copies a maximum of +.Fa size +bytes of the name of the property following the +.Fa propname +property into +.Fa buf . +If +.Fa propname +is NULL, the function copies the name of the first property of the +device node +.Fa node . +.Fn OF_nextprop +returns -1 if +.Fa propname +is invalid or there is an internal error, 0 if there are no more +properties after +.Fa propname , +or 1 otherwise. +.Pp +.Fn OF_setprop +sets the value of the property +.Fa propname +in the device node +.Fa node +to the value beginning at the address specified by +.Fa buf +and running for +.Fa len +bytes. +If the property does not exist, the function tries to create +it. +.Fn OF_setprop +returns the actual size of the new value, or -1 if the +property value cannot be changed or the new property +cannot be created. +.Sh EXAMPLES +.Bd -literal + phandle_t node; + phandle_t hdmixref, hdminode; + device_t hdmi; + uint8_t mac[6]; + char *model; + + /* + * Get a byte array property + */ + if (OF_getprop(node, "eth,hwaddr", mac, sizeof(mac)) != sizeof(mac)) + return; + + /* + * Get internal node reference and device associated with it + */ + if (OF_getencprop(node, "hdmi", &hdmixref) <= 0) + return; + hdmi = OF_device_from_xref(hdmixref); + + /* + * Get string value of model property of HDMI framer node + */ + hdminode = OF_node_from_xref(hdmixref); + if (OF_getprop_alloc(hdminode, "model", (void **)&model) <= 0) + return; +.Ed +.Sh SEE ALSO +.Xr OF_device_from_xref 9 +.Xr OF_node_from_xref 9 +.Sh AUTHORS +.An -nosplit +This manual page was written by +.An Oleksandr Tymoshenko Aq Mt gonzo@FreeBSD.org . Added: head/share/man/man9/OF_node_from_xref.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/OF_node_from_xref.9 Mon Apr 9 22:23:45 2018 (r332342) @@ -0,0 +1,100 @@ +.\" +.\" Copyright (c) 2018 Oleksandr Tymoshenko +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 9, 2018 +.Dt OF_NODE_FROM_XREF 9 +.Os +.Sh NAME +.Nm OF_node_from_xref , +.Nm OF_xref_from_node +.Nd convert between kernel phandle and effective phandle +.Sh SYNOPSIS +.In dev/ofw/ofw_bus.h +.In dev/ofw/ofw_bus_subr.h +.Ft phandle_t +.Fn OF_node_from_xref "phandle_t xref" +.Ft phandle_t +.Fn OF_xref_from_node "phandle_t node" +.Sh DESCRIPTION +.Pp +Some OpenFirmware implementations (FDT, IBM) have a concept +of effective phandle or xrefs. +They are used to cross-reference device tree nodes. +For instance, a framebuffer controller may refer to a GPIO +controller and pin that controls the backlight. +In this example, the GPIO node would have a cell (32-bit integer) +property with a reserved name like "phandle" or "linux,phandle" +whose value uniquely identifies the node. +The actual name depends on the implementation. +The framebuffer node would have a property with the name +described by device bindings (device-specific set of properties). +It can be a cell property or a combined property with one part +of it being a cell. +The value of the framebuffer node's property would be the same +as the value of the GPIO "phandle" property so it can be said +that the framebuffer node refers to the GPIO node. +The kernel uses internal logic to assign unique identifiers +to the device tree nodes, and these values do not match +the values of "phandle" properties. +.Fn OF_node_from_xref +and +.Fn OF_xref_from_node +are used to perform conversion between these two kinds of node +identifiers. +.Pp +.Fn OF_node_from_xref +returns the kernel phandle for the effective phandle +.Fa xref . +If one cannot be found or the OpenFirmware implementation +does not support effective phandles, the function returns +the input value. +.Pp +.Fn OF_xref_from_xref +returns the effective phandle for the kernel phandle +.Fa xref . +If one cannot be found or the OpenFirmware implementation +does not support effective phandles, the function returns +the input value. +.Sh EXAMPLES +.Bd -literal + phandle_t panelnode, panelxref; + char *model; + + if (OF_getencprop(node, "lcd-panel", &panelxref) <= 0) + return; + + panelnode = OF_node_from_xref(panelxref); + if (OF_getprop_alloc(hdminode, "model", (void **)&model) <= 0) + return; +.Ed +.Sh SEE ALSO +.Xr OF_device_from_xref 9 +.Xr OF_device_register_xref 9 +.Sh AUTHORS +.An -nosplit +This manual page was written by +.An Oleksandr Tymoshenko Aq Mt gonzo@FreeBSD.org . Added: head/share/man/man9/OF_package_to_path.9 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man9/OF_package_to_path.9 Mon Apr 9 22:23:45 2018 (r332342) @@ -0,0 +1,54 @@ +.\" +.\" Copyright (c) 2018 Oleksandr Tymoshenko +.\" +.\" 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 DEVELOPERS ``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 DEVELOPERS BE LIABLE FOR ANY DIRECT, INDIRECT, +.\" INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +.\" NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +.\" DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +.\" THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +.\" (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +.\" THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd April 9, 2018 +.Dt OF_PACKAGE_TO_PATH 9 +.Os +.Sh NAME +.Nm OF_package_to_path +.Nd get fully qualified path to a device tree node +.Sh SYNOPSIS +.In dev/ofw/ofw_bus.h +.In dev/ofw/ofw_bus_subr.h +.Ft ssize_t +.Fn OF_package_to_path "phandle_t node" "char *buf" "size_t len" +.Sh DESCRIPTION +.Pp +.Fn OF_package_to_path +copies at most +.Fa len +bytes of the fully qualified path to the device tree node +.Fa node +into the memory specified by +.Fa buf . +The function returns the number of bytes copied or -1 in case of the error. +.Sh SEE ALSO +.Xr OF_finddevice 9 +.Sh AUTHORS +.An -nosplit +This manual page was written by +.An Oleksandr Tymoshenko Aq Mt gonzo@FreeBSD.org . From owner-svn-src-head@freebsd.org Mon Apr 9 22:59:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C1287F85C37; Mon, 9 Apr 2018 22:59:10 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 749EF7F1AD; Mon, 9 Apr 2018 22:59:10 +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 6B58E25140; Mon, 9 Apr 2018 22:59:10 +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 w39MxAfn022142; Mon, 9 Apr 2018 22:59:10 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w39MxA7L022141; Mon, 9 Apr 2018 22:59:10 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201804092259.w39MxA7L022141@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 9 Apr 2018 22:59:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332343 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 332343 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 22:59:11 -0000 Author: brooks Date: Mon Apr 9 22:59:10 2018 New Revision: 332343 URL: https://svnweb.freebsd.org/changeset/base/332343 Log: Refactor PCIOCGETCONF for improved readability. The code now has a single, consistant flow for all three ioctl variants. ifdefs and for pre-FreeBSD-7 compatability are moved to functions and macros. So the flow is alwasy the same, we impose the cost of allocating, copying to, updating from, and freeing a copy of struct pci_conf_io on all paths. This change will allow PCIOCGETCONF32 support currently in sys/compat/freebsd32/freebsd32_ioctl.c to be moved here. Reviewed by: kib, jhb Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14978 Modified: head/sys/dev/pci/pci_user.c Modified: head/sys/dev/pci/pci_user.c ============================================================================== --- head/sys/dev/pci/pci_user.c Mon Apr 9 22:23:45 2018 (r332342) +++ head/sys/dev/pci/pci_user.c Mon Apr 9 22:59:10 2018 (r332343) @@ -65,8 +65,6 @@ __FBSDID("$FreeBSD$"); static d_open_t pci_open; static d_close_t pci_close; -static int pci_conf_match(struct pci_match_conf *matches, int num_matches, - struct pci_conf *match_buf); static d_ioctl_t pci_ioctl; struct cdevsw pcicdev = { @@ -106,7 +104,7 @@ pci_close(struct cdev *dev, int flag, int devtype, str * This function returns 1 on failure, 0 on success. */ static int -pci_conf_match(struct pci_match_conf *matches, int num_matches, +pci_conf_match_native(struct pci_match_conf *matches, int num_matches, struct pci_conf *match_buf) { int i; @@ -275,9 +273,6 @@ struct pci_conf_io32 { #define PCIOCREAD_OLD _IOWR('p', 2, struct pci_io_old) #define PCIOCWRITE_OLD _IOWR('p', 3, struct pci_io_old) -static int pci_conf_match_old(struct pci_match_conf_old *matches, - int num_matches, struct pci_conf *match_buf); - static int pci_conf_match_old(struct pci_match_conf_old *matches, int num_matches, struct pci_conf *match_buf) @@ -405,9 +400,46 @@ pci_conf_match_old32(struct pci_match_conf_old32 *matc return (1); } #endif /* COMPAT_FREEBSD32 */ -#endif /* PRE7_COMPAT */ +#endif /* !PRE7_COMPAT */ +union pci_conf_union { + struct pci_conf pc; +#ifdef PRE7_COMPAT + struct pci_conf_old pco; +#ifdef COMPAT_FREEBSD32 + struct pci_conf_old32 pco32; +#endif +#endif +}; + static int +pci_conf_match(u_long cmd, struct pci_match_conf *matches, int num_matches, + struct pci_conf *match_buf) +{ + + switch (cmd) { + case PCIOCGETCONF: + return (pci_conf_match_native( + (struct pci_match_conf *)matches, num_matches, match_buf)); +#ifdef PRE7_COMPAT + case PCIOCGETCONF_OLD: + return (pci_conf_match_old( + (struct pci_match_conf_old *)matches, num_matches, + match_buf)); +#ifdef COMPAT_FREEBSD32 + case PCIOCGETCONF_OLD32: + return (pci_conf_match_old32( + (struct pci_match_conf_old32 *)matches, num_matches, + match_buf)); +#endif +#endif + default: + /* programmer error */ + return (0); + } +} + +static int pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvio) { struct pci_vpd_element vpd_element, *vpd_user; @@ -490,11 +522,184 @@ pci_list_vpd(device_t dev, struct pci_list_vpd_io *lvi return (0); } +static size_t +pci_match_conf_size(u_long cmd) +{ + + switch (cmd) { + case PCIOCGETCONF: + return (sizeof(struct pci_match_conf)); +#ifdef PRE7_COMPAT + case PCIOCGETCONF_OLD: + return (sizeof(struct pci_match_conf_old)); +#ifdef COMPAT_FREEBSD32 + case PCIOCGETCONF_OLD32: + return (sizeof(struct pci_match_conf_old32)); +#endif +#endif + default: + /* programmer error */ + return (0); + } +} + +static size_t +pci_conf_size(u_long cmd) +{ + + switch (cmd) { + case PCIOCGETCONF: + return (sizeof(struct pci_conf)); +#ifdef PRE7_COMPAT + case PCIOCGETCONF_OLD: + return (sizeof(struct pci_conf_old)); +#ifdef COMPAT_FREEBSD32 + case PCIOCGETCONF_OLD32: + return (sizeof(struct pci_conf_old32)); +#endif +#endif + default: + /* programmer error */ + return (0); + } +} + +static void +pci_conf_io_init(struct pci_conf_io *cio, caddr_t data, u_long cmd) +{ +#if defined(PRE7_COMPAT) && defined(COMPAT_FREEBSD32) + struct pci_conf_io32 *cio32; +#endif + + switch (cmd) { + case PCIOCGETCONF: +#ifdef PRE7_COMPAT + case PCIOCGETCONF_OLD: +#endif + *cio = *(struct pci_conf_io *)data; + return; + +#if defined(PRE7_COMPAT) && defined(COMPAT_FREEBSD32) + case PCIOCGETCONF_OLD32: + cio32 = (struct pci_conf_io32 *)data; + cio->pat_buf_len = cio32->pat_buf_len; + cio->num_patterns = cio32->num_patterns; + cio->patterns = (void *)(uintptr_t)cio32->patterns; + cio->match_buf_len = cio32->match_buf_len; + cio->num_matches = cio32->num_matches; + cio->matches = (void *)(uintptr_t)cio32->matches; + cio->offset = cio32->offset; + cio->generation = cio32->generation; + cio->status = cio32->status; + return; +#endif + + default: + /* programmer error */ + return; + } +} + +static void +pci_conf_io_update_data(const struct pci_conf_io *cio, caddr_t data, + u_long cmd) +{ + struct pci_conf_io *d_cio; +#if defined(PRE7_COMPAT) && defined(COMPAT_FREEBSD32) + struct pci_conf_io32 *cio32; +#endif + + switch (cmd) { + case PCIOCGETCONF: +#ifdef PRE7_COMPAT + case PCIOCGETCONF_OLD: +#endif + d_cio = (struct pci_conf_io *)data; + d_cio->status = cio->status; + d_cio->generation = cio->generation; + d_cio->offset = cio->offset; + d_cio->num_matches = cio->num_matches; + return; + +#if defined(PRE7_COMPAT) && defined(COMPAT_FREEBSD32) + case PCIOCGETCONF_OLD32: + cio32 = (struct pci_conf_io32 *)data; + + cio32->status = cio->status; + cio32->generation = cio->generation; + cio32->offset = cio->offset; + cio32->num_matches = cio->num_matches; + return; +#endif + + default: + /* programmer error */ + return; + } +} + +static void +pci_conf_for_copyout(const struct pci_conf *pcp, union pci_conf_union *pcup, + u_long cmd) +{ + + memset(pcup, 0, sizeof(*pcup)); + + switch (cmd) { + case PCIOCGETCONF: + pcup->pc = *pcp; + return; + +#ifdef PRE7_COMPAT +#ifdef COMPAT_FREEBSD32 + case PCIOCGETCONF_OLD32: + pcup->pco32.pc_sel.pc_bus = pcp->pc_sel.pc_bus; + pcup->pco32.pc_sel.pc_dev = pcp->pc_sel.pc_dev; + pcup->pco32.pc_sel.pc_func = pcp->pc_sel.pc_func; + pcup->pco32.pc_hdr = pcp->pc_hdr; + pcup->pco32.pc_subvendor = pcp->pc_subvendor; + pcup->pco32.pc_subdevice = pcp->pc_subdevice; + pcup->pco32.pc_vendor = pcp->pc_vendor; + pcup->pco32.pc_device = pcp->pc_device; + pcup->pco32.pc_class = pcp->pc_class; + pcup->pco32.pc_subclass = pcp->pc_subclass; + pcup->pco32.pc_progif = pcp->pc_progif; + pcup->pco32.pc_revid = pcp->pc_revid; + strlcpy(pcup->pco32.pd_name, pcp->pd_name, + sizeof(pcup->pco32.pd_name)); + pcup->pco32.pd_unit = (uint32_t)pcp->pd_unit; + return; + +#endif /* COMPAT_FREEBSD32 */ + case PCIOCGETCONF_OLD: + pcup->pco.pc_sel.pc_bus = pcp->pc_sel.pc_bus; + pcup->pco.pc_sel.pc_dev = pcp->pc_sel.pc_dev; + pcup->pco.pc_sel.pc_func = pcp->pc_sel.pc_func; + pcup->pco.pc_hdr = pcp->pc_hdr; + pcup->pco.pc_subvendor = pcp->pc_subvendor; + pcup->pco.pc_subdevice = pcp->pc_subdevice; + pcup->pco.pc_vendor = pcp->pc_vendor; + pcup->pco.pc_device = pcp->pc_device; + pcup->pco.pc_class = pcp->pc_class; + pcup->pco.pc_subclass = pcp->pc_subclass; + pcup->pco.pc_progif = pcp->pc_progif; + pcup->pco.pc_revid = pcp->pc_revid; + strlcpy(pcup->pco.pd_name, pcp->pd_name, + sizeof(pcup->pco.pd_name)); + pcup->pco.pd_unit = pcp->pd_unit; + return; +#endif /* PRE7_COMPAT */ + + default: + /* programmer error */ + return; + } +} + static int pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flag, struct thread *td) { device_t pcidev; - void *confdata; const char *name; struct devlist *devlist_head; struct pci_conf_io *cio = NULL; @@ -504,31 +709,25 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, struct pci_list_vpd_io *lvio; struct pci_match_conf *pattern_buf; struct pci_map *pm; - size_t confsz, iolen, pbufsz; + size_t confsz, iolen; int error, ionum, i, num_patterns; + union pci_conf_union pcu; #ifdef PRE7_COMPAT -#ifdef COMPAT_FREEBSD32 - struct pci_conf_io32 *cio32 = NULL; - struct pci_conf_old32 conf_old32; - struct pci_match_conf_old32 *pattern_buf_old32 = NULL; -#endif - struct pci_conf_old conf_old; struct pci_io iodata; struct pci_io_old *io_old; - struct pci_match_conf_old *pattern_buf_old = NULL; io_old = NULL; #endif if (!(flag & FWRITE)) { switch (cmd) { + case PCIOCGETCONF: #ifdef PRE7_COMPAT + case PCIOCGETCONF_OLD: #ifdef COMPAT_FREEBSD32 case PCIOCGETCONF_OLD32: #endif - case PCIOCGETCONF_OLD: #endif - case PCIOCGETCONF: case PCIOCGETBAR: case PCIOCLISTVPD: break; @@ -537,39 +736,18 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, } } - switch (cmd) { -#ifdef PRE7_COMPAT -#ifdef COMPAT_FREEBSD32 - case PCIOCGETCONF_OLD32: - cio32 = (struct pci_conf_io32 *)data; - cio = malloc(sizeof(struct pci_conf_io), M_TEMP, M_WAITOK); - cio->pat_buf_len = cio32->pat_buf_len; - cio->num_patterns = cio32->num_patterns; - cio->patterns = (void *)(uintptr_t)cio32->patterns; - cio->match_buf_len = cio32->match_buf_len; - cio->num_matches = cio32->num_matches; - cio->matches = (void *)(uintptr_t)cio32->matches; - cio->offset = cio32->offset; - cio->generation = cio32->generation; - cio->status = cio32->status; - cio32->num_matches = 0; - break; -#endif - case PCIOCGETCONF_OLD: -#endif - case PCIOCGETCONF: - cio = (struct pci_conf_io *)data; - } switch (cmd) { + case PCIOCGETCONF: #ifdef PRE7_COMPAT + case PCIOCGETCONF_OLD: #ifdef COMPAT_FREEBSD32 case PCIOCGETCONF_OLD32: #endif - case PCIOCGETCONF_OLD: #endif - case PCIOCGETCONF: - + cio = malloc(sizeof(struct pci_conf_io), M_TEMP, + M_WAITOK | M_ZERO); + pci_conf_io_init(cio, data, cmd); pattern_buf = NULL; num_patterns = 0; dinfo = NULL; @@ -608,17 +786,7 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, * multiple of sizeof(struct pci_conf) in case the user * didn't specify a multiple of that size. */ -#ifdef PRE7_COMPAT -#ifdef COMPAT_FREEBSD32 - if (cmd == PCIOCGETCONF_OLD32) - confsz = sizeof(struct pci_conf_old32); - else -#endif - if (cmd == PCIOCGETCONF_OLD) - confsz = sizeof(struct pci_conf_old); - else -#endif - confsz = sizeof(struct pci_conf); + confsz = pci_conf_size(cmd); iolen = min(cio->match_buf_len - (cio->match_buf_len % confsz), pci_numdevs * confsz); @@ -647,18 +815,8 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, * it's far more likely to just catch folks that * updated their kernel but not their userland. */ -#ifdef PRE7_COMPAT -#ifdef COMPAT_FREEBSD32 - if (cmd == PCIOCGETCONF_OLD32) - pbufsz = sizeof(struct pci_match_conf_old32); - else -#endif - if (cmd == PCIOCGETCONF_OLD) - pbufsz = sizeof(struct pci_match_conf_old); - else -#endif - pbufsz = sizeof(struct pci_match_conf); - if (cio->num_patterns * pbufsz != cio->pat_buf_len) { + if (cio->num_patterns * pci_match_conf_size(cmd) != + cio->pat_buf_len) { /* The user made a mistake, return an error. */ cio->status = PCI_GETCONF_ERROR; error = EINVAL; @@ -668,28 +826,10 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, /* * Allocate a buffer to hold the patterns. */ -#ifdef PRE7_COMPAT -#ifdef COMPAT_FREEBSD32 - if (cmd == PCIOCGETCONF_OLD32) { - pattern_buf_old32 = malloc(cio->pat_buf_len, - M_TEMP, M_WAITOK); - error = copyin(cio->patterns, - pattern_buf_old32, cio->pat_buf_len); - } else -#endif /* COMPAT_FREEBSD32 */ - if (cmd == PCIOCGETCONF_OLD) { - pattern_buf_old = malloc(cio->pat_buf_len, - M_TEMP, M_WAITOK); - error = copyin(cio->patterns, - pattern_buf_old, cio->pat_buf_len); - } else -#endif /* PRE7_COMPAT */ - { - pattern_buf = malloc(cio->pat_buf_len, M_TEMP, - M_WAITOK); - error = copyin(cio->patterns, pattern_buf, - cio->pat_buf_len); - } + pattern_buf = malloc(cio->pat_buf_len, M_TEMP, + M_WAITOK); + error = copyin(cio->patterns, pattern_buf, + cio->pat_buf_len); if (error != 0) { error = EINVAL; goto getconfexit; @@ -732,27 +872,9 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, dinfo->conf.pd_unit = 0; } -#ifdef PRE7_COMPAT - if ( -#ifdef COMPAT_FREEBSD32 - (cmd == PCIOCGETCONF_OLD32 && - (pattern_buf_old32 == NULL || - pci_conf_match_old32(pattern_buf_old32, - num_patterns, &dinfo->conf) == 0)) || -#endif - (cmd == PCIOCGETCONF_OLD && - (pattern_buf_old == NULL || - pci_conf_match_old(pattern_buf_old, num_patterns, - &dinfo->conf) == 0)) || - (cmd == PCIOCGETCONF && - (pattern_buf == NULL || - pci_conf_match(pattern_buf, num_patterns, - &dinfo->conf) == 0))) { -#else if (pattern_buf == NULL || - pci_conf_match(pattern_buf, num_patterns, + pci_conf_match(cmd, pattern_buf, num_patterns, &dinfo->conf) == 0) { -#endif /* * If we've filled up the user's buffer, * break out at this point. Since we've @@ -766,79 +888,8 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, break; } -#ifdef PRE7_COMPAT -#ifdef COMPAT_FREEBSD32 - if (cmd == PCIOCGETCONF_OLD32) { - memset(&conf_old32, 0, - sizeof(conf_old32)); - conf_old32.pc_sel.pc_bus = - dinfo->conf.pc_sel.pc_bus; - conf_old32.pc_sel.pc_dev = - dinfo->conf.pc_sel.pc_dev; - conf_old32.pc_sel.pc_func = - dinfo->conf.pc_sel.pc_func; - conf_old32.pc_hdr = dinfo->conf.pc_hdr; - conf_old32.pc_subvendor = - dinfo->conf.pc_subvendor; - conf_old32.pc_subdevice = - dinfo->conf.pc_subdevice; - conf_old32.pc_vendor = - dinfo->conf.pc_vendor; - conf_old32.pc_device = - dinfo->conf.pc_device; - conf_old32.pc_class = - dinfo->conf.pc_class; - conf_old32.pc_subclass = - dinfo->conf.pc_subclass; - conf_old32.pc_progif = - dinfo->conf.pc_progif; - conf_old32.pc_revid = - dinfo->conf.pc_revid; - strncpy(conf_old32.pd_name, - dinfo->conf.pd_name, - sizeof(conf_old32.pd_name)); - conf_old32.pd_name[PCI_MAXNAMELEN] = 0; - conf_old32.pd_unit = - (uint32_t)dinfo->conf.pd_unit; - confdata = &conf_old32; - } else -#endif /* COMPAT_FREEBSD32 */ - if (cmd == PCIOCGETCONF_OLD) { - memset(&conf_old, 0, sizeof(conf_old)); - conf_old.pc_sel.pc_bus = - dinfo->conf.pc_sel.pc_bus; - conf_old.pc_sel.pc_dev = - dinfo->conf.pc_sel.pc_dev; - conf_old.pc_sel.pc_func = - dinfo->conf.pc_sel.pc_func; - conf_old.pc_hdr = dinfo->conf.pc_hdr; - conf_old.pc_subvendor = - dinfo->conf.pc_subvendor; - conf_old.pc_subdevice = - dinfo->conf.pc_subdevice; - conf_old.pc_vendor = - dinfo->conf.pc_vendor; - conf_old.pc_device = - dinfo->conf.pc_device; - conf_old.pc_class = - dinfo->conf.pc_class; - conf_old.pc_subclass = - dinfo->conf.pc_subclass; - conf_old.pc_progif = - dinfo->conf.pc_progif; - conf_old.pc_revid = - dinfo->conf.pc_revid; - strncpy(conf_old.pd_name, - dinfo->conf.pd_name, - sizeof(conf_old.pd_name)); - conf_old.pd_name[PCI_MAXNAMELEN] = 0; - conf_old.pd_unit = - dinfo->conf.pd_unit; - confdata = &conf_old; - } else -#endif /* PRE7_COMPAT */ - confdata = &dinfo->conf; - error = copyout(confdata, + pci_conf_for_copyout(&dinfo->conf, &pcu, cmd); + error = copyout(&pcu, (caddr_t)cio->matches + confsz * cio->num_matches, confsz); if (error) @@ -871,23 +922,9 @@ pci_ioctl(struct cdev *dev, u_long cmd, caddr_t data, cio->status = PCI_GETCONF_MORE_DEVS; getconfexit: -#ifdef PRE7_COMPAT -#ifdef COMPAT_FREEBSD32 - if (cmd == PCIOCGETCONF_OLD32) { - cio32->status = cio->status; - cio32->generation = cio->generation; - cio32->offset = cio->offset; - cio32->num_matches = cio->num_matches; - free(cio, M_TEMP); - } - if (pattern_buf_old32 != NULL) - free(pattern_buf_old32, M_TEMP); -#endif - if (pattern_buf_old != NULL) - free(pattern_buf_old, M_TEMP); -#endif - if (pattern_buf != NULL) - free(pattern_buf, M_TEMP); + pci_conf_io_update_data(cio, data, cmd); + free(cio, M_TEMP); + free(pattern_buf, M_TEMP); break; From owner-svn-src-head@freebsd.org Mon Apr 9 23:36:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BFE9AF882BA; Mon, 9 Apr 2018 23:36:53 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 71D9186DBA; Mon, 9 Apr 2018 23:36:53 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66E47257B4; Mon, 9 Apr 2018 23:36:53 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w39Nar7p042371; Mon, 9 Apr 2018 23:36:53 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w39NaqVs042367; Mon, 9 Apr 2018 23:36:52 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201804092336.w39NaqVs042367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Mon, 9 Apr 2018 23:36:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332344 - in head/sys: arm/mv dev/cesa X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: in head/sys: arm/mv dev/cesa X-SVN-Commit-Revision: 332344 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 23:36:54 -0000 Author: mw Date: Mon Apr 9 23:36:52 2018 New Revision: 332344 URL: https://svnweb.freebsd.org/changeset/base/332344 Log: Enable cesa driver to work with Linux DT binding Linux device tree binding, whose usage is obligatory, comprises faulty representation of Marvell cryptographic engine (CESA) - two engines are artificially gathered into single DT node, in order to avoid certain SW limitation. This patch improves the cesa driver to support above binding, depending on compatible string, which helps to ensure backward compatibility. Submitted by: Patryk Duda Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D14760 Modified: head/sys/arm/mv/mv_common.c head/sys/arm/mv/mvwin.h head/sys/dev/cesa/cesa.c head/sys/dev/cesa/cesa.h Modified: head/sys/arm/mv/mv_common.c ============================================================================== --- head/sys/arm/mv/mv_common.c Mon Apr 9 22:59:10 2018 (r332343) +++ head/sys/arm/mv/mv_common.c Mon Apr 9 23:36:52 2018 (r332344) @@ -108,6 +108,7 @@ static int decode_win_xor_valid(void); static void decode_win_cpu_setup(void); static int decode_win_sdram_fixup(void); static void decode_win_cesa_setup(u_long); +static void decode_win_a38x_cesa_setup(u_long); static void decode_win_usb_setup(u_long); static void decode_win_usb3_setup(u_long); static void decode_win_eth_setup(u_long); @@ -120,6 +121,7 @@ static void decode_win_idma_setup(u_long); static void decode_win_xor_setup(u_long); static void decode_win_cesa_dump(u_long); +static void decode_win_a38x_cesa_dump(u_long); static void decode_win_usb_dump(u_long); static void decode_win_usb3_dump(u_long); static void decode_win_eth_dump(u_long base); @@ -226,6 +228,8 @@ static struct soc_node_spec soc_nodes[] = { { "mrvl,idma", &decode_win_idma_setup, &decode_win_idma_dump, &decode_win_idma_valid}, { "mrvl,cesa", &decode_win_cesa_setup, &decode_win_cesa_dump, &decode_win_cesa_valid}, { "mrvl,pcie", &decode_win_pcie_setup, &decode_win_pcie_dump, &decode_win_pcie_valid}, + { "marvell,armada-38x-crypto", &decode_win_a38x_cesa_setup, + &decode_win_a38x_cesa_dump, &decode_win_cesa_valid}, { NULL, NULL, NULL, NULL }, }; @@ -1558,6 +1562,20 @@ decode_win_cesa_setup(u_long base) } } } +} + +static void +decode_win_a38x_cesa_setup(u_long base) +{ + decode_win_cesa_setup(base); + decode_win_cesa_setup(base + MV_WIN_CESA_OFFSET); +} + +static void +decode_win_a38x_cesa_dump(u_long base) +{ + decode_win_cesa_dump(base); + decode_win_cesa_dump(base + MV_WIN_CESA_OFFSET); } /************************************************************************** Modified: head/sys/arm/mv/mvwin.h ============================================================================== --- head/sys/arm/mv/mvwin.h Mon Apr 9 22:59:10 2018 (r332343) +++ head/sys/arm/mv/mvwin.h Mon Apr 9 23:36:52 2018 (r332344) @@ -202,6 +202,8 @@ #define MV_WIN_NETA_OFFSET 0x2000 #define MV_WIN_NETA_BASE(n) MV_WIN_ETH_BASE(n) + MV_WIN_NETA_OFFSET +#define MV_WIN_CESA_OFFSET 0x2000 + #define MV_WIN_ETH_BASE(n) (0x8 * (n) + 0x200) #define MV_WIN_ETH_SIZE(n) (0x8 * (n) + 0x204) #define MV_WIN_ETH_REMAP(n) (0x4 * (n) + 0x280) Modified: head/sys/dev/cesa/cesa.c ============================================================================== --- head/sys/dev/cesa/cesa.c Mon Apr 9 22:59:10 2018 (r332343) +++ head/sys/dev/cesa/cesa.c Mon Apr 9 23:36:52 2018 (r332344) @@ -59,6 +59,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -76,6 +77,7 @@ __FBSDID("$FreeBSD$"); static int cesa_probe(device_t); static int cesa_attach(device_t); +static int cesa_attach_late(device_t); static int cesa_detach(device_t); static void cesa_intr(void *); static int cesa_newsession(device_t, u_int32_t *, struct cryptoini *); @@ -1003,14 +1005,130 @@ cesa_setup_sram(struct cesa_softc *sc) return (0); } +/* + * Function: device_from_node + * This function returns appropriate device_t to phandle_t + * Parameters: + * root - device where you want to start search + * if you provide NULL here, function will take + * "root0" device as root. + * node - we are checking every device_t to be + * appropriate with this. + */ +static device_t +device_from_node(device_t root, phandle_t node) +{ + device_t *children, retval; + int nkid, i; + + /* Nothing matches no node */ + if (node == -1) + return (NULL); + + if (root == NULL) + /* Get root of device tree */ + if ((root = device_lookup_by_name("root0")) == NULL) + return (NULL); + + if (device_get_children(root, &children, &nkid) != 0) + return (NULL); + + retval = NULL; + for (i = 0; i < nkid; i++) { + /* Check if device and node matches */ + if (OFW_BUS_GET_NODE(root, children[i]) == node) { + retval = children[i]; + break; + } + /* or go deeper */ + if ((retval = device_from_node(children[i], node)) != NULL) + break; + } + free(children, M_TEMP); + + return (retval); +} + static int +cesa_setup_sram_armada(struct cesa_softc *sc) +{ + phandle_t sram_node; + ihandle_t sram_ihandle; + pcell_t sram_handle[2]; + void *sram_va; + int rv, j; + struct resource_list rl; + struct resource_list_entry *rle; + struct simplebus_softc *ssc; + device_t sdev; + + /* Get refs to SRAMS from CESA node */ + rv = OF_getencprop(ofw_bus_get_node(sc->sc_dev), "marvell,crypto-srams", + (void *)sram_handle, sizeof(sram_handle)); + if (rv <= 0) + return (rv); + + if (sc->sc_cesa_engine_id >= 2) + return (ENXIO); + + /* Get SRAM node on the basis of sc_cesa_engine_id */ + sram_ihandle = (ihandle_t)sram_handle[sc->sc_cesa_engine_id]; + sram_node = OF_instance_to_package(sram_ihandle); + + /* Get device_t of simplebus (sram_node parent) */ + sdev = device_from_node(NULL, OF_parent(sram_node)); + if (!sdev) + return (ENXIO); + + ssc = device_get_softc(sdev); + + resource_list_init(&rl); + /* Parse reg property to resource list */ + ofw_bus_reg_to_rl(sdev, sram_node, ssc->acells, + ssc->scells, &rl); + + /* We expect only one resource */ + rle = resource_list_find(&rl, SYS_RES_MEMORY, 0); + if (rle == NULL) + return (ENXIO); + + /* Remap through ranges property */ + for (j = 0; j < ssc->nranges; j++) { + if (rle->start >= ssc->ranges[j].bus && + rle->end < ssc->ranges[j].bus + ssc->ranges[j].size) { + rle->start -= ssc->ranges[j].bus; + rle->start += ssc->ranges[j].host; + rle->end -= ssc->ranges[j].bus; + rle->end += ssc->ranges[j].host; + } + } + + sc->sc_sram_base_pa = rle->start; + sc->sc_sram_size = rle->count; + + /* SRAM memory was not mapped in platform_sram_devmap(), map it now */ + sram_va = pmap_mapdev(sc->sc_sram_base_pa, sc->sc_sram_size); + if (sram_va == NULL) + return (ENOMEM); + sc->sc_sram_base_va = (vm_offset_t)sram_va; + + return (0); +} + +struct ofw_compat_data cesa_devices[] = { + { "mrvl,cesa", (uintptr_t)true }, + { "marvell,armada-38x-crypto", (uintptr_t)true }, + { NULL, 0 } +}; + +static int cesa_probe(device_t dev) { if (!ofw_bus_status_okay(dev)) return (ENXIO); - if (!ofw_bus_is_compatible(dev, "mrvl,cesa")) + if (!ofw_bus_search_compatible(dev, cesa_devices)->ocd_data) return (ENXIO); device_set_desc(dev, "Marvell Cryptographic Engine and Security " @@ -1022,7 +1140,78 @@ cesa_probe(device_t dev) static int cesa_attach(device_t dev) { + static int engine_idx = 0; + struct simplebus_devinfo *ndi; + struct resource_list *rl; struct cesa_softc *sc; + + if (!ofw_bus_is_compatible(dev, "marvell,armada-38x-crypto")) + return (cesa_attach_late(dev)); + + /* + * Get simplebus_devinfo which contains + * resource list filled with adresses and + * interrupts read form FDT. + * Let's correct it by splitting resources + * for each engine. + */ + if ((ndi = device_get_ivars(dev)) == NULL) + return (ENXIO); + + rl = &ndi->rl; + + switch (engine_idx) { + case 0: + /* Update regs values */ + resource_list_add(rl, SYS_RES_MEMORY, 0, CESA0_TDMA_ADDR, + CESA0_TDMA_ADDR + CESA_TDMA_SIZE - 1, CESA_TDMA_SIZE); + resource_list_add(rl, SYS_RES_MEMORY, 1, CESA0_CESA_ADDR, + CESA0_CESA_ADDR + CESA_CESA_SIZE - 1, CESA_CESA_SIZE); + + /* Remove unused interrupt */ + resource_list_delete(rl, SYS_RES_IRQ, 1); + break; + + case 1: + /* Update regs values */ + resource_list_add(rl, SYS_RES_MEMORY, 0, CESA1_TDMA_ADDR, + CESA1_TDMA_ADDR + CESA_TDMA_SIZE - 1, CESA_TDMA_SIZE); + resource_list_add(rl, SYS_RES_MEMORY, 1, CESA1_CESA_ADDR, + CESA1_CESA_ADDR + CESA_CESA_SIZE - 1, CESA_CESA_SIZE); + + /* Remove unused interrupt */ + resource_list_delete(rl, SYS_RES_IRQ, 0); + resource_list_find(rl, SYS_RES_IRQ, 1)->rid = 0; + break; + + default: + device_printf(dev, "Bad cesa engine_idx\n"); + return (ENXIO); + } + + sc = device_get_softc(dev); + sc->sc_cesa_engine_id = engine_idx; + + /* + * Call simplebus_add_device only once. + * It will create second cesa driver instance + * with the same FDT node as first instance. + * When second driver reach this function, + * it will be configured to use second cesa engine + */ + if (engine_idx == 0) + simplebus_add_device(device_get_parent(dev), ofw_bus_get_node(dev), + 0, "cesa", 1, NULL); + + engine_idx++; + + return (cesa_attach_late(dev)); +} + +static int +cesa_attach_late(device_t dev) +{ + struct cesa_softc *sc; uint32_t d, r, val; int error; int i; @@ -1086,7 +1275,11 @@ cesa_attach(device_t dev) } /* Acquire SRAM base address */ - error = cesa_setup_sram(sc); + if (!ofw_bus_is_compatible(dev, "marvell,armada-38x-crypto")) + error = cesa_setup_sram(sc); + else + error = cesa_setup_sram_armada(sc); + if (error) { device_printf(dev, "could not setup SRAM\n"); goto err1; Modified: head/sys/dev/cesa/cesa.h ============================================================================== --- head/sys/dev/cesa/cesa.h Mon Apr 9 22:59:10 2018 (r332343) +++ head/sys/dev/cesa/cesa.h Mon Apr 9 23:36:52 2018 (r332344) @@ -239,6 +239,7 @@ struct cesa_softc { bus_dma_tag_t sc_data_dtag; int sc_error; int sc_tperr; + uint8_t sc_cesa_engine_id; struct mtx sc_sc_lock; int sc_blocked; @@ -367,4 +368,10 @@ struct cesa_chain_info { #define CESA_SA_SR 0x0E0C #define CESA_SA_SR_ACTIVE (1 << 0) +#define CESA_TDMA_SIZE 0x1000 +#define CESA_CESA_SIZE 0x1000 +#define CESA0_TDMA_ADDR 0x90000 +#define CESA0_CESA_ADDR 0x9D000 +#define CESA1_TDMA_ADDR 0x92000 +#define CESA1_CESA_ADDR 0x9F000 #endif From owner-svn-src-head@freebsd.org Mon Apr 9 23:38:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E96C4F884C8; Mon, 9 Apr 2018 23:38:41 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (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 8384A875B6; Mon, 9 Apr 2018 23:38:41 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id C521221080; Mon, 9 Apr 2018 19:38:40 -0400 (EDT) Received: from mailfrontend1 ([10.202.2.162]) by compute1.internal (MEProxy); Mon, 09 Apr 2018 19:38:40 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-sender :x-me-sender:x-sasl-enc; s=fm2; bh=yQTr6e0Lfj/6KWrjW2usGY5+GCpg/ AkjJo3F8kOY3Fg=; b=MsgxOPZodzb2YqGMVR6PC4bPJFZZOh5JD6pA+YKrJNj7z zLw6YtsbjbBBYHne967y+LyvUKlr5LArPSDh7dzQwgioxWegzbYecCOtC0UYvTLT DE1aVjJHoZzGjL4QXQ1jxiFc3a99hoebr023NEOYzMRTa1FGpJ+5Zaq6pxXQQuoH ZVBYClreoQRY27q9QagcOlIkIm+HVlJRrdINMDe8io1upl3lfjesyF9fKqkqsICL nLf7zxDwLClvki4oIETbvMtxn1Ekg1BjQx/zsbziwmcIR23x0ch5mzeS8rNrYUCo cx/6Vi3/C2JUDD4AqdBDAqOSoyatVgq3HfFY+86RQ== X-ME-Sender: Received: from [10.57.2.204] (unknown [209.63.143.172]) by mail.messagingengine.com (Postfix) with ESMTPA id 20804E4449; Mon, 9 Apr 2018 19:38:40 -0400 (EDT) From: Benno Rice Message-Id: Mime-Version: 1.0 (Mac OS X Mail 11.3 \(3445.6.18\)) Subject: Re: svn commit: r331843 - in head/usr.sbin/makefs: . cd9660 Date: Mon, 9 Apr 2018 16:38:38 -0700 In-Reply-To: <20180409133717.GB82598@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Glen Barber References: <201803311504.w2VF4gxR024784@repo.freebsd.org> <20180409133717.GB82598@FreeBSD.org> X-Mailer: Apple Mail (2.3445.6.18) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 09 Apr 2018 23:38:42 -0000 > On Apr 9, 2018, at 6:37 AM, Glen Barber wrote: [snip] > It appears this part has broken creating disc1.iso (and other ISO > images) for amd64. I see the following error: [snip] Yep, that=E2=80=99s on me. I forgot to update mkisoimages.sh. Could you = try the attached patch? From owner-svn-src-head@freebsd.org Tue Apr 10 00:39:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D248F8C58F; Tue, 10 Apr 2018 00:39:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-it0-x236.google.com (mail-it0-x236.google.com [IPv6:2607:f8b0:4001:c0b::236]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DD9AD76A73; Tue, 10 Apr 2018 00:39:20 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-it0-x236.google.com with SMTP id 15-v6so12654961itl.1; Mon, 09 Apr 2018 17:39:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=+J9iqXZFvIgvyLERMoSmzE53hieHEb96jkcbgW6Lr4E=; b=lj7NX1gpYVtNvQO0LSBiGjrRSVsPclvjs6XMAhIgxeuVapiekpd3B9KdgBZxatAVWk vH297c+aynj2Cf2TzXL14J4+r2XiAc1iXWpi3lg9B8wJa/L50ktn9C8pTBfzZw773FW3 pAFnKqBwZHs9IkSxh7fwGgiYe+c+6csMlqmLOEZoKBMSVu4RMcIv62f6Kxd9f2N9bYdA fTzhiNR17nQIJLdpT6qvRd2dgFrhokIOMuW/CveOzHJLJVDIcMIcZ4vEEZ5EWONFqxqw o0rqRVI7DQVePTUZotyA1IEHcPvdFrPDDmtm24F9TNE6FZ6DBJ26LrH8fFxgAYxUr36u 0CpA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=+J9iqXZFvIgvyLERMoSmzE53hieHEb96jkcbgW6Lr4E=; b=inwex4HojUTOPa8Nsyvb8Wf7iH1i0PF1XSPUiJbG/acaffjclEIIH36+H7jHZlXSrA vRL0XHXuIxfs9sWzUuGlfE+4IPb2LCoX6ih5jDRK6DvMKQqhLReKpw7YAW/TbXkup+5T r4rYhj0Bn6gFeltzewbgTJZAl3ms1Sg4FnEN1iFJIkbZsBw9rYHmc7w5QV9rdbIZ/neo FMTqP9x5BA4uWhIfqzHH+Hx0lgteKVo0UQKb7wEv7s6BwlbUDex4XJcj69SN4moJHEle 7GouqIzTmXQK7BfnWcAS28+rIjI4BTC6i/5j57x/sPZBx791pjhznoJK9EBi5eeEEQ6F 3LWQ== X-Gm-Message-State: ALQs6tAnF4KaievVMtsIsIBvpbQ+TK08KqMBWlk4pzGyk7Ah/BtrRwDr K/hdSdk59Jjdy1DejMOuVMpJrlpQq31t9qiGrQDc3dnd X-Google-Smtp-Source: AIpwx4+5MIkSBBUNvIWLbDPLBzKBIZrjNpbgsYqgJvBI54xNObDP87HtUGy/CaChbcpEXZJUjGqJhrpqo/tF+LlGqGI= X-Received: by 2002:a24:a0c6:: with SMTP id o189-v6mr58205ite.52.1523320760193; Mon, 09 Apr 2018 17:39:20 -0700 (PDT) MIME-Version: 1.0 Sender: carpeddiem@gmail.com Received: by 10.107.130.197 with HTTP; Mon, 9 Apr 2018 17:38:59 -0700 (PDT) In-Reply-To: <3188731.iHBUE9bOzj@ralph.baldwin.cx> References: <201804060257.w362vwi3023158@repo.freebsd.org> <3188731.iHBUE9bOzj@ralph.baldwin.cx> From: Ed Maste Date: Mon, 9 Apr 2018 20:38:59 -0400 X-Google-Sender-Auth: paa6-3UAbG1K_cTCzkBqn1WWE58 Message-ID: Subject: Re: svn commit: r332090 - head/stand/i386 To: John Baldwin Cc: Warner Losh , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 00:39:21 -0000 On 9 April 2018 at 15:28, John Baldwin wrote: > > I do think we are likely to have far fewer conditional LDFLAGS rather > than CFLAGS though. I think if we are only going to have 1 or 2 > instances in the tree then LDFLAGS.LINKER_TYPE might perhaps be > overkill, but if we think there will be several then I think it is > more readable. Indeed, I don't anticipate we'd end up with more than 1 or 2 instances, but even with only the single case today I think it is clearer (D14998). From owner-svn-src-head@freebsd.org Tue Apr 10 01:44:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3589EF915D6; Tue, 10 Apr 2018 01:44:07 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB3A5878D6; Tue, 10 Apr 2018 01:44:06 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from FreeBSD.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by freefall.freebsd.org (Postfix) with ESMTPS id 82BC81DFCA; Tue, 10 Apr 2018 01:44:06 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Date: Tue, 10 Apr 2018 01:44:04 +0000 From: Glen Barber To: Benno Rice Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r331843 - in head/usr.sbin/makefs: . cd9660 Message-ID: <20180410014404.GK91263@FreeBSD.org> References: <201803311504.w2VF4gxR024784@repo.freebsd.org> <20180409133717.GB82598@FreeBSD.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="/rDaUNvWv5XYRSKj" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 01:44:07 -0000 --/rDaUNvWv5XYRSKj Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Mon, Apr 09, 2018 at 04:38:38PM -0700, Benno Rice wrote: >=20 >=20 > > On Apr 9, 2018, at 6:37 AM, Glen Barber wrote: >=20 > [snip] >=20 > > It appears this part has broken creating disc1.iso (and other ISO > > images) for amd64. I see the following error: >=20 > [snip] >=20 > Yep, that=E2=80=99s on me. I forgot to update mkisoimages.sh. Could you t= ry the attached patch? >=20 % Index: release/amd64/mkisoimages.sh % =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 % --- release/amd64/mkisoimages.sh (revision 332343) % +++ release/amd64/mkisoimages.sh (working copy) % @@ -38,7 +38,7 @@ % umount efi % rmdir efi % mdconfig -d -u $device % - bootable=3D"-o bootimage=3Defi;efiboot.img -o no-emul-boot $bootable" % + bootable=3D"-o bootimage=3Di386;efiboot.img -o no-emul-boot $bootable -= o platformid=3Defi" % =09 % shift % else This appears to have fixed it. Glen --/rDaUNvWv5XYRSKj Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEjRJAPC5sqwhs9k2jAxRYpUeP4pMFAlrMFt8ACgkQAxRYpUeP 4pP+uxAAoHi8+UlSwH4cIGRyXv9k6ZEnFnJtVEVP+TFOe9BCQjuhOOY+3UPP+LeQ DBdcueFlohITGeUI7XBFqYB1bbP7GXe2fhFRX+OjABdtKscQ5p4CiYyUtbHf0z/u N7tNLuUnDV4eQU3oPMlh7yAzooq1OuFJvNK25FPwSFdye1ApMRbiH9DdPpELd/WG 7WX5qtFhTCIlOWnJmvm3+WnFTgvmwNGoKSENPdrhZrY1J+yPc7yr4wD/hClnHZQC shZ/UeY9MgKLW9f1Vppw6nFoFYqBiDj+QfvjBhG1IkLzu1y3jFJtDzd+aBrcOY7W KIT8dKUG4L4xzQggG5ozuXFCQmzK8CHADxdpnx7HTrRJoxetJDH0+LP5rsBPs8Ga WURJsirPY8AUysdipnn1xjPvRa+rlE8OG5ahli/eUGiiCpLeAgI/iKDa3t7wdcOt 2CAXJ2KU+n8o+u+ozYtGyxBJMjfDhUhrqIde7PbQlHz7OzJcM7qX1DcADXhVo5y+ +k7qvX6d+yj2hYhb8gqEVaL9EBgbzrG4XGANYu/Lm0+Q0M3+DFOO6Tv5Y+3U9eE6 +a0wTrLHnjkB79Zlc0TBeJ5zqO5qlVTgWVUaaeVtGwrEQhmtI59NVpszX6K8jCYi n6y03ZLlCQXt7Jm++o18axb7E+BZXvlPSbbU/QmdzqSFvQXgIgI= =f7DL -----END PGP SIGNATURE----- --/rDaUNvWv5XYRSKj-- From owner-svn-src-head@freebsd.org Tue Apr 10 02:43:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 28D92F95860; Tue, 10 Apr 2018 02:43:08 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CD13C778A0; Tue, 10 Apr 2018 02:43:07 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C7D7F2768F; Tue, 10 Apr 2018 02:43:07 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3A2h7fh038651; Tue, 10 Apr 2018 02:43:07 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3A2h7oF038650; Tue, 10 Apr 2018 02:43:07 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201804100243.w3A2h7oF038650@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Tue, 10 Apr 2018 02:43:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332345 - head/release/amd64 X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/release/amd64 X-SVN-Commit-Revision: 332345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 02:43:08 -0000 Author: benno Date: Tue Apr 10 02:43:07 2018 New Revision: 332345 URL: https://svnweb.freebsd.org/changeset/base/332345 Log: Fix makefs invocation after r331843. Reported by: gjb Reviewed by: gjb Sponsored by: iXsystems, Inc. Pointy hat to: benno Modified: head/release/amd64/mkisoimages.sh Modified: head/release/amd64/mkisoimages.sh ============================================================================== --- head/release/amd64/mkisoimages.sh Mon Apr 9 23:36:52 2018 (r332344) +++ head/release/amd64/mkisoimages.sh Tue Apr 10 02:43:07 2018 (r332345) @@ -38,7 +38,7 @@ if [ "$1" = "-b" ]; then umount efi rmdir efi mdconfig -d -u $device - bootable="-o bootimage=efi;efiboot.img -o no-emul-boot $bootable" + bootable="-o bootimage=i386;efiboot.img -o no-emul-boot $bootable -o platformid=efi" shift else From owner-svn-src-head@freebsd.org Tue Apr 10 02:49:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7280CF95EC1; Tue, 10 Apr 2018 02:49:54 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1F0137A2AB; Tue, 10 Apr 2018 02:49:54 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1401C2769D; Tue, 10 Apr 2018 02:49:54 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3A2nra7038915; Tue, 10 Apr 2018 02:49:53 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3A2nrqV038914; Tue, 10 Apr 2018 02:49:53 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201804100249.w3A2nrqV038914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Tue, 10 Apr 2018 02:49:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332346 - head/release/amd64 X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/release/amd64 X-SVN-Commit-Revision: 332346 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 02:49:54 -0000 Author: benno Date: Tue Apr 10 02:49:53 2018 New Revision: 332346 URL: https://svnweb.freebsd.org/changeset/base/332346 Log: Fix the position of $bootable so that -o platformid=efi applies correctly. Sponsored by: iXsystems, Inc. Pointy hat to: benno (again) Modified: head/release/amd64/mkisoimages.sh Modified: head/release/amd64/mkisoimages.sh ============================================================================== --- head/release/amd64/mkisoimages.sh Tue Apr 10 02:43:07 2018 (r332345) +++ head/release/amd64/mkisoimages.sh Tue Apr 10 02:49:53 2018 (r332346) @@ -38,7 +38,7 @@ if [ "$1" = "-b" ]; then umount efi rmdir efi mdconfig -d -u $device - bootable="-o bootimage=i386;efiboot.img -o no-emul-boot $bootable -o platformid=efi" + bootable="-o bootimage=i386;efiboot.img -o no-emul-boot -o platformid=efi $bootable" shift else From owner-svn-src-head@freebsd.org Tue Apr 10 08:01:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3D56EF86B3C; Tue, 10 Apr 2018 08:01:56 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D903F7F4B5; Tue, 10 Apr 2018 08:01:55 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D40622AA0; Tue, 10 Apr 2018 08:01:55 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3A81tCx096312; Tue, 10 Apr 2018 08:01:55 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3A81t61096311; Tue, 10 Apr 2018 08:01:55 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201804100801.w3A81t61096311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 10 Apr 2018 08:01:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332350 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 332350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 08:01:56 -0000 Author: trasz Date: Tue Apr 10 08:01:55 2018 New Revision: 332350 URL: https://svnweb.freebsd.org/changeset/base/332350 Log: Make development(7) mention tests and section 9 of manual pages. MFC after: 2 weeks Modified: head/share/man/man7/development.7 Modified: head/share/man/man7/development.7 ============================================================================== --- head/share/man/man7/development.7 Tue Apr 10 04:56:31 2018 (r332349) +++ head/share/man/man7/development.7 Tue Apr 10 08:01:55 2018 (r332350) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd March 27, 2018 +.Dd April 10, 2018 .Dt DEVELOPMENT 7 .Os .Sh NAME @@ -75,6 +75,11 @@ Build instructions can be found in .Xr build 7 and .Xr release 7 . +Kernel APIs are usually documented, use +.Cm apropos -s 9 '' +for a list. +Regression test suite is described in +.Xr tests 7 . For coding conventions, see .Xr style 9 . .Pp From owner-svn-src-head@freebsd.org Tue Apr 10 08:14:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 55594F877C3; Tue, 10 Apr 2018 08:14:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0331B824B0; Tue, 10 Apr 2018 08:14:00 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D80542C5F; Tue, 10 Apr 2018 08:13:59 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3A8DxZr002269; Tue, 10 Apr 2018 08:13:59 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3A8DxKI002268; Tue, 10 Apr 2018 08:13:59 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201804100813.w3A8DxKI002268@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 10 Apr 2018 08:13:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332351 - head/sbin/camcontrol X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/sbin/camcontrol X-SVN-Commit-Revision: 332351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 08:14:00 -0000 Author: trasz Date: Tue Apr 10 08:13:59 2018 New Revision: 332351 URL: https://svnweb.freebsd.org/changeset/base/332351 Log: Strip trailing whitespace. MFC after: 2 weeks Modified: head/sbin/camcontrol/camcontrol.8 Modified: head/sbin/camcontrol/camcontrol.8 ============================================================================== --- head/sbin/camcontrol/camcontrol.8 Tue Apr 10 08:01:55 2018 (r332350) +++ head/sbin/camcontrol/camcontrol.8 Tue Apr 10 08:13:59 2018 (r332351) @@ -561,7 +561,7 @@ the blocksize. Note that this command only displays the information, it does not update the kernel data structures. Use the -.Nm +.Nm reprobe subcommand to do that. .It Ic start Send the SCSI Start/Stop Unit (0x1B) command to the given device with the @@ -1593,7 +1593,7 @@ If the device is a .Tn SCSI device and it provides a recommended timeout for the WRITE BUFFER command (see the -.Nm +.Nm opcodes subcommand), that timeout will be used for the firmware download. The drive-recommended timeout value may be overridden on the command line with the @@ -1644,12 +1644,12 @@ will currently attempt a firmware download to any .Tn ATA or .Tn SATA -device, since the standard +device, since the standard .Tn ATA DOWNLOAD MICROCODE command may work. Firmware downloads to .Tn ATA -and +and .Tn SATA devices are supported for devices connected to standard @@ -1658,7 +1658,7 @@ and .Tn SATA controllers, and devices connected to SAS controllers with -.Tn SCSI +.Tn SCSI to .Tn ATA translation capability. @@ -1667,7 +1667,7 @@ In the latter case, uses the .Tn SCSI .Tn ATA -PASS-THROUGH command to send the +PASS-THROUGH command to send the .Tn ATA DOWNLOAD MICROCODE command to the drive. Some @@ -1991,9 +1991,9 @@ For instance, .Tn LTO tapes have MAM. Either the -.Fl r +.Fl r option or the -.Fl w +.Fl w option must be specified. .Bl -tag -width 14n .It Fl r Ar action @@ -2022,7 +2022,7 @@ This option is not yet implemented. .It Fl a Ar num Specify the attribute number to display. This option only works with the attr_values, attr_list and supp_attr -arguments to +arguments to .Fl r . .It Fl c Display cached attributes. @@ -2038,7 +2038,7 @@ Specify the output format for the attribute values (at comma separated list of options. The default output is currently set to field_all,nonascii_trim,text_raw. Once this code is ported to FreeBSD 10, any text fields will be converted -from their codeset to the user's native codeset with +from their codeset to the user's native codeset with .Xr iconv 3 . .Pp The text options are mutually exclusive; if you specify more than one, you @@ -2146,7 +2146,7 @@ action. This requests that the device report Nominal and Recommended timeout values for the given command or commands. The timeout values are in seconds. -The timeout descriptor also includes a command-specific +The timeout descriptor also includes a command-specific .El .It Ic zone Manage @@ -2287,8 +2287,8 @@ The summary and column headings are printed, fields ar and the fields themselves may contain spaces. .It summary Just print the summary: the number of zones, the maximum LBA (LBA of the -last logical block on the drive), and the value of the -.Dq same +last logical block on the drive), and the value of the +.Dq same field. The .Dq same @@ -2319,7 +2319,7 @@ to translation layer (SAT). It may be helpful to read the ATA Command Set - 4 (ACS-4) description of the Extended Power Conditions feature set, available at t13.org, to -understand the details of this particular +understand the details of this particular .Nm subcommand. .Bl -tag -width 6n @@ -2365,7 +2365,7 @@ Idle and Standby mode supported by the drive. .Bl -tag -width 8n .It Fl e Enable the power condition. -One of +One of .Fl e or .Fl d @@ -2395,7 +2395,7 @@ Enable or disable a particular power condition. .Bl -tag -width 7n .It Fl e Enable the power condition. -One of +One of .Fl e or .Fl d @@ -2485,7 +2485,7 @@ time, but override the system time zone and use UTC in .It Fl s Set the device's timestamp. Either the .Fl f -and +and .Fl T options or the .Fl U @@ -2494,7 +2494,7 @@ option must be specified. .It Fl f Ar format Specify the strptime format string, as documented in strptime(3). The time must also be specified with the -.Fl T +.Fl T option. .It Fl T Ar time Provide the time in the format specified with the @@ -2790,7 +2790,7 @@ camcontrol epc da4 -c goto -p Standby_z -H Tell drive .Pa da4 to go to the Standby_z power state (which is -the drive's lowest power state) and hold in that state until it is +the drive's lowest power state) and hold in that state until it is explicitly released by another .Cm goto command. @@ -2802,14 +2802,14 @@ camcontrol epc da2 -c status -P Report only the power state of drive .Pa da2 . -Some drives will power up in response to the commands sent by the +Some drives will power up in response to the commands sent by the .Pa status subcommand, and the .Fl P option causes .Nm to only send the -.Tn ATA +.Tn ATA CHECK POWER MODE command, which should not trigger a change in the drive's power state. .Pp @@ -2829,7 +2829,7 @@ camcontrol timestamp sa0 -s -f "%a, %d %b %Y %T %z" \e Set the timestamp of drive .Pa sa0 using a -.Xr strptime 3 +.Xr strptime 3 format string followed by a time string that was created using this format string. .Sh SEE ALSO From owner-svn-src-head@freebsd.org Tue Apr 10 08:14:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 22E8AF87893; Tue, 10 Apr 2018 08:14:32 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C58B1825CD; Tue, 10 Apr 2018 08:14:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C08222C60; Tue, 10 Apr 2018 08:14:31 +0000 (UTC) (envelope-from trasz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3A8EVCQ002332; Tue, 10 Apr 2018 08:14:31 GMT (envelope-from trasz@FreeBSD.org) Received: (from trasz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3A8EVoh002331; Tue, 10 Apr 2018 08:14:31 GMT (envelope-from trasz@FreeBSD.org) Message-Id: <201804100814.w3A8EVoh002331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: trasz set sender to trasz@FreeBSD.org using -f From: Edward Tomasz Napierala Date: Tue, 10 Apr 2018 08:14:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332352 - head/usr.sbin/ctld X-SVN-Group: head X-SVN-Commit-Author: trasz X-SVN-Commit-Paths: head/usr.sbin/ctld X-SVN-Commit-Revision: 332352 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 08:14:32 -0000 Author: trasz Date: Tue Apr 10 08:14:31 2018 New Revision: 332352 URL: https://svnweb.freebsd.org/changeset/base/332352 Log: Strip trailing whitespace. MFC after: 2 weeks Modified: head/usr.sbin/ctld/ctl.conf.5 Modified: head/usr.sbin/ctld/ctl.conf.5 ============================================================================== --- head/usr.sbin/ctld/ctl.conf.5 Tue Apr 10 08:13:59 2018 (r332351) +++ head/usr.sbin/ctld/ctl.conf.5 Tue Apr 10 08:14:31 2018 (r332352) @@ -483,7 +483,7 @@ target naa.50015178f369f092 { .Ed .Pp An equivalent configuration in UCL format, for use with -.Fl u : +.Fl u : .Bd -literal auth-group { ag0 { From owner-svn-src-head@freebsd.org Tue Apr 10 08:19:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D530F87E0A; Tue, 10 Apr 2018 08:19:15 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0FBE08291B; Tue, 10 Apr 2018 08:19:15 +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 0AAB12C71; Tue, 10 Apr 2018 08:19:15 +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 w3A8JElo002520; Tue, 10 Apr 2018 08:19:14 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3A8JEKE002519; Tue, 10 Apr 2018 08:19:14 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201804100819.w3A8JEKE002519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Tue, 10 Apr 2018 08:19:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332353 - head/usr.bin/systat X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/usr.bin/systat X-SVN-Commit-Revision: 332353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 08:19:15 -0000 Author: tuexen Date: Tue Apr 10 08:19:14 2018 New Revision: 332353 URL: https://svnweb.freebsd.org/changeset/base/332353 Log: Don't show the number of currently established SCTP associations, since this is not monotonically increasing. It's number can be derived from the other counters shown. MFC after: 3 days Modified: head/usr.bin/systat/sctp.c Modified: head/usr.bin/systat/sctp.c ============================================================================== --- head/usr.bin/systat/sctp.c Tue Apr 10 08:14:31 2018 (r332352) +++ head/usr.bin/systat/sctp.c Tue Apr 10 08:19:14 2018 (r332353) @@ -53,24 +53,23 @@ static struct sctpstat curstat, initstat, oldstat; 00 SCTP Associations SCTP Packets 01999999999999 associations initiated 999999999999 packets sent 02999999999999 associations accepted 999999999999 packets received -03999999999999 associations established 999999999999 - out of the blue -04999999999999 associations restarted 999999999999 - bad vtag -05999999999999 associations terminated 999999999999 - bad crc32c -06999999999999 associations aborted -07 -08 SCTP Timers SCTP Chunks -09999999999999 init timeouts 999999999999 control chunks sent -10999999999999 cookie timeouts 999999999999 data chunks sent -11999999999999 data timeouts 999999999999 - ordered -12999999999999 delayed sack timeouts 999999999999 - unordered -13999999999999 shutdown timeouts 999999999999 control chunks received -14999999999999 shutdown-ack timeouts 999999999999 data chunks received -15999999999999 shutdown guard timeouts 999999999999 - ordered -16999999999999 heartbeat timeouts 999999999999 - unordered -17999999999999 path MTU timeouts -18999999999999 autoclose timeouts SCTP user messages -19999999999999 asconf timeouts 999999999999 fragmented -20999999999999 stream reset timeouts 999999999999 reassembled +03999999999999 associations restarted 999999999999 - out of the blue +04999999999999 associations terminated 999999999999 - bad vtag +05999999999999 associations aborted 999999999999 - bad crc32c +06 +07 SCTP Timers SCTP Chunks +08999999999999 init timeouts 999999999999 control chunks sent +09999999999999 cookie timeouts 999999999999 data chunks sent +10999999999999 data timeouts 999999999999 - ordered +11999999999999 delayed sack timeouts 999999999999 - unordered +12999999999999 shutdown timeouts 999999999999 control chunks received +13999999999999 shutdown-ack timeouts 999999999999 data chunks received +14999999999999 shutdown guard timeouts 999999999999 - ordered +15999999999999 heartbeat timeouts 999999999999 - unordered +16999999999999 path MTU timeouts +17999999999999 autoclose timeouts SCTP user messages +18999999999999 asconf timeouts 999999999999 fragmented +19999999999999 stream reset timeouts 999999999999 reassembled --0123456789012345678901234567890123456789012345678901234567890123456789012345 --0 1 2 3 4 5 6 7 */ @@ -100,24 +99,23 @@ labelsctp(void) L(0, "SCTP Associations"); R(0, "SCTP Packets"); L(1, "associations initiated"); R(1, "packets sent"); L(2, "associations accepted"); R(2, "packets received"); - L(3, "associations established"); R(3, "- out of the blue"); - L(4, "associations restarted"); R(4, "- bad vtag"); - L(5, "associations terminated"); R(5, "- bad crc32c"); - L(6, "associations aborted"); + L(3, "associations restarted"); R(3, "- out of the blue"); + L(4, "associations terminated"); R(4, "- bad vtag"); + L(5, "associations aborted"); R(5, "- bad crc32c"); - L(8, "SCTP Timers"); R(8, "SCTP Chunks"); - L(9, "init timeouts"); R(9, "control chunks sent"); - L(10, "cookie timeouts"); R(10, "data chunks sent"); - L(11, "data timeouts"); R(11, "- ordered"); - L(12, "delayed sack timeouts"); R(12, "- unordered"); - L(13, "shutdown timeouts"); R(13, "control chunks received"); - L(14, "shutdown-ack timeouts"); R(14, "data chunks received"); - L(15, "shutdown guard timeouts"); R(15, "- ordered"); - L(16, "heartbeat timeouts"); R(16, "- unordered"); - L(17, "path MTU timeouts"); - L(18, "autoclose timeouts"); R(18, "SCTP User Messages"); - L(19, "asconf timeouts"); R(19, "fragmented"); - L(20, "stream reset timeouts"); R(20, "reassembled"); + L(7, "SCTP Timers"); R(7, "SCTP Chunks"); + L(8, "init timeouts"); R(8, "control chunks sent"); + L(9, "cookie timeouts"); R(9, "data chunks sent"); + L(10, "data timeouts"); R(10, "- ordered"); + L(11, "delayed sack timeouts"); R(11, "- unordered"); + L(12, "shutdown timeouts"); R(12, "control chunks received"); + L(13, "shutdown-ack timeouts"); R(13, "data chunks received"); + L(14, "shutdown guard timeouts"); R(14, "- ordered"); + L(15, "heartbeat timeouts"); R(15, "- unordered"); + L(16, "path MTU timeouts"); + L(17, "autoclose timeouts"); R(17, "SCTP User Messages"); + L(18, "asconf timeouts"); R(18, "fragmented"); + L(19, "stream reset timeouts"); R(19, "reassembled"); #undef L #undef R } @@ -286,24 +284,23 @@ showsctp(void) #define R(row, stat) DO(stat, row, 38) L(1, sctps_activeestab); R(1, sctps_outpackets); L(2, sctps_passiveestab); R(2, sctps_inpackets); - L(3, sctps_currestab); R(3, sctps_outoftheblue); - L(4, sctps_restartestab); R(4, sctps_badvtag); - L(5, sctps_shutdown); R(5, sctps_checksumerrors); - L(6, sctps_aborted); + L(3, sctps_restartestab); R(3, sctps_outoftheblue); + L(4, sctps_shutdown); R(4, sctps_badvtag); + L(5, sctps_aborted); R(5, sctps_checksumerrors); - L(9, sctps_timoinit); R(9, sctps_outcontrolchunks); - L(10, sctps_timocookie); R(10, sctps_senddata); - L(11, sctps_timodata); R(11, sctps_outorderchunks); - L(12, sctps_timosack); R(12, sctps_outunorderchunks); - L(13, sctps_timoshutdown); R(13, sctps_incontrolchunks); - L(14, sctps_timoshutdownack); R(14, sctps_recvdata); - L(15, sctps_timoshutdownguard); R(15, sctps_inorderchunks); - L(16, sctps_timoheartbeat); R(16, sctps_inunorderchunks); - L(17, sctps_timopathmtu); - L(18, sctps_timoautoclose); - L(19, sctps_timoasconf); R(19, sctps_fragusrmsgs); - L(20, sctps_timostrmrst); R(20, sctps_reasmusrmsgs); + L(8, sctps_timoinit); R(8, sctps_outcontrolchunks); + L(9, sctps_timocookie); R(9, sctps_senddata); + L(10, sctps_timodata); R(10, sctps_outorderchunks); + L(11, sctps_timosack); R(11, sctps_outunorderchunks); + L(12, sctps_timoshutdown); R(12, sctps_incontrolchunks); + L(13, sctps_timoshutdownack); R(13, sctps_recvdata); + L(14, sctps_timoshutdownguard); R(14, sctps_inorderchunks); + L(15, sctps_timoheartbeat); R(15, sctps_inunorderchunks); + L(16, sctps_timopathmtu); + L(17, sctps_timoautoclose); + L(18, sctps_timoasconf); R(18, sctps_fragusrmsgs); + L(19, sctps_timostrmrst); R(19, sctps_reasmusrmsgs); #undef DO #undef L #undef R From owner-svn-src-head@freebsd.org Tue Apr 10 08:35:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 06023F88FD9; Tue, 10 Apr 2018 08:35:44 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 914298611D; Tue, 10 Apr 2018 08:35:43 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 885522F88; Tue, 10 Apr 2018 08:35:43 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3A8ZhMi012720; Tue, 10 Apr 2018 08:35:43 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3A8ZhVD012719; Tue, 10 Apr 2018 08:35:43 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201804100835.w3A8ZhVD012719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Tue, 10 Apr 2018 08:35:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332354 - head/sys/dev/etherswitch/e6000sw X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dev/etherswitch/e6000sw X-SVN-Commit-Revision: 332354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 08:35:44 -0000 Author: mw Date: Tue Apr 10 08:35:43 2018 New Revision: 332354 URL: https://svnweb.freebsd.org/changeset/base/332354 Log: Improve detection of addressing mode in e6000sw Some devices cannot rely on the switch MDIO address passed in the DTB for specifying single/multi-chip addressing mode. Introduce new property "single-chip-addressing" which added to DTS will force single-chip mode. Submitted by: Michal Mazur Obtained from: Semihalf Sponsored by: Stormshield Differential Revision: https://reviews.freebsd.org/D14800 Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c Modified: head/sys/dev/etherswitch/e6000sw/e6000sw.c ============================================================================== --- head/sys/dev/etherswitch/e6000sw/e6000sw.c Tue Apr 10 08:19:14 2018 (r332353) +++ head/sys/dev/etherswitch/e6000sw/e6000sw.c Tue Apr 10 08:35:43 2018 (r332354) @@ -213,7 +213,9 @@ e6000sw_probe(device_t dev) if (OF_getencprop(sc->node, "reg", &sc->sw_addr, sizeof(sc->sw_addr)) < 0) return (ENXIO); - if (sc->sw_addr != 0 && (sc->sw_addr % 2) == 0) + + if (!OF_hasprop(sc->node, "single-chip-addressing") && + (sc->sw_addr != 0 && (sc->sw_addr % 2) == 0)) sc->multi_chip = true; /* From owner-svn-src-head@freebsd.org Tue Apr 10 12:45:34 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D2A21F99A10; Tue, 10 Apr 2018 12:45:34 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8044C804C2; Tue, 10 Apr 2018 12:45:34 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7B2205C01; Tue, 10 Apr 2018 12:45:34 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3ACjYoR038213; Tue, 10 Apr 2018 12:45:34 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3ACjYeD038212; Tue, 10 Apr 2018 12:45:34 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201804101245.w3ACjYeD038212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 10 Apr 2018 12:45:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332358 - head/tests/sys/netpfil X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil X-SVN-Commit-Revision: 332358 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 12:45:35 -0000 Author: kp Date: Tue Apr 10 12:45:34 2018 New Revision: 332358 URL: https://svnweb.freebsd.org/changeset/base/332358 Log: pf tests: Do not build or install if pf is not enabled Do not build or install pf tests if WITHOUT_PF is set. This fixes the build failure with WITHOUT_PF=yes. Reported by: Vladimir Zakharov Modified: head/tests/sys/netpfil/Makefile Modified: head/tests/sys/netpfil/Makefile ============================================================================== --- head/tests/sys/netpfil/Makefile Tue Apr 10 10:27:55 2018 (r332357) +++ head/tests/sys/netpfil/Makefile Tue Apr 10 12:45:34 2018 (r332358) @@ -1,7 +1,11 @@ # $FreeBSD$ +.include + TESTSDIR= ${TESTSBASE}/sys/netpfil +.if ${MK_PF} != "no" TESTS_SUBDIRS+= pf +.endif .include From owner-svn-src-head@freebsd.org Tue Apr 10 12:53:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 34CB9F9A54A; Tue, 10 Apr 2018 12:53:49 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D66E28296B; Tue, 10 Apr 2018 12:53:48 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D172B5D8E; Tue, 10 Apr 2018 12:53:48 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3ACrm81042864; Tue, 10 Apr 2018 12:53:48 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3ACrmjE042861; Tue, 10 Apr 2018 12:53:48 GMT (envelope-from br@FreeBSD.org) Message-Id: <201804101253.w3ACrmjE042861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Tue, 10 Apr 2018 12:53:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332359 - in head/sys: arm64/conf arm64/qualcomm conf X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: arm64/conf arm64/qualcomm conf X-SVN-Commit-Revision: 332359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 12:53:49 -0000 Author: br Date: Tue Apr 10 12:53:48 2018 New Revision: 332359 URL: https://svnweb.freebsd.org/changeset/base/332359 Log: Enable Qualcomm Debug Subsystem (QDSS) block on MSM8916 SoC. This is required for ARM Coresight operation on Dragonboard 410c. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14987 Added: head/sys/arm64/qualcomm/ head/sys/arm64/qualcomm/qcom_gcc.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 Tue Apr 10 12:45:34 2018 (r332358) +++ head/sys/arm64/conf/GENERIC Tue Apr 10 12:53:48 2018 (r332359) @@ -106,6 +106,9 @@ device al_iofic # I/O Fabric Interrupt Controller device al_serdes # Serializer/Deserializer device al_udma # Universal DMA +# Qualcomm Snapdragon drivers +device qcom_gcc # Global Clock Controller + # VirtIO support device virtio device virtio_pci Added: head/sys/arm64/qualcomm/qcom_gcc.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/qualcomm/qcom_gcc.c Tue Apr 10 12:53:48 2018 (r332359) @@ -0,0 +1,148 @@ +/*- + * Copyright (c) 2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by BAE Systems, the University of Cambridge + * Computer Laboratory, and Memorial University under DARPA/AFRL contract + * FA8650-15-C-7558 ("CADETS"), as part of the DARPA Transparent Computing + * (TC) research program. + * + * 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 + +#define GCC_QDSS_BCR 0x29000 +#define GCC_QDSS_BCR_BLK_ARES (1 << 0) /* Async software reset. */ +#define GCC_QDSS_CFG_AHB_CBCR 0x29008 +#define AHB_CBCR_CLK_ENABLE (1 << 0) /* AHB clk branch ctrl */ +#define GCC_QDSS_ETR_USB_CBCR 0x29028 +#define ETR_USB_CBCR_CLK_ENABLE (1 << 0) /* ETR USB clk branch ctrl */ +#define GCC_QDSS_DAP_CBCR 0x29084 +#define DAP_CBCR_CLK_ENABLE (1 << 0) /* DAP clk branch ctrl */ + +static struct ofw_compat_data compat_data[] = { + { "qcom,gcc-msm8916", 1 }, + { NULL, 0 } +}; + +struct qcom_gcc_softc { + struct resource *res; +}; + +static struct resource_spec qcom_gcc_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +/* + * Qualcomm Debug Subsystem (QDSS) + * block enabling routine. + */ +static void +qcom_qdss_enable(struct qcom_gcc_softc *sc) +{ + + /* Put QDSS block to reset */ + bus_write_4(sc->res, GCC_QDSS_BCR, GCC_QDSS_BCR_BLK_ARES); + + /* Enable AHB clock branch */ + bus_write_4(sc->res, GCC_QDSS_CFG_AHB_CBCR, AHB_CBCR_CLK_ENABLE); + + /* Enable DAP clock branch */ + bus_write_4(sc->res, GCC_QDSS_DAP_CBCR, DAP_CBCR_CLK_ENABLE); + + /* Enable ETR USB clock branch */ + bus_write_4(sc->res, GCC_QDSS_ETR_USB_CBCR, ETR_USB_CBCR_CLK_ENABLE); + + /* Out of reset */ + bus_write_4(sc->res, GCC_QDSS_BCR, 0); +} + +static int +qcom_gcc_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, "Qualcomm Global Clock Controller"); + + return (BUS_PROBE_DEFAULT); +} + +static int +qcom_gcc_attach(device_t dev) +{ + struct qcom_gcc_softc *sc; + + sc = device_get_softc(dev); + + if (bus_alloc_resources(dev, qcom_gcc_spec, &sc->res) != 0) { + device_printf(dev, "cannot allocate resources for device\n"); + return (ENXIO); + } + + /* + * Enable debug unit. + * This is required for Coresight operation. + * This also enables USB clock branch. + */ + qcom_qdss_enable(sc); + + return (0); +} + +static device_method_t qcom_gcc_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, qcom_gcc_probe), + DEVMETHOD(device_attach, qcom_gcc_attach), + + DEVMETHOD_END +}; + +static driver_t qcom_gcc_driver = { + "qcom_gcc", + qcom_gcc_methods, + sizeof(struct qcom_gcc_softc), +}; + +static devclass_t qcom_gcc_devclass; + +EARLY_DRIVER_MODULE(qcom_gcc, simplebus, qcom_gcc_driver, qcom_gcc_devclass, + 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); +MODULE_VERSION(qcom_gcc, 1); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Tue Apr 10 12:45:34 2018 (r332358) +++ head/sys/conf/files.arm64 Tue Apr 10 12:53:48 2018 (r332359) @@ -151,6 +151,7 @@ arm64/coresight/coresight-dynamic-replicator.c standar arm64/coresight/coresight-etm4x.c standard arm64/coresight/coresight-funnel.c standard arm64/coresight/coresight-tmc.c standard +arm64/qualcomm/qcom_gcc.c optional qcom_gcc fdt contrib/vchiq/interface/compat/vchi_bsd.c optional vchiq soc_brcm_bcm2837 \ compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x04000000 -I$S/contrib/vchiq" contrib/vchiq/interface/vchiq_arm/vchiq_2835_arm.c optional vchiq soc_brcm_bcm2837 \ From owner-svn-src-head@freebsd.org Tue Apr 10 13:22:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D637F9C754; Tue, 10 Apr 2018 13:22:49 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AE6BD6AE4F; Tue, 10 Apr 2018 13:22:48 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A96886265; Tue, 10 Apr 2018 13:22:48 +0000 (UTC) (envelope-from oshogbo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3ADMm8I057916; Tue, 10 Apr 2018 13:22:48 GMT (envelope-from oshogbo@FreeBSD.org) Received: (from oshogbo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3ADMmhg057913; Tue, 10 Apr 2018 13:22:48 GMT (envelope-from oshogbo@FreeBSD.org) Message-Id: <201804101322.w3ADMmhg057913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oshogbo set sender to oshogbo@FreeBSD.org using -f From: Mariusz Zaborski Date: Tue, 10 Apr 2018 13:22:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332361 - in head: sbin/geom/class/eli sys/geom/eli X-SVN-Group: head X-SVN-Commit-Author: oshogbo X-SVN-Commit-Paths: in head: sbin/geom/class/eli sys/geom/eli X-SVN-Commit-Revision: 332361 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 13:22:49 -0000 Author: oshogbo Date: Tue Apr 10 13:22:48 2018 New Revision: 332361 URL: https://svnweb.freebsd.org/changeset/base/332361 Log: Introduce dry run option for attaching the device. This will allow us to verify if passphrase and key is valid without decrypting whole device. Reviewed by: cem@, allanjude@ Differential Revision: https://reviews.freebsd.org/D15000 Modified: head/sbin/geom/class/eli/geli.8 head/sbin/geom/class/eli/geom_eli.c head/sys/geom/eli/g_eli_ctl.c Modified: head/sbin/geom/class/eli/geli.8 ============================================================================== --- head/sbin/geom/class/eli/geli.8 Tue Apr 10 13:16:50 2018 (r332360) +++ head/sbin/geom/class/eli/geli.8 Tue Apr 10 13:22:48 2018 (r332361) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd September 17, 2017 +.Dd April 10, 2018 .Dt GELI 8 .Os .Sh NAME @@ -67,7 +67,7 @@ utility: .Cm init .Nm .Cm attach -.Op Fl dprv +.Op Fl dnprv .Op Fl j Ar passfile .Op Fl k Ar keyfile .Ar prov @@ -420,6 +420,9 @@ For more information see the description of the option for the .Cm init subcommand. +.It Fl n +Do a dry-run decryption. +This is useful to verify passphrase and keyfile without decrypting the device. .It Fl p Do not use a passphrase as a component of the User Key. Cannot be combined with the Modified: head/sbin/geom/class/eli/geom_eli.c ============================================================================== --- head/sbin/geom/class/eli/geom_eli.c Tue Apr 10 13:16:50 2018 (r332360) +++ head/sbin/geom/class/eli/geom_eli.c Tue Apr 10 13:22:48 2018 (r332361) @@ -148,11 +148,12 @@ struct g_command class_commands[] = { { 'd', "detach", NULL, G_TYPE_BOOL }, { 'j', "passfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, { 'k', "keyfile", G_VAL_OPTIONAL, G_TYPE_STRING | G_TYPE_MULTI }, + { 'n', "dryrun", NULL, G_TYPE_BOOL }, { 'p', "nopassphrase", NULL, G_TYPE_BOOL }, { 'r', "readonly", NULL, G_TYPE_BOOL }, G_OPT_SENTINEL }, - "[-dprv] [-j passfile] [-k keyfile] prov" + "[-dnprv] [-j passfile] [-k keyfile] prov" }, { "detach", 0, NULL, { Modified: head/sys/geom/eli/g_eli_ctl.c ============================================================================== --- head/sys/geom/eli/g_eli_ctl.c Tue Apr 10 13:16:50 2018 (r332360) +++ head/sys/geom/eli/g_eli_ctl.c Tue Apr 10 13:22:48 2018 (r332361) @@ -59,7 +59,7 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class struct g_provider *pp; const char *name; u_char *key, mkey[G_ELI_DATAIVKEYLEN]; - int *nargs, *detach, *readonly; + int *nargs, *detach, *readonly, *dryrun; int keysize, error; u_int nkey; @@ -87,6 +87,12 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class return; } + dryrun = gctl_get_paraml(req, "dryrun", sizeof(*dryrun)); + if (dryrun == NULL) { + gctl_error(req, "No '%s' argument.", "dryrun"); + return; + } + if (*detach && *readonly) { gctl_error(req, "Options -d and -r are mutually exclusive."); return; @@ -141,7 +147,8 @@ g_eli_ctl_attach(struct gctl_req *req, struct g_class md.md_flags |= G_ELI_FLAG_WO_DETACH; if (*readonly) md.md_flags |= G_ELI_FLAG_RO; - g_eli_create(req, mp, pp, &md, mkey, nkey); + if (!*dryrun) + g_eli_create(req, mp, pp, &md, mkey, nkey); explicit_bzero(mkey, sizeof(mkey)); explicit_bzero(&md, sizeof(md)); } From owner-svn-src-head@freebsd.org Tue Apr 10 13:25:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AADC4F9CAAE; Tue, 10 Apr 2018 13:25:42 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D9426C297; Tue, 10 Apr 2018 13:25:42 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5886D6279; Tue, 10 Apr 2018 13:25:42 +0000 (UTC) (envelope-from mw@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3ADPgG7058058; Tue, 10 Apr 2018 13:25:42 GMT (envelope-from mw@FreeBSD.org) Received: (from mw@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3ADPgaW058057; Tue, 10 Apr 2018 13:25:42 GMT (envelope-from mw@FreeBSD.org) Message-Id: <201804101325.w3ADPgaW058057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mw set sender to mw@FreeBSD.org using -f From: Marcin Wojtas Date: Tue, 10 Apr 2018 13:25:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332362 - head/sys/dts/arm X-SVN-Group: head X-SVN-Commit-Author: mw X-SVN-Commit-Paths: head/sys/dts/arm X-SVN-Commit-Revision: 332362 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 13:25:42 -0000 Author: mw Date: Tue Apr 10 13:25:42 2018 New Revision: 332362 URL: https://svnweb.freebsd.org/changeset/base/332362 Log: Remove deprecated DT sources of Armada 38x SoCs Now, as all platform code and drivers support Linux DT binding, safely remove deprecated sources and rely on sys/gnu/dts from now on. Obtained from: Semihalf Sponsored by: Stormshield Deleted: head/sys/dts/arm/armada-380.dtsi head/sys/dts/arm/armada-385-db-ap.dts head/sys/dts/arm/armada-385.dtsi head/sys/dts/arm/armada-388-clearfog.dts head/sys/dts/arm/armada-388-gp.dts head/sys/dts/arm/armada-388.dtsi head/sys/dts/arm/armada-38x-solidrun-microsom.dtsi head/sys/dts/arm/armada-38x.dtsi From owner-svn-src-head@freebsd.org Tue Apr 10 13:47:10 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7AE18F9E2E3; Tue, 10 Apr 2018 13:47:10 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D0D426F980; Tue, 10 Apr 2018 13:47:09 +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 CBA7B65AC; Tue, 10 Apr 2018 13:47:09 +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 w3ADl9HN067641; Tue, 10 Apr 2018 13:47:09 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3ADl9st067639; Tue, 10 Apr 2018 13:47:09 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201804101347.w3ADl9st067639@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 10 Apr 2018 13:47:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332364 - in head/sys/cddl: contrib/opensolaris/uts/common/dtrace dev/dtrace X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/cddl: contrib/opensolaris/uts/common/dtrace dev/dtrace X-SVN-Commit-Revision: 332364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 13:47:10 -0000 Author: markj Date: Tue Apr 10 13:47:09 2018 New Revision: 332364 URL: https://svnweb.freebsd.org/changeset/base/332364 Log: Assert that dtrace_probe() doesn't re-enter itself. This helps catch cases where an instrumented function is called while in probe context. Submitted by: Domagoj Stolfa MFC after: 2 weeks Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D14863 Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c head/sys/cddl/dev/dtrace/dtrace_cddl.h Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Apr 10 13:35:07 2018 (r332363) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Apr 10 13:47:09 2018 (r332364) @@ -7257,6 +7257,44 @@ dtrace_store_by_ref(dtrace_difo_t *dp, caddr_t tomax, } /* + * Disables interrupts and sets the per-thread inprobe flag. When DEBUG is + * defined, we also assert that we are not recursing unless the probe ID is an + * error probe. + */ +static dtrace_icookie_t +dtrace_probe_enter(dtrace_id_t id) +{ + dtrace_icookie_t cookie; + + cookie = dtrace_interrupt_disable(); + + /* + * Unless this is an ERROR probe, we are not allowed to recurse in + * dtrace_probe(). Recursing into DTrace probe usually means that a + * function is instrumented that should not have been instrumented or + * that the ordering guarantee of the records will be violated, + * resulting in unexpected output. If there is an exception to this + * assertion, a new case should be added. + */ + ASSERT(curthread->t_dtrace_inprobe == 0 || + id == dtrace_probeid_error); + curthread->t_dtrace_inprobe = 1; + + return (cookie); +} + +/* + * Disables interrupts and clears the per-thread inprobe flag. + */ +static void +dtrace_probe_exit(dtrace_icookie_t cookie) +{ + + curthread->t_dtrace_inprobe = 0; + dtrace_interrupt_enable(cookie); +} + +/* * If you're looking for the epicenter of DTrace, you just found it. This * is the function called by the provider to fire a probe -- from which all * subsequent probe-context DTrace activity emanates. @@ -7290,7 +7328,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t return; #endif - cookie = dtrace_interrupt_disable(); + cookie = dtrace_probe_enter(id); probe = dtrace_probes[id - 1]; cpuid = curcpu; onintr = CPU_ON_INTR(CPU); @@ -7301,7 +7339,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t * We have hit in the predicate cache; we know that * this predicate would evaluate to be false. */ - dtrace_interrupt_enable(cookie); + dtrace_probe_exit(cookie); return; } @@ -7313,7 +7351,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t /* * We don't trace anything if we're panicking. */ - dtrace_interrupt_enable(cookie); + dtrace_probe_exit(cookie); return; } @@ -7939,7 +7977,7 @@ dtrace_probe(dtrace_id_t id, uintptr_t arg0, uintptr_t if (vtime) curthread->t_dtrace_start = dtrace_gethrtime(); - dtrace_interrupt_enable(cookie); + dtrace_probe_exit(cookie); } /* Modified: head/sys/cddl/dev/dtrace/dtrace_cddl.h ============================================================================== --- head/sys/cddl/dev/dtrace/dtrace_cddl.h Tue Apr 10 13:35:07 2018 (r332363) +++ head/sys/cddl/dev/dtrace/dtrace_cddl.h Tue Apr 10 13:47:09 2018 (r332364) @@ -46,6 +46,7 @@ typedef struct kdtrace_proc { typedef struct kdtrace_thread { u_int8_t td_dtrace_stop; /* Indicates a DTrace-desired stop */ u_int8_t td_dtrace_sig; /* Signal sent via DTrace's raise() */ + u_int8_t td_dtrace_inprobe; /* Are we in a probe? */ u_int td_predcache; /* DTrace predicate cache */ u_int64_t td_dtrace_vtime; /* DTrace virtual time */ u_int64_t td_dtrace_start; /* DTrace slice start time */ @@ -97,6 +98,7 @@ typedef struct kdtrace_thread { #define t_dtrace_start td_dtrace->td_dtrace_start #define t_dtrace_stop td_dtrace->td_dtrace_stop #define t_dtrace_sig td_dtrace->td_dtrace_sig +#define t_dtrace_inprobe td_dtrace->td_dtrace_inprobe #define t_predcache td_dtrace->td_predcache #define t_dtrace_ft td_dtrace->td_dtrace_ft #define t_dtrace_on td_dtrace->td_dtrace_on From owner-svn-src-head@freebsd.org Tue Apr 10 13:56:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F25A8F9EBB6; Tue, 10 Apr 2018 13:56: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 93A4B726C8; Tue, 10 Apr 2018 13:56: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 8E7FE6745; Tue, 10 Apr 2018 13:56: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 w3ADu6v6072767; Tue, 10 Apr 2018 13:56:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3ADu6Jr072766; Tue, 10 Apr 2018 13:56:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201804101356.w3ADu6Jr072766@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 10 Apr 2018 13:56:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332365 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 332365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 13:56:07 -0000 Author: markj Date: Tue Apr 10 13:56:06 2018 New Revision: 332365 URL: https://svnweb.freebsd.org/changeset/base/332365 Log: Set zfs_arc_free_target to v_free_target. Page daemon output is now regulated by a PID controller with a setpoint of v_free_target. Moreover, the page daemon now wakes up regularly rather than waiting for a wakeup from another thread. This means that the free page count is unlikely to drop below the old zfs_arc_free_target value, and as a result the ARC was not readily freeing pages under memory pressure. Address the immediate problem by updating zfs_arc_free_target to match the page daemon's new behaviour. Reported and tested by: truckman Discussed with: jeff X-MFC with: r329882 Differential Revision: https://reviews.freebsd.org/D14994 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Apr 10 13:47:09 2018 (r332364) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Tue Apr 10 13:56:06 2018 (r332365) @@ -389,7 +389,7 @@ static void arc_free_target_init(void *unused __unused) { - zfs_arc_free_target = (vm_cnt.v_free_min / 10) * 11; + zfs_arc_free_target = vm_cnt.v_free_target; } SYSINIT(arc_free_target_init, SI_SUB_KTHREAD_PAGE, SI_ORDER_ANY, arc_free_target_init, NULL); From owner-svn-src-head@freebsd.org Tue Apr 10 14:07:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 86D71F9FA2A; Tue, 10 Apr 2018 14:07:03 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 31B1B74311; Tue, 10 Apr 2018 14:07:03 +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 2C9FA68F7; Tue, 10 Apr 2018 14:07:03 +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 w3AE73Ne078355; Tue, 10 Apr 2018 14:07:03 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AE73Nh078354; Tue, 10 Apr 2018 14:07:03 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201804101407.w3AE73Nh078354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 10 Apr 2018 14:07:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332369 - head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/cddl/contrib/opensolaris/uts/common/dtrace X-SVN-Commit-Revision: 332369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 14:07:03 -0000 Author: markj Date: Tue Apr 10 14:07:02 2018 New Revision: 332369 URL: https://svnweb.freebsd.org/changeset/base/332369 Log: Correct a comment. Submitted by: Domagoj Stolfa X-MFC with: r332364 Sponsored by: DARPA, AFRL Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Apr 10 14:04:11 2018 (r332368) +++ head/sys/cddl/contrib/opensolaris/uts/common/dtrace/dtrace.c Tue Apr 10 14:07:02 2018 (r332369) @@ -7284,7 +7284,7 @@ dtrace_probe_enter(dtrace_id_t id) } /* - * Disables interrupts and clears the per-thread inprobe flag. + * Clears the per-thread inprobe flag and enables interrupts. */ static void dtrace_probe_exit(dtrace_icookie_t cookie) From owner-svn-src-head@freebsd.org Tue Apr 10 14:10:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3E780F9FE3A; Tue, 10 Apr 2018 14:10:01 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (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 CDE1975FD0; Tue, 10 Apr 2018 14:10:00 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1f5ty9-000Bnj-Sg; Tue, 10 Apr 2018 17:09:57 +0300 Date: Tue, 10 Apr 2018 17:09:57 +0300 From: Slawa Olhovchenkov To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332365 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <20180410140957.GG6612@zxy.spb.ru> References: <201804101356.w3ADu6Jr072766@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201804101356.w3ADu6Jr072766@repo.freebsd.org> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 14:10:01 -0000 On Tue, Apr 10, 2018 at 01:56:06PM +0000, Mark Johnston wrote: > Author: markj > Date: Tue Apr 10 13:56:06 2018 > New Revision: 332365 > URL: https://svnweb.freebsd.org/changeset/base/332365 > > Log: > Set zfs_arc_free_target to v_free_target. > > Page daemon output is now regulated by a PID controller with a setpoint > of v_free_target. Moreover, the page daemon now wakes up regularly > rather than waiting for a wakeup from another thread. This means that > the free page count is unlikely to drop below the old > zfs_arc_free_target value, and as a result the ARC was not readily > freeing pages under memory pressure. Address the immediate problem by > updating zfs_arc_free_target to match the page daemon's new behaviour. Can you explain some more about new page daemon algo (and reclaim zone free memory)? PS: zfs need some more time for free pages from ARC. Also, vanila zfs have broken logic for count used and free ARC's memory. For most correctly count system-wide used and free memory need accounting in-zone free memory. > arc_free_target_init(void *unused __unused) > { > > - zfs_arc_free_target = (vm_cnt.v_free_min / 10) * 11; > + zfs_arc_free_target = vm_cnt.v_free_target; > } From owner-svn-src-head@freebsd.org Tue Apr 10 14:27:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 51227FA0FDF; Tue, 10 Apr 2018 14:27:28 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF1B37956F; Tue, 10 Apr 2018 14:27:27 +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 EA2A96C30; Tue, 10 Apr 2018 14:27:27 +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 w3AERRAN088110; Tue, 10 Apr 2018 14:27:27 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AERR7G088108; Tue, 10 Apr 2018 14:27:27 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804101427.w3AERR7G088108@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 10 Apr 2018 14:27:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332372 - head/usr.bin/tail X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.bin/tail X-SVN-Commit-Revision: 332372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 14:27:28 -0000 Author: kevans Date: Tue Apr 10 14:27:27 2018 New Revision: 332372 URL: https://svnweb.freebsd.org/changeset/base/332372 Log: tail(1): Add some long options Add --blocks, --bytes, and --lines long options for -b, -c, and -n respectively. This improves tail(1)'s compatibility with its GNU counterpart in a straightforward way. Reviewed by: eadler (earlier version) MFC after: 3 days Modified: head/usr.bin/tail/tail.1 head/usr.bin/tail/tail.c Modified: head/usr.bin/tail/tail.1 ============================================================================== --- head/usr.bin/tail/tail.1 Tue Apr 10 14:13:35 2018 (r332371) +++ head/usr.bin/tail/tail.1 Tue Apr 10 14:27:27 2018 (r332372) @@ -31,7 +31,7 @@ .\" @(#)tail.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd March 16, 2013 +.Dd April 10, 2018 .Dt TAIL 1 .Os .Sh NAME @@ -73,11 +73,11 @@ or the last 10 lines of the input. .Pp The options are as follows: .Bl -tag -width indent -.It Fl b Ar number +.It Fl b Ar number , Fl -blocks Ns = Ns Ar number The location is .Ar number 512-byte blocks. -.It Fl c Ar number +.It Fl c Ar number , Fl -bytes Ns = Ns Ar number The location is .Ar number bytes. @@ -112,7 +112,7 @@ The option is the same as the .Fl f option if reading from standard input rather than a file. -.It Fl n Ar number +.It Fl n Ar number, Fl -lines Ns = Ns Ar number The location is .Ar number lines. Modified: head/usr.bin/tail/tail.c ============================================================================== --- head/usr.bin/tail/tail.c Tue Apr 10 14:13:35 2018 (r332371) +++ head/usr.bin/tail/tail.c Tue Apr 10 14:27:27 2018 (r332372) @@ -51,6 +51,7 @@ static const char sccsid[] = "@(#)tail.c 8.1 (Berkeley #include #include +#include #include #include #include @@ -65,6 +66,14 @@ static file_info_t *files; static void obsolete(char **); static void usage(void); +static const struct option long_opts[] = +{ + {"blocks", required_argument, NULL, 'b'}, + {"bytes", required_argument, NULL, 'c'}, + {"lines", required_argument, NULL, 'n'}, + {NULL, no_argument, NULL, 0} +}; + int main(int argc, char *argv[]) { @@ -113,7 +122,8 @@ main(int argc, char *argv[]) obsolete(argv); style = NOTSET; off = 0; - while ((ch = getopt(argc, argv, "Fb:c:fn:qr")) != -1) + while ((ch = getopt_long(argc, argv, "+Fb:c:fn:qr", long_opts, NULL)) != + -1) switch(ch) { case 'F': /* -F is superset of (and implies) -f */ Fflag = fflag = 1; From owner-svn-src-head@freebsd.org Tue Apr 10 14:28:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB581FA1111; Tue, 10 Apr 2018 14:28:37 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (unknown [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 65EFF7A08E; Tue, 10 Apr 2018 14:28:37 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-lf0-f49.google.com (mail-lf0-f49.google.com [209.85.215.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 15E9711403; Tue, 10 Apr 2018 14:28:37 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lf0-f49.google.com with SMTP id q9-v6so11979922lfk.9; Tue, 10 Apr 2018 07:28:37 -0700 (PDT) X-Gm-Message-State: ALQs6tBWO6/YG/f0SXVD/aKbEBs5kf4mR/Eo0w4GVH+OphrsS1O0avve gCCFf+2A8xdH3RcERqqK3V75PS+eo7PCZZM3BfM= X-Google-Smtp-Source: AIpwx48I3boobdyCXEXhknUl0vxh+1Pndg2aRij+oLWPSLt3teAEm4QxpiIvS3KVNWy2LERUPaYhC4XTYDZrayBLVHs= X-Received: by 10.46.29.1 with SMTP id d1mr434617ljd.22.1523370515508; Tue, 10 Apr 2018 07:28:35 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Tue, 10 Apr 2018 07:28:14 -0700 (PDT) In-Reply-To: <201804101427.w3AERR7G088108@repo.freebsd.org> References: <201804101427.w3AERR7G088108@repo.freebsd.org> From: Kyle Evans Date: Tue, 10 Apr 2018 09:28:14 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r332372 - head/usr.bin/tail To: Kyle Evans Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 14:28:37 -0000 On Tue, Apr 10, 2018 at 9:27 AM, Kyle Evans wrote: > Author: kevans > Date: Tue Apr 10 14:27:27 2018 > New Revision: 332372 > URL: https://svnweb.freebsd.org/changeset/base/332372 > > Log: > tail(1): Add some long options > > Add --blocks, --bytes, and --lines long options for -b, -c, and -n > respectively. This improves tail(1)'s compatibility with its GNU counterpart > in a straightforward way. > > Reviewed by: eadler (earlier version) > MFC after: 3 days > ... Differential revision: https://reviews.freebsd.org/D14140 From owner-svn-src-head@freebsd.org Tue Apr 10 14:42:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 04BA9FA1EE0; Tue, 10 Apr 2018 14:42:25 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A9FF67D5F4; Tue, 10 Apr 2018 14:42:24 +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 A4F5B6F62; Tue, 10 Apr 2018 14:42:24 +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 w3AEgOgR098086; Tue, 10 Apr 2018 14:42:24 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AEgOfU098085; Tue, 10 Apr 2018 14:42:24 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804101442.w3AEgOfU098085@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 10 Apr 2018 14:42:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332373 - head/usr.bin/tail X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.bin/tail X-SVN-Commit-Revision: 332373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 14:42:25 -0000 Author: kevans Date: Tue Apr 10 14:42:24 2018 New Revision: 332373 URL: https://svnweb.freebsd.org/changeset/base/332373 Log: tail(1): Address mandoc concern (space before punctuation after macro) X-MFC-With: r332372 Modified: head/usr.bin/tail/tail.1 Modified: head/usr.bin/tail/tail.1 ============================================================================== --- head/usr.bin/tail/tail.1 Tue Apr 10 14:27:27 2018 (r332372) +++ head/usr.bin/tail/tail.1 Tue Apr 10 14:42:24 2018 (r332373) @@ -112,7 +112,7 @@ The option is the same as the .Fl f option if reading from standard input rather than a file. -.It Fl n Ar number, Fl -lines Ns = Ns Ar number +.It Fl n Ar number , Fl -lines Ns = Ns Ar number The location is .Ar number lines. From owner-svn-src-head@freebsd.org Tue Apr 10 14:44:08 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FA9DFA2046; Tue, 10 Apr 2018 14:44:08 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 13CAF7D7E3; Tue, 10 Apr 2018 14:44:08 +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 0E9C86F70; Tue, 10 Apr 2018 14:44:08 +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 w3AEi71F098234; Tue, 10 Apr 2018 14:44:07 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AEi79n098232; Tue, 10 Apr 2018 14:44:07 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804101444.w3AEi79n098232@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 10 Apr 2018 14:44:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332374 - head/usr.bin/head X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.bin/head X-SVN-Commit-Revision: 332374 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 14:44:08 -0000 Author: kevans Date: Tue Apr 10 14:44:07 2018 New Revision: 332374 URL: https://svnweb.freebsd.org/changeset/base/332374 Log: head(1): Provide long options Provide long options --bytes and --lines to match -c and -n respectively. This improves head(1)'s compatibility with its GNU counterpart in a sensible way. Reviewed by: eadler (previous version) MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D14139 Modified: head/usr.bin/head/head.1 head/usr.bin/head/head.c Modified: head/usr.bin/head/head.1 ============================================================================== --- head/usr.bin/head/head.1 Tue Apr 10 14:42:24 2018 (r332373) +++ head/usr.bin/head/head.1 Tue Apr 10 14:44:07 2018 (r332374) @@ -28,7 +28,7 @@ .\" @(#)head.1 8.1 (Berkeley) 6/6/93 .\" $FreeBSD$ .\" -.Dd March 16, 2013 +.Dd April 10, 2018 .Dt HEAD 1 .Os .Sh NAME @@ -48,6 +48,18 @@ files are specified. If .Ar count is omitted it defaults to 10. +.Pp +The following options are available: +.Bl -tag -width indent +.It Fl c Ar bytes , Fl -bytes Ns = Ns Ar bytes +Print +.Ar bytes +of each of the specified files. +.It Fl n Ar count , Fl -lines Ns = Ns Ar count +Print +.Ar count +lines of each of the specified files. +.El .Pp If more than a single file is specified, each file is preceded by a header consisting of the string Modified: head/usr.bin/head/head.c ============================================================================== --- head/usr.bin/head/head.c Tue Apr 10 14:42:24 2018 (r332373) +++ head/usr.bin/head/head.c Tue Apr 10 14:44:07 2018 (r332374) @@ -47,6 +47,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -64,6 +65,13 @@ static void head_bytes(FILE *, off_t); static void obsolete(char *[]); static void usage(void); +static const struct option long_opts[] = +{ + {"bytes", required_argument, NULL, 'c'}, + {"lines", required_argument, NULL, 'n'}, + {NULL, no_argument, NULL, 0} +}; + int main(int argc, char *argv[]) { @@ -74,7 +82,7 @@ main(int argc, char *argv[]) char *ep; obsolete(argv); - while ((ch = getopt(argc, argv, "n:c:")) != -1) + while ((ch = getopt_long(argc, argv, "+n:c:", long_opts, NULL)) != -1) switch(ch) { case 'c': bytecnt = strtoimax(optarg, &ep, 10); From owner-svn-src-head@freebsd.org Tue Apr 10 15:17:39 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 786ADF8004D; Tue, 10 Apr 2018 15:17:39 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-io0-x22c.google.com (mail-io0-x22c.google.com [IPv6:2607:f8b0:4001:c06::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0AA0B853D1; Tue, 10 Apr 2018 15:17:39 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-io0-x22c.google.com with SMTP id o4so14097639iod.3; Tue, 10 Apr 2018 08:17:39 -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=7ZG8VPnm7ia40tPK+biKdB0HSXwTeSWZl/Jh539jx9M=; b=mYreIj9gyoM6FnO9TpR3FQqzA+HD+e2fyPJR2ykhYIVQpigbBGe/6Gy0ZSxRuZx94d 4QIhtw7uymb4GUWXw3/mgxA8rh0K+WMZwLNTb4AQLQOL97O9MwpxOuCuBYVG54bNWdbl EllAKg/UlguBVXSasZMmjQoxLXbK6rEv0zqGnVdlAeSQLbwdv/hy6tCrsewJIR1D+UcP KtzytywOy584zFKGrajtJYjGP5nmczASF0kPH5CpgzaH3n4EjJHVPNMoWF1/TYcuPnse v6POB4w1z+ItzBTn/IZCC4oatX/o5dSd07FXZzmTyv/Pc/zyNu5rA3dE1vhIOh+hUWz7 ut+g== 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=7ZG8VPnm7ia40tPK+biKdB0HSXwTeSWZl/Jh539jx9M=; b=h41AEwV4eihu7DzyRo+3hQeu6NqKnESKUC+16Ubyed/DixVXw1IX3+1dCoisCEg0Vq V5hKVn3110wj+RFM5piR6t+Kcr9jo8vjzUHa2uskDTLRKb7a1kJW8gvFra41MZlJoLUj VuRMBIh74yA4BaGSvrBw5EuSryJaLl6aAEAU6V06CE6tM2vDFdXzHrn8HN+adjNOKc4g v8iYLSCY4wiaT3Vf98Kk0PpYJW3klgrnVNIBrnBR7AV66M3xbY8k3RsEvKBkaHxlyiAc zXmtlmriEVUbkIfRXwRPOBs63scJWRU7mPgnAa/T9VygF0REwgJkY5PcagRFFt/cxFeF 3X+w== X-Gm-Message-State: ALQs6tDeWv6OPZVuJxvwpb2WLV+EZYHhscjOoW5ytLWJ06Vk9rIGQ+ka pvBxOM4vlcvRr4EK/BTrn8oMiw== X-Google-Smtp-Source: AIpwx492rDXUX7o2M+f1FMMHe2rRBDLRTu9b/78gByz62A5SW914jaerm6jtKcziqJfADJjShD41AQ== X-Received: by 10.107.135.157 with SMTP id r29mr919413ioi.248.1523373458360; Tue, 10 Apr 2018 08:17:38 -0700 (PDT) Received: from raichu (toroon0560w-lp130-04-184-145-252-74.dsl.bell.ca. [184.145.252.74]) by smtp.gmail.com with ESMTPSA id n142-v6sm1023053itn.38.2018.04.10.08.17.36 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 10 Apr 2018 08:17:37 -0700 (PDT) Sender: Mark Johnston Date: Tue, 10 Apr 2018 11:17:33 -0400 From: Mark Johnston To: Slawa Olhovchenkov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332365 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <20180410151733.GA64021@raichu> References: <201804101356.w3ADu6Jr072766@repo.freebsd.org> <20180410140957.GG6612@zxy.spb.ru> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180410140957.GG6612@zxy.spb.ru> User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 15:17:39 -0000 On Tue, Apr 10, 2018 at 05:09:57PM +0300, Slawa Olhovchenkov wrote: > On Tue, Apr 10, 2018 at 01:56:06PM +0000, Mark Johnston wrote: > > > Author: markj > > Date: Tue Apr 10 13:56:06 2018 > > New Revision: 332365 > > URL: https://svnweb.freebsd.org/changeset/base/332365 > > > > Log: > > Set zfs_arc_free_target to v_free_target. > > > > Page daemon output is now regulated by a PID controller with a setpoint > > of v_free_target. Moreover, the page daemon now wakes up regularly > > rather than waiting for a wakeup from another thread. This means that > > the free page count is unlikely to drop below the old > > zfs_arc_free_target value, and as a result the ARC was not readily > > freeing pages under memory pressure. Address the immediate problem by > > updating zfs_arc_free_target to match the page daemon's new behaviour. > > Can you explain some more about new page daemon algo (and reclaim zone > free memory)? The old algorithm was pretty simple: there was a free page target and below that, a wakeup threshold. Any time a thread allocated a page and in so doing caused the free page count to drop below the wakeup threshold, that thread would wake up the page daemon, which would scan the inactive queue and free pages until the free target is reached, or the end of the inactive queue was reached. This is simple and easy to reason about, but has some drawbacks. When memory pressure is constant, it leads to bursts of CPU usage and lock contention. The static watermarks may also be insufficient for some demanding workloads. In particular, the wakeup threshold might be too low, thus allowing the free page count to drop to dangerous levels and triggering expensive memory shortage handling (i.e., VM_WAIT). The new algorithm uses a control loop to dynamically compute a target for each scan of the inactive queue. The loop takes as input the magnitude of the page shortage (v_free_target - v_free_count) and keeps track of the rate of change of this difference (i.e., the rate at which free pages are being consumed) and the sum of this difference over time (i.e., a cumulative value for the magnitude of recent page shortages). These factors are used to compute "shortage", the number of pages to reclaim with the goal of maintaining a free page count of v_free_target. The effect of the new algorithm is that the page daemon runs more frequently but for shorter durations, so its CPU usage is more even. It responds dynamically to the demands of the workload, so the shortcomings of a pair of static watermarks are gone. r329882 doesn't really change anything with respect to reclamation of pages from UMA zones. There are some plans to address shortcomings there in the near future though. > PS: zfs need some more time for free pages from ARC. Also, vanila zfs > have broken logic for count used and free ARC's memory. For most > correctly count system-wide used and free memory need accounting > in-zone free memory. Yes, there is a number of problems in this area predating r329882. This commit is really just a bandaid. From owner-svn-src-head@freebsd.org Tue Apr 10 15:51:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 54399F826AB; Tue, 10 Apr 2018 15:51:38 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 043B96EC5E; Tue, 10 Apr 2018 15:51:38 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F1BE27A8A; Tue, 10 Apr 2018 15:51:37 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3AFpbI5041501; Tue, 10 Apr 2018 15:51:37 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AFpb1v041499; Tue, 10 Apr 2018 15:51:37 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201804101551.w3AFpb1v041499@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Tue, 10 Apr 2018 15:51:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332378 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 332378 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 15:51:38 -0000 Author: jtl Date: Tue Apr 10 15:51:37 2018 New Revision: 332378 URL: https://svnweb.freebsd.org/changeset/base/332378 Log: Clean up some debugging code left in tcp_log_buf.c from r331347. Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_log_buf.c Modified: head/sys/netinet/tcp_log_buf.c ============================================================================== --- head/sys/netinet/tcp_log_buf.c Tue Apr 10 15:38:16 2018 (r332377) +++ head/sys/netinet/tcp_log_buf.c Tue Apr 10 15:51:37 2018 (r332378) @@ -1667,52 +1667,7 @@ tcp_log_logs_to_buf(struct sockopt *sopt, struct tcp_l #ifdef TCPLOG_DEBUG_COUNTERS counter_u64_add(tcp_log_que_copyout, 1); #endif -#if 0 - struct tcp_log_buffer *lb = &log_entry->tlm_buf; - int i; - printf("lb = %p:\n", lb); -#define PRINT(f) printf(#f " = %u\n", (unsigned int)lb->f) - printf("tlb_tv = {%lu, %lu}\n", lb->tlb_tv.tv_sec, lb->tlb_tv.tv_usec); - PRINT(tlb_ticks); - PRINT(tlb_sn); - PRINT(tlb_stackid); - PRINT(tlb_eventid); - PRINT(tlb_eventflags); - PRINT(tlb_errno); - PRINT(tlb_rxbuf.tls_sb_acc); - PRINT(tlb_rxbuf.tls_sb_ccc); - PRINT(tlb_rxbuf.tls_sb_spare); - PRINT(tlb_txbuf.tls_sb_acc); - PRINT(tlb_txbuf.tls_sb_ccc); - PRINT(tlb_txbuf.tls_sb_spare); - PRINT(tlb_state); - PRINT(tlb_flags); - PRINT(tlb_snd_una); - PRINT(tlb_snd_max); - PRINT(tlb_snd_cwnd); - PRINT(tlb_snd_nxt); - PRINT(tlb_snd_recover); - PRINT(tlb_snd_wnd); - PRINT(tlb_snd_ssthresh); - PRINT(tlb_srtt); - PRINT(tlb_rttvar); - PRINT(tlb_rcv_up); - PRINT(tlb_rcv_adv); - PRINT(tlb_rcv_nxt); - PRINT(tlb_sack_newdata); - PRINT(tlb_rcv_wnd); - PRINT(tlb_dupacks); - PRINT(tlb_segqlen); - PRINT(tlb_snd_numholes); - PRINT(tlb_snd_scale); - PRINT(tlb_rcv_scale); - PRINT(tlb_len); - printf("hex dump: "); - for (i = 0; i < sizeof(struct tcp_log_buffer); i++) - printf("%02x", *(((uint8_t *)lb) + i)); -#undef PRINT -#endif /* * Skip copying out the header if it isn't present. * Instead, copy out zeros (to ensure we don't leak info). From owner-svn-src-head@freebsd.org Tue Apr 10 15:54:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6E3EDF82A50; Tue, 10 Apr 2018 15:54:30 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1BB1B707EB; Tue, 10 Apr 2018 15:54:30 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 148D77AD3; Tue, 10 Apr 2018 15:54:30 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3AFsTx0048638; Tue, 10 Apr 2018 15:54:29 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AFsTE5048636; Tue, 10 Apr 2018 15:54:29 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201804101554.w3AFsTE5048636@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Tue, 10 Apr 2018 15:54:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332379 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 332379 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 15:54:30 -0000 Author: jtl Date: Tue Apr 10 15:54:29 2018 New Revision: 332379 URL: https://svnweb.freebsd.org/changeset/base/332379 Log: Move the TCP Blackbox Recorder probe in tcp_output.c to be with the other tracing/debugging code. Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_output.c Modified: head/sys/netinet/tcp_output.c ============================================================================== --- head/sys/netinet/tcp_output.c Tue Apr 10 15:51:37 2018 (r332378) +++ head/sys/netinet/tcp_output.c Tue Apr 10 15:54:29 2018 (r332379) @@ -1311,10 +1311,6 @@ send: } #endif - /* We're getting ready to send; log now. */ - TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_OUT, ERRNO_UNK, - len, NULL, false); - /* * Enable TSO and specify the size of the segments. * The TCP pseudo header checksum is always provided. @@ -1362,6 +1358,10 @@ send: } #endif /* TCPDEBUG */ TCP_PROBE3(debug__output, tp, th, m); + + /* We're getting ready to send; log now. */ + TCP_LOG_EVENT(tp, th, &so->so_rcv, &so->so_snd, TCP_LOG_OUT, ERRNO_UNK, + len, NULL, false); /* * Fill in IP length and desired time to live and From owner-svn-src-head@freebsd.org Tue Apr 10 16:02:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0D202F8366C; Tue, 10 Apr 2018 16:02:41 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from zxy.spb.ru (zxy.spb.ru [195.70.199.98]) (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 998FE71483; Tue, 10 Apr 2018 16:02:40 +0000 (UTC) (envelope-from slw@zxy.spb.ru) Received: from slw by zxy.spb.ru with local (Exim 4.86 (FreeBSD)) (envelope-from ) id 1f5vjB-000CXN-KT; Tue, 10 Apr 2018 19:02:37 +0300 Date: Tue, 10 Apr 2018 19:02:37 +0300 From: Slawa Olhovchenkov To: Mark Johnston Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332365 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <20180410160237.GP4305@zxy.spb.ru> References: <201804101356.w3ADu6Jr072766@repo.freebsd.org> <20180410140957.GG6612@zxy.spb.ru> <20180410151733.GA64021@raichu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180410151733.GA64021@raichu> User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: X-SA-Exim-Mail-From: slw@zxy.spb.ru X-SA-Exim-Scanned: No (on zxy.spb.ru); SAEximRunCond expanded to false X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 16:02:41 -0000 On Tue, Apr 10, 2018 at 11:17:33AM -0400, Mark Johnston wrote: > On Tue, Apr 10, 2018 at 05:09:57PM +0300, Slawa Olhovchenkov wrote: > > On Tue, Apr 10, 2018 at 01:56:06PM +0000, Mark Johnston wrote: > > > > > Author: markj > > > Date: Tue Apr 10 13:56:06 2018 > > > New Revision: 332365 > > > URL: https://svnweb.freebsd.org/changeset/base/332365 > > > > > > Log: > > > Set zfs_arc_free_target to v_free_target. > > > > > > Page daemon output is now regulated by a PID controller with a setpoint > > > of v_free_target. Moreover, the page daemon now wakes up regularly > > > rather than waiting for a wakeup from another thread. This means that > > > the free page count is unlikely to drop below the old > > > zfs_arc_free_target value, and as a result the ARC was not readily > > > freeing pages under memory pressure. Address the immediate problem by > > > updating zfs_arc_free_target to match the page daemon's new behaviour. > > > > Can you explain some more about new page daemon algo (and reclaim zone > > free memory)? > > The old algorithm was pretty simple: there was a free page target and > below that, a wakeup threshold. Any time a thread allocated a page and > in so doing caused the free page count to drop below the wakeup > threshold, that thread would wake up the page daemon, which would scan > the inactive queue and free pages until the free target is reached, or > the end of the inactive queue was reached. > > This is simple and easy to reason about, but has some drawbacks. When > memory pressure is constant, it leads to bursts of CPU usage and lock > contention. The static watermarks may also be insufficient for some > demanding workloads. In particular, the wakeup threshold might be too > low, thus allowing the free page count to drop to dangerous levels and > triggering expensive memory shortage handling (i.e., VM_WAIT). > > The new algorithm uses a control loop to dynamically compute a target > for each scan of the inactive queue. The loop takes as input the > magnitude of the page shortage (v_free_target - v_free_count) and keeps > track of the rate of change of this difference (i.e., the rate at which > free pages are being consumed) and the sum of this difference over time > (i.e., a cumulative value for the magnitude of recent page shortages). > These factors are used to compute "shortage", the number of pages to > reclaim with the goal of maintaining a free page count of v_free_target. > > The effect of the new algorithm is that the page daemon runs more > frequently but for shorter durations, so its CPU usage is more even. It > responds dynamically to the demands of the workload, so the shortcomings > of a pair of static watermarks are gone. > > r329882 doesn't really change anything with respect to reclamation of > pages from UMA zones. There are some plans to address shortcomings there > in the near future though. Thank, very nice explain. IMHO, in this case for ZFS best is old zfs_arc_free_target: too close zfs_arc_free_target to vm_cnt.v_free_min can cause too often run arc_target correction and cause CPU consumption and memory subsystem overuse. ZFS need more correct pressure, ZFS-specific, and I am try it in D7538. > > PS: zfs need some more time for free pages from ARC. Also, vanila zfs > > have broken logic for count used and free ARC's memory. For most > > correctly count system-wide used and free memory need accounting > > in-zone free memory. > > Yes, there is a number of problems in this area predating r329882. This > commit is really just a bandaid. From owner-svn-src-head@freebsd.org Tue Apr 10 16:59:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id EF686F86EEE; Tue, 10 Apr 2018 16:59:36 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9FB6E7F931; Tue, 10 Apr 2018 16:59:36 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 92D7310477; Tue, 10 Apr 2018 16:59:36 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3AGxaon005257; Tue, 10 Apr 2018 16:59:36 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AGxa9d005256; Tue, 10 Apr 2018 16:59:36 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201804101659.w3AGxa9d005256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Tue, 10 Apr 2018 16:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332381 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 332381 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 16:59:37 -0000 Author: jtl Date: Tue Apr 10 16:59:36 2018 New Revision: 332381 URL: https://svnweb.freebsd.org/changeset/base/332381 Log: Modify the net.inet.tcp.function_ids sysctl introduced in r331347. Export additional information which may be helpful to userspace consumers and rename the sysctl to net.inet.tcp.function_info. Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_subr.c Modified: head/sys/netinet/tcp_subr.c ============================================================================== --- head/sys/netinet/tcp_subr.c Tue Apr 10 16:44:40 2018 (r332380) +++ head/sys/netinet/tcp_subr.c Tue Apr 10 16:59:36 2018 (r332381) @@ -255,6 +255,7 @@ static struct tcp_function_block tcp_def_funcblk = { }; int t_functions_inited = 0; +static int tcp_fb_cnt = 0; struct tcp_funchead t_functions; static struct tcp_function_block *tcp_func_set_ptr = &tcp_def_funcblk; @@ -426,14 +427,14 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, functions_availab "list available TCP Function sets"); /* - * Exports one (struct tcp_function_id) for each non-alias. + * Exports one (struct tcp_function_info) for each alias/name. */ static int -sysctl_net_inet_list_func_ids(SYSCTL_HANDLER_ARGS) +sysctl_net_inet_list_func_info(SYSCTL_HANDLER_ARGS) { - int error, cnt; + int cnt, error; struct tcp_function *f; - struct tcp_function_id tfi; + struct tcp_function_info tfi; /* * We don't allow writes. @@ -452,21 +453,32 @@ sysctl_net_inet_list_func_ids(SYSCTL_HANDLER_ARGS) } /* - * Walk the list, comparing the name of the function entry and - * function block to determine which is an alias. - * If exporting the list, copy out matching entries. Otherwise, - * just record the total length. + * Walk the list and copy out matching entries. If INVARIANTS + * is compiled in, also walk the list to verify the length of + * the list matches what we have recorded. */ - cnt = 0; rw_rlock(&tcp_function_lock); +#ifdef INVARIANTS + cnt = 0; +#else + if (req->oldptr == NULL) { + cnt = tcp_fb_cnt; + goto skip_loop; + } +#endif TAILQ_FOREACH(f, &t_functions, tf_next) { - if (strncmp(f->tf_name, f->tf_fb->tfb_tcp_block_name, - TCP_FUNCTION_NAME_LEN_MAX)) - continue; +#ifdef INVARIANTS + cnt++; +#endif if (req->oldptr != NULL) { + tfi.tfi_refcnt = f->tf_fb->tfb_refcnt; tfi.tfi_id = f->tf_fb->tfb_id; - (void)strncpy(tfi.tfi_name, f->tf_name, + (void)strncpy(tfi.tfi_alias, f->tf_name, TCP_FUNCTION_NAME_LEN_MAX); + tfi.tfi_alias[TCP_FUNCTION_NAME_LEN_MAX - 1] = '\0'; + (void)strncpy(tfi.tfi_name, + f->tf_fb->tfb_tcp_block_name, + TCP_FUNCTION_NAME_LEN_MAX); tfi.tfi_name[TCP_FUNCTION_NAME_LEN_MAX - 1] = '\0'; error = SYSCTL_OUT(req, &tfi, sizeof(tfi)); /* @@ -474,20 +486,24 @@ sysctl_net_inet_list_func_ids(SYSCTL_HANDLER_ARGS) * mechanism we use to accumulate length * information if the buffer was too short. */ - } else - cnt++; + } } + KASSERT(cnt == tcp_fb_cnt, + ("%s: cnt (%d) != tcp_fb_cnt (%d)", __func__, cnt, tcp_fb_cnt)); +#ifndef INVARIANTS +skip_loop: +#endif rw_runlock(&tcp_function_lock); if (req->oldptr == NULL) error = SYSCTL_OUT(req, NULL, - (cnt + 1) * sizeof(struct tcp_function_id)); + (cnt + 1) * sizeof(struct tcp_function_info)); return (error); } -SYSCTL_PROC(_net_inet_tcp, OID_AUTO, function_ids, +SYSCTL_PROC(_net_inet_tcp, OID_AUTO, function_info, CTLTYPE_OPAQUE | CTLFLAG_SKIP | CTLFLAG_RD | CTLFLAG_MPSAFE, - NULL, 0, sysctl_net_inet_list_func_ids, "S,tcp_function_id", + NULL, 0, sysctl_net_inet_list_func_info, "S,tcp_function_info", "List TCP function block name-to-ID mappings"); /* @@ -653,6 +669,7 @@ register_tcp_functions_as_names(struct tcp_function_bl (void)strncpy(n->tf_name, names[i], TCP_FUNCTION_NAME_LEN_MAX); n->tf_name[TCP_FUNCTION_NAME_LEN_MAX - 1] = '\0'; TAILQ_INSERT_TAIL(&t_functions, n, tf_next); + tcp_fb_cnt++; rw_wunlock(&tcp_function_lock); } return(0); @@ -669,6 +686,7 @@ cleanup: if (!strncmp(n->tf_name, names[i], TCP_FUNCTION_NAME_LEN_MAX)) { TAILQ_REMOVE(&t_functions, n, tf_next); + tcp_fb_cnt--; n->tf_fb = NULL; free(n, M_TCPFUNCTIONS); break; @@ -739,6 +757,7 @@ deregister_tcp_functions(struct tcp_function_block *bl while (find_tcp_fb_locked(blk, &f) != NULL) { /* Found */ TAILQ_REMOVE(&t_functions, f, tf_next); + tcp_fb_cnt--; f->tf_fb = NULL; free(f, M_TCPFUNCTIONS); error = 0; From owner-svn-src-head@freebsd.org Tue Apr 10 17:00:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B84FF870EE; Tue, 10 Apr 2018 17:00:38 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id F1FF97FD79; Tue, 10 Apr 2018 17:00:37 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EC5001048B; Tue, 10 Apr 2018 17:00:37 +0000 (UTC) (envelope-from jtl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3AH0bnw007037; Tue, 10 Apr 2018 17:00:37 GMT (envelope-from jtl@FreeBSD.org) Received: (from jtl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AH0b4X007036; Tue, 10 Apr 2018 17:00:37 GMT (envelope-from jtl@FreeBSD.org) Message-Id: <201804101700.w3AH0b4X007036@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jtl set sender to jtl@FreeBSD.org using -f From: "Jonathan T. Looney" Date: Tue, 10 Apr 2018 17:00:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332382 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: jtl X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 332382 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 17:00:38 -0000 Author: jtl Date: Tue Apr 10 17:00:37 2018 New Revision: 332382 URL: https://svnweb.freebsd.org/changeset/base/332382 Log: Add missing header change from r332381. Sponsored by: Netflix, Inc. Pointy hat: jtl Modified: head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Tue Apr 10 16:59:36 2018 (r332381) +++ head/sys/netinet/tcp_var.h Tue Apr 10 17:00:37 2018 (r332382) @@ -688,11 +688,14 @@ void tcp_inptoxtp(const struct inpcb *, struct xtcpcb #endif /* - * TCP function name-to-id mapping exported to user-land via sysctl(3). + * TCP function information (name-to-id mapping, aliases, and refcnt) + * exported to user-land via sysctl(3). */ -struct tcp_function_id { +struct tcp_function_info { + uint32_t tfi_refcnt; uint8_t tfi_id; char tfi_name[TCP_FUNCTION_NAME_LEN_MAX]; + char tfi_alias[TCP_FUNCTION_NAME_LEN_MAX]; }; /* From owner-svn-src-head@freebsd.org Tue Apr 10 17:32:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E97C7F89B16; Tue, 10 Apr 2018 17:32:27 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9DA258787B; Tue, 10 Apr 2018 17:32:27 +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 98B5810AD6; Tue, 10 Apr 2018 17:32:27 +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 w3AHWRSe071985; Tue, 10 Apr 2018 17:32:27 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AHWRER071984; Tue, 10 Apr 2018 17:32:27 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201804101732.w3AHWRER071984@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 10 Apr 2018 17:32:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332383 - 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: 332383 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 17:32:28 -0000 Author: jhibbits Date: Tue Apr 10 17:32:27 2018 New Revision: 332383 URL: https://svnweb.freebsd.org/changeset/base/332383 Log: Call through powerpc_interrupt for all Book-E interrupts Make int_external_input, int_decrementer, and int_performance_counter all now use trap_common, just like on AIM. The effects of this are: * All traps are now properly displayed in ddb. Previously traps from external input, decrementer, and performance counters, would display as just basic stack traces. Now the frame is displayed. * External interrupts are now handled with interrupts enabled, so handling can be preempted. This seems to fix a hang found post-r329882. Modified: head/sys/powerpc/booke/trap_subr.S Modified: head/sys/powerpc/booke/trap_subr.S ============================================================================== --- head/sys/powerpc/booke/trap_subr.S Tue Apr 10 17:00:37 2018 (r332382) +++ head/sys/powerpc/booke/trap_subr.S Tue Apr 10 17:32:27 2018 (r332383) @@ -563,11 +563,7 @@ INTERRUPT(int_instr_storage) INTERRUPT(int_external_input) STANDARD_PROLOG(SPR_SPRG1, PC_TEMPSAVE, SPR_SRR0, SPR_SRR1) FRAME_SETUP(SPR_SPRG1, PC_TEMPSAVE, EXC_EXI) - GET_TOCBASE(%r2) - addi %r3, %r1, CALLSIZE - bl CNAME(powerpc_interrupt) - TOC_RESTORE - b trapexit + b trap_common INTERRUPT(int_alignment) @@ -603,11 +599,7 @@ INTERRUPT(int_syscall) INTERRUPT(int_decrementer) STANDARD_PROLOG(SPR_SPRG1, PC_TEMPSAVE, SPR_SRR0, SPR_SRR1) FRAME_SETUP(SPR_SPRG1, PC_TEMPSAVE, EXC_DECR) - GET_TOCBASE(%r2) - addi %r3, %r1, CALLSIZE - bl CNAME(powerpc_interrupt) - TOC_RESTORE - b trapexit + b trap_common /***************************************************************************** @@ -653,11 +645,7 @@ INTERRUPT(int_vecast) INTERRUPT(int_performance_counter) STANDARD_PROLOG(SPR_SPRG3, PC_TEMPSAVE, SPR_SRR0, SPR_SRR1) FRAME_SETUP(SPR_SPRG3, PC_TEMPSAVE, EXC_PERF) - GET_TOCBASE(%r2) - addi %r3, %r1, CALLSIZE - bl CNAME(powerpc_interrupt) - TOC_RESTORE - b trapexit + b trap_common #endif @@ -1002,7 +990,7 @@ trap_common: /* Call C trap dispatcher */ GET_TOCBASE(%r2) addi %r3, %r1, CALLSIZE - bl CNAME(trap) + bl CNAME(powerpc_interrupt) TOC_RESTORE .globl CNAME(trapexit) /* exported for db_backtrace use */ From owner-svn-src-head@freebsd.org Tue Apr 10 17:40:44 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C60E0F8A67B; Tue, 10 Apr 2018 17:40:44 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 793F76AB88; Tue, 10 Apr 2018 17:40:44 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 741B510B02; Tue, 10 Apr 2018 17:40:44 +0000 (UTC) (envelope-from gjb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3AHeiVu084094; Tue, 10 Apr 2018 17:40:44 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AHeiaq084093; Tue, 10 Apr 2018 17:40:44 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201804101740.w3AHeiaq084093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Tue, 10 Apr 2018 17:40:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332384 - head/release/arm64 X-SVN-Group: head X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: head/release/arm64 X-SVN-Commit-Revision: 332384 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 17:40:44 -0000 Author: gjb Date: Tue Apr 10 17:40:44 2018 New Revision: 332384 URL: https://svnweb.freebsd.org/changeset/base/332384 Log: Following r331292, many of the files (such as the LICENSE file) have moved from the u-boot-rpi3 share directory to the default rpi-firmware share directory. Remove the files from UBOOT_FILES and append the DTB file to a DTB_FILES list so the correct path is used, fixing a build failure. Sponsored by: The FreeBSD Foundation Modified: head/release/arm64/RPI3.conf Modified: head/release/arm64/RPI3.conf ============================================================================== --- head/release/arm64/RPI3.conf Tue Apr 10 17:32:27 2018 (r332383) +++ head/release/arm64/RPI3.conf Tue Apr 10 17:40:44 2018 (r332384) @@ -22,9 +22,10 @@ export BOARDNAME="RPI3" arm_install_uboot() { UBOOT_DIR="/usr/local/share/u-boot/u-boot-rpi3" - UBOOT_FILES="LICENCE.broadcom README armstub8.bin bootcode.bin config.txt \ - fixup.dat fixup_cd.dat fixup_x.dat start.elf start_cd.elf \ - start_x.elf u-boot.bin" + UBOOT_FILES="README u-boot.bin" + DTB_FILES="armstub8.bin bootcode.bin config.txt fixup_cd.dat \ + fixup_db.dat fixup_x.dat fixup.dat LICENCE.broadcom \ + start_cd.elf start_db.elf start_x.elf start.elf ${DTB}" FATMOUNT="${DESTDIR%${KERNEL}}fat" UFSMOUNT="${DESTDIR%${KERNEL}}ufs" chroot ${CHROOTDIR} mkdir -p "${FATMOUNT}" "${UFSMOUNT}" @@ -34,7 +35,10 @@ arm_install_uboot() { chroot ${CHROOTDIR} cp -p ${UBOOT_DIR}/${_UF} \ ${FATMOUNT}/${_UF} done - chroot ${CHROOTDIR} cp -p ${DTB_DIR}/${DTB} ${FATMOUNT}/${DTB} + for _DF in ${DTB_FILES}; do + chroot ${CHROOTDIR} cp -p ${DTB_DIR}/${_DF} \ + ${FATMOUNT}/${_DF} + done chroot ${CHROOTDIR} mkdir -p ${FATMOUNT}/overlays for _OL in ${OVERLAYS}; do chroot ${CHROOTDIR} cp -p ${OL_DIR}/${_OL} \ From owner-svn-src-head@freebsd.org Tue Apr 10 18:05:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A46ADF8C1B0; Tue, 10 Apr 2018 18:05:03 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5619A6FF77; Tue, 10 Apr 2018 18:05:03 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 50F9B11005; Tue, 10 Apr 2018 18:05:03 +0000 (UTC) (envelope-from dexuan@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3AI533S007921; Tue, 10 Apr 2018 18:05:03 GMT (envelope-from dexuan@FreeBSD.org) Received: (from dexuan@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AI53lb007920; Tue, 10 Apr 2018 18:05:03 GMT (envelope-from dexuan@FreeBSD.org) Message-Id: <201804101805.w3AI53lb007920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dexuan set sender to dexuan@FreeBSD.org using -f From: Dexuan Cui Date: Tue, 10 Apr 2018 18:05:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332385 - head/sys/dev/hyperv/storvsc X-SVN-Group: head X-SVN-Commit-Author: dexuan X-SVN-Commit-Paths: head/sys/dev/hyperv/storvsc X-SVN-Commit-Revision: 332385 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 18:05:03 -0000 Author: dexuan Date: Tue Apr 10 18:05:02 2018 New Revision: 332385 URL: https://svnweb.freebsd.org/changeset/base/332385 Log: hyperv/storvsc: storvsc_io_done(): do not use CAM_SEL_TIMEOUT CAM_SEL_TIMEOUT was introduced in https://reviews.freebsd.org/D7521 (r304251), which claimed: "VM shall response to CAM layer with CAM_SEL_TIMEOUT to filter those invalid LUNs. Never use CAM_DEV_NOT_THERE which will block LUN scan for LUN number higher than 7." But it turns out this is not correct: I think what really filters the invalid LUNs in r304251 is that: before r304251, we could set the CAM_REQ_CMP without checking vm_srb->srb_status at all: ccb->ccb_h.status |= CAM_REQ_CMP. r304251 checks vm_srb->srb_status and sets ccb->ccb_h.status properly, so the invalid LUNs are filtered. I changed my code version to r304251 but replaced the CAM_SEL_TIMEOUT with CAM_DEV_NOT_THERE, and I confirmed the invalid LUNs can also be filtered, and I successfully hot-added and hot-removed 8 disks to/from the VM without any issue. CAM_SEL_TIMEOUT has an unwanted side effect -- see cam_periph_error(): For a selection timeout, we consider all of the LUNs on the target to be gone. If the status is CAM_DEV_NOT_THERE, then we only get rid of the device(s) specified by the path in the original CCB. This means: for a VM with a valid LUN on 3:0:0:0, when the VM inquires 3:0:0:1 and the host reports 3:0:0:1 doesn't exist and storvsc returns CAM_SEL_TIMEOUT to the CAM layer, CAM will detech 3:0:0:0 as well: this is the bug I reported recently: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=226583 PR: 226583 Reviewed by: mav MFC after: 1 week Sponsored by: Microsoft Differential Revision: https://reviews.freebsd.org/D14690 Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Modified: head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c ============================================================================== --- head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Apr 10 17:40:44 2018 (r332384) +++ head/sys/dev/hyperv/storvsc/hv_storvsc_drv_freebsd.c Tue Apr 10 18:05:02 2018 (r332385) @@ -2173,20 +2173,7 @@ storvsc_io_done(struct hv_storvsc_request *reqp) scsi_op_desc(cmd->opcode, NULL)); } } - - /* - * XXX For a selection timeout, all of the LUNs - * on the target will be gone. It works for SCSI - * disks, but does not work for IDE disks. - * - * For CAM_DEV_NOT_THERE, CAM will only get - * rid of the device(s) specified by the path. - */ - if (storvsc_get_storage_type(sc->hs_dev) == - DRIVER_STORVSC) - ccb->ccb_h.status |= CAM_SEL_TIMEOUT; - else - ccb->ccb_h.status |= CAM_DEV_NOT_THERE; + ccb->ccb_h.status |= CAM_DEV_NOT_THERE; } else { ccb->ccb_h.status |= CAM_REQ_CMP; } From owner-svn-src-head@freebsd.org Tue Apr 10 18:39:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 23ECFF8ED73; Tue, 10 Apr 2018 18:39:21 +0000 (UTC) (envelope-from ram@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C669E79DE8; Tue, 10 Apr 2018 18:39:20 +0000 (UTC) (envelope-from ram@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C15511152C; Tue, 10 Apr 2018 18:39:20 +0000 (UTC) (envelope-from ram@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3AIdKfD026213; Tue, 10 Apr 2018 18:39:20 GMT (envelope-from ram@FreeBSD.org) Received: (from ram@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AIdKZk026212; Tue, 10 Apr 2018 18:39:20 GMT (envelope-from ram@FreeBSD.org) Message-Id: <201804101839.w3AIdKZk026212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ram set sender to ram@FreeBSD.org using -f From: Ram Kishore Vegesna Date: Tue, 10 Apr 2018 18:39:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332386 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: ram X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 332386 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 18:39:21 -0000 Author: ram Date: Tue Apr 10 18:39:20 2018 New Revision: 332386 URL: https://svnweb.freebsd.org/changeset/base/332386 Log: Updated mentors information. Approved by: ken, mav Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Tue Apr 10 18:05:02 2018 (r332385) +++ head/share/misc/committers-src.dot Tue Apr 10 18:39:20 2018 (r332386) @@ -76,6 +76,7 @@ nate [label="Nate Willams\nnate@FreeBSD.org\n1993/06/1 njl [label="Nate Lawson\nnjl@FreeBSD.org\n2002/08/07\n2008/02/16"] non [label="Noriaki Mitsnaga\nnon@FreeBSD.org\n2000/06/19\n2007/03/06"] onoe [label="Atsushi Onoe\nonoe@FreeBSD.org\n2000/07/21\n2008/11/10"] +ram [label="Ram Kishore Vegesna\nram@FreeBSD.org\n2018/04/04\n???/??/??"] rafan [label="Rong-En Fan\nrafan@FreeBSD.org\n2007/01/31\n2012/07/23"] randi [label="Randi Harper\nrandi@FreeBSD.org\n2010/04/20\n2012/05/10"] rink [label="Rink Springer\nrink@FreeBSD.org\n2006/01/16\n2010/11/04"] @@ -629,6 +630,7 @@ kan -> kib ken -> asomers ken -> chuck +ken -> ram ken -> slm kib -> ae @@ -671,6 +673,7 @@ markm -> sheldonh mav -> ae mav -> eugen +mav -> ram mdf -> gleb From owner-svn-src-head@freebsd.org Tue Apr 10 19:18:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 68D51F91A02; Tue, 10 Apr 2018 19:18:20 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 150CF830B1; Tue, 10 Apr 2018 19:18:20 +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 0FCEA11BC1; Tue, 10 Apr 2018 19:18:20 +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 w3AJIJXs049220; Tue, 10 Apr 2018 19:18:19 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AJIG62049183; Tue, 10 Apr 2018 19:18:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804101918.w3AJIG62049183@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 10 Apr 2018 19:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332387 - in head/sys/geom: . bde cache concat eli gate journal label linux_lvm mirror mountver multipath nop part raid3 shsec stripe uzip vinum virstor zero X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/sys/geom: . bde cache concat eli gate journal label linux_lvm mirror mountver multipath nop part raid3 shsec stripe uzip vinum virstor zero X-SVN-Commit-Revision: 332387 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 19:18:20 -0000 Author: kevans Date: Tue Apr 10 19:18:16 2018 New Revision: 332387 URL: https://svnweb.freebsd.org/changeset/base/332387 Log: Annotate geom modules with MODULE_VERSION GEOM ELI may double ask the password during boot. Once at loader time, and once at init time. This happens due a module loading bug. By default GEOM ELI caches the password in the kernel, but without the MODULE_VERSION annotation, the kernel loads over the kernel module, even if the GEOM ELI was compiled into the kernel. In this case, the newly loaded module purges/invalidates/overwrites the GEOM ELI's password cache, which causes the double asking. MFC Note: There's a pc98 component to the original submission that is omitted here due to pc98 removal in head. This part will need to be revived upon MFC. Reviewed by: imp Submitted by: op Obtained from: opBSD MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D14992 Modified: head/sys/geom/bde/g_bde.c head/sys/geom/cache/g_cache.c head/sys/geom/concat/g_concat.c head/sys/geom/eli/g_eli.c head/sys/geom/gate/g_gate.c head/sys/geom/geom_bsd.c head/sys/geom/geom_ccd.c head/sys/geom/geom_fox.c head/sys/geom/geom_map.c head/sys/geom/geom_mbr.c head/sys/geom/geom_redboot.c head/sys/geom/geom_sunlabel.c head/sys/geom/geom_vol_ffs.c head/sys/geom/journal/g_journal_ufs.c head/sys/geom/label/g_label.c head/sys/geom/linux_lvm/g_linux_lvm.c head/sys/geom/mirror/g_mirror.c head/sys/geom/mountver/g_mountver.c head/sys/geom/multipath/g_multipath.c head/sys/geom/nop/g_nop.c head/sys/geom/part/g_part_apm.c head/sys/geom/part/g_part_bsd.c head/sys/geom/part/g_part_bsd64.c head/sys/geom/part/g_part_ebr.c head/sys/geom/part/g_part_gpt.c head/sys/geom/part/g_part_ldm.c head/sys/geom/part/g_part_mbr.c head/sys/geom/part/g_part_vtoc8.c head/sys/geom/raid3/g_raid3.c head/sys/geom/shsec/g_shsec.c head/sys/geom/stripe/g_stripe.c head/sys/geom/uzip/g_uzip.c head/sys/geom/vinum/geom_vinum.c head/sys/geom/virstor/g_virstor.c head/sys/geom/zero/g_zero.c Modified: head/sys/geom/bde/g_bde.c ============================================================================== --- head/sys/geom/bde/g_bde.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/bde/g_bde.c Tue Apr 10 19:18:16 2018 (r332387) @@ -292,3 +292,4 @@ static struct g_class g_bde_class = { }; DECLARE_GEOM_CLASS(g_bde_class, g_bde); +MODULE_VERSION(geom_bde, 0); Modified: head/sys/geom/cache/g_cache.c ============================================================================== --- head/sys/geom/cache/g_cache.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/cache/g_cache.c Tue Apr 10 19:18:16 2018 (r332387) @@ -1016,3 +1016,4 @@ g_cache_dumpconf(struct sbuf *sb, const char *indent, } DECLARE_GEOM_CLASS(g_cache_class, g_cache); +MODULE_VERSION(geom_cache, 0); Modified: head/sys/geom/concat/g_concat.c ============================================================================== --- head/sys/geom/concat/g_concat.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/concat/g_concat.c Tue Apr 10 19:18:16 2018 (r332387) @@ -993,3 +993,4 @@ g_concat_dumpconf(struct sbuf *sb, const char *indent, } DECLARE_GEOM_CLASS(g_concat_class, g_concat); +MODULE_VERSION(geom_concat, 0); Modified: head/sys/geom/eli/g_eli.c ============================================================================== --- head/sys/geom/eli/g_eli.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/eli/g_eli.c Tue Apr 10 19:18:16 2018 (r332387) @@ -1333,3 +1333,4 @@ g_eli_fini(struct g_class *mp) DECLARE_GEOM_CLASS(g_eli_class, g_eli); MODULE_DEPEND(g_eli, crypto, 1, 1, 1); +MODULE_VERSION(geom_eli, 0); Modified: head/sys/geom/gate/g_gate.c ============================================================================== --- head/sys/geom/gate/g_gate.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/gate/g_gate.c Tue Apr 10 19:18:16 2018 (r332387) @@ -964,3 +964,4 @@ static moduledata_t g_gate_module = { }; DECLARE_MODULE(geom_gate, g_gate_module, SI_SUB_DRIVERS, SI_ORDER_MIDDLE); DECLARE_GEOM_CLASS(g_gate_class, g_gate); +MODULE_VERSION(geom_gate, 0); Modified: head/sys/geom/geom_bsd.c ============================================================================== --- head/sys/geom/geom_bsd.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/geom_bsd.c Tue Apr 10 19:18:16 2018 (r332387) @@ -614,3 +614,4 @@ static struct g_class g_bsd_class = { }; DECLARE_GEOM_CLASS(g_bsd_class, g_bsd); +MODULE_VERSION(geom_bsd, 0); Modified: head/sys/geom/geom_ccd.c ============================================================================== --- head/sys/geom/geom_ccd.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/geom_ccd.c Tue Apr 10 19:18:16 2018 (r332387) @@ -936,3 +936,4 @@ static struct g_class g_ccd_class = { }; DECLARE_GEOM_CLASS(g_ccd_class, g_ccd); +MODULE_VERSION(geom_ccd, 0); Modified: head/sys/geom/geom_fox.c ============================================================================== --- head/sys/geom/geom_fox.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/geom_fox.c Tue Apr 10 19:18:16 2018 (r332387) @@ -485,3 +485,4 @@ static struct g_class g_fox_class = { }; DECLARE_GEOM_CLASS(g_fox_class, g_fox); +MODULE_VERSION(geom_fox, 0); Modified: head/sys/geom/geom_map.c ============================================================================== --- head/sys/geom/geom_map.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/geom_map.c Tue Apr 10 19:18:16 2018 (r332387) @@ -407,3 +407,4 @@ static struct g_class g_map_class = { .ctlreq = g_map_config, }; DECLARE_GEOM_CLASS(g_map_class, g_map); +MODULE_VERSION(geom_map, 0); Modified: head/sys/geom/geom_mbr.c ============================================================================== --- head/sys/geom/geom_mbr.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/geom_mbr.c Tue Apr 10 19:18:16 2018 (r332387) @@ -528,3 +528,4 @@ static struct g_class g_mbrext_class = { }; DECLARE_GEOM_CLASS(g_mbrext_class, g_mbrext); +MODULE_VERSION(geom_mbr, 0); Modified: head/sys/geom/geom_redboot.c ============================================================================== --- head/sys/geom/geom_redboot.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/geom_redboot.c Tue Apr 10 19:18:16 2018 (r332387) @@ -357,3 +357,4 @@ static struct g_class g_redboot_class = { .ioctl = g_redboot_ioctl, }; DECLARE_GEOM_CLASS(g_redboot_class, g_redboot); +MODULE_VERSION(geom_redboot, 0); Modified: head/sys/geom/geom_sunlabel.c ============================================================================== --- head/sys/geom/geom_sunlabel.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/geom_sunlabel.c Tue Apr 10 19:18:16 2018 (r332387) @@ -334,3 +334,4 @@ static struct g_class g_sunlabel_class = { }; DECLARE_GEOM_CLASS(g_sunlabel_class, g_sunlabel); +MODULE_VERSION(geom_sunlabel, 0); Modified: head/sys/geom/geom_vol_ffs.c ============================================================================== --- head/sys/geom/geom_vol_ffs.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/geom_vol_ffs.c Tue Apr 10 19:18:16 2018 (r332387) @@ -164,3 +164,4 @@ static struct g_class g_vol_ffs_class = { }; DECLARE_GEOM_CLASS(g_vol_ffs_class, g_vol_ffs); +MODULE_VERSION(geom_vol_ffs, 0); Modified: head/sys/geom/journal/g_journal_ufs.c ============================================================================== --- head/sys/geom/journal/g_journal_ufs.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/journal/g_journal_ufs.c Tue Apr 10 19:18:16 2018 (r332387) @@ -101,3 +101,4 @@ const struct g_journal_desc g_journal_ufs = { }; MODULE_DEPEND(g_journal, ufs, 1, 1, 1); +MODULE_VERSION(geom_journal, 0); Modified: head/sys/geom/label/g_label.c ============================================================================== --- head/sys/geom/label/g_label.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/label/g_label.c Tue Apr 10 19:18:16 2018 (r332387) @@ -556,3 +556,4 @@ g_label_config(struct gctl_req *req, struct g_class *m } DECLARE_GEOM_CLASS(g_label_class, g_label); +MODULE_VERSION(geom_label, 0); Modified: head/sys/geom/linux_lvm/g_linux_lvm.c ============================================================================== --- head/sys/geom/linux_lvm/g_linux_lvm.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/linux_lvm/g_linux_lvm.c Tue Apr 10 19:18:16 2018 (r332387) @@ -1190,3 +1190,4 @@ static struct g_class g_llvm_class = { }; DECLARE_GEOM_CLASS(g_llvm_class, g_linux_lvm); +MODULE_VERSION(geom_linux_lvm, 0); Modified: head/sys/geom/mirror/g_mirror.c ============================================================================== --- head/sys/geom/mirror/g_mirror.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/mirror/g_mirror.c Tue Apr 10 19:18:16 2018 (r332387) @@ -3492,3 +3492,4 @@ g_mirror_fini(struct g_class *mp) } DECLARE_GEOM_CLASS(g_mirror_class, g_mirror); +MODULE_VERSION(geom_mirror, 0); Modified: head/sys/geom/mountver/g_mountver.c ============================================================================== --- head/sys/geom/mountver/g_mountver.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/mountver/g_mountver.c Tue Apr 10 19:18:16 2018 (r332387) @@ -660,3 +660,4 @@ g_mountver_fini(struct g_class *mp) } DECLARE_GEOM_CLASS(g_mountver_class, g_mountver); +MODULE_VERSION(geom_mountver, 0); Modified: head/sys/geom/multipath/g_multipath.c ============================================================================== --- head/sys/geom/multipath/g_multipath.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/multipath/g_multipath.c Tue Apr 10 19:18:16 2018 (r332387) @@ -1532,3 +1532,4 @@ g_multipath_dumpconf(struct sbuf *sb, const char *inde } DECLARE_GEOM_CLASS(g_multipath_class, g_multipath); +MODULE_VERSION(geom_multipath, 0); Modified: head/sys/geom/nop/g_nop.c ============================================================================== --- head/sys/geom/nop/g_nop.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/nop/g_nop.c Tue Apr 10 19:18:16 2018 (r332387) @@ -717,3 +717,4 @@ g_nop_dumpconf(struct sbuf *sb, const char *indent, st } DECLARE_GEOM_CLASS(g_nop_class, g_nop); +MODULE_VERSION(geom_nop, 0); Modified: head/sys/geom/part/g_part_apm.c ============================================================================== --- head/sys/geom/part/g_part_apm.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/part/g_part_apm.c Tue Apr 10 19:18:16 2018 (r332387) @@ -107,6 +107,7 @@ static struct g_part_scheme g_part_apm_scheme = { .gps_maxent = 4096, }; G_PART_SCHEME_DECLARE(g_part_apm); +MODULE_VERSION(geom_part_apm, 0); static void swab(char *buf, size_t bufsz) Modified: head/sys/geom/part/g_part_bsd.c ============================================================================== --- head/sys/geom/part/g_part_bsd.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/part/g_part_bsd.c Tue Apr 10 19:18:16 2018 (r332387) @@ -113,6 +113,7 @@ static struct g_part_scheme g_part_bsd_scheme = { .gps_bootcodesz = BBSIZE, }; G_PART_SCHEME_DECLARE(g_part_bsd); +MODULE_VERSION(geom_part_bsd, 0); static struct g_part_bsd_alias { uint8_t type; Modified: head/sys/geom/part/g_part_bsd64.c ============================================================================== --- head/sys/geom/part/g_part_bsd64.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/part/g_part_bsd64.c Tue Apr 10 19:18:16 2018 (r332387) @@ -165,6 +165,7 @@ static struct g_part_scheme g_part_bsd64_scheme = { .gps_maxent = MAXPARTITIONS64 }; G_PART_SCHEME_DECLARE(g_part_bsd64); +MODULE_VERSION(geom_part_bsd64, 0); #define EQUUID(a, b) (memcmp(a, b, sizeof(struct uuid)) == 0) static struct uuid bsd64_uuid_unused = GPT_ENT_TYPE_UNUSED; Modified: head/sys/geom/part/g_part_ebr.c ============================================================================== --- head/sys/geom/part/g_part_ebr.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/part/g_part_ebr.c Tue Apr 10 19:18:16 2018 (r332387) @@ -128,6 +128,7 @@ static struct g_part_scheme g_part_ebr_scheme = { .gps_maxent = INT_MAX, }; G_PART_SCHEME_DECLARE(g_part_ebr); +MODULE_VERSION(geom_part_ebr, 0); static struct g_part_ebr_alias { u_char typ; Modified: head/sys/geom/part/g_part_gpt.c ============================================================================== --- head/sys/geom/part/g_part_gpt.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/part/g_part_gpt.c Tue Apr 10 19:18:16 2018 (r332387) @@ -146,6 +146,7 @@ static struct g_part_scheme g_part_gpt_scheme = { .gps_bootcodesz = MBRSIZE, }; G_PART_SCHEME_DECLARE(g_part_gpt); +MODULE_VERSION(geom_part_gpt, 0); static struct uuid gpt_uuid_apple_apfs = GPT_ENT_TYPE_APPLE_APFS; static struct uuid gpt_uuid_apple_boot = GPT_ENT_TYPE_APPLE_BOOT; Modified: head/sys/geom/part/g_part_ldm.c ============================================================================== --- head/sys/geom/part/g_part_ldm.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/part/g_part_ldm.c Tue Apr 10 19:18:16 2018 (r332387) @@ -363,6 +363,7 @@ static struct g_part_scheme g_part_ldm_scheme = { .gps_entrysz = sizeof(struct g_part_ldm_entry) }; G_PART_SCHEME_DECLARE(g_part_ldm); +MODULE_VERSION(geom_part_ldm, 0); static struct g_part_ldm_alias { u_char typ; Modified: head/sys/geom/part/g_part_mbr.c ============================================================================== --- head/sys/geom/part/g_part_mbr.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/part/g_part_mbr.c Tue Apr 10 19:18:16 2018 (r332387) @@ -121,6 +121,7 @@ static struct g_part_scheme g_part_mbr_scheme = { .gps_bootcodesz = MBRSIZE, }; G_PART_SCHEME_DECLARE(g_part_mbr); +MODULE_VERSION(geom_part_mbr, 0); static struct g_part_mbr_alias { u_char typ; Modified: head/sys/geom/part/g_part_vtoc8.c ============================================================================== --- head/sys/geom/part/g_part_vtoc8.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/part/g_part_vtoc8.c Tue Apr 10 19:18:16 2018 (r332387) @@ -101,6 +101,7 @@ static struct g_part_scheme g_part_vtoc8_scheme = { .gps_maxent = VTOC8_NPARTS, }; G_PART_SCHEME_DECLARE(g_part_vtoc8); +MODULE_VERSION(geom_part_vtoc8, 0); static int vtoc8_parse_type(const char *type, uint16_t *tag) Modified: head/sys/geom/raid3/g_raid3.c ============================================================================== --- head/sys/geom/raid3/g_raid3.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/raid3/g_raid3.c Tue Apr 10 19:18:16 2018 (r332387) @@ -3583,3 +3583,4 @@ g_raid3_fini(struct g_class *mp) } DECLARE_GEOM_CLASS(g_raid3_class, g_raid3); +MODULE_VERSION(geom_raid3, 0); Modified: head/sys/geom/shsec/g_shsec.c ============================================================================== --- head/sys/geom/shsec/g_shsec.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/shsec/g_shsec.c Tue Apr 10 19:18:16 2018 (r332387) @@ -836,3 +836,4 @@ g_shsec_dumpconf(struct sbuf *sb, const char *indent, } DECLARE_GEOM_CLASS(g_shsec_class, g_shsec); +MODULE_VERSION(geom_shsec, 0); Modified: head/sys/geom/stripe/g_stripe.c ============================================================================== --- head/sys/geom/stripe/g_stripe.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/stripe/g_stripe.c Tue Apr 10 19:18:16 2018 (r332387) @@ -1270,3 +1270,4 @@ g_stripe_dumpconf(struct sbuf *sb, const char *indent, } DECLARE_GEOM_CLASS(g_stripe_class, g_stripe); +MODULE_VERSION(geom_stripe, 0); Modified: head/sys/geom/uzip/g_uzip.c ============================================================================== --- head/sys/geom/uzip/g_uzip.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/uzip/g_uzip.c Tue Apr 10 19:18:16 2018 (r332387) @@ -922,3 +922,4 @@ static struct g_class g_uzip_class = { DECLARE_GEOM_CLASS(g_uzip_class, g_uzip); MODULE_DEPEND(g_uzip, zlib, 1, 1, 1); +MODULE_VERSION(geom_uzip, 0); Modified: head/sys/geom/vinum/geom_vinum.c ============================================================================== --- head/sys/geom/vinum/geom_vinum.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/vinum/geom_vinum.c Tue Apr 10 19:18:16 2018 (r332387) @@ -1048,3 +1048,4 @@ static struct g_class g_vinum_class = { }; DECLARE_GEOM_CLASS(g_vinum_class, g_vinum); +MODULE_VERSION(geom_vinum, 0); Modified: head/sys/geom/virstor/g_virstor.c ============================================================================== --- head/sys/geom/virstor/g_virstor.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/virstor/g_virstor.c Tue Apr 10 19:18:16 2018 (r332387) @@ -1891,3 +1891,4 @@ invalid_call(void) } DECLARE_GEOM_CLASS(g_virstor_class, g_virstor); /* Let there be light */ +MODULE_VERSION(geom_virstor, 0); Modified: head/sys/geom/zero/g_zero.c ============================================================================== --- head/sys/geom/zero/g_zero.c Tue Apr 10 18:39:20 2018 (r332386) +++ head/sys/geom/zero/g_zero.c Tue Apr 10 19:18:16 2018 (r332387) @@ -143,3 +143,4 @@ static struct g_class g_zero_class = { }; DECLARE_GEOM_CLASS(g_zero_class, g_zero); +MODULE_VERSION(geom_zero, 0); From owner-svn-src-head@freebsd.org Tue Apr 10 19:23:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A8E3F92241; Tue, 10 Apr 2018 19:23:05 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 9CF0384D63; Tue, 10 Apr 2018 19:23:00 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w3AJMvUY024595; Tue, 10 Apr 2018 12:22:57 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w3AJMvSL024594; Tue, 10 Apr 2018 12:22:57 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201804101922.w3AJMvSL024594@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r332386 - head/share/misc In-Reply-To: <201804101839.w3AIdKZk026212@repo.freebsd.org> To: Ram Kishore Vegesna Date: Tue, 10 Apr 2018 12:22:57 -0700 (PDT) CC: 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-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 19:23:05 -0000 [ Charset UTF-8 unsupported, converting... ] > Author: ram > Date: Tue Apr 10 18:39:20 2018 > New Revision: 332386 > URL: https://svnweb.freebsd.org/changeset/base/332386 > > Log: > Updated mentors information. > > Approved by: ken, mav > > Modified: > head/share/misc/committers-src.dot > > Modified: head/share/misc/committers-src.dot > ============================================================================== > --- head/share/misc/committers-src.dot Tue Apr 10 18:05:02 2018 (r332385) > +++ head/share/misc/committers-src.dot Tue Apr 10 18:39:20 2018 (r332386) > @@ -76,6 +76,7 @@ nate [label="Nate Willams\nnate@FreeBSD.org\n1993/06/1 > njl [label="Nate Lawson\nnjl@FreeBSD.org\n2002/08/07\n2008/02/16"] > non [label="Noriaki Mitsnaga\nnon@FreeBSD.org\n2000/06/19\n2007/03/06"] > onoe [label="Atsushi Onoe\nonoe@FreeBSD.org\n2000/07/21\n2008/11/10"] > +ram [label="Ram Kishore Vegesna\nram@FreeBSD.org\n2018/04/04\n???/??/??"] ^^^^^^^^^ That should be removed, you only have a start date. Oh and Welcome ram to the project! > rafan [label="Rong-En Fan\nrafan@FreeBSD.org\n2007/01/31\n2012/07/23"] > randi [label="Randi Harper\nrandi@FreeBSD.org\n2010/04/20\n2012/05/10"] > rink [label="Rink Springer\nrink@FreeBSD.org\n2006/01/16\n2010/11/04"] > @@ -629,6 +630,7 @@ kan -> kib > > ken -> asomers > ken -> chuck > +ken -> ram > ken -> slm > > kib -> ae > @@ -671,6 +673,7 @@ markm -> sheldonh > > mav -> ae > mav -> eugen > +mav -> ram > > mdf -> gleb > > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Tue Apr 10 19:27:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4E578F92779; Tue, 10 Apr 2018 19:27:49 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EF125862CD; Tue, 10 Apr 2018 19:27:48 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-lf0-f54.google.com (mail-lf0-f54.google.com [209.85.215.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id A51A11312F; Tue, 10 Apr 2018 19:27:48 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lf0-f54.google.com with SMTP id j68-v6so13312555lfg.13; Tue, 10 Apr 2018 12:27:48 -0700 (PDT) X-Gm-Message-State: ALQs6tCOSQWfagosaWPijb64XnYi9j9ZmRcp3kWb+w4Gmm2blLnJeq9f PPR+gIV+O3jO8Bx8SRD+DOZbDl1Ws+fSkDVvOTA= X-Google-Smtp-Source: AIpwx48oFqrxxL8SA2w57xUpv0/wrhIh5brP2Jls4Ho5F4DpI2tWct51q26w6dvVr0HOAbqso3hIrpCc0ry6JNlrx8Q= X-Received: by 2002:a19:9553:: with SMTP id x80-v6mr971331lfd.74.1523388467152; Tue, 10 Apr 2018 12:27:47 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Tue, 10 Apr 2018 12:27:26 -0700 (PDT) In-Reply-To: <201804101922.w3AJMvSL024594@pdx.rh.CN85.dnsmgr.net> References: <201804101839.w3AIdKZk026212@repo.freebsd.org> <201804101922.w3AJMvSL024594@pdx.rh.CN85.dnsmgr.net> From: Kyle Evans Date: Tue, 10 Apr 2018 14:27:26 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r332386 - head/share/misc To: "Rodney W. Grimes" Cc: Ram Kishore Vegesna , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 19:27:49 -0000 On Tue, Apr 10, 2018 at 2:22 PM, Rodney W. Grimes wrote: > [ Charset UTF-8 unsupported, converting... ] >> Author: ram >> Date: Tue Apr 10 18:39:20 2018 >> New Revision: 332386 >> URL: https://svnweb.freebsd.org/changeset/base/332386 >> >> Log: >> Updated mentors information. >> >> Approved by: ken, mav >> >> Modified: >> head/share/misc/committers-src.dot >> >> Modified: head/share/misc/committers-src.dot >> ============================================================================== >> --- head/share/misc/committers-src.dot Tue Apr 10 18:05:02 2018 (r332385) >> +++ head/share/misc/committers-src.dot Tue Apr 10 18:39:20 2018 (r332386) >> @@ -76,6 +76,7 @@ nate [label="Nate Willams\nnate@FreeBSD.org\n1993/06/1 >> njl [label="Nate Lawson\nnjl@FreeBSD.org\n2002/08/07\n2008/02/16"] >> non [label="Noriaki Mitsnaga\nnon@FreeBSD.org\n2000/06/19\n2007/03/06"] >> onoe [label="Atsushi Onoe\nonoe@FreeBSD.org\n2000/07/21\n2008/11/10"] >> +ram [label="Ram Kishore Vegesna\nram@FreeBSD.org\n2018/04/04\n???/??/??"] > ^^^^^^^^^ > That should be removed, you only have a start date. > Oh and Welcome ram to the project! > The entry is also smack dab in the middle of the alumni section, rather than the later 'active' section. =) From owner-svn-src-head@freebsd.org Tue Apr 10 19:42:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 509A8F9390E; Tue, 10 Apr 2018 19:42:51 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0421B698D1; Tue, 10 Apr 2018 19:42:51 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DAB0E1208D; Tue, 10 Apr 2018 19:42:50 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3AJgojE066101; Tue, 10 Apr 2018 19:42:50 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AJgoMF066098; Tue, 10 Apr 2018 19:42:50 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201804101942.w3AJgoMF066098@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Tue, 10 Apr 2018 19:42:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332388 - in head/sys: kern net X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: in head/sys: kern net X-SVN-Commit-Revision: 332388 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 19:42:51 -0000 Author: shurd Date: Tue Apr 10 19:42:50 2018 New Revision: 332388 URL: https://svnweb.freebsd.org/changeset/base/332388 Log: Make BPF global lock an SX This allows NIC drivers to sleep on polling config operations. Submitted by: Matthew Macy Reviewed by: shurd Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14982 Modified: head/sys/kern/subr_witness.c head/sys/net/bpf.c head/sys/net/bpfdesc.h Modified: head/sys/kern/subr_witness.c ============================================================================== --- head/sys/kern/subr_witness.c Tue Apr 10 19:18:16 2018 (r332387) +++ head/sys/kern/subr_witness.c Tue Apr 10 19:42:50 2018 (r332388) @@ -569,7 +569,7 @@ static struct witness_order_list_entry order_lists[] = /* * BPF */ - { "bpf global lock", &lock_class_mtx_sleep }, + { "bpf global lock", &lock_class_sx }, { "bpf interface lock", &lock_class_rw }, { "bpf cdev lock", &lock_class_mtx_sleep }, { NULL, NULL }, Modified: head/sys/net/bpf.c ============================================================================== --- head/sys/net/bpf.c Tue Apr 10 19:18:16 2018 (r332387) +++ head/sys/net/bpf.c Tue Apr 10 19:42:50 2018 (r332388) @@ -159,6 +159,9 @@ struct bpf_dltlist32 { #define BIOCSETFNR32 _IOW('B', 130, struct bpf_program32) #endif +#define BPF_LOCK() sx_xlock(&bpf_sx) +#define BPF_UNLOCK() sx_xunlock(&bpf_sx) +#define BPF_LOCK_ASSERT() sx_assert(&bpf_sx, SA_XLOCKED) /* * bpf_iflist is a list of BPF interface structures, each corresponding to a * specific DLT. The same network interface might have several BPF interface @@ -166,7 +169,7 @@ struct bpf_dltlist32 { * frames, ethernet frames, etc). */ static LIST_HEAD(, bpf_if) bpf_iflist, bpf_freelist; -static struct mtx bpf_mtx; /* bpf global lock */ +static struct sx bpf_sx; /* bpf global lock */ static int bpf_bpfd_cnt; static void bpf_attachd(struct bpf_d *, struct bpf_if *); @@ -2821,7 +2824,7 @@ bpf_drvinit(void *unused) { struct cdev *dev; - mtx_init(&bpf_mtx, "bpf global lock", NULL, MTX_DEF); + sx_init(&bpf_sx, "bpf global lock"); LIST_INIT(&bpf_iflist); LIST_INIT(&bpf_freelist); Modified: head/sys/net/bpfdesc.h ============================================================================== --- head/sys/net/bpfdesc.h Tue Apr 10 19:18:16 2018 (r332387) +++ head/sys/net/bpfdesc.h Tue Apr 10 19:42:50 2018 (r332388) @@ -118,9 +118,6 @@ struct bpf_d { #define BPF_PID_REFRESH(bd, td) (bd)->bd_pid = (td)->td_proc->p_pid #define BPF_PID_REFRESH_CUR(bd) (bd)->bd_pid = curthread->td_proc->p_pid -#define BPF_LOCK() mtx_lock(&bpf_mtx) -#define BPF_UNLOCK() mtx_unlock(&bpf_mtx) -#define BPF_LOCK_ASSERT() mtx_assert(&bpf_mtx, MA_OWNED) /* * External representation of the bpf descriptor */ From owner-svn-src-head@freebsd.org Tue Apr 10 19:48:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 29676F93E5E; Tue, 10 Apr 2018 19:48:25 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D17D36B657; Tue, 10 Apr 2018 19:48:24 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB63A12097; Tue, 10 Apr 2018 19:48:24 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3AJmOrO066565; Tue, 10 Apr 2018 19:48:24 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AJmOt2066564; Tue, 10 Apr 2018 19:48:24 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201804101948.w3AJmOt2066564@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Tue, 10 Apr 2018 19:48:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332389 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 332389 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 19:48:25 -0000 Author: shurd Date: Tue Apr 10 19:48:24 2018 New Revision: 332389 URL: https://svnweb.freebsd.org/changeset/base/332389 Log: Split out flag manipulation from general context manipulation in iflib To avoid blocking on the context lock in the swi thread and risk potential deadlocks, this change protects lighter weight updates that only need to be consistent with each other with their own lock. Submitted by: Matthew Macy Reviewed by: shurd Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14967 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Tue Apr 10 19:42:50 2018 (r332388) +++ head/sys/net/iflib.c Tue Apr 10 19:48:24 2018 (r332389) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2017, Matthew Macy + * Copyright (c) 2014-2018, Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -163,7 +163,8 @@ struct iflib_ctx { if_shared_ctx_t ifc_sctx; struct if_softc_ctx ifc_softc_ctx; - struct mtx ifc_mtx; + struct mtx ifc_ctx_mtx; + struct mtx ifc_state_mtx; uint16_t ifc_nhwtxqs; uint16_t ifc_nhwrxqs; @@ -318,8 +319,10 @@ typedef struct iflib_sw_tx_desc_array { #define IFC_INIT_DONE 0x020 #define IFC_PREFETCH 0x040 #define IFC_DO_RESET 0x080 -#define IFC_CHECK_HUNG 0x100 +#define IFC_DO_WATCHDOG 0x100 +#define IFC_CHECK_HUNG 0x200 + #define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) @@ -535,13 +538,19 @@ rxd_info_zero(if_rxd_info_t ri) #define CTX_ACTIVE(ctx) ((if_getdrvflags((ctx)->ifc_ifp) & IFF_DRV_RUNNING)) -#define CTX_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_mtx, _name, "iflib ctx lock", MTX_DEF) +#define CTX_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_ctx_mtx, _name, "iflib ctx lock", MTX_DEF) +#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_ctx_mtx) +#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_ctx_mtx) +#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_ctx_mtx) -#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_mtx) -#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_mtx) -#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_mtx) +#define STATE_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_state_mtx, _name, "iflib state lock", MTX_DEF) +#define STATE_LOCK(ctx) mtx_lock(&(ctx)->ifc_state_mtx) +#define STATE_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_state_mtx) +#define STATE_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_state_mtx) + + #define CALLOUT_LOCK(txq) mtx_lock(&txq->ift_mtx) #define CALLOUT_UNLOCK(txq) mtx_unlock(&txq->ift_mtx) @@ -2144,18 +2153,14 @@ iflib_timer(void *arg) if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, txq->ift_timer.c_cpu); return; -hung: - CTX_LOCK(ctx); - if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); + hung: device_printf(ctx->ifc_dev, "TX(%d) desc avail = %d, pidx = %d\n", txq->ift_id, TXQ_AVAIL(txq), txq->ift_pidx); - - IFDI_WATCHDOG_RESET(ctx); - ctx->ifc_watchdog_events++; - - ctx->ifc_flags |= IFC_DO_RESET; + STATE_LOCK(ctx); + if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); + ctx->ifc_flags |= (IFC_DO_WATCHDOG|IFC_DO_RESET); iflib_admin_intr_deferred(ctx); - CTX_UNLOCK(ctx); + STATE_UNLOCK(ctx); } static void @@ -2673,10 +2678,10 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) return true; return (iflib_rxd_avail(ctx, rxq, *cidxp, 1)); err: - CTX_LOCK(ctx); + STATE_LOCK(ctx); ctx->ifc_flags |= IFC_DO_RESET; iflib_admin_intr_deferred(ctx); - CTX_UNLOCK(ctx); + STATE_UNLOCK(ctx); return (false); } @@ -3706,27 +3711,35 @@ _task_fn_admin(void *context) if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; iflib_txq_t txq; int i; + bool oactive, running, do_reset, do_watchdog; - if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)) { - if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE)) { - return; - } - } + STATE_LOCK(ctx); + running = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING); + oactive = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE); + do_reset = (ctx->ifc_flags & IFC_DO_RESET); + do_watchdog = (ctx->ifc_flags & IFC_DO_WATCHDOG); + ctx->ifc_flags &= ~(IFC_DO_RESET|IFC_DO_WATCHDOG); + STATE_UNLOCK(ctx); + if (!running & !oactive) + return; + CTX_LOCK(ctx); for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) { CALLOUT_LOCK(txq); callout_stop(&txq->ift_timer); CALLOUT_UNLOCK(txq); } + if (do_watchdog) { + ctx->ifc_watchdog_events++; + IFDI_WATCHDOG_RESET(ctx); + } IFDI_UPDATE_ADMIN_STATUS(ctx); for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, txq->ift_timer.c_cpu); IFDI_LINK_INTR_ENABLE(ctx); - if (ctx->ifc_flags & IFC_DO_RESET) { - ctx->ifc_flags &= ~IFC_DO_RESET; + if (do_reset) iflib_if_init_locked(ctx); - } CTX_UNLOCK(ctx); if (LINK_ACTIVE(ctx) == 0) @@ -3870,15 +3883,15 @@ iflib_if_qflush(if_t ifp) iflib_txq_t txq = ctx->ifc_txqs; int i; - CTX_LOCK(ctx); + STATE_LOCK(ctx); ctx->ifc_flags |= IFC_QFLUSH; - CTX_UNLOCK(ctx); + STATE_UNLOCK(ctx); for (i = 0; i < NTXQSETS(ctx); i++, txq++) while (!(ifmp_ring_is_idle(txq->ift_br) || ifmp_ring_is_stalled(txq->ift_br))) iflib_txq_check_drain(txq, 0); - CTX_LOCK(ctx); + STATE_LOCK(ctx); ctx->ifc_flags &= ~IFC_QFLUSH; - CTX_UNLOCK(ctx); + STATE_UNLOCK(ctx); if_qflush(ifp); } @@ -3935,14 +3948,18 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) iflib_stop(ctx); if ((err = IFDI_MTU_SET(ctx, ifr->ifr_mtu)) == 0) { + STATE_LOCK(ctx); if (ifr->ifr_mtu > ctx->ifc_max_fl_buf_size) ctx->ifc_flags |= IFC_MULTISEG; else ctx->ifc_flags &= ~IFC_MULTISEG; + STATE_UNLOCK(ctx); err = if_setmtu(ifp, ifr->ifr_mtu); } iflib_init_locked(ctx); + STATE_LOCK(ctx); if_setdrvflags(ifp, bits); + STATE_UNLOCK(ctx); CTX_UNLOCK(ctx); break; case SIOCSIFFLAGS: @@ -4026,10 +4043,14 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) bits = if_getdrvflags(ifp); if (bits & IFF_DRV_RUNNING) iflib_stop(ctx); + STATE_LOCK(ctx); if_togglecapenable(ifp, setmask); + STATE_UNLOCK(ctx); if (bits & IFF_DRV_RUNNING) iflib_init_locked(ctx); + STATE_LOCK(ctx); if_setdrvflags(ifp, bits); + STATE_UNLOCK(ctx); CTX_UNLOCK(ctx); } break; @@ -5431,9 +5452,11 @@ iflib_link_state_change(if_ctx_t ctx, int link_state, iflib_txq_t txq = ctx->ifc_txqs; if_setbaudrate(ifp, baudrate); - if (baudrate >= IF_Gbps(10)) + if (baudrate >= IF_Gbps(10)) { + STATE_LOCK(ctx); ctx->ifc_flags |= IFC_PREFETCH; - + STATE_UNLOCK(ctx); + } /* If link down, disable watchdog */ if ((ctx->ifc_link_state == LINK_STATE_UP) && (link_state == LINK_STATE_DOWN)) { for (int i = 0; i < ctx->ifc_softc_ctx.isc_ntxqsets; i++, txq++) @@ -5492,7 +5515,7 @@ struct mtx * iflib_ctx_lock_get(if_ctx_t ctx) { - return (&ctx->ifc_mtx); + return (&ctx->ifc_ctx_mtx); } static int From owner-svn-src-head@freebsd.org Tue Apr 10 19:49:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 78867F93F62; Tue, 10 Apr 2018 19:49:05 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 25F096BD2A; Tue, 10 Apr 2018 19:49:05 +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 20FAB120A3; Tue, 10 Apr 2018 19:49:05 +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 w3AJn5FO066636; Tue, 10 Apr 2018 19:49:05 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AJn48R066632; Tue, 10 Apr 2018 19:49:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804101949.w3AJn48R066632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 10 Apr 2018 19:49:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332390 - in head/release: amd64 arm64 i386 powerpc X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: in head/release: amd64 arm64 i386 powerpc X-SVN-Commit-Revision: 332390 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 19:49:05 -0000 Author: emaste Date: Tue Apr 10 19:49:04 2018 New Revision: 332390 URL: https://svnweb.freebsd.org/changeset/base/332390 Log: make-memstick.sh: put partition args on separate lines This makes it easier to identify the individual partition types and facilitates comparisons across architectures. Reviewed by: gjb MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/release/amd64/make-memstick.sh head/release/arm64/make-memstick.sh head/release/i386/make-memstick.sh head/release/powerpc/make-memstick.sh Modified: head/release/amd64/make-memstick.sh ============================================================================== --- head/release/amd64/make-memstick.sh Tue Apr 10 19:48:24 2018 (r332389) +++ head/release/amd64/make-memstick.sh Tue Apr 10 19:49:04 2018 (r332390) @@ -36,6 +36,12 @@ makefs -B little -o label=FreeBSD_Install -o version=2 rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local -mkimg -s gpt -b ${1}/boot/pmbr -p efi:=${1}/boot/boot1.efifat -p freebsd-boot:=${1}/boot/gptboot -p freebsd-ufs:=${2}.part -p freebsd-swap::1M -o ${2} +mkimg -s gpt \ + -b ${1}/boot/pmbr \ + -p efi:=${1}/boot/boot1.efifat \ + -p freebsd-boot:=${1}/boot/gptboot \ + -p freebsd-ufs:=${2}.part \ + -p freebsd-swap::1M \ + -o ${2} rm ${2}.part Modified: head/release/arm64/make-memstick.sh ============================================================================== --- head/release/arm64/make-memstick.sh Tue Apr 10 19:48:24 2018 (r332389) +++ head/release/arm64/make-memstick.sh Tue Apr 10 19:49:04 2018 (r332390) @@ -36,6 +36,9 @@ makefs -B little -o label=FreeBSD_Install -o version=2 rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local -mkimg -s gpt -p efi:=${1}/boot/boot1.efifat -p freebsd:=${2}.part -o ${2} +mkimg -s gpt \ + -p efi:=${1}/boot/boot1.efifat \ + -p freebsd:=${2}.part \ + -o ${2} rm ${2}.part Modified: head/release/i386/make-memstick.sh ============================================================================== --- head/release/i386/make-memstick.sh Tue Apr 10 19:48:24 2018 (r332389) +++ head/release/i386/make-memstick.sh Tue Apr 10 19:49:04 2018 (r332390) @@ -36,6 +36,11 @@ makefs -B little -o label=FreeBSD_Install -o version=2 rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local -mkimg -s gpt -b ${1}/boot/pmbr -p freebsd-boot:=${1}/boot/gptboot -p freebsd-ufs:=${2}.part -p freebsd-swap::1M -o ${2} +mkimg -s gpt \ + -b ${1}/boot/pmbr \ + -p freebsd-boot:=${1}/boot/gptboot \ + -p freebsd-ufs:=${2}.part \ + -p freebsd-swap::1M \ + -o ${2} rm ${2}.part Modified: head/release/powerpc/make-memstick.sh ============================================================================== --- head/release/powerpc/make-memstick.sh Tue Apr 10 19:48:24 2018 (r332389) +++ head/release/powerpc/make-memstick.sh Tue Apr 10 19:49:04 2018 (r332390) @@ -41,7 +41,10 @@ makefs -B big -o version=2 ${tempfile} ${1} rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local -mkimg -s apm -p freebsd-boot:=${1}/boot/boot1.hfs -p freebsd-ufs/FreeBSD_Install:=${tempfile} -o ${2} +mkimg -s apm \ + -p freebsd-boot:=${1}/boot/boot1.hfs \ + -p freebsd-ufs/FreeBSD_Install:=${tempfile} \ + -o ${2} rm -f ${tempfile} From owner-svn-src-head@freebsd.org Tue Apr 10 20:31:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5538FF96FA1; Tue, 10 Apr 2018 20:31:26 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 08B6975F4B; Tue, 10 Apr 2018 20:31:26 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03BFE12889; Tue, 10 Apr 2018 20:31:26 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3AKVPbn088766; Tue, 10 Apr 2018 20:31:25 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AKVPQk088753; Tue, 10 Apr 2018 20:31:25 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804102031.w3AKVPQk088753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 10 Apr 2018 20:31:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332392 - head/sys/arm/broadcom/bcm2835 X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/arm/broadcom/bcm2835 X-SVN-Commit-Revision: 332392 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 20:31:26 -0000 Author: gonzo Date: Tue Apr 10 20:31:25 2018 New Revision: 332392 URL: https://svnweb.freebsd.org/changeset/base/332392 Log: [pi] Do not attach bcm2835_pwm if DTB node is not enabled Switch to standard FDT-base driver behavior and don't attach if node "status" property value nn DTS is not set to "okay" On RPi PWM by default is disabled, to enable it pwm.dtbo from official repo[1] should be copied to overlays directory on SD card FAT partition and "dtoverlay=pwm" line added to config.txt. For more details see pwm overlay documentation[2] sysutils/rpi-firmware port now includes overlays, so they can be installed as a part of release image build. [1] https://github.com/raspberrypi/firmware/tree/master/boot [2] https://github.com/raspberrypi/firmware/blob/master/boot/overlays/README No objections from: phk@ Modified: head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Modified: head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c ============================================================================== --- head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Tue Apr 10 20:22:36 2018 (r332391) +++ head/sys/arm/broadcom/bcm2835/bcm2835_pwm.c Tue Apr 10 20:31:25 2018 (r332392) @@ -276,12 +276,8 @@ static int bcm_pwm_probe(device_t dev) { -#if 0 - // XXX: default state is disabled in RPI3 DTB, assume for now - // XXX: that people want the PWM to work if the KLD this module. if (!ofw_bus_status_okay(dev)) return (ENXIO); -#endif if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) return (ENXIO); From owner-svn-src-head@freebsd.org Tue Apr 10 21:14:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 931B6F99F69; Tue, 10 Apr 2018 21:14:55 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3AB487F0CF; Tue, 10 Apr 2018 21:14:55 +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 35C4512F5B; Tue, 10 Apr 2018 21:14:55 +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 w3ALEtHD011735; Tue, 10 Apr 2018 21:14:55 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3ALEtN0011734; Tue, 10 Apr 2018 21:14:55 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201804102114.w3ALEtN0011734@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Tue, 10 Apr 2018 21:14:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332393 - head/sys/powerpc/powerpc X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/powerpc X-SVN-Commit-Revision: 332393 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 21:14:55 -0000 Author: jhibbits Date: Tue Apr 10 21:14:54 2018 New Revision: 332393 URL: https://svnweb.freebsd.org/changeset/base/332393 Log: Reenter KDB on fault on powerpc, instead of panicking Most other architectures already re-enter KDB on faults, powerpc and mips are the only outliers. Correct this for powerpc, so that now bad addresses can be handled gracefully instead of panicking. Modified: head/sys/powerpc/powerpc/trap.c Modified: head/sys/powerpc/powerpc/trap.c ============================================================================== --- head/sys/powerpc/powerpc/trap.c Tue Apr 10 20:31:25 2018 (r332392) +++ head/sys/powerpc/powerpc/trap.c Tue Apr 10 21:14:54 2018 (r332393) @@ -208,6 +208,13 @@ trap(struct trapframe *frame) VM_CNT_INC(v_trap); +#ifdef KDB + if (kdb_active) { + kdb_reenter(); + return; + } +#endif + td = curthread; p = td->td_proc; From owner-svn-src-head@freebsd.org Tue Apr 10 22:32:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96A7BF9F356; Tue, 10 Apr 2018 22:32:32 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CBD47089B; Tue, 10 Apr 2018 22:32:32 +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 45D5113C47; Tue, 10 Apr 2018 22:32:32 +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 w3AMWWeU051027; Tue, 10 Apr 2018 22:32:32 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AMWWDl051026; Tue, 10 Apr 2018 22:32:32 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201804102232.w3AMWWDl051026@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 10 Apr 2018 22:32:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332394 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 332394 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 22:32:32 -0000 Author: mjg Date: Tue Apr 10 22:32:31 2018 New Revision: 332394 URL: https://svnweb.freebsd.org/changeset/base/332394 Log: rw: whack avoidable re-reads in try_upgrade Modified: head/sys/kern/kern_rwlock.c Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Tue Apr 10 21:14:54 2018 (r332393) +++ head/sys/kern/kern_rwlock.c Tue Apr 10 22:32:31 2018 (r332394) @@ -1204,7 +1204,7 @@ __rw_wunlock_hard(volatile uintptr_t *c, uintptr_t v L int __rw_try_upgrade_int(struct rwlock *rw LOCK_FILE_LINE_ARG_DEF) { - uintptr_t v, x, tid; + uintptr_t v, setv, tid; struct turnstile *ts; int success; @@ -1224,12 +1224,12 @@ __rw_try_upgrade_int(struct rwlock *rw LOCK_FILE_LINE_ */ tid = (uintptr_t)curthread; success = 0; + v = RW_READ_VALUE(rw); for (;;) { - v = rw->rw_lock; if (RW_READERS(v) > 1) break; if (!(v & RW_LOCK_WAITERS)) { - success = atomic_cmpset_acq_ptr(&rw->rw_lock, v, tid); + success = atomic_fcmpset_acq_ptr(&rw->rw_lock, &v, tid); if (!success) continue; break; @@ -1239,7 +1239,8 @@ __rw_try_upgrade_int(struct rwlock *rw LOCK_FILE_LINE_ * Ok, we think we have waiters, so lock the turnstile. */ ts = turnstile_trywait(&rw->lock_object); - v = rw->rw_lock; + v = RW_READ_VALUE(rw); +retry_ts: if (RW_READERS(v) > 1) { turnstile_cancel(ts); break; @@ -1250,16 +1251,16 @@ __rw_try_upgrade_int(struct rwlock *rw LOCK_FILE_LINE_ * If we obtain the lock with the flags set, then claim * ownership of the turnstile. */ - x = rw->rw_lock & RW_LOCK_WAITERS; - success = atomic_cmpset_ptr(&rw->rw_lock, v, tid | x); + setv = tid | (v & RW_LOCK_WAITERS); + success = atomic_fcmpset_ptr(&rw->rw_lock, &v, setv); if (success) { - if (x) + if (v & RW_LOCK_WAITERS) turnstile_claim(ts); else turnstile_cancel(ts); break; } - turnstile_cancel(ts); + goto retry_ts; } LOCK_LOG_TRY("WUPGRADE", &rw->lock_object, 0, success, file, line); if (success) { From owner-svn-src-head@freebsd.org Tue Apr 10 22:57:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DBA05FA11FC; Tue, 10 Apr 2018 22:57:56 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 8D4EB76D32; Tue, 10 Apr 2018 22:57:56 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8731513F8D; Tue, 10 Apr 2018 22:57:56 +0000 (UTC) (envelope-from ian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3AMvuXs061051; Tue, 10 Apr 2018 22:57:56 GMT (envelope-from ian@FreeBSD.org) Received: (from ian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3AMvuIF061050; Tue, 10 Apr 2018 22:57:56 GMT (envelope-from ian@FreeBSD.org) Message-Id: <201804102257.w3AMvuIF061050@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ian set sender to ian@FreeBSD.org using -f From: Ian Lepore Date: Tue, 10 Apr 2018 22:57:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332395 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: ian X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 332395 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 22:57:57 -0000 Author: ian Date: Tue Apr 10 22:57:56 2018 New Revision: 332395 URL: https://svnweb.freebsd.org/changeset/base/332395 Log: Use explicit_bzero() when cleaning values out of the kernel environment. Sometimes the values contain geli passphrases being communicated from loader(8) to the kernel, and some day the compiler may decide to start eliding calls to memset() for a pointer which is not dereferenced again before being passed to free(). Modified: head/sys/kern/kern_environment.c Modified: head/sys/kern/kern_environment.c ============================================================================== --- head/sys/kern/kern_environment.c Tue Apr 10 22:32:31 2018 (r332394) +++ head/sys/kern/kern_environment.c Tue Apr 10 22:57:56 2018 (r332395) @@ -289,7 +289,7 @@ init_dynamic_kenv(void *data __unused) if (i < KENV_SIZE) { kenvp[i] = malloc(len, M_KENV, M_WAITOK); strcpy(kenvp[i++], cp); - memset(cp, 0, strlen(cp)); + explicit_bzero(cp, strlen(cp)); } else printf( "WARNING: too many kenv strings, ignoring %s\n", @@ -308,7 +308,7 @@ freeenv(char *env) { if (dynamic_kenv && env != NULL) { - memset(env, 0, strlen(env)); + explicit_bzero(env, strlen(env)); free(env, M_KENV); } } @@ -486,7 +486,7 @@ kern_unsetenv(const char *name) kenvp[i++] = kenvp[j]; kenvp[i] = NULL; mtx_unlock(&kenv_lock); - memset(oldenv, 0, strlen(oldenv)); + explicit_bzero(oldenv, strlen(oldenv)); free(oldenv, M_KENV); return (0); } From owner-svn-src-head@freebsd.org Tue Apr 10 23:29:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 48BA9FA337E; Tue, 10 Apr 2018 23:29:58 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EB5787D1D5; Tue, 10 Apr 2018 23:29:57 +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 E61DB144D6; Tue, 10 Apr 2018 23:29:57 +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 w3ANTviN075721; Tue, 10 Apr 2018 23:29:57 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3ANTvqb075717; Tue, 10 Apr 2018 23:29:57 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804102329.w3ANTvqb075717@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 10 Apr 2018 23:29:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332396 - head/bin/setfacl X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/bin/setfacl X-SVN-Commit-Revision: 332396 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 10 Apr 2018 23:29:58 -0000 Author: emaste Date: Tue Apr 10 23:29:57 2018 New Revision: 332396 URL: https://svnweb.freebsd.org/changeset/base/332396 Log: setfacl: add recursive functionality Add a -R option to setfacl to operate recursively on directories, along with the accompanying flags -H, -L, and -P (whose behaviour mimics chmod). A patch was submitted with PR 155163, but this is a new implementation based on comments raised in the Phabricator review for that patch (review D9096). PR: 155163 Submitted by: Mitchell Horne Reviewed by: jilles MFC after: 2 weeks Relnotes: Yes Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D14934 Modified: head/bin/setfacl/setfacl.1 head/bin/setfacl/setfacl.c head/bin/setfacl/setfacl.h head/bin/setfacl/util.c Modified: head/bin/setfacl/setfacl.1 ============================================================================== --- head/bin/setfacl/setfacl.1 Tue Apr 10 22:57:56 2018 (r332395) +++ head/bin/setfacl/setfacl.1 Tue Apr 10 23:29:57 2018 (r332396) @@ -26,7 +26,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 23, 2016 +.Dd April 10, 2018 .Dt SETFACL 1 .Os .Sh NAME @@ -34,6 +34,7 @@ .Nd set ACL information .Sh SYNOPSIS .Nm +.Op Fl R Op Fl H | L | P .Op Fl bdhkn .Op Fl a Ar position entries .Op Fl m Ar entries @@ -83,6 +84,12 @@ default ACL's. This option is not applicable to NFSv4 .It Fl h If the target of the operation is a symbolic link, perform the operation on the symbolic link itself, rather than following the link. +.It Fl H +If the +.Fl R +option is specified, symbolic links on the command line are followed +and hence unaffected by the command. +(Symbolic links encountered during tree traversal are not followed.) .It Fl k Delete any default ACL entries on the specified files. It @@ -91,6 +98,10 @@ any default ACL entries. An error will be reported if any of the specified files cannot have a default entry (i.e.\& non-directories). This option is not applicable to NFSv4 ACLs. +.It Fl L +If the +.Fl R +option is specified, all symbolic links are followed. .It Fl m Ar entries Modify the ACL on the specified file. New entries will be added, and existing entries will be modified @@ -116,6 +127,13 @@ the input is taken from stdin. Do not recalculate the permissions associated with the ACL mask entry. This option is not applicable to NFSv4 ACLs. +.It Fl P +If the +.Fl R +option is specified, no symbolic links are followed. +This is the default. +.It Fl R +Perform the action recursively on any specified directories. .It Fl x Ar entries | position If .Ar entries Modified: head/bin/setfacl/setfacl.c ============================================================================== --- head/bin/setfacl/setfacl.c Tue Apr 10 22:57:56 2018 (r332395) +++ head/bin/setfacl/setfacl.c Tue Apr 10 23:29:57 2018 (r332396) @@ -35,6 +35,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include +#include #include #include #include @@ -59,41 +62,20 @@ struct sf_entry { }; static TAILQ_HEAD(, sf_entry) entrylist; -/* TAILQ entry for files */ -struct sf_file { - const char *filename; - TAILQ_ENTRY(sf_file) next; -}; -static TAILQ_HEAD(, sf_file) filelist; - uint have_mask; uint need_mask; uint have_stdin; uint n_flag; -static void add_filename(const char *filename); static void usage(void); static void -add_filename(const char *filename) -{ - struct sf_file *file; - - if (strlen(filename) > PATH_MAX - 1) { - warn("illegal filename"); - return; - } - file = zmalloc(sizeof(struct sf_file)); - file->filename = filename; - TAILQ_INSERT_TAIL(&filelist, file, next); -} - -static void usage(void) { - fprintf(stderr, "usage: setfacl [-bdhkn] [-a position entries] " - "[-m entries] [-M file] [-x entries] [-X file] [file ...]\n"); + fprintf(stderr, "usage: setfacl [-R [-H | -L | -P]] [-bdhkn] " + "[-a position entries] [-m entries] [-M file] " + "[-x entries] [-X file] [file ...]\n"); exit(1); } @@ -104,23 +86,32 @@ main(int argc, char *argv[]) acl_type_t acl_type; acl_entry_t unused_entry; char filename[PATH_MAX]; - int local_error, carried_error, ch, i, entry_number, ret; - int h_flag; - struct sf_file *file; + int local_error, carried_error, ch, entry_number, ret, fts_options; + bool h_flag, H_flag, L_flag, R_flag, follow_symlink; + size_t fl_count, i; + FTS *ftsp; + FTSENT *file; + char **files_list; struct sf_entry *entry; - const char *fn_dup; char *end; - struct stat sb; acl_type = ACL_TYPE_ACCESS; - carried_error = local_error = 0; - h_flag = have_mask = have_stdin = n_flag = need_mask = 0; + carried_error = local_error = fts_options = 0; + have_mask = have_stdin = n_flag = need_mask = 0; + h_flag = H_flag = L_flag = R_flag = false; TAILQ_INIT(&entrylist); - TAILQ_INIT(&filelist); - while ((ch = getopt(argc, argv, "M:X:a:bdhkm:nx:")) != -1) + while ((ch = getopt(argc, argv, "HLM:PRX:a:bdhkm:nx:")) != -1) switch(ch) { + case 'H': + H_flag = true; + L_flag = false; + break; + case 'L': + L_flag = true; + H_flag = false; + break; case 'M': entry = zmalloc(sizeof(struct sf_entry)); entry->acl = get_acl_from_file(optarg); @@ -129,6 +120,12 @@ main(int argc, char *argv[]) entry->op = OP_MERGE_ACL; TAILQ_INSERT_TAIL(&entrylist, entry, next); break; + case 'P': + H_flag = L_flag = false; + break; + case 'R': + R_flag = true; + break; case 'X': entry = zmalloc(sizeof(struct sf_entry)); entry->acl = get_acl_from_file(optarg); @@ -213,43 +210,93 @@ main(int argc, char *argv[]) err(1, "cannot have more than one stdin"); have_stdin = 1; bzero(&filename, sizeof(filename)); + i = 0; + /* Start with an array size sufficient for basic cases. */ + fl_count = 1024; + files_list = zmalloc(fl_count * sizeof(char *)); while (fgets(filename, (int)sizeof(filename), stdin)) { /* remove the \n */ filename[strlen(filename) - 1] = '\0'; - fn_dup = strdup(filename); - if (fn_dup == NULL) + files_list[i] = strdup(filename); + if (files_list[i] == NULL) err(1, "strdup() failed"); - add_filename(fn_dup); + /* Grow array if necessary. */ + if (++i == fl_count) { + fl_count <<= 1; + if (fl_count > SIZE_MAX / sizeof(char *)) + errx(1, "Too many input files"); + files_list = zrealloc(files_list, + fl_count * sizeof(char *)); + } } + + /* fts_open() requires the last array element to be NULL. */ + files_list[i] = NULL; } else - for (i = 0; i < argc; i++) - add_filename(argv[i]); + files_list = argv; - /* cycle through each file */ - TAILQ_FOREACH(file, &filelist, next) { - local_error = 0; + if (R_flag) { + if (h_flag) + errx(1, "the -R and -h options may not be " + "specified together."); + if (L_flag) { + fts_options = FTS_LOGICAL; + } else { + fts_options = FTS_PHYSICAL; - if (stat(file->filename, &sb) == -1) { - warn("%s: stat() failed", file->filename); - carried_error++; + if (H_flag) { + fts_options |= FTS_COMFOLLOW; + } + } + } else if (h_flag) { + fts_options = FTS_PHYSICAL; + } else { + fts_options = FTS_LOGICAL; + } + + /* Open all files. */ + if ((ftsp = fts_open(files_list, fts_options | FTS_NOSTAT, 0)) == NULL) + err(1, "fts_open"); + while ((file = fts_read(ftsp)) != NULL) { + switch (file->fts_info) { + case FTS_D: + /* Do not recurse if -R not specified. */ + if (!R_flag) + fts_set(ftsp, file, FTS_SKIP); + break; + case FTS_DP: + /* Skip the second visit to a directory. */ continue; + case FTS_DNR: + case FTS_ERR: + warnx("%s: %s", file->fts_path, + strerror(file->fts_errno)); + continue; + default: + break; } - if (acl_type == ACL_TYPE_DEFAULT && S_ISDIR(sb.st_mode) == 0) { - warnx("%s: default ACL may only be set on a directory", - file->filename); + if (acl_type == ACL_TYPE_DEFAULT && file->fts_info != FTS_D) { + warnx("%s: default ACL may only be set on " + "a directory", file->fts_path); carried_error++; continue; } - if (h_flag) - ret = lpathconf(file->filename, _PC_ACL_NFS4); + local_error = 0; + + follow_symlink = ((fts_options & FTS_LOGICAL) || + ((fts_options & FTS_COMFOLLOW) && + file->fts_level == FTS_ROOTLEVEL)); + + if (follow_symlink) + ret = pathconf(file->fts_accpath, _PC_ACL_NFS4); else - ret = pathconf(file->filename, _PC_ACL_NFS4); + ret = lpathconf(file->fts_accpath, _PC_ACL_NFS4); if (ret > 0) { if (acl_type == ACL_TYPE_DEFAULT) { warnx("%s: there are no default entries " - "in NFSv4 ACLs", file->filename); + "in NFSv4 ACLs", file->fts_path); carried_error++; continue; } @@ -259,20 +306,20 @@ main(int argc, char *argv[]) acl_type = ACL_TYPE_ACCESS; } else if (ret < 0 && errno != EINVAL) { warn("%s: pathconf(..., _PC_ACL_NFS4) failed", - file->filename); + file->fts_path); } - if (h_flag) - acl = acl_get_link_np(file->filename, acl_type); + if (follow_symlink) + acl = acl_get_file(file->fts_accpath, acl_type); else - acl = acl_get_file(file->filename, acl_type); + acl = acl_get_link_np(file->fts_accpath, acl_type); if (acl == NULL) { - if (h_flag) - warn("%s: acl_get_link_np() failed", - file->filename); - else + if (follow_symlink) warn("%s: acl_get_file() failed", - file->filename); + file->fts_path); + else + warn("%s: acl_get_link_np() failed", + file->fts_path); carried_error++; continue; } @@ -285,11 +332,12 @@ main(int argc, char *argv[]) switch(entry->op) { case OP_ADD_ACL: local_error += add_acl(entry->acl, - entry->entry_number, &acl, file->filename); + entry->entry_number, + &acl, file->fts_path); break; case OP_MERGE_ACL: local_error += merge_acl(entry->acl, &acl, - file->filename); + file->fts_path); need_mask = 1; break; case OP_REMOVE_EXT: @@ -301,37 +349,37 @@ main(int argc, char *argv[]) acl_get_entry(acl, ACL_FIRST_ENTRY, &unused_entry) == 0) { local_error += remove_default(&acl, - file->filename); + file->fts_path); break; } - remove_ext(&acl, file->filename); + remove_ext(&acl, file->fts_path); need_mask = 0; break; case OP_REMOVE_DEF: if (acl_type == ACL_TYPE_NFS4) { warnx("%s: there are no default entries in NFSv4 ACLs; " - "cannot remove", file->filename); + "cannot remove", file->fts_path); local_error++; break; } - if (acl_delete_def_file(file->filename) == -1) { + if (acl_delete_def_file(file->fts_accpath) == -1) { warn("%s: acl_delete_def_file() failed", - file->filename); + file->fts_path); local_error++; } if (acl_type == ACL_TYPE_DEFAULT) local_error += remove_default(&acl, - file->filename); + file->fts_path); need_mask = 0; break; case OP_REMOVE_ACL: local_error += remove_acl(entry->acl, &acl, - file->filename); + file->fts_path); need_mask = 1; break; case OP_REMOVE_BY_NUMBER: local_error += remove_by_number(entry->entry_number, - &acl, file->filename); + &acl, file->fts_path); need_mask = 1; break; } @@ -343,9 +391,9 @@ main(int argc, char *argv[]) */ if (acl_type == ACL_TYPE_DEFAULT && acl_get_entry(acl, ACL_FIRST_ENTRY, &unused_entry) == 0) { - if (acl_delete_def_file(file->filename) == -1) { + if (acl_delete_def_file(file->fts_accpath) == -1) { warn("%s: acl_delete_def_file() failed", - file->filename); + file->fts_path); carried_error++; } continue; @@ -358,22 +406,22 @@ main(int argc, char *argv[]) } if (acl_type != ACL_TYPE_NFS4 && need_mask && - set_acl_mask(&acl, file->filename) == -1) { - warnx("%s: failed to set ACL mask", file->filename); + set_acl_mask(&acl, file->fts_path) == -1) { + warnx("%s: failed to set ACL mask", file->fts_path); carried_error++; - } else if (h_flag) { - if (acl_set_link_np(file->filename, acl_type, + } else if (follow_symlink) { + if (acl_set_file(file->fts_accpath, acl_type, acl) == -1) { carried_error++; - warn("%s: acl_set_link_np() failed", - file->filename); + warn("%s: acl_set_file() failed", + file->fts_path); } } else { - if (acl_set_file(file->filename, acl_type, + if (acl_set_link_np(file->fts_accpath, acl_type, acl) == -1) { carried_error++; - warn("%s: acl_set_file() failed", - file->filename); + warn("%s: acl_set_link_np() failed", + file->fts_path); } } Modified: head/bin/setfacl/setfacl.h ============================================================================== --- head/bin/setfacl/setfacl.h Tue Apr 10 22:57:56 2018 (r332395) +++ head/bin/setfacl/setfacl.h Tue Apr 10 23:29:57 2018 (r332396) @@ -47,6 +47,7 @@ void remove_ext(acl_t *prev_acl, const char *filenam int set_acl_mask(acl_t *prev_acl, const char *filename); /* util.c */ void *zmalloc(size_t size); +void *zrealloc(void *ptr, size_t size); const char *brand_name(int brand); int branding_mismatch(int brand1, int brand2); Modified: head/bin/setfacl/util.c ============================================================================== --- head/bin/setfacl/util.c Tue Apr 10 22:57:56 2018 (r332395) +++ head/bin/setfacl/util.c Tue Apr 10 23:29:57 2018 (r332396) @@ -44,6 +44,17 @@ zmalloc(size_t size) return (ptr); } +void * +zrealloc(void *ptr, size_t size) +{ + void *newptr; + + newptr = realloc(ptr, size); + if (newptr == NULL) + err(1, "realloc() failed"); + return (newptr); +} + const char * brand_name(int brand) { From owner-svn-src-head@freebsd.org Wed Apr 11 01:43:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6B059F88597; Wed, 11 Apr 2018 01:43:30 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B6DE7ECF2; Wed, 11 Apr 2018 01:43:30 +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 1655515BD5; Wed, 11 Apr 2018 01:43:30 +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 w3B1hTXo045077; Wed, 11 Apr 2018 01:43:29 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3B1hT5o045075; Wed, 11 Apr 2018 01:43:29 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201804110143.w3B1hT5o045075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 11 Apr 2018 01:43:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332398 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 332398 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 01:43:30 -0000 Author: mjg Date: Wed Apr 11 01:43:29 2018 New Revision: 332398 URL: https://svnweb.freebsd.org/changeset/base/332398 Log: locks: extend speculative spin waiting for readers to drain Now that 10 years have passed since the original limit of 10000 was committed, bump it a little bit. Spinning waiting for writers is semi-informed in the sense that we always know if the owner is running and base the decision to spin on that. However, no such information is provided for read-locking. In particular this means that it is possible for a write-spinner to completely waste cpu time waiting for the lock to be released, while the reader holding it was preempted and is now waiting for the spinner to go off cpu. Nonetheless, in majority of cases it is an improvement to spin instead of instantly giving up and going to sleep. The current approach is pretty simple: snatch the number of current readers and performs that many pauses before checking again. The total number of pauses to execute is limited to 10k. If the lock is still not free by that time, go to sleep. Given the previously noted problem of not knowing whether spinning makes any sense to begin with the new limit has to remain rather conservative. But at the very least it should also be related to the machine. Waiting for writers uses parameters selected based on the number of activated hardware threads. The upper limit of pause instructions to be executed in-between re-reads of the lock is typically 16384 or 32678. It was selected as the limit of total spins. The lower bound is set to already present 10000 as to not change it for smaller machines. Bumping the limit reduces system time by few % during benchmarks like buildworld, buildkernel and others. Tested on 2 and 4 socket machines (Broadwell, Skylake). Figuring out how to make a more informed decision while not pessimizing the fast path is left as an exercise for the reader. Modified: head/sys/kern/kern_rwlock.c head/sys/kern/kern_sx.c Modified: head/sys/kern/kern_rwlock.c ============================================================================== --- head/sys/kern/kern_rwlock.c Tue Apr 10 23:38:31 2018 (r332397) +++ head/sys/kern/kern_rwlock.c Wed Apr 11 01:43:29 2018 (r332398) @@ -95,8 +95,8 @@ struct lock_class lock_class_rw = { }; #ifdef ADAPTIVE_RWLOCKS -static int __read_frequently rowner_retries = 10; -static int __read_frequently rowner_loops = 10000; +static int __read_frequently rowner_retries; +static int __read_frequently rowner_loops; static SYSCTL_NODE(_debug, OID_AUTO, rwlock, CTLFLAG_RD, NULL, "rwlock debugging"); SYSCTL_INT(_debug_rwlock, OID_AUTO, retry, CTLFLAG_RW, &rowner_retries, 0, ""); @@ -109,7 +109,15 @@ SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_base, CTLFLA SYSCTL_INT(_debug_rwlock, OID_AUTO, delay_max, CTLFLAG_RW, &rw_delay.max, 0, ""); -LOCK_DELAY_SYSINIT_DEFAULT(rw_delay); +static void +rw_lock_delay_init(void *arg __unused) +{ + + lock_delay_default_init(&rw_delay); + rowner_retries = 10; + rowner_loops = max(10000, rw_delay.max); +} +LOCK_DELAY_SYSINIT(rw_lock_delay_init); #endif /* Modified: head/sys/kern/kern_sx.c ============================================================================== --- head/sys/kern/kern_sx.c Tue Apr 10 23:38:31 2018 (r332397) +++ head/sys/kern/kern_sx.c Wed Apr 11 01:43:29 2018 (r332398) @@ -145,8 +145,8 @@ struct lock_class lock_class_sx = { #endif #ifdef ADAPTIVE_SX -static __read_frequently u_int asx_retries = 10; -static __read_frequently u_int asx_loops = 10000; +static __read_frequently u_int asx_retries; +static __read_frequently u_int asx_loops; static SYSCTL_NODE(_debug, OID_AUTO, sx, CTLFLAG_RD, NULL, "sxlock debugging"); SYSCTL_UINT(_debug_sx, OID_AUTO, retries, CTLFLAG_RW, &asx_retries, 0, ""); SYSCTL_UINT(_debug_sx, OID_AUTO, loops, CTLFLAG_RW, &asx_loops, 0, ""); @@ -158,7 +158,15 @@ SYSCTL_INT(_debug_sx, OID_AUTO, delay_base, CTLFLAG_RW SYSCTL_INT(_debug_sx, OID_AUTO, delay_max, CTLFLAG_RW, &sx_delay.max, 0, ""); -LOCK_DELAY_SYSINIT_DEFAULT(sx_delay); +static void +sx_lock_delay_init(void *arg __unused) +{ + + lock_delay_default_init(&sx_delay); + asx_retries = 10; + asx_loops = max(10000, sx_delay.max); +} +LOCK_DELAY_SYSINIT(sx_lock_delay_init); #endif void From owner-svn-src-head@freebsd.org Wed Apr 11 04:52:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 178AFF9511A; Wed, 11 Apr 2018 04:52:07 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) (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 AB994871DE; Wed, 11 Apr 2018 04:52:06 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (Seawolf.HML3.ScaleEngine.net [209.51.186.28]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id 6948B146C0; Wed, 11 Apr 2018 04:52:00 +0000 (UTC) Subject: Re: svn commit: r332365 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs To: Mark Johnston , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201804101356.w3ADu6Jr072766@repo.freebsd.org> From: Allan Jude Openpgp: preference=signencrypt Message-ID: <33ea9236-2442-10d6-95d0-9e4d33c4613e@freebsd.org> Date: Wed, 11 Apr 2018 00:51:55 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <201804101356.w3ADu6Jr072766@repo.freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Bv5MZTSXhBrZQG7Ah1pQNP4qbfe0jggFx" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 04:52:07 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Bv5MZTSXhBrZQG7Ah1pQNP4qbfe0jggFx Content-Type: multipart/mixed; boundary="NbJClafTHxD5uEnny03GpV5P87esparfL"; protected-headers="v1" From: Allan Jude To: Mark Johnston , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Message-ID: <33ea9236-2442-10d6-95d0-9e4d33c4613e@freebsd.org> Subject: Re: svn commit: r332365 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs References: <201804101356.w3ADu6Jr072766@repo.freebsd.org> In-Reply-To: <201804101356.w3ADu6Jr072766@repo.freebsd.org> --NbJClafTHxD5uEnny03GpV5P87esparfL Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 2018-04-10 09:56, Mark Johnston wrote: > Author: markj > Date: Tue Apr 10 13:56:06 2018 > New Revision: 332365 > URL: https://svnweb.freebsd.org/changeset/base/332365 >=20 > Log: > Set zfs_arc_free_target to v_free_target. > =20 > Page daemon output is now regulated by a PID controller with a setpoi= nt > of v_free_target. Moreover, the page daemon now wakes up regularly > rather than waiting for a wakeup from another thread. This means that= > the free page count is unlikely to drop below the old > zfs_arc_free_target value, and as a result the ARC was not readily > freeing pages under memory pressure. Address the immediate problem by= > updating zfs_arc_free_target to match the page daemon's new behaviour= =2E > =20 > Reported and tested by: truckman > Discussed with: jeff > X-MFC with: r329882 > Differential Revision: https://reviews.freebsd.org/D14994 >=20 On a somewhat unrelated note, can we rename this sysctl and change to be counted in bytes? When users are tuning ZFS, every other ZFS value is in bytes, not pages. Maybe keep the currently variable as it is, in pages, and adjust it by dividing the user set value by the page size. The current name is great, but I wouldn't want anyone to end up setting it to 4096x the value they actually want if we just changed it out from under them. --=20 Allan Jude --NbJClafTHxD5uEnny03GpV5P87esparfL-- --Bv5MZTSXhBrZQG7Ah1pQNP4qbfe0jggFx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (MingW32) iQIcBAEBAgAGBQJazZRvAAoJEBmVNT4SmAt+fDoQAOjY4MAP17oUWGUo0zgfqWww Yt2f2TUwzB5p61EscwIkhUo/4LalQWihnkm3EM0jF7piiaa+Kzei0aWX0Ky4Adv+ mcfU8CYbOakvqJ6PpxEBK0NZGkzTETCzLRxBA0RDtZnZJW4GddwuACp1D7LZHl5e TbFh0kWETs9kt/ADxPbjIMfyRUoxyh1bVnR4eeSTRHF/uuB2chmrVxTJBTG0kVU8 t2VpvefRee1X1XPJNKKIqOSsWLiN/VaEljEcwRmPTy/LDwLCxOnwkbMs0mFFOm71 OzZerSIMUI3e7irhQB9DDtyY5I98aybCKpEQqC8ctzRyaGVOhcNxuprLy5+w4UUO SvOkHMebMSOMxtgSjxJZYyy3b43CSggTXMtWQVVvdSI0++gz9RhtTy4diqF32oXq N9jOiWPn9J9cvjiKYai+SCwQoHrAFXPx+/SdVMuRu1+81nwFD8MAVzitlpxBK6XS mh6pBDIVOycqeGbiswMl2RT60n2AgazWHameR/mo27nWm0m5hqMV2MynjvIEVMOv YIdta3DYUVcdSTCt/jbr2HdsL+M34U/7q5A1MT5NoI1y6NGLk2JLEORa+EdljxHt 2M53vBZgW8712Jj5p34+z/+PPSzbkKDfpR6M6bD3fmqgC73/oHCDR/JkDB+oNAGc PO23nvJNRT89ukWXiw1q =X8iN -----END PGP SIGNATURE----- --Bv5MZTSXhBrZQG7Ah1pQNP4qbfe0jggFx-- From owner-svn-src-head@freebsd.org Wed Apr 11 05:04:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 834B3F95F49; Wed, 11 Apr 2018 05:04:59 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from mx1.scaleengine.net (mx1.scaleengine.net [209.51.186.6]) (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 1F4376B88A; Wed, 11 Apr 2018 05:04:59 +0000 (UTC) (envelope-from allanjude@freebsd.org) Received: from [10.1.1.2] (Seawolf.HML3.ScaleEngine.net [209.51.186.28]) (Authenticated sender: allanjude.freebsd@scaleengine.com) by mx1.scaleengine.net (Postfix) with ESMTPSA id 6D3DA146E7; Wed, 11 Apr 2018 05:04:58 +0000 (UTC) Subject: Re: svn commit: r315449 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs From: Allan Jude To: Steven Hartland , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Cc: Andriy Gapon , Josh Paetzel , Alexander Motin , Mark Johnston References: <201703171234.v2HCYvgd026429@repo.freebsd.org> <6bf452f9-fd55-1ea9-196a-1cfcf97d06f4@freebsd.org> Openpgp: preference=signencrypt Message-ID: <67b803af-3ec3-1bf4-68d9-8cfa19dde160@freebsd.org> Date: Wed, 11 Apr 2018 01:04:54 -0400 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: <6bf452f9-fd55-1ea9-196a-1cfcf97d06f4@freebsd.org> Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="FvKA9jmSEiZ4hcNv4wJsPdcs0VzkmlO1I" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 05:04:59 -0000 This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --FvKA9jmSEiZ4hcNv4wJsPdcs0VzkmlO1I Content-Type: multipart/mixed; boundary="RS1c8P4Ud5TSvJ9m7xo6RsK4RjtV0w1fT"; protected-headers="v1" From: Allan Jude To: Steven Hartland , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Cc: Andriy Gapon , Josh Paetzel , Alexander Motin , Mark Johnston Message-ID: <67b803af-3ec3-1bf4-68d9-8cfa19dde160@freebsd.org> Subject: Re: svn commit: r315449 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs References: <201703171234.v2HCYvgd026429@repo.freebsd.org> <6bf452f9-fd55-1ea9-196a-1cfcf97d06f4@freebsd.org> In-Reply-To: <6bf452f9-fd55-1ea9-196a-1cfcf97d06f4@freebsd.org> --RS1c8P4Ud5TSvJ9m7xo6RsK4RjtV0w1fT Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: quoted-printable On 2018-02-25 22:56, Allan Jude wrote: > On 2017-03-17 08:34, Steven Hartland wrote: >> Author: smh >> Date: Fri Mar 17 12:34:57 2017 >> New Revision: 315449 >> URL: https://svnweb.freebsd.org/changeset/base/315449 >> >> Log: >> Reduce ARC fragmentation threshold >> =20 >> As ZFS can request up to SPA_MAXBLOCKSIZE memory block e.g. during z= fs recv, >> update the threshold at which we start agressive reclamation to use >> SPA_MAXBLOCKSIZE (16M) instead of the lower zfs_max_recordsize which= >> defaults to 1M. >> =20 >> PR: 194513 >> Reviewed by: avg, mav >> MFC after: 1 month >> Sponsored by: Multiplay >> Differential Revision: https://reviews.freebsd.org/D10012 >> >> Modified: >> head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c >> >> Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.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/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Mar = 17 12:34:56 2017 (r315448) >> +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c Fri Mar = 17 12:34:57 2017 (r315449) >> @@ -3978,7 +3978,7 @@ arc_available_memory(void) >> * Start aggressive reclamation if too little sequential KVA left. >> */ >> if (lowest > 0) { >> - n =3D (vmem_size(heap_arena, VMEM_MAXFREE) < zfs_max_recordsize) ? >> + n =3D (vmem_size(heap_arena, VMEM_MAXFREE) < SPA_MAXBLOCKSIZE) ? >> -((int64_t)vmem_size(heap_arena, VMEM_ALLOC) >> 4) : >> INT64_MAX; >> if (n < lowest) { >> >=20 > I have some users reporting excessive ARC shrinking in 11.1 vs 11.0 due= > to this change. >=20 > Memory seems quite fragmented, and this change makes it much more > sensitive to that, but the problem seems to be that is can get to > aggressive. >=20 > The most recent case, the machine has 128GB of ram, and no other major > processes running, just ZFS zvols being served over iSCIS by ctld. >=20 > arc_max set to 85GB, rather conservative. After running for a few days,= > fragmentation seems to trip this line, when there are no 16mb contiguou= s > blocks, and it shrinks the ARC by 1/16th of memory, but this does not > result in a 16mb contiguous chunk, so it shrinks the ARC by another > 1/16th, and again until it hits arc_min. Apparently eventually the ARC > does regrow, but then crashes again later. >=20 > You can see the ARC oscillating between arc_max and arc_min, with some > long periods pinned at arc_min: https://imgur.com/a/emztF >=20 >=20 > [root@ZFS-AF ~]# vmstat -z | tail +3 | awk -F '[:,] *' 'BEGIN { total=3D= 0; > cache=3D0; used=3D0 } {u =3D $2 * $4; c =3D $2 * $5; t =3D u + c; cache= +=3D c; used > +=3D u; total +=3D t; name=3D$1; gsub(" ", "_", name); print t, name, u= , c} > END { print total, "TOTAL", used, cache } ' | sort -n | perl -a -p -e > 'while (($j, $_) =3D each(@F)) { 1 while s/^(-?\d+)(\d{3})/$1,$2/; prin= t > $_, " "} print "\n"' | column -t | tail TOTAL NAME USED Cache > 1,723,367,424 zio_data_buf_49152 1,722,875,904 491,520 > 1,827,057,664 zio_buf_4096 1,826,848,768 208,896 > 2,289,459,200 zio_data_buf_40960 2,289,090,560 368,640 > 3,642,736,640 zio_data_buf_81920 3,642,408,960 327,680 > 6,713,180,160 zio_data_buf_98304 6,712,688,640 491,520 > 9,388,195,840 zio_buf_8192 9,388,064,768 131,072 > 11,170,152,448 zio_data_buf_114688 11,168,890,880 1,261,568 > 29,607,329,792 zio_data_buf_131072 29,606,674,432 655,360 > 32,944,750,592 zio_buf_65536 32,943,833,088 917,504 > 114,235,296,752 TOTAL 111,787,212,900 2,448,083,852 >=20 >=20 > [root@ZFS-AF ~]# vmstat -z | tail +3 | awk -F '[:,] *' 'BEGIN { total=3D= 0; > cache=3D0; used=3D0 } {u =3D $2 * $4; c =3D $2 * $5; t =3D u + c; cache= +=3D c; used > +=3D u; total +=3D t; name=3D$1; gsub(" ", "_", name); print t, name, u= , c} > END { print total, "TOTAL", used, cache } ' | sort -n +3 | perl -a -p -= e > 'while (($j, $_) =3D each(@F)) { 1 while s/^(-?\d+)(\d{3})/$1,$2/; prin= t > $_, " "} print "\n"' | column -t | tail Sorted by cache (waste) TOTAL NAME USED Cache > 71,565,312 cblk15 0 71,565,312 > 72,220,672 cblk16 0 72,220,672 > 72,351,744 cblk18 131,072 72,220,672 > 72,744,960 cblk3 0 72,744,960 > 75,497,472 cblk8 0 75,497,472 > 76,283,904 cblk22 0 76,283,904 > 403,696,384 128 286,225,792 117,470,592 > 229,519,360 mbuf_jumbo_page 67,043,328 162,476,032 > 1,196,795,160 arc_buf_hdr_t_l2only 601,620,624 595,174,536 > 114,220,354,544 TOTAL 111,778,349,508 2,442,005,036 >=20 >=20 > Maybe the right thing to do is call the new kmem_cache_reap_soon() or > other functions that might actually reduce fragmentation, or rate limit= > how quickly the ARC will shrink? >=20 > What kind of tools do we have to look at why memory is so fragmented > that ZFS feels the need to tank the ARC? >=20 >=20 >=20 > I know this block and the FMR_ZIO_FRAG reason have been removed from > -CURRENT as part of the NUMA work, but I am worried about addressing > this issue for the upcoming 11.2-RELEASE. >=20 >=20 >=20 Does anyone have any thoughts on this? The 11.2 code slush starts in 1 week, so we really need to decide what to do here. --=20 Allan Jude --RS1c8P4Ud5TSvJ9m7xo6RsK4RjtV0w1fT-- --FvKA9jmSEiZ4hcNv4wJsPdcs0VzkmlO1I Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (MingW32) iQIcBAEBAgAGBQJazZd5AAoJEBmVNT4SmAt+YBIQAOuIMs21mhqgs3T+xJYtyIKL EvfE+wfe5N3SwO0TnUHb5vg6A6kX+9dJr9U2UH77x4gAxkrIyl/Gz0KDGg4SxfGR byMYUEkADbJ0aTR828Sw+bKnCRMvRSrZsWYkLM7AY+m5irCmhUXPgZcWECaj7GK9 rTqf6D8dFNFaP+SSnvypotwbv9lDi3RTOASXzrbQShwBGk1On5jNQBA2OqOGXJ2g 371iu+wpPzIQkxqHkQSDKu0vSGac7s03eGLqe7fqi+bUhTdi1pE8tY3F0mXlCwXP 3k8j+uTiPQk3eQg3KXVN2PYhljCV7/Ua+jXwlDQl0k61OB08xrQg5YUQ19WuFdpH 4AdlKzNyeDU1PyT4+cthFIudjHTlguC7CC/8hqELkIUWsHKJKXfUQyP6otG5tolZ vayx7x+w/ibUDdxMEGIdfJhHaOdbV/WJ8v+2cyxpveK6OeMAPpy726eARRNRe85Q PnE/Wp8neTUCpT4p5SsT8uSb3LHaTVDcB53tP3Xtw7LkoeS+CIzkksbayxJBU+g8 9I3ObAeL36VuNjA35UosztaVt6vqS0DdPN3rSItfckBdDzZSaQ2GvfFdErhotU3a nS3LhHP8Rowe5rv9RIk6onejzUV8agE+hXmyvsnVVfumHX904KPOdWbAZ2ruzRjF 9v0JdfThXOYnVnb82VP9 =egwp -----END PGP SIGNATURE----- --FvKA9jmSEiZ4hcNv4wJsPdcs0VzkmlO1I-- From owner-svn-src-head@freebsd.org Wed Apr 11 07:15:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E3A51F9ECE4; Wed, 11 Apr 2018 07:15:30 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 950F187C4C; Wed, 11 Apr 2018 07:15:30 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 900FF190B5; Wed, 11 Apr 2018 07:15:30 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3B7FUgv009365; Wed, 11 Apr 2018 07:15:30 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3B7FUCo009364; Wed, 11 Apr 2018 07:15:30 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201804110715.w3B7FUCo009364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Wed, 11 Apr 2018 07:15:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332399 - head/tests/sys/acl X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/tests/sys/acl X-SVN-Commit-Revision: 332399 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 07:15:31 -0000 Author: eadler Date: Wed Apr 11 07:15:30 2018 New Revision: 332399 URL: https://svnweb.freebsd.org/changeset/base/332399 Log: [tests] change tests/sys/acl/run to run on perl 5.26 Previously unescaped regex just resulted in a warning. Now it results in a failed test. Modified: head/tests/sys/acl/run Modified: head/tests/sys/acl/run ============================================================================== --- head/tests/sys/acl/run Wed Apr 11 01:43:29 2018 (r332398) +++ head/tests/sys/acl/run Wed Apr 11 07:15:30 2018 (r332399) @@ -70,7 +70,7 @@ for (;;) { if (defined $line) { # Substitute %VAR and %{VAR} with environment variables. $line =~ s[%(\w+)][$ENV{$1}]eg; - $line =~ s[%{(\w+)}][$ENV{$1}]eg; + $line =~ s[%\{(\w+)\}][$ENV{$1}]eg; } if (defined $line) { if ($line =~ s/^\s*< ?//) { From owner-svn-src-head@freebsd.org Wed Apr 11 11:12:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 59BF0F8AFFC; Wed, 11 Apr 2018 11:12:21 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 07F7278FFF; Wed, 11 Apr 2018 11:12:21 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 02D091B792; Wed, 11 Apr 2018 11:12:21 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3BBCK0k028495; Wed, 11 Apr 2018 11:12:20 GMT (envelope-from oleg@FreeBSD.org) Received: (from oleg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3BBCKj9028494; Wed, 11 Apr 2018 11:12:20 GMT (envelope-from oleg@FreeBSD.org) Message-Id: <201804111112.w3BBCKj9028494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oleg set sender to oleg@FreeBSD.org using -f From: Oleg Bulyzhin Date: Wed, 11 Apr 2018 11:12:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332402 - head/sys/netpfil/ipfw X-SVN-Group: head X-SVN-Commit-Author: oleg X-SVN-Commit-Paths: head/sys/netpfil/ipfw X-SVN-Commit-Revision: 332402 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 11:12:21 -0000 Author: oleg Date: Wed Apr 11 11:12:20 2018 New Revision: 332402 URL: https://svnweb.freebsd.org/changeset/base/332402 Log: Fix ipfw table creation when net.inet.ip.fw.tables_sets = 0 and non zero set specified on table creation. This fixes following: # sysctl net.inet.ip.fw.tables_sets net.inet.ip.fw.tables_sets: 0 # ipfw table all info # ipfw set 1 table 1 create type addr # ipfw set 1 table 1 create type addr # ipfw add 10 set 1 count ip from table\(1\) to any 00010 count ip from table(1) to any # ipfw add 10 set 1 count ip from table\(1\) to any 00010 count ip from table(1) to any # ipfw table all info --- table(1), set(1) --- kindex: 4, type: addr references: 1, valtype: legacy algorithm: addr:radix items: 0, size: 296 --- table(1), set(1) --- kindex: 3, type: addr references: 1, valtype: legacy algorithm: addr:radix items: 0, size: 296 --- table(1), set(1) --- kindex: 2, type: addr references: 0, valtype: legacy algorithm: addr:radix items: 0, size: 296 --- table(1), set(1) --- kindex: 1, type: addr references: 0, valtype: legacy algorithm: addr:radix items: 0, size: 296 # MFC after: 1 week Modified: head/sys/netpfil/ipfw/ip_fw_table.c Modified: head/sys/netpfil/ipfw/ip_fw_table.c ============================================================================== --- head/sys/netpfil/ipfw/ip_fw_table.c Wed Apr 11 10:36:20 2018 (r332401) +++ head/sys/netpfil/ipfw/ip_fw_table.c Wed Apr 11 11:12:20 2018 (r332402) @@ -3171,7 +3171,7 @@ alloc_table_config(struct ip_fw_chain *ch, struct tid_ if (ntlv == NULL) return (NULL); name = ntlv->name; - set = ntlv->set; + set = (V_fw_tables_sets == 0) ? 0 : ntlv->set; } else { /* Compat part: convert number to string representation */ snprintf(bname, sizeof(bname), "%d", ti->uidx); From owner-svn-src-head@freebsd.org Wed Apr 11 11:17:57 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0177F8B563; Wed, 11 Apr 2018 11:17:57 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 54F0B792D4; Wed, 11 Apr 2018 11:17:57 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4FD081B7A6; Wed, 11 Apr 2018 11:17:57 +0000 (UTC) (envelope-from oleg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3BBHvxB029397; Wed, 11 Apr 2018 11:17:57 GMT (envelope-from oleg@FreeBSD.org) Received: (from oleg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3BBHv4u029396; Wed, 11 Apr 2018 11:17:57 GMT (envelope-from oleg@FreeBSD.org) Message-Id: <201804111117.w3BBHv4u029396@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: oleg set sender to oleg@FreeBSD.org using -f From: Oleg Bulyzhin Date: Wed, 11 Apr 2018 11:17:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332403 - head/sbin/ipfw X-SVN-Group: head X-SVN-Commit-Author: oleg X-SVN-Commit-Paths: head/sbin/ipfw X-SVN-Commit-Revision: 332403 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 11:17:57 -0000 Author: oleg Date: Wed Apr 11 11:17:57 2018 New Revision: 332403 URL: https://svnweb.freebsd.org/changeset/base/332403 Log: Fix typo. MFC after: 1 week Modified: head/sbin/ipfw/ipfw.8 Modified: head/sbin/ipfw/ipfw.8 ============================================================================== --- head/sbin/ipfw/ipfw.8 Wed Apr 11 11:12:20 2018 (r332402) +++ head/sbin/ipfw/ipfw.8 Wed Apr 11 11:17:57 2018 (r332403) @@ -2233,7 +2233,7 @@ of the firewall and quickly (and atomically) switch be By default, tables from set 0 are referenced when adding rule with table opcodes regardless of rule set. This behavior can be changed by setting -.Va net.inet.ip.fw.tables_set +.Va net.inet.ip.fw.tables_sets variable to 1. Rule's set will then be used for table references. .Pp From owner-svn-src-head@freebsd.org Wed Apr 11 11:43:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DC57CF8D1B7; Wed, 11 Apr 2018 11:43:12 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 80F3B7E285; Wed, 11 Apr 2018 11:43:12 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AEB31BC58; Wed, 11 Apr 2018 11:43:12 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3BBhCVc044194; Wed, 11 Apr 2018 11:43:12 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3BBhCL6044192; Wed, 11 Apr 2018 11:43:12 GMT (envelope-from kp@FreeBSD.org) Message-Id: <201804111143.w3BBhCL6044192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 11 Apr 2018 11:43:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332404 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 332404 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 11:43:13 -0000 Author: kp Date: Wed Apr 11 11:43:12 2018 New Revision: 332404 URL: https://svnweb.freebsd.org/changeset/base/332404 Log: pf: limit ioctl to a reasonable and tuneable number of elements pf ioctls frequently take a variable number of elements as argument. This can potentially allow users to request very large allocations. These will fail, but even a failing M_NOWAIT might tie up resources and result in concurrent M_WAITOK allocations entering vm_wait and inducing reclamation of caches. Limit these ioctls to what should be a reasonable value, but allow users to tune it should they need to. Differential Revision: https://reviews.freebsd.org/D15018 Modified: head/sys/netpfil/pf/pf.c head/sys/netpfil/pf/pf_ioctl.c Modified: head/sys/netpfil/pf/pf.c ============================================================================== --- head/sys/netpfil/pf/pf.c Wed Apr 11 11:17:57 2018 (r332403) +++ head/sys/netpfil/pf/pf.c Wed Apr 11 11:43:12 2018 (r332404) @@ -369,11 +369,14 @@ u_long pf_hashmask; u_long pf_srchashmask; static u_long pf_hashsize; static u_long pf_srchashsize; +u_long pf_ioctl_maxcount = 65535; SYSCTL_ULONG(_net_pf, OID_AUTO, states_hashsize, CTLFLAG_RDTUN, &pf_hashsize, 0, "Size of pf(4) states hashtable"); SYSCTL_ULONG(_net_pf, OID_AUTO, source_nodes_hashsize, CTLFLAG_RDTUN, &pf_srchashsize, 0, "Size of pf(4) source nodes hashtable"); +SYSCTL_ULONG(_net_pf, OID_AUTO, request_maxcount, CTLFLAG_RDTUN, + &pf_ioctl_maxcount, 0, "Maximum number of tables, addresses, ... in a single ioctl() call"); VNET_DEFINE(void *, pf_swi_cookie); Modified: head/sys/netpfil/pf/pf_ioctl.c ============================================================================== --- head/sys/netpfil/pf/pf_ioctl.c Wed Apr 11 11:17:57 2018 (r332403) +++ head/sys/netpfil/pf/pf_ioctl.c Wed Apr 11 11:43:12 2018 (r332404) @@ -89,8 +89,6 @@ __FBSDID("$FreeBSD$"); #include #endif -#define PF_TABLES_MAX_REQUEST 65535 /* Maximum tables per request. */ - static struct pf_pool *pf_get_pool(char *, u_int32_t, u_int8_t, u_int32_t, u_int8_t, u_int8_t, u_int8_t); @@ -218,6 +216,8 @@ pfsync_defer_t *pfsync_defer_ptr = NULL; /* pflog */ pflog_packet_t *pflog_packet_ptr = NULL; +extern u_long pf_ioctl_maxcount; + static void pfattach_vnet(void) { @@ -2533,7 +2533,8 @@ DIOCCHANGEADDR_error: break; } - if (io->pfrio_size < 0 || io->pfrio_size > PF_TABLES_MAX_REQUEST) { + if (io->pfrio_size < 0 || io->pfrio_size > pf_ioctl_maxcount || + WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_table))) { error = ENOMEM; break; } @@ -2564,7 +2565,8 @@ DIOCCHANGEADDR_error: break; } - if (io->pfrio_size < 0 || io->pfrio_size > PF_TABLES_MAX_REQUEST) { + if (io->pfrio_size < 0 || io->pfrio_size > pf_ioctl_maxcount || + WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_table))) { error = ENOMEM; break; } @@ -2741,6 +2743,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) { error = EINVAL; break; @@ -2778,6 +2781,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) { error = EINVAL; break; @@ -2819,7 +2823,8 @@ DIOCCHANGEADDR_error: break; } count = max(io->pfrio_size, io->pfrio_size2); - if (WOULD_OVERFLOW(count, sizeof(struct pfr_addr))) { + if (count > pf_ioctl_maxcount || + WOULD_OVERFLOW(count, sizeof(struct pfr_addr))) { error = EINVAL; break; } @@ -2857,6 +2862,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) { error = EINVAL; break; @@ -2888,6 +2894,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_astats))) { error = EINVAL; break; @@ -2919,6 +2926,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) { error = EINVAL; break; @@ -2956,6 +2964,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) { error = EINVAL; break; @@ -2993,6 +3002,7 @@ DIOCCHANGEADDR_error: break; } if (io->pfrio_size < 0 || + io->pfrio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfrio_size, sizeof(struct pfr_addr))) { error = EINVAL; break; @@ -3045,6 +3055,7 @@ DIOCCHANGEADDR_error: break; } if (io->size < 0 || + io->size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->size, sizeof(struct pfioc_trans_e))) { error = EINVAL; break; @@ -3121,6 +3132,7 @@ DIOCCHANGEADDR_error: break; } if (io->size < 0 || + io->size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->size, sizeof(struct pfioc_trans_e))) { error = EINVAL; break; @@ -3198,6 +3210,7 @@ DIOCCHANGEADDR_error: } if (io->size < 0 || + io->size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->size, sizeof(struct pfioc_trans_e))) { error = EINVAL; break; @@ -3410,6 +3423,7 @@ DIOCCHANGEADDR_error: } if (io->pfiio_size < 0 || + io->pfiio_size > pf_ioctl_maxcount || WOULD_OVERFLOW(io->pfiio_size, sizeof(struct pfi_kif))) { error = EINVAL; break; From owner-svn-src-head@freebsd.org Wed Apr 11 13:33:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7D62CF94EFA; Wed, 11 Apr 2018 13:33:13 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 25F197756C; Wed, 11 Apr 2018 13:33:13 +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 20B871CDF5; Wed, 11 Apr 2018 13:33:13 +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 w3BDXDO6098472; Wed, 11 Apr 2018 13:33:13 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3BDXDq0098471; Wed, 11 Apr 2018 13:33:13 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804111333.w3BDXDq0098471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 11 Apr 2018 13:33:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332405 - head/bin/setfacl X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/bin/setfacl X-SVN-Commit-Revision: 332405 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 13:33:13 -0000 Author: emaste Date: Wed Apr 11 13:33:12 2018 New Revision: 332405 URL: https://svnweb.freebsd.org/changeset/base/332405 Log: setfacl: minor man page edit to appease igor(1) Modified: head/bin/setfacl/setfacl.1 Modified: head/bin/setfacl/setfacl.1 ============================================================================== --- head/bin/setfacl/setfacl.1 Wed Apr 11 11:43:12 2018 (r332404) +++ head/bin/setfacl/setfacl.1 Wed Apr 11 13:33:12 2018 (r332405) @@ -80,7 +80,8 @@ entries of the current ACL. The operations apply to the default ACL entries instead of access ACL entries. Currently only directories may have -default ACL's. This option is not applicable to NFSv4 ACLs. +default ACL's. +This option is not applicable to NFSv4 ACLs. .It Fl h If the target of the operation is a symbolic link, perform the operation on the symbolic link itself, rather than following the link. @@ -96,8 +97,9 @@ It is not considered an error if the specified files do not have any default ACL entries. An error will be reported if any of -the specified files cannot have a default entry (i.e.\& -non-directories). This option is not applicable to NFSv4 ACLs. +the specified files cannot have a default entry (i.e., +non-directories). +This option is not applicable to NFSv4 ACLs. .It Fl L If the .Fl R From owner-svn-src-head@freebsd.org Wed Apr 11 13:37:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 494EDF953BC; Wed, 11 Apr 2018 13:37:55 +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 86E1A78A3A; Wed, 11 Apr 2018 13:37:54 +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 8C0D01045E64; Wed, 11 Apr 2018 23:37:46 +1000 (AEST) Date: Wed, 11 Apr 2018 23:37:46 +1000 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Ian Lepore cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332395 - head/sys/kern In-Reply-To: <201804102257.w3AMvuIF061050@repo.freebsd.org> Message-ID: <20180411222028.W952@besplex.bde.org> References: <201804102257.w3AMvuIF061050@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=cIaQihWN c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=MjzpdK5aTTREc79HclsA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 13:37:55 -0000 On Tue, 10 Apr 2018, Ian Lepore wrote: > URL: https://svnweb.freebsd.org/changeset/base/332395 > > Log: > Use explicit_bzero() when cleaning values out of the kernel environment. > > Sometimes the values contain geli passphrases being communicated from > loader(8) to the kernel, and some day the compiler may decide to start > eliding calls to memset() for a pointer which is not dereferenced again > before being passed to free(). Using memset() in the kernel is also a style bug. I used to police this in files that I used, and there were still only 37 instances of it in kern/*.c before this commit. There were 209 instances of using the BSD API bzero(). It is interesting that using memset() also asks for security holes. bzero() already has the correct semantics for avoiding security holes, so explicit_bzero() instead of just bzero() in the kernel is another style bug. There were only 6 instances of this style bug in kern/*.c (all in kern_shutdown.c). Most places where there is an obvious security bug just use bzero(). The most common bug was for copying out structs. Padding in the structs must be zeroed, and bzero() is a good way to do this. In this case, the compiler can't see where the copy is used, so even bzero() is safe. bzero() should not cause security bugs anywhere, since it is not a standard C function so C compilers cannot know what it does. However, it is a standard POSIX function so C compilers with POSIX extensions could know what it does. POSIX has a deficient specification of it in at least the 2001 version. It says that "The bzero() function shall place n zero-valued bytes in the area pointed to by s" and under APPLICATION USAGE it says "[bad advice on preferring memset() deleted. Now I quote its bad advice on portability:] for maximum portability, it is recommended to replace the function call to bzero [by] #define bzero(b,len) (memset((b), '\0', (len)), (void) 0). The C standard says much the same for memset(), but it is clearer that the "as if" rule applies to memset(), so compilers don't have to actually fill in the array as specified they can prove that no conforming program can tell the difference. Before POSIX standardized bzero() in 2001, compilers couldn't do the same opimization for bzero(), so the de-facto standard for it was to actually fill in the array and this is what should have been standardized. Similarly for memset() when it was standardized in the late 1980's. Not many people would have noticed and/or cared about the security problem then. It should have been better known in 2001. In the kernel, the compiler cannot know what even memset() does, since the kernel is built by freestanding compilers. However, bzero() was recently optimized to use __builtin_memset(). This is an invalid optimization, since it gives the security hole. bzero(9) is actually documented, but its documentation has the same deficiencies as POSIX's and FreeBSD's bzero(3) -- it is unobvious if the "as if" rule applies to these functions. (The "as if" rule probably applies to all APIs, but it is too difficult to determine and allow for operations not don;t exactly what their man page says they do.) Strangely, memset() in the kernel is not optimized using __builtin_memset(), although this optimization might be valid. (No one knows what memset() in the kernel does since it doesn't have even a fuzzy memset(9).). memset(9) is still correctly deprecated by not optimizing it like bzero(9). It is significantly pessimized only for a nonzero full byte -- then it uses a simple loop, with the loop bogusly optimized by inlining it. For a zero fill byte, it uses bzero() which often uses __builtin_memset(). clang and even gcc-4.2.1 have a builtin bzero, but this is not used. Its semantics are as unclear as bzero()'s. The simple loop for memset() in the nonzero fill-byte case is an older mistake. IIRC, it was originally only done for the inline memset() in libkern.h. However, due to bugs in builtins and possibly with -O0, memset() is need as an extern function too. So the loop occurs in the inline version where it is mostly a negative optimization for space, and in the extern version where it is good enough. Inlining the loop only clearly optimizes for security holes -- it allows the compiler to see what the function does, so the compiler can make it do nothing. However, in the freestanding case, it is still an invalid optimization to not zero things before they are freed. The compiler cannot know what free(9) does unless free() is inlined, and free() is too large to even be inlined. So explicit_bzero() is needed here even less than in most places. Bruce From owner-svn-src-head@freebsd.org Wed Apr 11 13:48:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5FB9CF95EEE; Wed, 11 Apr 2018 13:48:27 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-io0-x22c.google.com (mail-io0-x22c.google.com [IPv6:2607:f8b0:4001:c06::22c]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E6EFC79106; Wed, 11 Apr 2018 13:48:26 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-io0-x22c.google.com with SMTP id y128so2414799iod.4; Wed, 11 Apr 2018 06:48:26 -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=mJuLtrgm1lAAZIhTL23pumvb5yVDEjH38a9NnYXGRbM=; b=I4mknSM13MoribB2T9YEEz2vwpzyu4Bk7AkYY4g2btdtblo0lS7shdbbEw844b4KgY NHzpZKQlOTzyTU5BuOiYREymD+oMk97KzEMYeKZgifdEQgIrAy9kaNKJKqPkoYtwHcjj TZn2cCEfGyF2FE0g1tw8dKHMahD7el2GJ04qvxtMztxBgvlmt2K/JzRPiDp8HPcTAw8O OuXQkxaGcg5h2bkQWFxI9vAUdYgh0LIgLVEBK2hAu16zCfvKomPOjtGzzlJxSBUbjTg0 Fy6wNf411ELePzfVE9SF43sNXxIa3Az2lRewujDEPrvNzLHtiI0riN7fdQd4YqBplQjy NW/Q== 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=mJuLtrgm1lAAZIhTL23pumvb5yVDEjH38a9NnYXGRbM=; b=Y1fgvMlVXbKi2aKoWvibKB6+cuTrJWMcKVDxw8Fp9n469kPvrfAxRbhl+vTZmgvHYB 3kAZmZX8kvpgHND1wYBRrVcYCBRiVDFEGx9+qkCaxYy3zfmnByTLukQKRDJCF7vdz9XE GT9I2OLoD31Wh6AjMlBi6kkK52e3iegDiPcAoClBqmpN2H7nUbvy20QK/A/QjD6woE4o W4rky4+QC/Wwdzgse69dWPOJmhfqGbFnx7HFd7A+L/2yzTgswsdvpX67IDaDj6xGEPbA 2mMbQcPQyiJLNY/5+48wWpqNbXJYRHGograJkDcDmTlt16S7+/1ZkH5+XKRirjSTsUgQ /KGQ== X-Gm-Message-State: ALQs6tC0IuwyxydJhOnRCoz8UhiSHeaL2rJfVKt3IF153hm/N9ii9I2R bAjgHOdhIMNcc4pl8VcYgxbrRg== X-Google-Smtp-Source: AIpwx4+fIvgstrJwPwBNrM+ByHOcpi2VZGq5MsCqi8eqvOsWj0hXYZW035KQc4KIlBN2SnyV9h6WAQ== X-Received: by 10.107.137.158 with SMTP id t30mr4619027ioi.230.1523454506131; Wed, 11 Apr 2018 06:48:26 -0700 (PDT) Received: from raichu (toroon0560w-lp130-04-184-145-252-74.dsl.bell.ca. [184.145.252.74]) by smtp.gmail.com with ESMTPSA id 72-v6sm708735itg.36.2018.04.11.06.48.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Apr 2018 06:48:25 -0700 (PDT) Sender: Mark Johnston Date: Wed, 11 Apr 2018 09:48:20 -0400 From: Mark Johnston To: Allan Jude Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332365 - head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs Message-ID: <20180411134820.GA43015@raichu> References: <201804101356.w3ADu6Jr072766@repo.freebsd.org> <33ea9236-2442-10d6-95d0-9e4d33c4613e@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <33ea9236-2442-10d6-95d0-9e4d33c4613e@freebsd.org> User-Agent: Mutt/1.9.4 (2018-02-28) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 13:48:27 -0000 On Wed, Apr 11, 2018 at 12:51:55AM -0400, Allan Jude wrote: > On 2018-04-10 09:56, Mark Johnston wrote: > > Author: markj > > Date: Tue Apr 10 13:56:06 2018 > > New Revision: 332365 > > URL: https://svnweb.freebsd.org/changeset/base/332365 > > > > Log: > > Set zfs_arc_free_target to v_free_target. > > > > Page daemon output is now regulated by a PID controller with a setpoint > > of v_free_target. Moreover, the page daemon now wakes up regularly > > rather than waiting for a wakeup from another thread. This means that > > the free page count is unlikely to drop below the old > > zfs_arc_free_target value, and as a result the ARC was not readily > > freeing pages under memory pressure. Address the immediate problem by > > updating zfs_arc_free_target to match the page daemon's new behaviour. > > > > Reported and tested by: truckman > > Discussed with: jeff > > X-MFC with: r329882 > > Differential Revision: https://reviews.freebsd.org/D14994 > > > > On a somewhat unrelated note, can we rename this sysctl and change to be > counted in bytes? When users are tuning ZFS, every other ZFS value is in > bytes, not pages. > > Maybe keep the currently variable as it is, in pages, and adjust it by > dividing the user set value by the page size. > > The current name is great, but I wouldn't want anyone to end up setting > it to 4096x the value they actually want if we just changed it out from > under them. Sure, any suggestions for what the new sysctl should be named? From owner-svn-src-head@freebsd.org Wed Apr 11 14:27:29 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BBFDBF98A9A; Wed, 11 Apr 2018 14:27:29 +0000 (UTC) (envelope-from ken@kdm.org) Received: from mithlond.kdm.org (mithlond.kdm.org [96.89.93.250]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mithlond.kdm.org", Issuer "mithlond.kdm.org" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ADFD8216E; Wed, 11 Apr 2018 14:27:29 +0000 (UTC) (envelope-from ken@kdm.org) Received: from mithlond.kdm.org (localhost [127.0.0.1]) by mithlond.kdm.org (8.15.2/8.14.9) with ESMTPS id w3BERLGO057180 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 11 Apr 2018 10:27:21 -0400 (EDT) (envelope-from ken@mithlond.kdm.org) Received: (from ken@localhost) by mithlond.kdm.org (8.15.2/8.14.9/Submit) id w3BERLqU057179; Wed, 11 Apr 2018 10:27:21 -0400 (EDT) (envelope-from ken) Date: Wed, 11 Apr 2018 10:27:21 -0400 From: "Kenneth D. Merry" To: Kyle Evans , Ram Kishore Vegesna , ram.vegesna@broadcom.com Cc: "Rodney W. Grimes" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332386 - head/share/misc Message-ID: <20180411142720.GB36126@mithlond.kdm.org> References: <201804101839.w3AIdKZk026212@repo.freebsd.org> <201804101922.w3AJMvSL024594@pdx.rh.CN85.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.23 (2014-03-12) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (mithlond.kdm.org [127.0.0.1]); Wed, 11 Apr 2018 10:27:21 -0400 (EDT) X-Spam-Status: No, score=-2.6 required=5.0 tests=ALL_TRUSTED,BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mithlond.kdm.org X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 14:27:29 -0000 On Tue, Apr 10, 2018 at 14:27:26 -0500, Kyle Evans wrote: > On Tue, Apr 10, 2018 at 2:22 PM, Rodney W. Grimes > wrote: > > [ Charset UTF-8 unsupported, converting... ] > >> Author: ram > >> Date: Tue Apr 10 18:39:20 2018 > >> New Revision: 332386 > >> URL: https://svnweb.freebsd.org/changeset/base/332386 > >> > >> Log: > >> Updated mentors information. > >> > >> Approved by: ken, mav > >> > >> Modified: > >> head/share/misc/committers-src.dot > >> > >> Modified: head/share/misc/committers-src.dot > >> ============================================================================== > >> --- head/share/misc/committers-src.dot Tue Apr 10 18:05:02 2018 (r332385) > >> +++ head/share/misc/committers-src.dot Tue Apr 10 18:39:20 2018 (r332386) > >> @@ -76,6 +76,7 @@ nate [label="Nate Willams\nnate@FreeBSD.org\n1993/06/1 > >> njl [label="Nate Lawson\nnjl@FreeBSD.org\n2002/08/07\n2008/02/16"] > >> non [label="Noriaki Mitsnaga\nnon@FreeBSD.org\n2000/06/19\n2007/03/06"] > >> onoe [label="Atsushi Onoe\nonoe@FreeBSD.org\n2000/07/21\n2008/11/10"] > >> +ram [label="Ram Kishore Vegesna\nram@FreeBSD.org\n2018/04/04\n???/??/??"] > > ^^^^^^^^^ > > That should be removed, you only have a start date. > > Oh and Welcome ram to the project! > > > > The entry is also smack dab in the middle of the alumni section, > rather than the later 'active' section. =) Oops. My fault for not paying attention. :( Pointy hat to: ken Ram, could you fix this and send me the diffs for approval before you commit it? Thanks, Ken -- Kenneth Merry ken@FreeBSD.ORG From owner-svn-src-head@freebsd.org Wed Apr 11 15:15:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 909A6F9C757; Wed, 11 Apr 2018 15:15:35 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3DF736FBF7; Wed, 11 Apr 2018 15:15:35 +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 345131DE45; Wed, 11 Apr 2018 15:15:35 +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 w3BFFZcO051469; Wed, 11 Apr 2018 15:15:35 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3BFFYCG051465; Wed, 11 Apr 2018 15:15:34 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201804111515.w3BFFYCG051465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 11 Apr 2018 15:15:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332409 - in head/sys/dev: bnxt e1000 ixgbe X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys/dev: bnxt e1000 ixgbe X-SVN-Commit-Revision: 332409 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 15:15:35 -0000 Author: markj Date: Wed Apr 11 15:15:34 2018 New Revision: 332409 URL: https://svnweb.freebsd.org/changeset/base/332409 Log: Use C99 initializers for iflib function tables. Reviewed by: sbruno MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D15041 Modified: head/sys/dev/bnxt/bnxt_txrx.c head/sys/dev/e1000/em_txrx.c head/sys/dev/e1000/igb_txrx.c head/sys/dev/ixgbe/ix_txrx.c Modified: head/sys/dev/bnxt/bnxt_txrx.c ============================================================================== --- head/sys/dev/bnxt/bnxt_txrx.c Wed Apr 11 15:04:31 2018 (r332408) +++ head/sys/dev/bnxt/bnxt_txrx.c Wed Apr 11 15:15:34 2018 (r332409) @@ -66,14 +66,14 @@ static int bnxt_isc_rxd_pkt_get(void *sc, if_rxd_info_ static int bnxt_intr(void *sc); struct if_txrx bnxt_txrx = { - bnxt_isc_txd_encap, - bnxt_isc_txd_flush, - bnxt_isc_txd_credits_update, - bnxt_isc_rxd_available, - bnxt_isc_rxd_pkt_get, - bnxt_isc_rxd_refill, - bnxt_isc_rxd_flush, - bnxt_intr + .ift_txd_encap = bnxt_isc_txd_encap, + .ift_txd_flush = bnxt_isc_txd_flush, + .ift_txd_credits_update = bnxt_isc_txd_credits_update, + .ift_rxd_available = bnxt_isc_rxd_available, + .ift_rxd_pkt_get = bnxt_isc_rxd_pkt_get, + .ift_rxd_refill = bnxt_isc_rxd_refill, + .ift_rxd_flush = bnxt_isc_rxd_flush, + .ift_legacy_intr = bnxt_intr }; /* Modified: head/sys/dev/e1000/em_txrx.c ============================================================================== --- head/sys/dev/e1000/em_txrx.c Wed Apr 11 15:04:31 2018 (r332408) +++ head/sys/dev/e1000/em_txrx.c Wed Apr 11 15:15:34 2018 (r332409) @@ -68,25 +68,25 @@ static int em_determine_rsstype(u32 pkt_info); extern int em_intr(void *arg); struct if_txrx em_txrx = { - em_isc_txd_encap, - em_isc_txd_flush, - em_isc_txd_credits_update, - em_isc_rxd_available, - em_isc_rxd_pkt_get, - em_isc_rxd_refill, - em_isc_rxd_flush, - em_intr + .ift_txd_encap = em_isc_txd_encap, + .ift_txd_flush = em_isc_txd_flush, + .ift_txd_credits_update = em_isc_txd_credits_update, + .ift_rxd_available = em_isc_rxd_available, + .ift_rxd_pkt_get = em_isc_rxd_pkt_get, + .ift_rxd_refill = em_isc_rxd_refill, + .ift_rxd_flush = em_isc_rxd_flush, + .ift_legacy_intr = em_intr }; struct if_txrx lem_txrx = { - em_isc_txd_encap, - em_isc_txd_flush, - em_isc_txd_credits_update, - lem_isc_rxd_available, - lem_isc_rxd_pkt_get, - lem_isc_rxd_refill, - em_isc_rxd_flush, - em_intr + .ift_txd_encap = em_isc_txd_encap, + .ift_txd_flush = em_isc_txd_flush, + .ift_txd_credits_update = em_isc_txd_credits_update, + .ift_rxd_available = lem_isc_rxd_available, + .ift_rxd_pkt_get = lem_isc_rxd_pkt_get, + .ift_rxd_refill = lem_isc_rxd_refill, + .ift_rxd_flush = em_isc_rxd_flush, + .ift_legacy_intr = em_intr }; extern if_shared_ctx_t em_sctx; Modified: head/sys/dev/e1000/igb_txrx.c ============================================================================== --- head/sys/dev/e1000/igb_txrx.c Wed Apr 11 15:04:31 2018 (r332408) +++ head/sys/dev/e1000/igb_txrx.c Wed Apr 11 15:15:34 2018 (r332409) @@ -62,14 +62,14 @@ extern void igb_if_enable_intr(if_ctx_t ctx); extern int em_intr(void *arg); struct if_txrx igb_txrx = { - igb_isc_txd_encap, - igb_isc_txd_flush, - igb_isc_txd_credits_update, - igb_isc_rxd_available, - igb_isc_rxd_pkt_get, - igb_isc_rxd_refill, - igb_isc_rxd_flush, - em_intr + .ift_txd_encap = igb_isc_txd_encap, + .ift_txd_flush = igb_isc_txd_flush, + .ift_txd_credits_update = igb_isc_txd_credits_update, + .ift_rxd_available = igb_isc_rxd_available, + .ift_rxd_pkt_get = igb_isc_rxd_pkt_get, + .ift_rxd_refill = igb_isc_rxd_refill, + .ift_rxd_flush = igb_isc_rxd_flush, + .ift_legacy_intr = em_intr }; extern if_shared_ctx_t em_sctx; Modified: head/sys/dev/ixgbe/ix_txrx.c ============================================================================== --- head/sys/dev/ixgbe/ix_txrx.c Wed Apr 11 15:04:31 2018 (r332408) +++ head/sys/dev/ixgbe/ix_txrx.c Wed Apr 11 15:15:34 2018 (r332409) @@ -62,14 +62,14 @@ extern void ixgbe_if_enable_intr(if_ctx_t ctx); static int ixgbe_determine_rsstype(u16 pkt_info); struct if_txrx ixgbe_txrx = { - ixgbe_isc_txd_encap, - ixgbe_isc_txd_flush, - ixgbe_isc_txd_credits_update, - ixgbe_isc_rxd_available, - ixgbe_isc_rxd_pkt_get, - ixgbe_isc_rxd_refill, - ixgbe_isc_rxd_flush, - NULL + .ift_txd_encap = ixgbe_isc_txd_encap, + .ift_txd_flush = ixgbe_isc_txd_flush, + .ift_txd_credits_update = ixgbe_isc_txd_credits_update, + .ift_rxd_available = ixgbe_isc_rxd_available, + .ift_rxd_pkt_get = ixgbe_isc_rxd_pkt_get, + .ift_rxd_refill = ixgbe_isc_rxd_refill, + .ift_rxd_flush = ixgbe_isc_rxd_flush, + .ift_legacy_intr = NULL }; extern if_shared_ctx_t ixgbe_sctx; From owner-svn-src-head@freebsd.org Wed Apr 11 17:19:12 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B478EF80993; Wed, 11 Apr 2018 17:19:11 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: from mail-wm0-f49.google.com (mail-wm0-f49.google.com [74.125.82.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1EFF36A8FF; Wed, 11 Apr 2018 17:19:10 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: by mail-wm0-f49.google.com with SMTP id i3so5098956wmf.3; Wed, 11 Apr 2018 10:19:10 -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:in-reply-to:references:from:date :message-id:subject:to:cc; bh=08vCITbl7YQtwje6mYNfBwFTZqyOKHbjRfe8cfAnNO4=; b=AAH6YD5pOrPIJ2fc+Q0+ZjlL7JDS2/n0ltyCyKIaCm2bPWJQYFVWqpGTqSp9zxhoBg 89HOgrgA+lIwDztUq6w4DkISb8uyZ6R+EevVeMXP2P1ippsy+Wlk0flxyprvhlMQ1F6T zICDoEYUUfTfP59bp72jE96oFeMHvnjNXdBkng+YWJTb9Tu6hzeb5QivaVyDqneoOfw0 EyiAL3Ex6+zgnOt9K9eDT2m8hAezQxrj5qccsCYEYdYmW/t6SDkOO19qKc7GVs7C49Dy fRkjMdL4RnzI5s5+pu5h1HOJezNMdsuWrSmf8Xm4VX1WxJVf/hiS24J0su2unweaPfbX su0A== X-Gm-Message-State: ALQs6tAC/85xXP/WIBxqfPV12QfD+e7Tg5f4jstk/emwTenEs4UUYctU mCBZ59xXyveRw//71rSib+KqS9wm X-Google-Smtp-Source: AIpwx48QlTFskSdC6diraXqjPfESsG7Z25641R1m4ViLqKGwH73HLTWuCFFosvpoadpLSeCF/bgEYw== X-Received: by 10.80.235.72 with SMTP id z8mr11141077edp.170.1523466776548; Wed, 11 Apr 2018 10:12:56 -0700 (PDT) Received: from mail-wm0-f51.google.com (mail-wm0-f51.google.com. [74.125.82.51]) by smtp.gmail.com with ESMTPSA id y4sm1033779edi.4.2018.04.11.10.12.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Apr 2018 10:12:56 -0700 (PDT) Received: by mail-wm0-f51.google.com with SMTP id x4so5044617wmh.5; Wed, 11 Apr 2018 10:12:56 -0700 (PDT) X-Received: by 10.28.118.3 with SMTP id r3mr3256482wmc.90.1523466776178; Wed, 11 Apr 2018 10:12:56 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.199.203 with HTTP; Wed, 11 Apr 2018 10:12:55 -0700 (PDT) In-Reply-To: <201804101948.w3AJmOt2066564@repo.freebsd.org> References: <201804101948.w3AJmOt2066564@repo.freebsd.org> From: "Jonathan T. Looney" Date: Wed, 11 Apr 2018 13:12:55 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r332389 - head/sys/net To: Stephen Hurd Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 17:19:12 -0000 It appears this is causing panics (see the emails on freebsd-current@). >From a brief glance, it appears that the new STATE_LOCK macros is used (and causes panics), but the STATE_LOCK_INIT macro is not used. Is it possible the code is missing an initialization call for the new mutex? Jonathan On Tue, Apr 10, 2018 at 3:48 PM, Stephen Hurd wrote: > Author: shurd > Date: Tue Apr 10 19:48:24 2018 > New Revision: 332389 > URL: https://svnweb.freebsd.org/changeset/base/332389 > > Log: > Split out flag manipulation from general context manipulation in iflib > > To avoid blocking on the context lock in the swi thread and risk > potential > deadlocks, this change protects lighter weight updates that only need to > be consistent with each other with their own lock. > > Submitted by: Matthew Macy > Reviewed by: shurd > Sponsored by: Limelight Networks > Differential Revision: https://reviews.freebsd.org/D14967 > > Modified: > head/sys/net/iflib.c > > Modified: head/sys/net/iflib.c > ============================================================ > ================== > --- head/sys/net/iflib.c Tue Apr 10 19:42:50 2018 (r332388) > +++ head/sys/net/iflib.c Tue Apr 10 19:48:24 2018 (r332389) > @@ -1,5 +1,5 @@ > /*- > - * Copyright (c) 2014-2017, Matthew Macy > + * Copyright (c) 2014-2018, Matthew Macy > * All rights reserved. > * > * Redistribution and use in source and binary forms, with or without > @@ -163,7 +163,8 @@ struct iflib_ctx { > if_shared_ctx_t ifc_sctx; > struct if_softc_ctx ifc_softc_ctx; > > - struct mtx ifc_mtx; > + struct mtx ifc_ctx_mtx; > + struct mtx ifc_state_mtx; > > uint16_t ifc_nhwtxqs; > uint16_t ifc_nhwrxqs; > @@ -318,8 +319,10 @@ typedef struct iflib_sw_tx_desc_array { > #define IFC_INIT_DONE 0x020 > #define IFC_PREFETCH 0x040 > #define IFC_DO_RESET 0x080 > -#define IFC_CHECK_HUNG 0x100 > +#define IFC_DO_WATCHDOG 0x100 > +#define IFC_CHECK_HUNG 0x200 > > + > #define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ > CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ > CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) > @@ -535,13 +538,19 @@ rxd_info_zero(if_rxd_info_t ri) > > #define CTX_ACTIVE(ctx) ((if_getdrvflags((ctx)->ifc_ifp) & > IFF_DRV_RUNNING)) > > -#define CTX_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_mtx, _name, > "iflib ctx lock", MTX_DEF) > +#define CTX_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_ctx_mtx, _name, > "iflib ctx lock", MTX_DEF) > +#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_ctx_mtx) > +#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_ctx_mtx) > +#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_ctx_mtx) > > -#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_mtx) > -#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_mtx) > -#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_mtx) > > +#define STATE_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_state_mtx, > _name, "iflib state lock", MTX_DEF) > +#define STATE_LOCK(ctx) mtx_lock(&(ctx)->ifc_state_mtx) > +#define STATE_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_state_mtx) > +#define STATE_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_state_mtx) > > + > + > #define CALLOUT_LOCK(txq) mtx_lock(&txq->ift_mtx) > #define CALLOUT_UNLOCK(txq) mtx_unlock(&txq->ift_mtx) > > @@ -2144,18 +2153,14 @@ iflib_timer(void *arg) > if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) > callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, > txq->ift_timer.c_cpu); > return; > -hung: > - CTX_LOCK(ctx); > - if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); > + hung: > device_printf(ctx->ifc_dev, "TX(%d) desc avail = %d, pidx = %d\n", > txq->ift_id, TXQ_AVAIL(txq), > txq->ift_pidx); > - > - IFDI_WATCHDOG_RESET(ctx); > - ctx->ifc_watchdog_events++; > - > - ctx->ifc_flags |= IFC_DO_RESET; > + STATE_LOCK(ctx); > + if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); > + ctx->ifc_flags |= (IFC_DO_WATCHDOG|IFC_DO_RESET); > iflib_admin_intr_deferred(ctx); > - CTX_UNLOCK(ctx); > + STATE_UNLOCK(ctx); > } > > static void > @@ -2673,10 +2678,10 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) > return true; > return (iflib_rxd_avail(ctx, rxq, *cidxp, 1)); > err: > - CTX_LOCK(ctx); > + STATE_LOCK(ctx); > ctx->ifc_flags |= IFC_DO_RESET; > iflib_admin_intr_deferred(ctx); > - CTX_UNLOCK(ctx); > + STATE_UNLOCK(ctx); > return (false); > } > > @@ -3706,27 +3711,35 @@ _task_fn_admin(void *context) > if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; > iflib_txq_t txq; > int i; > + bool oactive, running, do_reset, do_watchdog; > > - if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)) { > - if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE)) { > - return; > - } > - } > + STATE_LOCK(ctx); > + running = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING); > + oactive = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE); > + do_reset = (ctx->ifc_flags & IFC_DO_RESET); > + do_watchdog = (ctx->ifc_flags & IFC_DO_WATCHDOG); > + ctx->ifc_flags &= ~(IFC_DO_RESET|IFC_DO_WATCHDOG); > + STATE_UNLOCK(ctx); > > + if (!running & !oactive) > + return; > + > CTX_LOCK(ctx); > for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, > txq++) { > CALLOUT_LOCK(txq); > callout_stop(&txq->ift_timer); > CALLOUT_UNLOCK(txq); > } > + if (do_watchdog) { > + ctx->ifc_watchdog_events++; > + IFDI_WATCHDOG_RESET(ctx); > + } > IFDI_UPDATE_ADMIN_STATUS(ctx); > for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, > txq++) > callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, > txq->ift_timer.c_cpu); > IFDI_LINK_INTR_ENABLE(ctx); > - if (ctx->ifc_flags & IFC_DO_RESET) { > - ctx->ifc_flags &= ~IFC_DO_RESET; > + if (do_reset) > iflib_if_init_locked(ctx); > - } > CTX_UNLOCK(ctx); > > if (LINK_ACTIVE(ctx) == 0) > @@ -3870,15 +3883,15 @@ iflib_if_qflush(if_t ifp) > iflib_txq_t txq = ctx->ifc_txqs; > int i; > > - CTX_LOCK(ctx); > + STATE_LOCK(ctx); > ctx->ifc_flags |= IFC_QFLUSH; > - CTX_UNLOCK(ctx); > + STATE_UNLOCK(ctx); > for (i = 0; i < NTXQSETS(ctx); i++, txq++) > while (!(ifmp_ring_is_idle(txq->ift_br) || > ifmp_ring_is_stalled(txq->ift_br))) > iflib_txq_check_drain(txq, 0); > - CTX_LOCK(ctx); > + STATE_LOCK(ctx); > ctx->ifc_flags &= ~IFC_QFLUSH; > - CTX_UNLOCK(ctx); > + STATE_UNLOCK(ctx); > > if_qflush(ifp); > } > @@ -3935,14 +3948,18 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t > data) > iflib_stop(ctx); > > if ((err = IFDI_MTU_SET(ctx, ifr->ifr_mtu)) == 0) { > + STATE_LOCK(ctx); > if (ifr->ifr_mtu > ctx->ifc_max_fl_buf_size) > ctx->ifc_flags |= IFC_MULTISEG; > else > ctx->ifc_flags &= ~IFC_MULTISEG; > + STATE_UNLOCK(ctx); > err = if_setmtu(ifp, ifr->ifr_mtu); > } > iflib_init_locked(ctx); > + STATE_LOCK(ctx); > if_setdrvflags(ifp, bits); > + STATE_UNLOCK(ctx); > CTX_UNLOCK(ctx); > break; > case SIOCSIFFLAGS: > @@ -4026,10 +4043,14 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t > data) > bits = if_getdrvflags(ifp); > if (bits & IFF_DRV_RUNNING) > iflib_stop(ctx); > + STATE_LOCK(ctx); > if_togglecapenable(ifp, setmask); > + STATE_UNLOCK(ctx); > if (bits & IFF_DRV_RUNNING) > iflib_init_locked(ctx); > + STATE_LOCK(ctx); > if_setdrvflags(ifp, bits); > + STATE_UNLOCK(ctx); > CTX_UNLOCK(ctx); > } > break; > @@ -5431,9 +5452,11 @@ iflib_link_state_change(if_ctx_t ctx, int > link_state, > iflib_txq_t txq = ctx->ifc_txqs; > > if_setbaudrate(ifp, baudrate); > - if (baudrate >= IF_Gbps(10)) > + if (baudrate >= IF_Gbps(10)) { > + STATE_LOCK(ctx); > ctx->ifc_flags |= IFC_PREFETCH; > - > + STATE_UNLOCK(ctx); > + } > /* If link down, disable watchdog */ > if ((ctx->ifc_link_state == LINK_STATE_UP) && (link_state == > LINK_STATE_DOWN)) { > for (int i = 0; i < ctx->ifc_softc_ctx.isc_ntxqsets; i++, > txq++) > @@ -5492,7 +5515,7 @@ struct mtx * > iflib_ctx_lock_get(if_ctx_t ctx) > { > > - return (&ctx->ifc_mtx); > + return (&ctx->ifc_ctx_mtx); > } > > static int > > From owner-svn-src-head@freebsd.org Wed Apr 11 17:26:54 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8B80DF81519; Wed, 11 Apr 2018 17:26:54 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3997C6BE4E; Wed, 11 Apr 2018 17:26:54 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2FEF71F2AB; Wed, 11 Apr 2018 17:26:54 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3BHQsB3015895; Wed, 11 Apr 2018 17:26:54 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3BHQs1S015894; Wed, 11 Apr 2018 17:26:54 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201804111726.w3BHQs1S015894@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Wed, 11 Apr 2018 17:26:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332411 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 332411 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 17:26:54 -0000 Author: sbruno Date: Wed Apr 11 17:26:53 2018 New Revision: 332411 URL: https://svnweb.freebsd.org/changeset/base/332411 Log: Revert r332389 as it is causing panics for various users and we need to add some more test cases. Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Wed Apr 11 17:18:54 2018 (r332410) +++ head/sys/net/iflib.c Wed Apr 11 17:26:53 2018 (r332411) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2018, Matthew Macy + * Copyright (c) 2014-2017, Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -163,8 +163,7 @@ struct iflib_ctx { if_shared_ctx_t ifc_sctx; struct if_softc_ctx ifc_softc_ctx; - struct mtx ifc_ctx_mtx; - struct mtx ifc_state_mtx; + struct mtx ifc_mtx; uint16_t ifc_nhwtxqs; uint16_t ifc_nhwrxqs; @@ -319,10 +318,8 @@ typedef struct iflib_sw_tx_desc_array { #define IFC_INIT_DONE 0x020 #define IFC_PREFETCH 0x040 #define IFC_DO_RESET 0x080 -#define IFC_DO_WATCHDOG 0x100 -#define IFC_CHECK_HUNG 0x200 +#define IFC_CHECK_HUNG 0x100 - #define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) @@ -538,19 +535,13 @@ rxd_info_zero(if_rxd_info_t ri) #define CTX_ACTIVE(ctx) ((if_getdrvflags((ctx)->ifc_ifp) & IFF_DRV_RUNNING)) -#define CTX_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_ctx_mtx, _name, "iflib ctx lock", MTX_DEF) -#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_ctx_mtx) -#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_ctx_mtx) -#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_ctx_mtx) +#define CTX_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_mtx, _name, "iflib ctx lock", MTX_DEF) +#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_mtx) +#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_mtx) +#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_mtx) -#define STATE_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_state_mtx, _name, "iflib state lock", MTX_DEF) -#define STATE_LOCK(ctx) mtx_lock(&(ctx)->ifc_state_mtx) -#define STATE_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_state_mtx) -#define STATE_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_state_mtx) - - #define CALLOUT_LOCK(txq) mtx_lock(&txq->ift_mtx) #define CALLOUT_UNLOCK(txq) mtx_unlock(&txq->ift_mtx) @@ -2153,14 +2144,18 @@ iflib_timer(void *arg) if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, txq->ift_timer.c_cpu); return; - hung: +hung: + CTX_LOCK(ctx); + if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); device_printf(ctx->ifc_dev, "TX(%d) desc avail = %d, pidx = %d\n", txq->ift_id, TXQ_AVAIL(txq), txq->ift_pidx); - STATE_LOCK(ctx); - if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); - ctx->ifc_flags |= (IFC_DO_WATCHDOG|IFC_DO_RESET); + + IFDI_WATCHDOG_RESET(ctx); + ctx->ifc_watchdog_events++; + + ctx->ifc_flags |= IFC_DO_RESET; iflib_admin_intr_deferred(ctx); - STATE_UNLOCK(ctx); + CTX_UNLOCK(ctx); } static void @@ -2678,10 +2673,10 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) return true; return (iflib_rxd_avail(ctx, rxq, *cidxp, 1)); err: - STATE_LOCK(ctx); + CTX_LOCK(ctx); ctx->ifc_flags |= IFC_DO_RESET; iflib_admin_intr_deferred(ctx); - STATE_UNLOCK(ctx); + CTX_UNLOCK(ctx); return (false); } @@ -3711,35 +3706,27 @@ _task_fn_admin(void *context) if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; iflib_txq_t txq; int i; - bool oactive, running, do_reset, do_watchdog; - STATE_LOCK(ctx); - running = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING); - oactive = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE); - do_reset = (ctx->ifc_flags & IFC_DO_RESET); - do_watchdog = (ctx->ifc_flags & IFC_DO_WATCHDOG); - ctx->ifc_flags &= ~(IFC_DO_RESET|IFC_DO_WATCHDOG); - STATE_UNLOCK(ctx); + if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)) { + if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE)) { + return; + } + } - if (!running & !oactive) - return; - CTX_LOCK(ctx); for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) { CALLOUT_LOCK(txq); callout_stop(&txq->ift_timer); CALLOUT_UNLOCK(txq); } - if (do_watchdog) { - ctx->ifc_watchdog_events++; - IFDI_WATCHDOG_RESET(ctx); - } IFDI_UPDATE_ADMIN_STATUS(ctx); for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, txq->ift_timer.c_cpu); IFDI_LINK_INTR_ENABLE(ctx); - if (do_reset) + if (ctx->ifc_flags & IFC_DO_RESET) { + ctx->ifc_flags &= ~IFC_DO_RESET; iflib_if_init_locked(ctx); + } CTX_UNLOCK(ctx); if (LINK_ACTIVE(ctx) == 0) @@ -3883,15 +3870,15 @@ iflib_if_qflush(if_t ifp) iflib_txq_t txq = ctx->ifc_txqs; int i; - STATE_LOCK(ctx); + CTX_LOCK(ctx); ctx->ifc_flags |= IFC_QFLUSH; - STATE_UNLOCK(ctx); + CTX_UNLOCK(ctx); for (i = 0; i < NTXQSETS(ctx); i++, txq++) while (!(ifmp_ring_is_idle(txq->ift_br) || ifmp_ring_is_stalled(txq->ift_br))) iflib_txq_check_drain(txq, 0); - STATE_LOCK(ctx); + CTX_LOCK(ctx); ctx->ifc_flags &= ~IFC_QFLUSH; - STATE_UNLOCK(ctx); + CTX_UNLOCK(ctx); if_qflush(ifp); } @@ -3948,18 +3935,14 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) iflib_stop(ctx); if ((err = IFDI_MTU_SET(ctx, ifr->ifr_mtu)) == 0) { - STATE_LOCK(ctx); if (ifr->ifr_mtu > ctx->ifc_max_fl_buf_size) ctx->ifc_flags |= IFC_MULTISEG; else ctx->ifc_flags &= ~IFC_MULTISEG; - STATE_UNLOCK(ctx); err = if_setmtu(ifp, ifr->ifr_mtu); } iflib_init_locked(ctx); - STATE_LOCK(ctx); if_setdrvflags(ifp, bits); - STATE_UNLOCK(ctx); CTX_UNLOCK(ctx); break; case SIOCSIFFLAGS: @@ -4043,14 +4026,10 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) bits = if_getdrvflags(ifp); if (bits & IFF_DRV_RUNNING) iflib_stop(ctx); - STATE_LOCK(ctx); if_togglecapenable(ifp, setmask); - STATE_UNLOCK(ctx); if (bits & IFF_DRV_RUNNING) iflib_init_locked(ctx); - STATE_LOCK(ctx); if_setdrvflags(ifp, bits); - STATE_UNLOCK(ctx); CTX_UNLOCK(ctx); } break; @@ -5452,11 +5431,9 @@ iflib_link_state_change(if_ctx_t ctx, int link_state, iflib_txq_t txq = ctx->ifc_txqs; if_setbaudrate(ifp, baudrate); - if (baudrate >= IF_Gbps(10)) { - STATE_LOCK(ctx); + if (baudrate >= IF_Gbps(10)) ctx->ifc_flags |= IFC_PREFETCH; - STATE_UNLOCK(ctx); - } + /* If link down, disable watchdog */ if ((ctx->ifc_link_state == LINK_STATE_UP) && (link_state == LINK_STATE_DOWN)) { for (int i = 0; i < ctx->ifc_softc_ctx.isc_ntxqsets; i++, txq++) @@ -5515,7 +5492,7 @@ struct mtx * iflib_ctx_lock_get(if_ctx_t ctx) { - return (&ctx->ifc_ctx_mtx); + return (&ctx->ifc_mtx); } static int From owner-svn-src-head@freebsd.org Wed Apr 11 17:28:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1CC26F81733; Wed, 11 Apr 2018 17:28:27 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C48456C093; Wed, 11 Apr 2018 17:28:26 +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 BEFCB1F2AE; Wed, 11 Apr 2018 17:28:26 +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 w3BHSQU2016014; Wed, 11 Apr 2018 17:28:26 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3BHSOvP015995; Wed, 11 Apr 2018 17:28:24 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201804111728.w3BHSOvP015995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 11 Apr 2018 17:28:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332412 - in head: . lib/libifconfig sbin/etherswitchcfg sbin/ifconfig share/man/man4 sys/conf sys/dev/pdq sys/net sys/netinet sys/netinet6 sys/nfs X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: . lib/libifconfig sbin/etherswitchcfg sbin/ifconfig share/man/man4 sys/conf sys/dev/pdq sys/net sys/netinet sys/netinet6 sys/nfs X-SVN-Commit-Revision: 332412 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 17:28:27 -0000 Author: brooks Date: Wed Apr 11 17:28:24 2018 New Revision: 332412 URL: https://svnweb.freebsd.org/changeset/base/332412 Log: Remove support for FDDI networks. Defines in net/if_media.h remain in case code copied from ifconfig is in use elsewere (supporting non-existant media type is harmless). Reviewed by: kib, jhb Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15017 Deleted: head/share/man/man4/fpa.4 head/sys/dev/pdq/if_fpa.c head/sys/dev/pdq/pdq.c head/sys/dev/pdq/pdq_freebsd.h head/sys/dev/pdq/pdq_ifsubr.c head/sys/dev/pdq/pdqreg.h head/sys/dev/pdq/pdqvar.h head/sys/net/fddi.h head/sys/net/if_fddisubr.c Modified: head/ObsoleteFiles.inc head/UPDATING head/lib/libifconfig/libifconfig_media.c head/sbin/etherswitchcfg/ifmedia.c head/sbin/ifconfig/ifmedia.c head/share/man/man4/Makefile head/sys/conf/NOTES head/sys/conf/files head/sys/net/if.c head/sys/net/if_bridge.c head/sys/net/if_media.c head/sys/netinet/if_ether.c head/sys/netinet/ip_carp.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c head/sys/nfs/bootp_subr.c Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Wed Apr 11 17:26:53 2018 (r332411) +++ head/ObsoleteFiles.inc Wed Apr 11 17:28:24 2018 (r332412) @@ -38,6 +38,8 @@ # xargs -n1 | sort | uniq -d; # done +# 20180409: remove FDDI support +OLD_FILES+=usr/include/net/fddi.h # 20180319: remove /boot/overlays, replaced by /boot/dtb/overlays OLD_DIRS+=boot/overlays # 20180311: remove sys/sys/i386/include/pcaudioio.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Wed Apr 11 17:26:53 2018 (r332411) +++ head/UPDATING Wed Apr 11 17:28:24 2018 (r332412) @@ -51,6 +51,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20180411: + Support for FDDI networks has been removed. If you have device + fddi or device fpa in your kernel config file they must be + removed. + 20180406: In addition to supporting RFC 3164 formatted messages, the syslogd(8) service is now capable of parsing RFC 5424 formatted Modified: head/lib/libifconfig/libifconfig_media.c ============================================================================== --- head/lib/libifconfig/libifconfig_media.c Wed Apr 11 17:26:53 2018 (r332411) +++ head/lib/libifconfig/libifconfig_media.c Wed Apr 11 17:28:24 2018 (r332412) @@ -86,15 +86,6 @@ static struct ifmedia_description ifm_subtype_tokenrin static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] = IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_fddi_descriptions[] = - IFM_SUBTYPE_FDDI_DESCRIPTIONS; - -static struct ifmedia_description ifm_subtype_fddi_aliases[] = - IFM_SUBTYPE_FDDI_ALIASES; - -static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] = - IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS; - static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = IFM_SUBTYPE_IEEE80211_DESCRIPTIONS; @@ -182,24 +173,6 @@ static struct ifmedia_type_to_subtype ifmedia_types_to { &ifm_shared_option_descriptions[0], 0 }, { &ifm_shared_option_aliases[0], 1 }, { &ifm_subtype_tokenring_option_descriptions[0], 0 }, - { NULL, 0 }, - }, - { - { NULL, 0 }, - }, - }, - { - { - { &ifm_subtype_shared_descriptions[0], 0 }, - { &ifm_subtype_shared_aliases[0], 1 }, - { &ifm_subtype_fddi_descriptions[0], 0 }, - { &ifm_subtype_fddi_aliases[0], 1 }, - { NULL, 0 }, - }, - { - { &ifm_shared_option_descriptions[0], 0 }, - { &ifm_shared_option_aliases[0], 1 }, - { &ifm_subtype_fddi_option_descriptions[0], 0 }, { NULL, 0 }, }, { Modified: head/sbin/etherswitchcfg/ifmedia.c ============================================================================== --- head/sbin/etherswitchcfg/ifmedia.c Wed Apr 11 17:26:53 2018 (r332411) +++ head/sbin/etherswitchcfg/ifmedia.c Wed Apr 11 17:28:24 2018 (r332412) @@ -380,15 +380,6 @@ static struct ifmedia_description ifm_subtype_tokenrin static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] = IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_fddi_descriptions[] = - IFM_SUBTYPE_FDDI_DESCRIPTIONS; - -static struct ifmedia_description ifm_subtype_fddi_aliases[] = - IFM_SUBTYPE_FDDI_ALIASES; - -static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] = - IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS; - static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = IFM_SUBTYPE_IEEE80211_DESCRIPTIONS; @@ -472,24 +463,6 @@ static struct ifmedia_type_to_subtype ifmedia_types_to { &ifm_shared_option_descriptions[0], 0 }, { &ifm_shared_option_aliases[0], 1 }, { &ifm_subtype_tokenring_option_descriptions[0], 0 }, - { NULL, 0 }, - }, - { - { NULL, 0 }, - }, - }, - { - { - { &ifm_subtype_shared_descriptions[0], 0 }, - { &ifm_subtype_shared_aliases[0], 1 }, - { &ifm_subtype_fddi_descriptions[0], 0 }, - { &ifm_subtype_fddi_aliases[0], 1 }, - { NULL, 0 }, - }, - { - { &ifm_shared_option_descriptions[0], 0 }, - { &ifm_shared_option_aliases[0], 1 }, - { &ifm_subtype_fddi_option_descriptions[0], 0 }, { NULL, 0 }, }, { Modified: head/sbin/ifconfig/ifmedia.c ============================================================================== --- head/sbin/ifconfig/ifmedia.c Wed Apr 11 17:26:53 2018 (r332411) +++ head/sbin/ifconfig/ifmedia.c Wed Apr 11 17:28:24 2018 (r332412) @@ -397,15 +397,6 @@ static struct ifmedia_description ifm_subtype_tokenrin static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] = IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS; -static struct ifmedia_description ifm_subtype_fddi_descriptions[] = - IFM_SUBTYPE_FDDI_DESCRIPTIONS; - -static struct ifmedia_description ifm_subtype_fddi_aliases[] = - IFM_SUBTYPE_FDDI_ALIASES; - -static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] = - IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS; - static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = IFM_SUBTYPE_IEEE80211_DESCRIPTIONS; @@ -489,24 +480,6 @@ static struct ifmedia_type_to_subtype ifmedia_types_to { &ifm_shared_option_descriptions[0], 0 }, { &ifm_shared_option_aliases[0], 1 }, { &ifm_subtype_tokenring_option_descriptions[0], 0 }, - { NULL, 0 }, - }, - { - { NULL, 0 }, - }, - }, - { - { - { &ifm_subtype_shared_descriptions[0], 0 }, - { &ifm_subtype_shared_aliases[0], 1 }, - { &ifm_subtype_fddi_descriptions[0], 0 }, - { &ifm_subtype_fddi_aliases[0], 1 }, - { NULL, 0 }, - }, - { - { &ifm_shared_option_descriptions[0], 0 }, - { &ifm_shared_option_aliases[0], 1 }, - { &ifm_subtype_fddi_option_descriptions[0], 0 }, { NULL, 0 }, }, { Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Wed Apr 11 17:26:53 2018 (r332411) +++ head/share/man/man4/Makefile Wed Apr 11 17:28:24 2018 (r332412) @@ -170,7 +170,6 @@ MAN= aac.4 \ ffclock.4 \ filemon.4 \ firewire.4 \ - fpa.4 \ full.4 \ fwe.4 \ fwip.4 \ Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Wed Apr 11 17:26:53 2018 (r332411) +++ head/sys/conf/NOTES Wed Apr 11 17:28:24 2018 (r332412) @@ -845,9 +845,6 @@ device wlan_xauth device wlan_acl device wlan_amrr -# The `fddi' device provides generic code to support FDDI. -device fddi - # The `arcnet' device provides generic code to support Arcnet. device arcnet @@ -1972,7 +1969,6 @@ device xmphy # XaQti XMAC II # ex: Intel EtherExpress Pro/10 and other i82595-based adapters, # Olicom Ethernet PC Card devices. # fe: Fujitsu MB86960A/MB86965A Ethernet -# fpa: Support for the Digital DEFPA PCI FDDI. `device fddi' is also needed. # fxp: Intel EtherExpress Pro/100B # (hint of prefer_iomap can be done to prefer I/O instead of Mem mapping) # gem: Apple GMAC/Sun ERI/Sun GEM @@ -2149,9 +2145,6 @@ device ti # Alteon Networks Tigon I/II gigabit Ether device txp # 3Com 3cR990 (``Typhoon'') device vx # 3Com 3c590, 3c595 (``Vortex'') device vxge # Exar/Neterion XFrame 3100 10GbE - -# PCI FDDI NICs. -device fpa # PCI WAN adapters. device lmc Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Wed Apr 11 17:26:53 2018 (r332411) +++ head/sys/conf/files Wed Apr 11 17:28:24 2018 (r332412) @@ -2642,9 +2642,6 @@ dev/pci/pcib_if.m standard dev/pci/pcib_support.c standard dev/pci/vga_pci.c optional pci dev/pcn/if_pcn.c optional pcn pci -dev/pdq/if_fpa.c optional fpa pci -dev/pdq/pdq.c optional nowerror fpa pci -dev/pdq/pdq_ifsubr.c optional nowerror fpa pci dev/pms/freebsd/driver/ini/src/agtiapi.c optional pmspcv \ compile-with "${NORMAL_C} -Wunused-variable -Woverflow -Wparentheses -w" dev/pms/RefTisa/sallsdk/spc/sadisc.c optional pmspcv \ @@ -4130,7 +4127,6 @@ net/if_edsc.c optional edsc net/if_enc.c optional enc inet | enc inet6 net/if_epair.c optional epair net/if_ethersubr.c optional ether -net/if_fddisubr.c optional fddi net/if_fwsubr.c optional fwip net/if_gif.c optional gif inet | gif inet6 | \ netgraph_gif inet | netgraph_gif inet6 Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Wed Apr 11 17:26:53 2018 (r332411) +++ head/sys/net/if.c Wed Apr 11 17:28:24 2018 (r332412) @@ -3692,7 +3692,6 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, } switch (ifp->if_type) { case IFT_ETHER: - case IFT_FDDI: case IFT_XETHER: case IFT_L2VLAN: case IFT_BRIDGE: Modified: head/sys/net/if_bridge.c ============================================================================== --- head/sys/net/if_bridge.c Wed Apr 11 17:26:53 2018 (r332411) +++ head/sys/net/if_bridge.c Wed Apr 11 17:28:24 2018 (r332412) @@ -72,8 +72,8 @@ * * - Currently only supports Ethernet-like interfaces (Ethernet, * 802.11, VLANs on Ethernet, etc.) Figure out a nice way - * to bridge other types of interfaces (FDDI-FDDI, and maybe - * consider heterogeneous bridges). + * to bridge other types of interfaces (maybe consider + * heterogeneous bridges). */ #include Modified: head/sys/net/if_media.c ============================================================================== --- head/sys/net/if_media.c Wed Apr 11 17:26:53 2018 (r332411) +++ head/sys/net/if_media.c Wed Apr 11 17:28:24 2018 (r332412) @@ -405,12 +405,6 @@ struct ifmedia_description ifm_subtype_tokenring_descr struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] = IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS; -struct ifmedia_description ifm_subtype_fddi_descriptions[] = - IFM_SUBTYPE_FDDI_DESCRIPTIONS; - -struct ifmedia_description ifm_subtype_fddi_option_descriptions[] = - IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS; - struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = IFM_SUBTYPE_IEEE80211_DESCRIPTIONS; @@ -448,11 +442,6 @@ struct ifmedia_type_to_subtype ifmedia_types_to_subtyp { &ifm_subtype_tokenring_descriptions[0], &ifm_subtype_tokenring_option_descriptions[0], - NULL, - }, - { - &ifm_subtype_fddi_descriptions[0], - &ifm_subtype_fddi_option_descriptions[0], NULL, }, { Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Wed Apr 11 17:26:53 2018 (r332411) +++ head/sys/netinet/if_ether.c Wed Apr 11 17:28:24 2018 (r332412) @@ -694,10 +694,6 @@ arpintr(struct mbuf *m) hlen = ETHER_ADDR_LEN; /* RFC 826 */ layer = "ethernet"; break; - case ARPHRD_IEEE802: - hlen = 6; /* RFC 1390, FDDI_ADDR_LEN */ - layer = "fddi"; - break; case ARPHRD_ARCNET: hlen = 1; /* RFC 1201, ARC_ADDR_LEN */ layer = "arcnet"; Modified: head/sys/netinet/ip_carp.c ============================================================================== --- head/sys/netinet/ip_carp.c Wed Apr 11 17:26:53 2018 (r332411) +++ head/sys/netinet/ip_carp.c Wed Apr 11 17:28:24 2018 (r332412) @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -1526,18 +1525,6 @@ carp_output(struct ifnet *ifp, struct mbuf *m, const s eh->ether_shost[5] = sc->sc_vhid; } break; - case IFT_FDDI: { - struct fddi_header *fh; - - fh = mtod(m, struct fddi_header *); - fh->fddi_shost[0] = 0; - fh->fddi_shost[1] = 0; - fh->fddi_shost[2] = 0x5e; - fh->fddi_shost[3] = 0; - fh->fddi_shost[4] = 1; - fh->fddi_shost[5] = sc->sc_vhid; - } - break; default: printf("%s: carp is not supported for the %d interface type\n", ifp->if_xname, ifp->if_type); @@ -1719,7 +1706,6 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct threa case IFT_ETHER: case IFT_L2VLAN: case IFT_BRIDGE: - case IFT_FDDI: break; default: error = EOPNOTSUPP; Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Wed Apr 11 17:26:53 2018 (r332411) +++ head/sys/netinet6/in6.c Wed Apr 11 17:28:24 2018 (r332412) @@ -1972,8 +1972,6 @@ in6_if2idlen(struct ifnet *ifp) case IFT_BRIDGE: /* bridge(4) only does Ethernet-like links */ case IFT_INFINIBAND: return (64); - case IFT_FDDI: /* RFC2467 */ - return (64); case IFT_PPP: /* RFC2472 */ return (64); case IFT_ARCNET: /* RFC2497 */ Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Wed Apr 11 17:26:53 2018 (r332411) +++ head/sys/netinet6/in6_ifattach.c Wed Apr 11 17:28:24 2018 (r332412) @@ -274,7 +274,6 @@ found: case IFT_BRIDGE: case IFT_ETHER: case IFT_L2VLAN: - case IFT_FDDI: case IFT_ATM: case IFT_IEEE1394: /* IEEE802/EUI64 cases - what others? */ Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Wed Apr 11 17:26:53 2018 (r332411) +++ head/sys/netinet6/nd6.c Wed Apr 11 17:28:24 2018 (r332412) @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include @@ -340,9 +339,6 @@ nd6_setmtu0(struct ifnet *ifp, struct nd_ifinfo *ndi) case IFT_ARCNET: ndi->maxmtu = MIN(ARC_PHDS_MAXMTU, ifp->if_mtu); /* RFC2497 */ break; - case IFT_FDDI: - ndi->maxmtu = MIN(FDDIIPMTU, ifp->if_mtu); /* RFC2467 */ - break; default: ndi->maxmtu = ifp->if_mtu; break; @@ -2272,7 +2268,6 @@ nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf if (m != NULL && m->m_flags & M_MCAST) { switch (ifp->if_type) { case IFT_ETHER: - case IFT_FDDI: case IFT_L2VLAN: case IFT_BRIDGE: ETHER_MAP_IPV6_MULTICAST(&dst6->sin6_addr, @@ -2524,7 +2519,7 @@ nd6_need_cache(struct ifnet *ifp) { /* * XXX: we currently do not make neighbor cache on any interface - * other than ARCnet, Ethernet, FDDI and GIF. + * other than ARCnet, Ethernet and GIF. * * RFC2893 says: * - unidirectional tunnels needs no ND @@ -2532,7 +2527,6 @@ nd6_need_cache(struct ifnet *ifp) switch (ifp->if_type) { case IFT_ARCNET: case IFT_ETHER: - case IFT_FDDI: case IFT_IEEE1394: case IFT_L2VLAN: case IFT_INFINIBAND: Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Wed Apr 11 17:26:53 2018 (r332411) +++ head/sys/netinet6/nd6_nbr.c Wed Apr 11 17:28:24 2018 (r332412) @@ -1092,7 +1092,6 @@ nd6_ifptomac(struct ifnet *ifp) switch (ifp->if_type) { case IFT_ARCNET: case IFT_ETHER: - case IFT_FDDI: case IFT_IEEE1394: case IFT_L2VLAN: case IFT_INFINIBAND: @@ -1466,7 +1465,6 @@ nd6_dad_duplicated(struct ifaddr *ifa, struct dadq *dp */ switch (ifp->if_type) { case IFT_ETHER: - case IFT_FDDI: case IFT_ATM: case IFT_IEEE1394: case IFT_INFINIBAND: Modified: head/sys/nfs/bootp_subr.c ============================================================================== --- head/sys/nfs/bootp_subr.c Wed Apr 11 17:26:53 2018 (r332411) +++ head/sys/nfs/bootp_subr.c Wed Apr 11 17:28:24 2018 (r332412) @@ -1645,7 +1645,6 @@ bootpc_init(void) continue; switch (ifp->if_alloctype) { case IFT_ETHER: - case IFT_FDDI: break; default: continue; @@ -1675,7 +1674,6 @@ retry: continue; switch (ifp->if_alloctype) { case IFT_ETHER: - case IFT_FDDI: break; default: continue; From owner-svn-src-head@freebsd.org Wed Apr 11 17:30:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 128C5F81A69; Wed, 11 Apr 2018 17:30:18 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from forward3j.cmail.yandex.net (forward3j.cmail.yandex.net [IPv6:2a02:6b8:0:1630::16]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "forwards.mail.yandex.net", Issuer "Yandex CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AC8C86C35D; Wed, 11 Apr 2018 17:30:17 +0000 (UTC) (envelope-from melifaro@ipfw.ru) Received: from mxback18j.mail.yandex.net (mxback18j.mail.yandex.net [IPv6:2a02:6b8:0:1619::94]) by forward3j.cmail.yandex.net (Yandex) with ESMTP id 4998C20694; Wed, 11 Apr 2018 20:30:14 +0300 (MSK) Received: from localhost (localhost [::1]) by mxback18j.mail.yandex.net (nwsmtp/Yandex) with ESMTP id v77o75vgbj-UCBGxZHO; Wed, 11 Apr 2018 20:30:13 +0300 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ipfw.ru; s=mail; t=1523467813; bh=PxdzbADZXPI6RX+QNGvAEOcRb6rTK9WuPpoqQ24sids=; h=From:To:In-Reply-To:References:Subject:Message-Id:Date; b=RqukMMjb2fDy51ULoGDjvwcpKc3zFFGHEOpuieUBhYgkqNtcN3yd+L5b6F8NL/LCE mm4Na0wxNSfed73yTpKzTyCYiIpHc0ZpdPbi2x2kZ1UwhCvIYbR63W1UGwgCzG4T+G C1LA9z9dp03uRE+bXzLpceehz6ge1EU1i3Sy/qAU= Authentication-Results: mxback18j.mail.yandex.net; dkim=pass header.i=@ipfw.ru Received: by web41g.yandex.ru with HTTP; Wed, 11 Apr 2018 20:30:12 +0300 From: Alexander V. Chernikov To: Brooks Davis , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" In-Reply-To: <201804111728.w3BHSOvP015995@repo.freebsd.org> References: <201804111728.w3BHSOvP015995@repo.freebsd.org> Subject: Re: svn commit: r332412 - in head: . lib/libifconfig sbin/etherswitchcfg sbin/ifconfig share/man/man4 sys/conf sys/dev/pdq sys/net sys/netinet sys/netinet6 sys/nfs MIME-Version: 1.0 Message-Id: <266041523467812@web41g.yandex.ru> X-Mailer: Yamail [ http://yandex.ru ] 5.0 Date: Wed, 11 Apr 2018 20:30:12 +0300 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=utf-8 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 17:30:18 -0000 11.04.2018, 20:28, "Brooks Davis" : > Author: brooks > Date: Wed Apr 11 17:28:24 2018 > New Revision: 332412 > URL: https://svnweb.freebsd.org/changeset/base/332412 > > Log: >   Remove support for FDDI networks. Awesome! Thank you! > >   Defines in net/if_media.h remain in case code copied from ifconfig is in >   use elsewere (supporting non-existant media type is harmless). > >   Reviewed by: kib, jhb >   Sponsored by: DARPA, AFRL >   Differential Revision: https://reviews.freebsd.org/D15017 > > Deleted: >   head/share/man/man4/fpa.4 >   head/sys/dev/pdq/if_fpa.c >   head/sys/dev/pdq/pdq.c >   head/sys/dev/pdq/pdq_freebsd.h >   head/sys/dev/pdq/pdq_ifsubr.c >   head/sys/dev/pdq/pdqreg.h >   head/sys/dev/pdq/pdqvar.h >   head/sys/net/fddi.h >   head/sys/net/if_fddisubr.c > Modified: >   head/ObsoleteFiles.inc >   head/UPDATING >   head/lib/libifconfig/libifconfig_media.c >   head/sbin/etherswitchcfg/ifmedia.c >   head/sbin/ifconfig/ifmedia.c >   head/share/man/man4/Makefile >   head/sys/conf/NOTES >   head/sys/conf/files >   head/sys/net/if.c >   head/sys/net/if_bridge.c >   head/sys/net/if_media.c >   head/sys/netinet/if_ether.c >   head/sys/netinet/ip_carp.c >   head/sys/netinet6/in6.c >   head/sys/netinet6/in6_ifattach.c >   head/sys/netinet6/nd6.c >   head/sys/netinet6/nd6_nbr.c >   head/sys/nfs/bootp_subr.c > > Modified: head/ObsoleteFiles.inc > ============================================================================== > --- head/ObsoleteFiles.inc Wed Apr 11 17:26:53 2018 (r332411) > +++ head/ObsoleteFiles.inc Wed Apr 11 17:28:24 2018 (r332412) > @@ -38,6 +38,8 @@ >  # xargs -n1 | sort | uniq -d; >  # done > > +# 20180409: remove FDDI support > +OLD_FILES+=usr/include/net/fddi.h >  # 20180319: remove /boot/overlays, replaced by /boot/dtb/overlays >  OLD_DIRS+=boot/overlays >  # 20180311: remove sys/sys/i386/include/pcaudioio.h > > Modified: head/UPDATING > ============================================================================== > --- head/UPDATING Wed Apr 11 17:26:53 2018 (r332411) > +++ head/UPDATING Wed Apr 11 17:28:24 2018 (r332412) > @@ -51,6 +51,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: > >  ****************************** SPECIAL WARNING: ****************************** > > +20180411: > + Support for FDDI networks has been removed. If you have device > + fddi or device fpa in your kernel config file they must be > + removed. > + >  20180406: >          In addition to supporting RFC 3164 formatted messages, the >          syslogd(8) service is now capable of parsing RFC 5424 formatted > > Modified: head/lib/libifconfig/libifconfig_media.c > ============================================================================== > --- head/lib/libifconfig/libifconfig_media.c Wed Apr 11 17:26:53 2018 (r332411) > +++ head/lib/libifconfig/libifconfig_media.c Wed Apr 11 17:28:24 2018 (r332412) > @@ -86,15 +86,6 @@ static struct ifmedia_description ifm_subtype_tokenrin >  static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] = >      IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS; > > -static struct ifmedia_description ifm_subtype_fddi_descriptions[] = > - IFM_SUBTYPE_FDDI_DESCRIPTIONS; > - > -static struct ifmedia_description ifm_subtype_fddi_aliases[] = > - IFM_SUBTYPE_FDDI_ALIASES; > - > -static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] = > - IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS; > - >  static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = >      IFM_SUBTYPE_IEEE80211_DESCRIPTIONS; > > @@ -182,24 +173,6 @@ static struct ifmedia_type_to_subtype ifmedia_types_to >                          { &ifm_shared_option_descriptions[0], 0 }, >                          { &ifm_shared_option_aliases[0], 1 }, >                          { &ifm_subtype_tokenring_option_descriptions[0], 0 }, > - { NULL, 0 }, > - }, > - { > - { NULL, 0 }, > - }, > - }, > - { > - { > - { &ifm_subtype_shared_descriptions[0], 0 }, > - { &ifm_subtype_shared_aliases[0], 1 }, > - { &ifm_subtype_fddi_descriptions[0], 0 }, > - { &ifm_subtype_fddi_aliases[0], 1 }, > - { NULL, 0 }, > - }, > - { > - { &ifm_shared_option_descriptions[0], 0 }, > - { &ifm_shared_option_aliases[0], 1 }, > - { &ifm_subtype_fddi_option_descriptions[0], 0 }, >                          { NULL, 0 }, >                  }, >                  { > > Modified: head/sbin/etherswitchcfg/ifmedia.c > ============================================================================== > --- head/sbin/etherswitchcfg/ifmedia.c Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sbin/etherswitchcfg/ifmedia.c Wed Apr 11 17:28:24 2018 (r332412) > @@ -380,15 +380,6 @@ static struct ifmedia_description ifm_subtype_tokenrin >  static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] = >      IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS; > > -static struct ifmedia_description ifm_subtype_fddi_descriptions[] = > - IFM_SUBTYPE_FDDI_DESCRIPTIONS; > - > -static struct ifmedia_description ifm_subtype_fddi_aliases[] = > - IFM_SUBTYPE_FDDI_ALIASES; > - > -static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] = > - IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS; > - >  static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = >      IFM_SUBTYPE_IEEE80211_DESCRIPTIONS; > > @@ -472,24 +463,6 @@ static struct ifmedia_type_to_subtype ifmedia_types_to >                          { &ifm_shared_option_descriptions[0], 0 }, >                          { &ifm_shared_option_aliases[0], 1 }, >                          { &ifm_subtype_tokenring_option_descriptions[0], 0 }, > - { NULL, 0 }, > - }, > - { > - { NULL, 0 }, > - }, > - }, > - { > - { > - { &ifm_subtype_shared_descriptions[0], 0 }, > - { &ifm_subtype_shared_aliases[0], 1 }, > - { &ifm_subtype_fddi_descriptions[0], 0 }, > - { &ifm_subtype_fddi_aliases[0], 1 }, > - { NULL, 0 }, > - }, > - { > - { &ifm_shared_option_descriptions[0], 0 }, > - { &ifm_shared_option_aliases[0], 1 }, > - { &ifm_subtype_fddi_option_descriptions[0], 0 }, >                          { NULL, 0 }, >                  }, >                  { > > Modified: head/sbin/ifconfig/ifmedia.c > ============================================================================== > --- head/sbin/ifconfig/ifmedia.c Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sbin/ifconfig/ifmedia.c Wed Apr 11 17:28:24 2018 (r332412) > @@ -397,15 +397,6 @@ static struct ifmedia_description ifm_subtype_tokenrin >  static struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] = >      IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS; > > -static struct ifmedia_description ifm_subtype_fddi_descriptions[] = > - IFM_SUBTYPE_FDDI_DESCRIPTIONS; > - > -static struct ifmedia_description ifm_subtype_fddi_aliases[] = > - IFM_SUBTYPE_FDDI_ALIASES; > - > -static struct ifmedia_description ifm_subtype_fddi_option_descriptions[] = > - IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS; > - >  static struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = >      IFM_SUBTYPE_IEEE80211_DESCRIPTIONS; > > @@ -489,24 +480,6 @@ static struct ifmedia_type_to_subtype ifmedia_types_to >                          { &ifm_shared_option_descriptions[0], 0 }, >                          { &ifm_shared_option_aliases[0], 1 }, >                          { &ifm_subtype_tokenring_option_descriptions[0], 0 }, > - { NULL, 0 }, > - }, > - { > - { NULL, 0 }, > - }, > - }, > - { > - { > - { &ifm_subtype_shared_descriptions[0], 0 }, > - { &ifm_subtype_shared_aliases[0], 1 }, > - { &ifm_subtype_fddi_descriptions[0], 0 }, > - { &ifm_subtype_fddi_aliases[0], 1 }, > - { NULL, 0 }, > - }, > - { > - { &ifm_shared_option_descriptions[0], 0 }, > - { &ifm_shared_option_aliases[0], 1 }, > - { &ifm_subtype_fddi_option_descriptions[0], 0 }, >                          { NULL, 0 }, >                  }, >                  { > > Modified: head/share/man/man4/Makefile > ============================================================================== > --- head/share/man/man4/Makefile Wed Apr 11 17:26:53 2018 (r332411) > +++ head/share/man/man4/Makefile Wed Apr 11 17:28:24 2018 (r332412) > @@ -170,7 +170,6 @@ MAN= aac.4 \ >          ffclock.4 \ >          filemon.4 \ >          firewire.4 \ > - fpa.4 \ >          full.4 \ >          fwe.4 \ >          fwip.4 \ > > Modified: head/sys/conf/NOTES > ============================================================================== > --- head/sys/conf/NOTES Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sys/conf/NOTES Wed Apr 11 17:28:24 2018 (r332412) > @@ -845,9 +845,6 @@ device wlan_xauth >  device wlan_acl >  device wlan_amrr > > -# The `fddi' device provides generic code to support FDDI. > -device fddi > - >  # The `arcnet' device provides generic code to support Arcnet. >  device arcnet > > @@ -1972,7 +1969,6 @@ device xmphy # XaQti XMAC II >  # ex: Intel EtherExpress Pro/10 and other i82595-based adapters, >  # Olicom Ethernet PC Card devices. >  # fe: Fujitsu MB86960A/MB86965A Ethernet > -# fpa: Support for the Digital DEFPA PCI FDDI. `device fddi' is also needed. >  # fxp: Intel EtherExpress Pro/100B >  # (hint of prefer_iomap can be done to prefer I/O instead of Mem mapping) >  # gem: Apple GMAC/Sun ERI/Sun GEM > @@ -2149,9 +2145,6 @@ device ti # Alteon Networks Tigon I/II gigabit Ether >  device txp # 3Com 3cR990 (``Typhoon'') >  device vx # 3Com 3c590, 3c595 (``Vortex'') >  device vxge # Exar/Neterion XFrame 3100 10GbE > - > -# PCI FDDI NICs. > -device fpa > >  # PCI WAN adapters. >  device lmc > > Modified: head/sys/conf/files > ============================================================================== > --- head/sys/conf/files Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sys/conf/files Wed Apr 11 17:28:24 2018 (r332412) > @@ -2642,9 +2642,6 @@ dev/pci/pcib_if.m standard >  dev/pci/pcib_support.c standard >  dev/pci/vga_pci.c optional pci >  dev/pcn/if_pcn.c optional pcn pci > -dev/pdq/if_fpa.c optional fpa pci > -dev/pdq/pdq.c optional nowerror fpa pci > -dev/pdq/pdq_ifsubr.c optional nowerror fpa pci >  dev/pms/freebsd/driver/ini/src/agtiapi.c optional pmspcv \ >          compile-with "${NORMAL_C} -Wunused-variable -Woverflow -Wparentheses -w" >  dev/pms/RefTisa/sallsdk/spc/sadisc.c optional pmspcv \ > @@ -4130,7 +4127,6 @@ net/if_edsc.c optional edsc >  net/if_enc.c optional enc inet | enc inet6 >  net/if_epair.c optional epair >  net/if_ethersubr.c optional ether > -net/if_fddisubr.c optional fddi >  net/if_fwsubr.c optional fwip >  net/if_gif.c optional gif inet | gif inet6 | \ >                                           netgraph_gif inet | netgraph_gif inet6 > > Modified: head/sys/net/if.c > ============================================================================== > --- head/sys/net/if.c Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sys/net/if.c Wed Apr 11 17:28:24 2018 (r332412) > @@ -3692,7 +3692,6 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, >          } >          switch (ifp->if_type) { >          case IFT_ETHER: > - case IFT_FDDI: >          case IFT_XETHER: >          case IFT_L2VLAN: >          case IFT_BRIDGE: > > Modified: head/sys/net/if_bridge.c > ============================================================================== > --- head/sys/net/if_bridge.c Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sys/net/if_bridge.c Wed Apr 11 17:28:24 2018 (r332412) > @@ -72,8 +72,8 @@ >   * >   * - Currently only supports Ethernet-like interfaces (Ethernet, >   * 802.11, VLANs on Ethernet, etc.) Figure out a nice way > - * to bridge other types of interfaces (FDDI-FDDI, and maybe > - * consider heterogeneous bridges). > + * to bridge other types of interfaces (maybe consider > + * heterogeneous bridges). >   */ > >  #include > > Modified: head/sys/net/if_media.c > ============================================================================== > --- head/sys/net/if_media.c Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sys/net/if_media.c Wed Apr 11 17:28:24 2018 (r332412) > @@ -405,12 +405,6 @@ struct ifmedia_description ifm_subtype_tokenring_descr >  struct ifmedia_description ifm_subtype_tokenring_option_descriptions[] = >      IFM_SUBTYPE_TOKENRING_OPTION_DESCRIPTIONS; > > -struct ifmedia_description ifm_subtype_fddi_descriptions[] = > - IFM_SUBTYPE_FDDI_DESCRIPTIONS; > - > -struct ifmedia_description ifm_subtype_fddi_option_descriptions[] = > - IFM_SUBTYPE_FDDI_OPTION_DESCRIPTIONS; > - >  struct ifmedia_description ifm_subtype_ieee80211_descriptions[] = >      IFM_SUBTYPE_IEEE80211_DESCRIPTIONS; > > @@ -448,11 +442,6 @@ struct ifmedia_type_to_subtype ifmedia_types_to_subtyp >          { >            &ifm_subtype_tokenring_descriptions[0], >            &ifm_subtype_tokenring_option_descriptions[0], > - NULL, > - }, > - { > - &ifm_subtype_fddi_descriptions[0], > - &ifm_subtype_fddi_option_descriptions[0], >            NULL, >          }, >          { > > Modified: head/sys/netinet/if_ether.c > ============================================================================== > --- head/sys/netinet/if_ether.c Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sys/netinet/if_ether.c Wed Apr 11 17:28:24 2018 (r332412) > @@ -694,10 +694,6 @@ arpintr(struct mbuf *m) >                  hlen = ETHER_ADDR_LEN; /* RFC 826 */ >                  layer = "ethernet"; >                  break; > - case ARPHRD_IEEE802: > - hlen = 6; /* RFC 1390, FDDI_ADDR_LEN */ > - layer = "fddi"; > - break; >          case ARPHRD_ARCNET: >                  hlen = 1; /* RFC 1201, ARC_ADDR_LEN */ >                  layer = "arcnet"; > > Modified: head/sys/netinet/ip_carp.c > ============================================================================== > --- head/sys/netinet/ip_carp.c Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sys/netinet/ip_carp.c Wed Apr 11 17:28:24 2018 (r332412) > @@ -55,7 +55,6 @@ __FBSDID("$FreeBSD$"); >  #include > >  #include > -#include >  #include >  #include >  #include > @@ -1526,18 +1525,6 @@ carp_output(struct ifnet *ifp, struct mbuf *m, const s >                          eh->ether_shost[5] = sc->sc_vhid; >                  } >                  break; > - case IFT_FDDI: { > - struct fddi_header *fh; > - > - fh = mtod(m, struct fddi_header *); > - fh->fddi_shost[0] = 0; > - fh->fddi_shost[1] = 0; > - fh->fddi_shost[2] = 0x5e; > - fh->fddi_shost[3] = 0; > - fh->fddi_shost[4] = 1; > - fh->fddi_shost[5] = sc->sc_vhid; > - } > - break; >          default: >                  printf("%s: carp is not supported for the %d interface type\n", >                      ifp->if_xname, ifp->if_type); > @@ -1719,7 +1706,6 @@ carp_ioctl(struct ifreq *ifr, u_long cmd, struct threa >          case IFT_ETHER: >          case IFT_L2VLAN: >          case IFT_BRIDGE: > - case IFT_FDDI: >                  break; >          default: >                  error = EOPNOTSUPP; > > Modified: head/sys/netinet6/in6.c > ============================================================================== > --- head/sys/netinet6/in6.c Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sys/netinet6/in6.c Wed Apr 11 17:28:24 2018 (r332412) > @@ -1972,8 +1972,6 @@ in6_if2idlen(struct ifnet *ifp) >          case IFT_BRIDGE: /* bridge(4) only does Ethernet-like links */ >          case IFT_INFINIBAND: >                  return (64); > - case IFT_FDDI: /* RFC2467 */ > - return (64); >          case IFT_PPP: /* RFC2472 */ >                  return (64); >          case IFT_ARCNET: /* RFC2497 */ > > Modified: head/sys/netinet6/in6_ifattach.c > ============================================================================== > --- head/sys/netinet6/in6_ifattach.c Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sys/netinet6/in6_ifattach.c Wed Apr 11 17:28:24 2018 (r332412) > @@ -274,7 +274,6 @@ found: >          case IFT_BRIDGE: >          case IFT_ETHER: >          case IFT_L2VLAN: > - case IFT_FDDI: >          case IFT_ATM: >          case IFT_IEEE1394: >                  /* IEEE802/EUI64 cases - what others? */ > > Modified: head/sys/netinet6/nd6.c > ============================================================================== > --- head/sys/netinet6/nd6.c Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sys/netinet6/nd6.c Wed Apr 11 17:28:24 2018 (r332412) > @@ -61,7 +61,6 @@ __FBSDID("$FreeBSD$"); >  #include >  #include >  #include > -#include >  #include >  #include > > @@ -340,9 +339,6 @@ nd6_setmtu0(struct ifnet *ifp, struct nd_ifinfo *ndi) >          case IFT_ARCNET: >                  ndi->maxmtu = MIN(ARC_PHDS_MAXMTU, ifp->if_mtu); /* RFC2497 */ >                  break; > - case IFT_FDDI: > - ndi->maxmtu = MIN(FDDIIPMTU, ifp->if_mtu); /* RFC2467 */ > - break; >          default: >                  ndi->maxmtu = ifp->if_mtu; >                  break; > @@ -2272,7 +2268,6 @@ nd6_resolve(struct ifnet *ifp, int is_gw, struct mbuf >          if (m != NULL && m->m_flags & M_MCAST) { >                  switch (ifp->if_type) { >                  case IFT_ETHER: > - case IFT_FDDI: >                  case IFT_L2VLAN: >                  case IFT_BRIDGE: >                          ETHER_MAP_IPV6_MULTICAST(&dst6->sin6_addr, > @@ -2524,7 +2519,7 @@ nd6_need_cache(struct ifnet *ifp) >  { >          /* >           * XXX: we currently do not make neighbor cache on any interface > - * other than ARCnet, Ethernet, FDDI and GIF. > + * other than ARCnet, Ethernet and GIF. >           * >           * RFC2893 says: >           * - unidirectional tunnels needs no ND > @@ -2532,7 +2527,6 @@ nd6_need_cache(struct ifnet *ifp) >          switch (ifp->if_type) { >          case IFT_ARCNET: >          case IFT_ETHER: > - case IFT_FDDI: >          case IFT_IEEE1394: >          case IFT_L2VLAN: >          case IFT_INFINIBAND: > > Modified: head/sys/netinet6/nd6_nbr.c > ============================================================================== > --- head/sys/netinet6/nd6_nbr.c Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sys/netinet6/nd6_nbr.c Wed Apr 11 17:28:24 2018 (r332412) > @@ -1092,7 +1092,6 @@ nd6_ifptomac(struct ifnet *ifp) >          switch (ifp->if_type) { >          case IFT_ARCNET: >          case IFT_ETHER: > - case IFT_FDDI: >          case IFT_IEEE1394: >          case IFT_L2VLAN: >          case IFT_INFINIBAND: > @@ -1466,7 +1465,6 @@ nd6_dad_duplicated(struct ifaddr *ifa, struct dadq *dp >                   */ >                  switch (ifp->if_type) { >                  case IFT_ETHER: > - case IFT_FDDI: >                  case IFT_ATM: >                  case IFT_IEEE1394: >                  case IFT_INFINIBAND: > > Modified: head/sys/nfs/bootp_subr.c > ============================================================================== > --- head/sys/nfs/bootp_subr.c Wed Apr 11 17:26:53 2018 (r332411) > +++ head/sys/nfs/bootp_subr.c Wed Apr 11 17:28:24 2018 (r332412) > @@ -1645,7 +1645,6 @@ bootpc_init(void) >                          continue; >                  switch (ifp->if_alloctype) { >                          case IFT_ETHER: > - case IFT_FDDI: >                                  break; >                          default: >                                  continue; > @@ -1675,7 +1674,6 @@ retry: >                          continue; >                  switch (ifp->if_alloctype) { >                          case IFT_ETHER: > - case IFT_FDDI: >                                  break; >                          default: >                                  continue; From owner-svn-src-head@freebsd.org Wed Apr 11 17:44:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5B539F82FF9; Wed, 11 Apr 2018 17:44:55 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: from mail-ot0-x22e.google.com (mail-ot0-x22e.google.com [IPv6:2607:f8b0:4003:c0f::22e]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E20616FBBD; Wed, 11 Apr 2018 17:44:54 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: by mail-ot0-x22e.google.com with SMTP id v64-v6so2930662otb.13; Wed, 11 Apr 2018 10:44:54 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=qevC9bhbDpWH0NvX8MZ/TXaBINoFBiE4uEKN0V6mDVE=; b=WME9EQL7572OO0rJvQT795WFlggbOuoqcXNnFLFQ3tRnFbYRoUEzuGOr1jPPF2PAyy a9XTi4GthOOw1UJ9Ykh3wP6bkJc3gIiwqs6F7VyXJFOIPqQDMBtHJ8PTAzk7mpzBmR2R 5+jZkpYzjxrqZ2kn/7NXD3qursAxCjutkMarEOKnn6UB75Rpxw1SnzteRjJGdB4AWv8S kZGIVGfbv1BhLwN7lBcJ8ZDZl2jBhRgfU4xfJIhA790ms95zQYK+s233BFrnLssC1yfh 5E20RuqztxaoXU0h+OwfDtDxSNxZOppKRKDTj1L5lSDqS54phn57VbuUv/6u0OC0KbkG IHUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=qevC9bhbDpWH0NvX8MZ/TXaBINoFBiE4uEKN0V6mDVE=; b=ZUkiZ0YAuXHNPnNHpzWksmGosJVjwD9xWi85jFFAeilI9wanK2tJ6YYSW+WfsGv05a M6nevYFFwqTRjW7u0QlnMeNms24SmZK1pDeKOAg6H8o6HnULv4+52CCTCNgEh5jVd7uP d8namyw254tLRPcQ9n8ERVyXZklrPVy2L6eDzg/a+OlMQSYceSE7IkaPPV85fXHAkox0 fwtJoeopcxh2jRl0IjUDjsKYzZaFyRbXVpOjGR4+fFTo+Hkkb8wn1o7kx/6f7bnkOmnM Y1uijyqVb01VWf2AkXF22px3Mlst0sngQJ9FYwGMh368gBt67VALYNVj6ycSP+YB1Xse 40+g== X-Gm-Message-State: ALQs6tDtZvvzQTskUAOwflvitIjGgQUU9RgvUK972vlzcx+bnwGxSWyn aA6ZWD8YpbX8ZqxIXZib6BLV/OriTN4gqYvrMBRByQ== X-Google-Smtp-Source: AIpwx49yHPCrYvqsHlBQbZtFBMoTbi/4XtczxorW4yXdaI4AeEQgYv5Co5SSD5aCJEPapFOMqwFv7pBSXfqZvaPVnrE= X-Received: by 2002:a9d:7388:: with SMTP id j8-v6mr3629887otk.29.1523468693811; Wed, 11 Apr 2018 10:44:53 -0700 (PDT) MIME-Version: 1.0 Sender: kmacybsd@gmail.com Received: by 2002:a9d:4782:0:0:0:0:0 with HTTP; Wed, 11 Apr 2018 10:44:53 -0700 (PDT) In-Reply-To: References: <201804101948.w3AJmOt2066564@repo.freebsd.org> From: "K. Macy" Date: Wed, 11 Apr 2018 10:44:53 -0700 X-Google-Sender-Auth: lC7z7--nIyxsWSiHqKjFdHu9qRg Message-ID: Subject: Re: svn commit: r332389 - head/sys/net To: "Jonathan T. Looney" Cc: Stephen Hurd , svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 17:44:55 -0000 Yup. git<->phab patch update fail. Maybe some day we can move to git. -M On Wed, Apr 11, 2018 at 10:12 AM, Jonathan T. Looney wrote: > It appears this is causing panics (see the emails on freebsd-current@). > > From a brief glance, it appears that the new STATE_LOCK macros is used (and > causes panics), but the STATE_LOCK_INIT macro is not used. Is it possible > the code is missing an initialization call for the new mutex? > > Jonathan > > On Tue, Apr 10, 2018 at 3:48 PM, Stephen Hurd wrote: > >> Author: shurd >> Date: Tue Apr 10 19:48:24 2018 >> New Revision: 332389 >> URL: https://svnweb.freebsd.org/changeset/base/332389 >> >> Log: >> Split out flag manipulation from general context manipulation in iflib >> >> To avoid blocking on the context lock in the swi thread and risk >> potential >> deadlocks, this change protects lighter weight updates that only need to >> be consistent with each other with their own lock. >> >> Submitted by: Matthew Macy >> Reviewed by: shurd >> Sponsored by: Limelight Networks >> Differential Revision: https://reviews.freebsd.org/D14967 >> >> Modified: >> head/sys/net/iflib.c >> >> Modified: head/sys/net/iflib.c >> ============================================================ >> ================== >> --- head/sys/net/iflib.c Tue Apr 10 19:42:50 2018 (r332388) >> +++ head/sys/net/iflib.c Tue Apr 10 19:48:24 2018 (r332389) >> @@ -1,5 +1,5 @@ >> /*- >> - * Copyright (c) 2014-2017, Matthew Macy >> + * Copyright (c) 2014-2018, Matthew Macy >> * All rights reserved. >> * >> * Redistribution and use in source and binary forms, with or without >> @@ -163,7 +163,8 @@ struct iflib_ctx { >> if_shared_ctx_t ifc_sctx; >> struct if_softc_ctx ifc_softc_ctx; >> >> - struct mtx ifc_mtx; >> + struct mtx ifc_ctx_mtx; >> + struct mtx ifc_state_mtx; >> >> uint16_t ifc_nhwtxqs; >> uint16_t ifc_nhwrxqs; >> @@ -318,8 +319,10 @@ typedef struct iflib_sw_tx_desc_array { >> #define IFC_INIT_DONE 0x020 >> #define IFC_PREFETCH 0x040 >> #define IFC_DO_RESET 0x080 >> -#define IFC_CHECK_HUNG 0x100 >> +#define IFC_DO_WATCHDOG 0x100 >> +#define IFC_CHECK_HUNG 0x200 >> >> + >> #define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ >> CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ >> CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) >> @@ -535,13 +538,19 @@ rxd_info_zero(if_rxd_info_t ri) >> >> #define CTX_ACTIVE(ctx) ((if_getdrvflags((ctx)->ifc_ifp) & >> IFF_DRV_RUNNING)) >> >> -#define CTX_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_mtx, _name, >> "iflib ctx lock", MTX_DEF) >> +#define CTX_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_ctx_mtx, _name, >> "iflib ctx lock", MTX_DEF) >> +#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_ctx_mtx) >> +#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_ctx_mtx) >> +#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_ctx_mtx) >> >> -#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_mtx) >> -#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_mtx) >> -#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_mtx) >> >> +#define STATE_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_state_mtx, >> _name, "iflib state lock", MTX_DEF) >> +#define STATE_LOCK(ctx) mtx_lock(&(ctx)->ifc_state_mtx) >> +#define STATE_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_state_mtx) >> +#define STATE_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_state_mtx) >> >> + >> + >> #define CALLOUT_LOCK(txq) mtx_lock(&txq->ift_mtx) >> #define CALLOUT_UNLOCK(txq) mtx_unlock(&txq->ift_mtx) >> >> @@ -2144,18 +2153,14 @@ iflib_timer(void *arg) >> if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) >> callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, >> txq->ift_timer.c_cpu); >> return; >> -hung: >> - CTX_LOCK(ctx); >> - if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); >> + hung: >> device_printf(ctx->ifc_dev, "TX(%d) desc avail = %d, pidx = %d\n", >> txq->ift_id, TXQ_AVAIL(txq), >> txq->ift_pidx); >> - >> - IFDI_WATCHDOG_RESET(ctx); >> - ctx->ifc_watchdog_events++; >> - >> - ctx->ifc_flags |= IFC_DO_RESET; >> + STATE_LOCK(ctx); >> + if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); >> + ctx->ifc_flags |= (IFC_DO_WATCHDOG|IFC_DO_RESET); >> iflib_admin_intr_deferred(ctx); >> - CTX_UNLOCK(ctx); >> + STATE_UNLOCK(ctx); >> } >> >> static void >> @@ -2673,10 +2678,10 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) >> return true; >> return (iflib_rxd_avail(ctx, rxq, *cidxp, 1)); >> err: >> - CTX_LOCK(ctx); >> + STATE_LOCK(ctx); >> ctx->ifc_flags |= IFC_DO_RESET; >> iflib_admin_intr_deferred(ctx); >> - CTX_UNLOCK(ctx); >> + STATE_UNLOCK(ctx); >> return (false); >> } >> >> @@ -3706,27 +3711,35 @@ _task_fn_admin(void *context) >> if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; >> iflib_txq_t txq; >> int i; >> + bool oactive, running, do_reset, do_watchdog; >> >> - if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)) { >> - if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE)) { >> - return; >> - } >> - } >> + STATE_LOCK(ctx); >> + running = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING); >> + oactive = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE); >> + do_reset = (ctx->ifc_flags & IFC_DO_RESET); >> + do_watchdog = (ctx->ifc_flags & IFC_DO_WATCHDOG); >> + ctx->ifc_flags &= ~(IFC_DO_RESET|IFC_DO_WATCHDOG); >> + STATE_UNLOCK(ctx); >> >> + if (!running & !oactive) >> + return; >> + >> CTX_LOCK(ctx); >> for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, >> txq++) { >> CALLOUT_LOCK(txq); >> callout_stop(&txq->ift_timer); >> CALLOUT_UNLOCK(txq); >> } >> + if (do_watchdog) { >> + ctx->ifc_watchdog_events++; >> + IFDI_WATCHDOG_RESET(ctx); >> + } >> IFDI_UPDATE_ADMIN_STATUS(ctx); >> for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, >> txq++) >> callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, >> txq->ift_timer.c_cpu); >> IFDI_LINK_INTR_ENABLE(ctx); >> - if (ctx->ifc_flags & IFC_DO_RESET) { >> - ctx->ifc_flags &= ~IFC_DO_RESET; >> + if (do_reset) >> iflib_if_init_locked(ctx); >> - } >> CTX_UNLOCK(ctx); >> >> if (LINK_ACTIVE(ctx) == 0) >> @@ -3870,15 +3883,15 @@ iflib_if_qflush(if_t ifp) >> iflib_txq_t txq = ctx->ifc_txqs; >> int i; >> >> - CTX_LOCK(ctx); >> + STATE_LOCK(ctx); >> ctx->ifc_flags |= IFC_QFLUSH; >> - CTX_UNLOCK(ctx); >> + STATE_UNLOCK(ctx); >> for (i = 0; i < NTXQSETS(ctx); i++, txq++) >> while (!(ifmp_ring_is_idle(txq->ift_br) || >> ifmp_ring_is_stalled(txq->ift_br))) >> iflib_txq_check_drain(txq, 0); >> - CTX_LOCK(ctx); >> + STATE_LOCK(ctx); >> ctx->ifc_flags &= ~IFC_QFLUSH; >> - CTX_UNLOCK(ctx); >> + STATE_UNLOCK(ctx); >> >> if_qflush(ifp); >> } >> @@ -3935,14 +3948,18 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t >> data) >> iflib_stop(ctx); >> >> if ((err = IFDI_MTU_SET(ctx, ifr->ifr_mtu)) == 0) { >> + STATE_LOCK(ctx); >> if (ifr->ifr_mtu > ctx->ifc_max_fl_buf_size) >> ctx->ifc_flags |= IFC_MULTISEG; >> else >> ctx->ifc_flags &= ~IFC_MULTISEG; >> + STATE_UNLOCK(ctx); >> err = if_setmtu(ifp, ifr->ifr_mtu); >> } >> iflib_init_locked(ctx); >> + STATE_LOCK(ctx); >> if_setdrvflags(ifp, bits); >> + STATE_UNLOCK(ctx); >> CTX_UNLOCK(ctx); >> break; >> case SIOCSIFFLAGS: >> @@ -4026,10 +4043,14 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t >> data) >> bits = if_getdrvflags(ifp); >> if (bits & IFF_DRV_RUNNING) >> iflib_stop(ctx); >> + STATE_LOCK(ctx); >> if_togglecapenable(ifp, setmask); >> + STATE_UNLOCK(ctx); >> if (bits & IFF_DRV_RUNNING) >> iflib_init_locked(ctx); >> + STATE_LOCK(ctx); >> if_setdrvflags(ifp, bits); >> + STATE_UNLOCK(ctx); >> CTX_UNLOCK(ctx); >> } >> break; >> @@ -5431,9 +5452,11 @@ iflib_link_state_change(if_ctx_t ctx, int >> link_state, >> iflib_txq_t txq = ctx->ifc_txqs; >> >> if_setbaudrate(ifp, baudrate); >> - if (baudrate >= IF_Gbps(10)) >> + if (baudrate >= IF_Gbps(10)) { >> + STATE_LOCK(ctx); >> ctx->ifc_flags |= IFC_PREFETCH; >> - >> + STATE_UNLOCK(ctx); >> + } >> /* If link down, disable watchdog */ >> if ((ctx->ifc_link_state == LINK_STATE_UP) && (link_state == >> LINK_STATE_DOWN)) { >> for (int i = 0; i < ctx->ifc_softc_ctx.isc_ntxqsets; i++, >> txq++) >> @@ -5492,7 +5515,7 @@ struct mtx * >> iflib_ctx_lock_get(if_ctx_t ctx) >> { >> >> - return (&ctx->ifc_mtx); >> + return (&ctx->ifc_ctx_mtx); >> } >> >> static int >> >> > _______________________________________________ > 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 Wed Apr 11 17:52:13 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AF0ABF83923; Wed, 11 Apr 2018 17:52:13 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3F59572A91; Wed, 11 Apr 2018 17:52:10 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-lf0-f50.google.com (mail-lf0-f50.google.com [209.85.215.50]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id DBF291B43C; Wed, 11 Apr 2018 17:52:09 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-lf0-f50.google.com with SMTP id d20-v6so3863733lfe.3; Wed, 11 Apr 2018 10:52:09 -0700 (PDT) X-Gm-Message-State: ALQs6tCpR2865LvtBG9fRkDNHhzBMQ6URBGOf8tKzvksWuqJ0xOJjUYP sGNzp5FKPCvrAg1AN1adi83KJ+Y4J+PivgZaJJI= X-Google-Smtp-Source: AIpwx48tXCESipX6E+QVJTI1jwAoKo9Hsyjz46p8YlLUxqzdnUCgBC0+Vs9JI/q0I+A0dmyZoL1aC9QxeLp9KAIP29g= X-Received: by 2002:a19:c4c8:: with SMTP id u191-v6mr3634979lff.109.1523469128017; Wed, 11 Apr 2018 10:52:08 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.129.90 with HTTP; Wed, 11 Apr 2018 10:51:47 -0700 (PDT) In-Reply-To: <201804081139.w38BdR0t047036@repo.freebsd.org> References: <201804081139.w38BdR0t047036@repo.freebsd.org> From: Kyle Evans Date: Wed, 11 Apr 2018 12:51:47 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r332270 - head/stand/forth To: Toomas Soome Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 17:52:13 -0000 On Sun, Apr 8, 2018 at 6:39 AM, Toomas Soome wrote: > Author: tsoome > Date: Sun Apr 8 11:39:27 2018 > New Revision: 332270 > URL: https://svnweb.freebsd.org/changeset/base/332270 > > Log: > loader: include efi.4th only if we do have uefi > > Also simplify efi.4th. > > Modified: > head/stand/forth/efi.4th > head/stand/forth/loader.4th > head/stand/forth/loader.rc > > Modified: head/stand/forth/efi.4th > ============================================================================== > --- head/stand/forth/efi.4th Sun Apr 8 11:37:00 2018 (r332269) > +++ head/stand/forth/efi.4th Sun Apr 8 11:39:27 2018 (r332270) > @@ -26,16 +26,5 @@ > > only forth definitions > > -: efiboot? ( -- flag ) > - s" efi-version" getenv -1 <> dup if > - swap drop ( c-addr flag -- flag ) > - then > -; > - > -: maybe-efi-resizecons > - efiboot? if > - s" efi-autoresizecons" evaluate > - then > -; > - > +s" efi-autoresizecons" evaluate > .( EFI boot environment) cr > This was actually the wrong thing to do, here. efi-autoresizecons should *not* be executed before loader.conf is invoked, which is why this was done the way it was. From owner-svn-src-head@freebsd.org Wed Apr 11 18:02:15 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0FECDF84420; Wed, 11 Apr 2018 18:02:15 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B71AB74709; Wed, 11 Apr 2018 18:02:14 +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 97DA81F900; Wed, 11 Apr 2018 18:02:14 +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 w3BI2Ej9035382; Wed, 11 Apr 2018 18:02:14 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3BI2Etc035378; Wed, 11 Apr 2018 18:02:14 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201804111802.w3BI2Etc035378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 11 Apr 2018 18:02:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332413 - in head/stand: forth i386/loader X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand: forth i386/loader X-SVN-Commit-Revision: 332413 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 18:02:15 -0000 Author: imp Date: Wed Apr 11 18:02:13 2018 New Revision: 332413 URL: https://svnweb.freebsd.org/changeset/base/332413 Log: Revert r332275, r332272, r332270 There's problems with them. The order of efi stuff isn't quite right, and there's various problems. Revert until thos problems can be fixed. Reviewed by: kevans@ Modified: head/stand/forth/efi.4th head/stand/forth/loader.4th head/stand/forth/loader.rc head/stand/i386/loader/loader.rc Modified: head/stand/forth/efi.4th ============================================================================== --- head/stand/forth/efi.4th Wed Apr 11 17:28:24 2018 (r332412) +++ head/stand/forth/efi.4th Wed Apr 11 18:02:13 2018 (r332413) @@ -26,5 +26,16 @@ only forth definitions -s" efi-autoresizecons" evaluate +: efiboot? ( -- flag ) + s" efi-version" getenv -1 <> dup if + swap drop ( c-addr flag -- flag ) + then +; + +: maybe-efi-resizecons + efiboot? if + s" efi-autoresizecons" evaluate + then +; + .( EFI boot environment) cr Modified: head/stand/forth/loader.4th ============================================================================== --- head/stand/forth/loader.4th Wed Apr 11 17:28:24 2018 (r332412) +++ head/stand/forth/loader.4th Wed Apr 11 18:02:13 2018 (r332413) @@ -46,9 +46,6 @@ include /boot/support.4th include /boot/color.4th include /boot/delay.4th include /boot/check-password.4th -s" efi-version" getenv? [if] - include /boot/efi.4th -[then] only forth definitions Modified: head/stand/forth/loader.rc ============================================================================== --- head/stand/forth/loader.rc Wed Apr 11 17:28:24 2018 (r332412) +++ head/stand/forth/loader.rc Wed Apr 11 18:02:13 2018 (r332413) @@ -6,11 +6,14 @@ \ \ Includes additional commands include /boot/loader.4th +include /boot/efi.4th try-include /boot/loader.rc.local \ Reads and processes loader.conf variables \ NOTE: Change to `initialize' if you enable the below boot menu start + +maybe-efi-resizecons \ Tests for password -- executes autoboot first if a password was defined check-password Modified: head/stand/i386/loader/loader.rc ============================================================================== --- head/stand/i386/loader/loader.rc Wed Apr 11 17:28:24 2018 (r332412) +++ head/stand/i386/loader/loader.rc Wed Apr 11 18:02:13 2018 (r332413) @@ -3,10 +3,13 @@ \ \ Includes additional commands include /boot/loader.4th +include /boot/efi.4th try-include /boot/loader.rc.local \ Reads and processes loader.conf variables initialize + +maybe-efi-resizecons \ Tests for password -- executes autoboot first if a password was defined check-password From owner-svn-src-head@freebsd.org Wed Apr 11 18:39:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7F9F6F86EB3; Wed, 11 Apr 2018 18:39:48 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2D69D7D28B; Wed, 11 Apr 2018 18:39:48 +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 2421B1FDF6; Wed, 11 Apr 2018 18:39:48 +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 w3BIdl4t050519; Wed, 11 Apr 2018 18:39:47 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3BIdlBb050518; Wed, 11 Apr 2018 18:39:47 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201804111839.w3BIdlBb050518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 11 Apr 2018 18:39:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332414 - head/usr.bin/clang/clang X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/usr.bin/clang/clang X-SVN-Commit-Revision: 332414 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 18:39:48 -0000 Author: dim Date: Wed Apr 11 18:39:47 2018 New Revision: 332414 URL: https://svnweb.freebsd.org/changeset/base/332414 Log: Regenerate clang man page after upstream change to document the possible values for the -std= option. Noticed by: Steve Kargl Obtained from: https://reviews.llvm.org/rL329827 MFC after: 3 days Modified: head/usr.bin/clang/clang/clang.1 Modified: head/usr.bin/clang/clang/clang.1 ============================================================================== --- head/usr.bin/clang/clang/clang.1 Wed Apr 11 18:02:13 2018 (r332413) +++ head/usr.bin/clang/clang/clang.1 Wed Apr 11 18:39:47 2018 (r332414) @@ -1,7 +1,7 @@ .\" $FreeBSD$ .\" Man page generated from reStructuredText. . -.TH "CLANG" "1" "Dec 24, 2017" "6" "Clang" +.TH "CLANG" "1" "Apr 11, 2018" "6" "Clang" .SH NAME clang \- the Clang C, C++, and Objective-C compiler . @@ -128,10 +128,265 @@ Treat subsequent input files as having type language. .UNINDENT .INDENT 0.0 .TP -.B \-std= +.B \-std= Specify the language standard to compile for. +.sp +Supported values for the C language are: +.INDENT 7.0 +.INDENT 3.5 +.nf +\fBc89\fP +\fBc90\fP +\fBiso9899:1990\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 1990 .UNINDENT +.UNINDENT +.nf +\fBiso9899:199409\fP +.fi +.sp .INDENT 0.0 +.INDENT 3.5 +ISO C 1990 with amendment 1 +.UNINDENT +.UNINDENT +.nf +\fBgnu89\fP +\fBgnu90\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 1990 with GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc99\fP +\fBiso9899:1999\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 1999 +.UNINDENT +.UNINDENT +.nf +\fBgnu99\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 1999 with GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc11\fP +\fBiso9899:2011\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 2011 +.UNINDENT +.UNINDENT +.nf +\fBgnu11\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 2011 with GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc17\fP +\fBiso9899:2017\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 2017 +.UNINDENT +.UNINDENT +.nf +\fBgnu17\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C 2017 with GNU extensions +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.sp +The default C language standard is \fBgnu11\fP, except on PS4, where it is +\fBgnu99\fP\&. +.sp +Supported values for the C++ language are: +.INDENT 7.0 +.INDENT 3.5 +.nf +\fBc++98\fP +\fBc++03\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 1998 with amendments +.UNINDENT +.UNINDENT +.nf +\fBgnu++98\fP +\fBgnu++03\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 1998 with amendments and GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc++11\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 2011 with amendments +.UNINDENT +.UNINDENT +.nf +\fBgnu++11\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 2011 with amendments and GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc++14\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 2014 with amendments +.UNINDENT +.UNINDENT +.nf +\fBgnu++14\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 2014 with amendments and GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc++17\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 2017 with amendments +.UNINDENT +.UNINDENT +.nf +\fBgnu++17\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +ISO C++ 2017 with amendments and GNU extensions +.UNINDENT +.UNINDENT +.nf +\fBc++2a\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +Working draft for ISO C++ 2020 +.UNINDENT +.UNINDENT +.nf +\fBgnu++2a\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +Working draft for ISO C++ 2020 with GNU extensions +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.sp +The default C++ language standard is \fBgnu++14\fP\&. +.sp +Supported values for the OpenCL language are: +.INDENT 7.0 +.INDENT 3.5 +.nf +\fBcl1.0\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +OpenCL 1.0 +.UNINDENT +.UNINDENT +.nf +\fBcl1.1\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +OpenCL 1.1 +.UNINDENT +.UNINDENT +.nf +\fBcl1.2\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +OpenCL 1.2 +.UNINDENT +.UNINDENT +.nf +\fBcl2.0\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +OpenCL 2.0 +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.sp +The default OpenCL language standard is \fBcl1.0\fP\&. +.sp +Supported values for the CUDA language are: +.INDENT 7.0 +.INDENT 3.5 +.nf +\fBcuda\fP +.fi +.sp +.INDENT 0.0 +.INDENT 3.5 +NVIDIA CUDA(tm) +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.UNINDENT +.INDENT 0.0 .TP .B \-stdlib= Specify the C++ standard library to use; supported options are libstdc++ and @@ -602,6 +857,6 @@ output of the compiler, along with information to repr .SH AUTHOR Maintained by the Clang / LLVM Team () .SH COPYRIGHT -2007-2017, The Clang Team +2007-2018, The Clang Team .\" Generated by docutils manpage writer. . From owner-svn-src-head@freebsd.org Wed Apr 11 19:28:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A13F4F8A77D; Wed, 11 Apr 2018 19:28:55 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4F24668047; Wed, 11 Apr 2018 19:28:55 +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 462332064B; Wed, 11 Apr 2018 19:28:55 +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 w3BJStHo074691; Wed, 11 Apr 2018 19:28:55 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3BJStVv074690; Wed, 11 Apr 2018 19:28:55 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201804111928.w3BJStVv074690@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Wed, 11 Apr 2018 19:28:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332415 - head/lib/libufs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/lib/libufs X-SVN-Commit-Revision: 332415 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 19:28:55 -0000 Author: mckusick Date: Wed Apr 11 19:28:54 2018 New Revision: 332415 URL: https://svnweb.freebsd.org/changeset/base/332415 Log: Fix potentially overflowing expression "fs->fs_ipg * fs->fs_ncg" by casting fs->fs_ipg to (ino_t). CID: 1388258 Modified: head/lib/libufs/inode.c Modified: head/lib/libufs/inode.c ============================================================================== --- head/lib/libufs/inode.c Wed Apr 11 18:39:47 2018 (r332414) +++ head/lib/libufs/inode.c Wed Apr 11 19:28:54 2018 (r332415) @@ -60,7 +60,7 @@ getino(struct uufsd *disk, void **dino, ino_t inode, i ERROR(disk, NULL); fs = &disk->d_fs; - if (inode >= fs->fs_ipg * fs->fs_ncg) { + if (inode >= (ino_t)fs->fs_ipg * fs->fs_ncg) { ERROR(disk, "inode number out of range"); return (-1); } From owner-svn-src-head@freebsd.org Wed Apr 11 19:46:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9B494F8C0CB; Wed, 11 Apr 2018 19:46:25 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4C02C6D5C3; Wed, 11 Apr 2018 19:46:25 +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 28B4C209E7; Wed, 11 Apr 2018 19:46:25 +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 w3BJkPwp088301; Wed, 11 Apr 2018 19:46:25 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3BJkOYL088296; Wed, 11 Apr 2018 19:46:24 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201804111946.w3BJkOYL088296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 11 Apr 2018 19:46:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332416 - in head/stand/efi: include libefi loader X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: in head/stand/efi: include libefi loader X-SVN-Commit-Revision: 332416 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 19:46:25 -0000 Author: imp Date: Wed Apr 11 19:46:24 2018 New Revision: 332416 URL: https://svnweb.freebsd.org/changeset/base/332416 Log: Refactor currdev setting Refactor the currdev setting to find the device we booted from. Limit searching when we don't already have a reasonable currdev from that to the same device only. Search a little harder for ZFS volumes as that's needed for loader.efi to live on an ESP. Sponsored by: Netflix Differential Review: https://reviews.freebsd.org/D13784 Modified: head/stand/efi/include/efilib.h head/stand/efi/include/efizfs.h head/stand/efi/libefi/efipart.c head/stand/efi/libefi/efizfs.c head/stand/efi/loader/main.c Modified: head/stand/efi/include/efilib.h ============================================================================== --- head/stand/efi/include/efilib.h Wed Apr 11 19:28:54 2018 (r332415) +++ head/stand/efi/include/efilib.h Wed Apr 11 19:46:24 2018 (r332416) @@ -59,10 +59,13 @@ typedef struct pdinfo uint32_t pd_unit; /* unit number */ uint32_t pd_open; /* reference counter */ void *pd_bcache; /* buffer cache data */ + struct pdinfo *pd_parent; /* Linked items (eg partitions) */ + struct devsw *pd_devsw; /* Back pointer to devsw */ } pdinfo_t; pdinfo_list_t *efiblk_get_pdinfo_list(struct devsw *dev); pdinfo_t *efiblk_get_pdinfo(struct devdesc *dev); +pdinfo_t *efiblk_get_pdinfo_by_handle(EFI_HANDLE h); void *efi_get_table(EFI_GUID *tbl); Modified: head/stand/efi/include/efizfs.h ============================================================================== --- head/stand/efi/include/efizfs.h Wed Apr 11 19:28:54 2018 (r332415) +++ head/stand/efi/include/efizfs.h Wed Apr 11 19:46:24 2018 (r332416) @@ -48,6 +48,7 @@ extern void efi_zfs_probe(void); extern zfsinfo_list_t *efizfs_get_zfsinfo_list(void); extern bool efi_zfs_is_preferred(EFI_HANDLE *h); extern EFI_HANDLE efizfs_get_handle_by_guid(uint64_t); +extern bool efizfs_get_guid_by_handle(EFI_HANDLE, uint64_t *); #endif Modified: head/stand/efi/libefi/efipart.c ============================================================================== --- head/stand/efi/libefi/efipart.c Wed Apr 11 19:28:54 2018 (r332415) +++ head/stand/efi/libefi/efipart.c Wed Apr 11 19:46:24 2018 (r332416) @@ -119,6 +119,7 @@ efiblk_get_pdinfo_list(struct devsw *dev) return (NULL); } +/* XXX this gets called way way too often, investigate */ pdinfo_t * efiblk_get_pdinfo(struct devdesc *dev) { @@ -136,6 +137,40 @@ efiblk_get_pdinfo(struct devdesc *dev) return (pd); } +static bool +same_handle(pdinfo_t *pd, EFI_HANDLE h) +{ + + return (pd->pd_handle == h || pd->pd_alias == h); +} + +pdinfo_t * +efiblk_get_pdinfo_by_handle(EFI_HANDLE h) +{ + pdinfo_t *dp, *pp; + + /* + * Check hard disks, then cd, then floppy + */ + STAILQ_FOREACH(dp, &hdinfo, pd_link) { + if (same_handle(dp, h)) + return (dp); + STAILQ_FOREACH(pp, &dp->pd_part, pd_link) { + if (same_handle(pp, h)) + return (pp); + } + } + STAILQ_FOREACH(dp, &cdinfo, pd_link) { + if (same_handle(dp, h)) + return (dp); + } + STAILQ_FOREACH(dp, &fdinfo, pd_link) { + if (same_handle(dp, h)) + return (dp); + } + return (NULL); +} + static int efiblk_pdinfo_count(pdinfo_list_t *pdi) { @@ -294,6 +329,8 @@ efipart_fdinfo_add(EFI_HANDLE handle, uint32_t uid, EF fd->pd_unit = uid; fd->pd_handle = handle; fd->pd_devpath = devpath; + fd->pd_parent = NULL; + fd->pd_devsw = &efipart_fddev; STAILQ_INSERT_TAIL(&fdinfo, fd, pd_link); return (0); } @@ -364,6 +401,8 @@ efipart_cdinfo_add(EFI_HANDLE handle, EFI_HANDLE alias cd->pd_unit = unit; cd->pd_alias = alias; cd->pd_devpath = devpath; + cd->pd_parent = NULL; + cd->pd_devsw = &efipart_cddev; STAILQ_INSERT_TAIL(&cdinfo, cd, pd_link); return (0); } @@ -489,6 +528,8 @@ efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE pd->pd_handle = part_handle; pd->pd_unit = node->PartitionNumber; pd->pd_devpath = part_devpath; + pd->pd_parent = hd; + pd->pd_devsw = &efipart_hddev; STAILQ_INSERT_TAIL(&hd->pd_part, pd, pd_link); return (0); } @@ -505,6 +546,8 @@ efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE hd->pd_handle = disk_handle; hd->pd_unit = unit; hd->pd_devpath = disk_devpath; + hd->pd_parent = NULL; + hd->pd_devsw = &efipart_hddev; STAILQ_INSERT_TAIL(&hdinfo, hd, pd_link); if (part_devpath == NULL) @@ -521,6 +564,8 @@ efipart_hdinfo_add(EFI_HANDLE disk_handle, EFI_HANDLE pd->pd_handle = part_handle; pd->pd_unit = node->PartitionNumber; pd->pd_devpath = part_devpath; + pd->pd_parent = hd; + pd->pd_devsw = &efipart_hddev; STAILQ_INSERT_TAIL(&hd->pd_part, pd, pd_link); return (0); @@ -579,6 +624,8 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) pd->pd_handle = disk_handle; pd->pd_unit = unit; pd->pd_devpath = devpath; + pd->pd_parent = NULL; + pd->pd_devsw = &efipart_hddev; STAILQ_INSERT_TAIL(&hdinfo, pd, pd_link); free(pathname); return (0); @@ -609,6 +656,8 @@ efipart_hdinfo_add_filepath(EFI_HANDLE disk_handle) pd->pd_handle = disk_handle; pd->pd_unit = unit; pd->pd_devpath = devpath; + pd->pd_parent = last; + pd->pd_devsw = &efipart_hddev; STAILQ_INSERT_TAIL(&last->pd_part, pd, pd_link); free(pathname); return (0); Modified: head/stand/efi/libefi/efizfs.c ============================================================================== --- head/stand/efi/libefi/efizfs.c Wed Apr 11 19:28:54 2018 (r332415) +++ head/stand/efi/libefi/efizfs.c Wed Apr 11 19:46:24 2018 (r332416) @@ -64,6 +64,22 @@ efizfs_get_handle_by_guid(uint64_t guid) return (NULL); } +bool +efizfs_get_guid_by_handle(EFI_HANDLE handle, uint64_t *guid) +{ + zfsinfo_t *zi; + + if (guid == NULL) + return (false); + STAILQ_FOREACH(zi, &zfsinfo, zi_link) { + if (zi->zi_handle == handle) { + *guid = zi->zi_pool_guid; + return (true); + } + } + return (false); +} + static void insert_zfs(EFI_HANDLE handle, uint64_t guid) { Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Wed Apr 11 19:28:54 2018 (r332415) +++ head/stand/efi/loader/main.c Wed Apr 11 19:46:24 2018 (r332416) @@ -78,6 +78,15 @@ EFI_GUID inputid = SIMPLE_TEXT_INPUT_PROTOCOL; static EFI_LOADED_IMAGE *img; +/* + * Number of seconds to wait for a keystroke before exiting with failure + * in the event no currdev is found. -2 means always break, -1 means + * never break, 0 means poll once and then reboot, > 0 means wait for + * that many seconds. "fail_timeout" can be set in the environment as + * well. + */ +static int fail_timeout = 5; + #ifdef EFI_ZFS_BOOT bool efi_zfs_is_preferred(EFI_HANDLE *h) @@ -169,113 +178,183 @@ out: } static void -set_devdesc_currdev(struct devsw *dev, int unit) +set_currdev_devdesc(struct devdesc *currdev) { + const char *devname; + + devname = efi_fmtdev(currdev); + + printf("Setting currdev to %s\n", devname); + + env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, env_nounset); + env_setenv("loaddev", EV_VOLATILE, devname, env_noset, env_nounset); +} + +static void +set_currdev_devsw(struct devsw *dev, int unit) +{ struct devdesc currdev; - char *devname; currdev.d_dev = dev; currdev.d_unit = unit; + + set_currdev_devdesc(&currdev); +} + +static void +set_currdev_pdinfo(pdinfo_t *dp) +{ + + /* + * Disks are special: they have partitions. if the parent + * pointer is non-null, we're a partition not a full disk + * and we need to adjust currdev appropriately. + */ + if (dp->pd_devsw->dv_type == DEVT_DISK) { + struct disk_devdesc currdev; + + currdev.dd.d_dev = dp->pd_devsw; + if (dp->pd_parent == NULL) { + currdev.dd.d_unit = dp->pd_unit; + currdev.d_slice = -1; + currdev.d_partition = -1; + } else { + currdev.dd.d_unit = dp->pd_parent->pd_unit; + currdev.d_slice = dp->pd_unit; + currdev.d_partition = 255; /* Assumes GPT */ + } + set_currdev_devdesc((struct devdesc *)&currdev); + } else { + set_currdev_devsw(dp->pd_devsw, dp->pd_unit); + } +} + +static bool +sanity_check_currdev(void) +{ + struct stat st; + + return (stat("/boot/defaults/loader.conf", &st) == 0); +} + +#ifdef EFI_ZFS_BOOT +static bool +probe_zfs_currdev(uint64_t guid) +{ + char *devname; + struct zfs_devdesc currdev; + + currdev.dd.d_dev = &zfs_dev; + currdev.dd.d_unit = 0; + currdev.pool_guid = guid; + currdev.root_guid = 0; + set_currdev_devdesc((struct devdesc *)&currdev); devname = efi_fmtdev(&currdev); + init_zfs_bootenv(devname); - env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, - env_nounset); - env_setenv("loaddev", EV_VOLATILE, devname, env_noset, env_nounset); + return (sanity_check_currdev()); } +#endif +static bool +try_as_currdev(pdinfo_t *hd, pdinfo_t *pp) +{ + uint64_t guid; + +#ifdef EFI_ZFS_BOOT + /* + * If there's a zpool on this device, try it as a ZFS + * filesystem, which has somewhat different setup than all + * other types of fs due to imperfect loader integration. + * This all stems from ZFS being both a device (zpool) and + * a filesystem, plus the boot env feature. + */ + if (efizfs_get_guid_by_handle(pp->pd_handle, &guid)) + return (probe_zfs_currdev(guid)); +#endif + /* + * All other filesystems just need the pdinfo + * initialized in the standard way. + */ + set_currdev_pdinfo(pp); + return (sanity_check_currdev()); +} + static int find_currdev(EFI_LOADED_IMAGE *img) { - pdinfo_list_t *pdi_list; pdinfo_t *dp, *pp; EFI_DEVICE_PATH *devpath, *copy; EFI_HANDLE h; - char *devname; + CHAR16 *text; struct devsw *dev; int unit; uint64_t extra; #ifdef EFI_ZFS_BOOT - /* Did efi_zfs_probe() detect the boot pool? */ + /* + * Did efi_zfs_probe() detect the boot pool? If so, use the zpool + * it found, if it's sane. ZFS is the only thing that looks for + * disks and pools to boot. This may change in the future, however, + * if we allow specifying which pool to boot from via UEFI variables + * rather than the bootenv stuff that FreeBSD uses today. + */ if (pool_guid != 0) { - struct zfs_devdesc currdev; - - currdev.dd.d_dev = &zfs_dev; - currdev.dd.d_unit = 0; - currdev.pool_guid = pool_guid; - currdev.root_guid = 0; - devname = efi_fmtdev(&currdev); - - env_setenv("currdev", EV_VOLATILE, devname, efi_setcurrdev, - env_nounset); - env_setenv("loaddev", EV_VOLATILE, devname, env_noset, - env_nounset); - init_zfs_bootenv(devname); - return (0); + printf("Trying ZFS pool\n"); + if (probe_zfs_currdev(pool_guid)) + return (0); } #endif /* EFI_ZFS_BOOT */ - /* We have device lists for hd, cd, fd, walk them all. */ - pdi_list = efiblk_get_pdinfo_list(&efipart_hddev); - STAILQ_FOREACH(dp, pdi_list, pd_link) { - struct disk_devdesc currdev; - - currdev.dd.d_dev = &efipart_hddev; - currdev.dd.d_unit = dp->pd_unit; - currdev.d_slice = -1; - currdev.d_partition = -1; - - if (dp->pd_handle == img->DeviceHandle) { - devname = efi_fmtdev(&currdev); - - env_setenv("currdev", EV_VOLATILE, devname, - efi_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, devname, - env_noset, env_nounset); - return (0); + /* + * Try to find the block device by its handle based on the + * image we're booting. If we can't find a sane partition, + * search all the other partitions of the disk. We do not + * search other disks because it's a violation of the UEFI + * boot protocol to do so. We fail and let UEFI go on to + * the next candidate. + */ + dp = efiblk_get_pdinfo_by_handle(img->DeviceHandle); + if (dp != NULL) { + text = efi_devpath_name(dp->pd_devpath); + if (text != NULL) { + printf("Trying ESP: %S\n", text); + efi_free_devpath_name(text); } - /* Assuming GPT partitioning. */ - STAILQ_FOREACH(pp, &dp->pd_part, pd_link) { - if (pp->pd_handle == img->DeviceHandle) { - currdev.d_slice = pp->pd_unit; - currdev.d_partition = 255; - devname = efi_fmtdev(&currdev); - - env_setenv("currdev", EV_VOLATILE, devname, - efi_setcurrdev, env_nounset); - env_setenv("loaddev", EV_VOLATILE, devname, - env_noset, env_nounset); - return (0); + set_currdev_pdinfo(dp); + if (sanity_check_currdev()) + return (0); + if (dp->pd_parent != NULL) { + dp = dp->pd_parent; + STAILQ_FOREACH(pp, &dp->pd_part, pd_link) { + text = efi_devpath_name(pp->pd_devpath); + if (text != NULL) { + printf("And now the part: %S\n", text); + efi_free_devpath_name(text); + } + /* + * Roll up the ZFS special case + * for those partitions that have + * zpools on them + */ + if (try_as_currdev(dp, pp)) + return (0); } } + } else { + printf("Can't find device by handle\n"); } - pdi_list = efiblk_get_pdinfo_list(&efipart_cddev); - STAILQ_FOREACH(dp, pdi_list, pd_link) { - if (dp->pd_handle == img->DeviceHandle || - dp->pd_alias == img->DeviceHandle) { - set_devdesc_currdev(&efipart_cddev, dp->pd_unit); - return (0); - } - } - - pdi_list = efiblk_get_pdinfo_list(&efipart_fddev); - STAILQ_FOREACH(dp, pdi_list, pd_link) { - if (dp->pd_handle == img->DeviceHandle) { - set_devdesc_currdev(&efipart_fddev, dp->pd_unit); - return (0); - } - } - /* * Try the device handle from our loaded image first. If that * fails, use the device path from the loaded image and see if * any of the nodes in that path match one of the enumerated - * handles. + * handles. Currently, this handle list is only for netboot. */ if (efi_handle_lookup(img->DeviceHandle, &dev, &unit, &extra) == 0) { - set_devdesc_currdev(dev, unit); - return (0); + set_currdev_devsw(dev, unit); + if (sanity_check_currdev()) + return (0); } copy = NULL; @@ -289,8 +368,9 @@ find_currdev(EFI_LOADED_IMAGE *img) copy = NULL; if (efi_handle_lookup(h, &dev, &unit, &extra) == 0) { - set_devdesc_currdev(dev, unit); - return (0); + set_currdev_devsw(dev, unit); + if (sanity_check_currdev()) + return (0); } devpath = efi_lookup_devpath(h); @@ -304,6 +384,33 @@ find_currdev(EFI_LOADED_IMAGE *img) return (ENOENT); } +static bool +interactive_interrupt(const char *msg) +{ + time_t now, then, last; + + last = 0; + now = then = getsecs(); + printf("%s\n", msg); + if (fail_timeout == -2) /* Always break to OK */ + return (true); + if (fail_timeout == -1) /* Never break to OK */ + return (false); + do { + if (last != now) { + printf("press any key to interrupt reboot in %d seconds\r", + fail_timeout - (int)(now - then)); + last = now; + } + + /* XXX no pause or timeout wait for char */ + if (ischar()) + return (true); + now = getsecs(); + } while (now - then < fail_timeout); + return (false); +} + EFI_STATUS main(int argc, CHAR16 *argv[]) { @@ -312,12 +419,13 @@ main(int argc, CHAR16 *argv[]) int i, j, vargood, howto; UINTN k; int has_kbd; + char *s; + EFI_DEVICE_PATH *imgpath; CHAR16 *text; + EFI_STATUS status; UINT16 boot_current; size_t sz; UINT16 boot_order[100]; - EFI_DEVICE_PATH *imgpath; - EFI_STATUS status; #if !defined(__arm__) char buf[40]; #endif @@ -356,12 +464,15 @@ main(int argc, CHAR16 *argv[]) /* * Parse the args to set the console settings, etc * boot1.efi passes these in, if it can read /boot.config or /boot/config - * or iPXE may be setup to pass these in. + * or iPXE may be setup to pass these in. Or the optional argument in the + * boot environment was used to pass these arguments in (in which case + * neither /boot.config nor /boot/config are consulted). * * Loop through the args, and for each one that contains an '=' that is * not the first character, add it to the environment. This allows * loader and kernel env vars to be passed on the command line. Convert - * args from UCS-2 to ASCII (16 to 8 bit) as they are copied. + * args from UCS-2 to ASCII (16 to 8 bit) as they are copied (though this + * method is flawed for non-ASCII characters). */ howto = 0; for (i = 1; i < argc; i++) { @@ -441,6 +552,10 @@ main(int argc, CHAR16 *argv[]) for (i = 0; howto_names[i].ev != NULL; i++) if (howto & howto_names[i].mask) setenv(howto_names[i].ev, "YES", 1); + + /* + * XXX we need fallback to this stuff after looking at the ConIn, ConOut and ConErr variables + */ if (howto & RB_MULTIPLE) { if (howto & RB_SERIAL) setenv("console", "comconsole efi" , 1); @@ -448,13 +563,17 @@ main(int argc, CHAR16 *argv[]) setenv("console", "efi comconsole" , 1); } else if (howto & RB_SERIAL) { setenv("console", "comconsole" , 1); - } + } else + setenv("console", "efi", 1); if (efi_copy_init()) { printf("failed to allocate staging area\n"); return (EFI_BUFFER_TOO_SMALL); } + if ((s = getenv("fail_timeout")) != NULL) + fail_timeout = strtol(s, NULL, 10); + /* * Scan the BLOCK IO MEDIA handles then * march through the device switch probing for things. @@ -479,6 +598,7 @@ main(int argc, CHAR16 *argv[]) printf("\n%s", bootprog_info); + /* Determine the devpath of our image so we can prefer it. */ text = efi_devpath_name(img->FilePath); if (text != NULL) { printf(" Load Path: %S\n", text); @@ -520,8 +640,16 @@ main(int argc, CHAR16 *argv[]) */ BS->SetWatchdogTimer(0, 0, 0, NULL); + /* + * Try and find a good currdev based on the image that was booted. + * It might be desirable here to have a short pause to allow falling + * through to the boot loader instead of returning instantly to follow + * the boot protocol and also allow an escape hatch for users wishing + * to try something different. + */ if (find_currdev(img) != 0) - return (EFI_NOT_FOUND); + if (!interactive_interrupt("Failed to find bootable partition")) + return (EFI_NOT_FOUND); efi_init_environment(); setenv("LINES", "24", 1); /* optional */ From owner-svn-src-head@freebsd.org Wed Apr 11 21:42:00 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ECA8BF93F4D; Wed, 11 Apr 2018 21:41:59 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9AEA469544; Wed, 11 Apr 2018 21:41:59 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 95F6921C9F; Wed, 11 Apr 2018 21:41:59 +0000 (UTC) (envelope-from shurd@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3BLfxqw048322; Wed, 11 Apr 2018 21:41:59 GMT (envelope-from shurd@FreeBSD.org) Received: (from shurd@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3BLfxho048321; Wed, 11 Apr 2018 21:41:59 GMT (envelope-from shurd@FreeBSD.org) Message-Id: <201804112141.w3BLfxho048321@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: shurd set sender to shurd@FreeBSD.org using -f From: Stephen Hurd Date: Wed, 11 Apr 2018 21:41:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332419 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: shurd X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 332419 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 21:42:00 -0000 Author: shurd Date: Wed Apr 11 21:41:59 2018 New Revision: 332419 URL: https://svnweb.freebsd.org/changeset/base/332419 Log: Properly initialize ifc_nhwtxqs. Also, since ifc_nhwrxqs is only used in one place, remove it from the struct. This was preventing iflib_dma_free() from being called via iflib_device_detach(). Submitted by: Matthew Macy Reviewed by: shurd Sponsored by: Limelight Networks Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Wed Apr 11 20:04:06 2018 (r332418) +++ head/sys/net/iflib.c Wed Apr 11 21:41:59 2018 (r332419) @@ -166,7 +166,6 @@ struct iflib_ctx { struct mtx ifc_mtx; uint16_t ifc_nhwtxqs; - uint16_t ifc_nhwrxqs; iflib_txq_t ifc_txqs; iflib_rxq_t ifc_rxqs; @@ -2289,7 +2288,7 @@ iflib_stop(if_ctx_t ctx) for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) { /* make sure all transmitters have completed before proceeding XXX */ - for (j = 0, di = txq->ift_ifdi; j < ctx->ifc_nhwrxqs; j++, di++) + for (j = 0, di = txq->ift_ifdi; j < rxq->ifr_nfl; j++, di++) bzero((void *)di->idi_vaddr, di->idi_size); /* also resets the free lists pidx/cidx */ for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) @@ -4198,6 +4197,7 @@ iflib_device_register(device_t dev, void *sc, if_share scctx = &ctx->ifc_softc_ctx; ifp = ctx->ifc_ifp; + ctx->ifc_nhwtxqs = sctx->isc_ntxqs; /* * XXX sanity check that ntxd & nrxd are a power of 2 From owner-svn-src-head@freebsd.org Wed Apr 11 22:12:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5D418F95ECA; Wed, 11 Apr 2018 22:12:40 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from cell.glebi.us (glebi.us [96.95.210.25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id D95156E599; Wed, 11 Apr 2018 22:12:39 +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 w3BLgj2h018020 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Wed, 11 Apr 2018 14:42:45 -0700 (PDT) (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id w3BLgjxa018019; Wed, 11 Apr 2018 14:42:45 -0700 (PDT) (envelope-from glebius@FreeBSD.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@FreeBSD.org using -f Date: Wed, 11 Apr 2018 14:42:44 -0700 From: Gleb Smirnoff To: "Jonathan T. Looney" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332114 - head/sys/netinet Message-ID: <20180411214244.GD1069@FreeBSD.org> References: <201804061648.w36GmBkd046593@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201804061648.w36GmBkd046593@repo.freebsd.org> User-Agent: Mutt/1.9.3 (2018-01-21) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 11 Apr 2018 22:12:40 -0000 On Fri, Apr 06, 2018 at 04:48:11PM +0000, Jonathan T. Looney wrote: J> Author: jtl J> Date: Fri Apr 6 16:48:11 2018 J> New Revision: 332114 J> URL: https://svnweb.freebsd.org/changeset/base/332114 J> J> Log: J> Check that in_pcbfree() is only called once for each PCB. If that J> assumption is violated, "bad things" could follow. J> J> I believe such an assert would have detected some of the problems jch@ J> was chasing in PR 203175 (see r307551). We also use it in our internal J> TCP development efforts. And, in case a bug does slip through to J> released code, this change silently ignores subsequent calls to J> in_pcbfree(). J> J> Reviewed by: rrs J> Sponsored by: Netflix, Inc. J> Differential Revision: https://reviews.freebsd.org/D14990 J> J> Modified: J> head/sys/netinet/in_pcb.c J> J> Modified: head/sys/netinet/in_pcb.c J> ============================================================================== J> --- head/sys/netinet/in_pcb.c Fri Apr 6 16:48:07 2018 (r332113) J> +++ head/sys/netinet/in_pcb.c Fri Apr 6 16:48:11 2018 (r332114) J> @@ -1288,6 +1288,13 @@ in_pcbfree(struct inpcb *inp) J> J> KASSERT(inp->inp_socket == NULL, ("%s: inp_socket != NULL", __func__)); J> J> + KASSERT((inp->inp_flags2 & INP_FREED) == 0, J> + ("%s: called twice for pcb %p", __func__, inp)); J> + if (inp->inp_flags2 & INP_FREED) { J> + INP_WUNLOCK(inp); J> + return; J> + } J> + This code will create Coverity report. IMHO, only KASSERT should be left. -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Thu Apr 12 02:10:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A832EF81522; Thu, 12 Apr 2018 02:10:01 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 571E582079; Thu, 12 Apr 2018 02:10:01 +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 51F472479E; Thu, 12 Apr 2018 02:10:01 +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 w3C2A1Bg078504; Thu, 12 Apr 2018 02:10:01 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3C2A1El078503; Thu, 12 Apr 2018 02:10:01 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804120210.w3C2A1El078503@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 12 Apr 2018 02:10:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332421 - head/sys/dev/vt/hw/vga X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/vt/hw/vga X-SVN-Commit-Revision: 332421 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 02:10:01 -0000 Author: emaste Date: Thu Apr 12 02:10:01 2018 New Revision: 332421 URL: https://svnweb.freebsd.org/changeset/base/332421 Log: vt: add three more cp437 mappings for vga textmode In UTF-8 locales mandoc uses a number of characters outside of the Basic Latin group, e.g. from general punctuation or miscellaneous mathematical symbols, and these rendered as ? in text mode. This change adds (char, replacement, code point, description): – - U+2013 En Dash ⟨ < U+27E8 Mathematical Left Angle Bracket ⟩ > U+27E9 Mathematical Right Angle Bracket This change addresses some common cases; there are others that still need to be added after a more thorough review. PR: 227409 MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/hw/vga/vt_vga.c Modified: head/sys/dev/vt/hw/vga/vt_vga.c ============================================================================== --- head/sys/dev/vt/hw/vga/vt_vga.c Wed Apr 11 22:23:22 2018 (r332420) +++ head/sys/dev/vt/hw/vga/vt_vga.c Thu Apr 12 02:10:01 2018 (r332421) @@ -237,6 +237,7 @@ static const struct unicp437 cp437table[] = { { 0x03c0, 0xe3, 0x00 }, { 0x03c3, 0xe5, 0x00 }, { 0x03c4, 0xe7, 0x00 }, { 0x03c6, 0xed, 0x00 }, { 0x03d5, 0xed, 0x00 }, { 0x2010, 0x2d, 0x00 }, + { 0x2013, 0x2d, 0x00 }, { 0x2014, 0x2d, 0x00 }, { 0x2018, 0x60, 0x00 }, { 0x2019, 0x27, 0x00 }, { 0x201c, 0x22, 0x00 }, { 0x201d, 0x22, 0x00 }, { 0x2022, 0x07, 0x00 }, @@ -285,7 +286,8 @@ static const struct unicp437 cp437table[] = { { 0x2640, 0x0c, 0x00 }, { 0x2642, 0x0b, 0x00 }, { 0x2660, 0x06, 0x00 }, { 0x2663, 0x05, 0x00 }, { 0x2665, 0x03, 0x01 }, { 0x266a, 0x0d, 0x00 }, - { 0x266c, 0x0e, 0x00 }, + { 0x266c, 0x0e, 0x00 }, { 0x27e8, 0x3c, 0x00 }, + { 0x27e9, 0x3e, 0x00 }, }; static uint8_t From owner-svn-src-head@freebsd.org Thu Apr 12 04:03:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8249CF8B975; Thu, 12 Apr 2018 04:03:19 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: from mail-ot0-x232.google.com (mail-ot0-x232.google.com [IPv6:2607:f8b0:4003:c0f::232]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DA2997BDDE; Thu, 12 Apr 2018 04:03:18 +0000 (UTC) (envelope-from kmacybsd@gmail.com) Received: by mail-ot0-x232.google.com with SMTP id o9-v6so4502258otj.5; Wed, 11 Apr 2018 21:03:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=jEpsVBpjOeHmHwJ9YqQlRhnN0o+haB2L+pada8eVKcw=; b=qQiMnLWrYIWUEF1hcODM6ceSGvaIOEqtHW6X7tcANWfJfb70Bpp/R5UJpXlEd5bUh3 BUNHNyvFNoO+Z9ChWM7/gfpOWHmaMpqUZ9/bNBuWG17QFVdYDAij09QDlpYQ2NbzQ+Cz u2dmK4ZgwBBxYNkodT0SqGXBxNS4eUjJbz1CQJ95IZ06klIyEJ9PJk7jgVPjsoLCPpuD ZsE+zz7MzsyiKmvnOr+nTnt3qux3L3GyqAZNLRm5Kr82BccHxMmOFpbPjJuxXBS4nHqn aOrvJiU/KMbf0h1VwocCJ+h0RZ3KqHAMr0XwMo8gyaJq4Jlqf1Qmz8em9/Dhqz2utksp jFpQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=jEpsVBpjOeHmHwJ9YqQlRhnN0o+haB2L+pada8eVKcw=; b=Bdh4+x24+hTrY42WcD1w9VVXPjKpeOalOMJOgsxv/ELjd5RGVGO8OBYrNQhVf2d+8Z cEe6SG2NUfSledhwgYy+ov3koEYmzHOE4Il3BB6xkyX3t8YTFzEUX5pRgElyNmYcHJTU +v0HfNmicB9/xdVZGn6wX4xfCbaGHHRgd7WhkyiFWO+QmVQ3kKxirpZHZ6TaOYBPoIhV a7K1Sz9eji0uJkZP9C6xl1hizjANHGYdKlAcbkSmMhFsMGb20iKtE4nnY8qe+Ydz88pe cegnlSay8nQILpI8y8jHYhXZ+tcwu4Zc59JzkDVv+WUpVAkYX4EoYNfPLVr3qf1fH3dj zs3Q== X-Gm-Message-State: ALQs6tCruOkhuOxOxZs5EVjN6TqNsTLDKxS4lY2DUCEKqcEXMqENjNXZ vbA4YhZRxtrhwW+AJ3+CbLD37PRG0d39FswZmuUChG8k X-Google-Smtp-Source: AIpwx4+ZAWUOUvCacRFisvtGJy5WsDAG2c+tx/AhM20HwPxM7663JKoyWu0UedCIoLD0KVFOi0/Ow6eeiVoOY+1JUJQ= X-Received: by 2002:a9d:4082:: with SMTP id n2-v6mr4643162ote.150.1523505798141; Wed, 11 Apr 2018 21:03:18 -0700 (PDT) MIME-Version: 1.0 Sender: kmacybsd@gmail.com Received: by 2002:a9d:4782:0:0:0:0:0 with HTTP; Wed, 11 Apr 2018 21:03:17 -0700 (PDT) In-Reply-To: <201804112141.w3BLfxho048321@repo.freebsd.org> References: <201804112141.w3BLfxho048321@repo.freebsd.org> From: "K. Macy" Date: Wed, 11 Apr 2018 21:03:17 -0700 X-Google-Sender-Auth: _ukj_4ZZudNujFDhCPFbCpb6MCc Message-ID: Subject: Re: svn commit: r332419 - head/sys/net To: Stephen Hurd Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 04:03:19 -0000 There was a panic inducing merge error, please apply if you encounter problems: @ -2288,7 +2294,7 @@ iflib_stop(if_ctx_t ctx) for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) { /* make sure all transmitters have completed before proceeding XXX */ - for (j = 0, di = txq->ift_ifdi; j < rxq->ifr_nfl; j++, di++) + for (j = 0, di = rxq->ifr_ifdi; j < rxq->ifr_nfl; j++, di++) bzero((void *)di->idi_vaddr, di->idi_size); /* also resets the free lists pidx/cidx */ for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) On Wed, Apr 11, 2018 at 2:41 PM, Stephen Hurd wrote: > Author: shurd > Date: Wed Apr 11 21:41:59 2018 > New Revision: 332419 > URL: https://svnweb.freebsd.org/changeset/base/332419 > > Log: > Properly initialize ifc_nhwtxqs. > > Also, since ifc_nhwrxqs is only used in one place, remove it from the struct. > This was preventing iflib_dma_free() from being called via > iflib_device_detach(). > > Submitted by: Matthew Macy > Reviewed by: shurd > Sponsored by: Limelight Networks > > Modified: > head/sys/net/iflib.c > > Modified: head/sys/net/iflib.c > ============================================================================== > --- head/sys/net/iflib.c Wed Apr 11 20:04:06 2018 (r332418) > +++ head/sys/net/iflib.c Wed Apr 11 21:41:59 2018 (r332419) > @@ -166,7 +166,6 @@ struct iflib_ctx { > struct mtx ifc_mtx; > > uint16_t ifc_nhwtxqs; > - uint16_t ifc_nhwrxqs; > > iflib_txq_t ifc_txqs; > iflib_rxq_t ifc_rxqs; > @@ -2289,7 +2288,7 @@ iflib_stop(if_ctx_t ctx) > for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) { > /* make sure all transmitters have completed before proceeding XXX */ > > - for (j = 0, di = txq->ift_ifdi; j < ctx->ifc_nhwrxqs; j++, di++) > + for (j = 0, di = txq->ift_ifdi; j < rxq->ifr_nfl; j++, di++) > bzero((void *)di->idi_vaddr, di->idi_size); > /* also resets the free lists pidx/cidx */ > for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) > @@ -4198,6 +4197,7 @@ iflib_device_register(device_t dev, void *sc, if_share > > scctx = &ctx->ifc_softc_ctx; > ifp = ctx->ifc_ifp; > + ctx->ifc_nhwtxqs = sctx->isc_ntxqs; > > /* > * XXX sanity check that ntxd & nrxd are a power of 2 > _______________________________________________ > 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 Apr 12 04:11:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0C7C1F8C5B9; Thu, 12 Apr 2018 04:11:38 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B6B0B7E959; Thu, 12 Apr 2018 04:11:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B1CB125CED; Thu, 12 Apr 2018 04:11:37 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3C4BbQ8038461; Thu, 12 Apr 2018 04:11:37 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3C4Bbd1038460; Thu, 12 Apr 2018 04:11:37 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201804120411.w3C4Bbd1038460@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Thu, 12 Apr 2018 04:11:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332422 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 332422 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 04:11:38 -0000 Author: mjg Date: Thu Apr 12 04:11:37 2018 New Revision: 332422 URL: https://svnweb.freebsd.org/changeset/base/332422 Log: iflib: fix up a mismerge in r332419 Lead to crashes on boot while in ifconfig. Submitted by: Matthew Macy Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Apr 12 02:10:01 2018 (r332421) +++ head/sys/net/iflib.c Thu Apr 12 04:11:37 2018 (r332422) @@ -2288,7 +2288,7 @@ iflib_stop(if_ctx_t ctx) for (i = 0; i < scctx->isc_nrxqsets; i++, rxq++) { /* make sure all transmitters have completed before proceeding XXX */ - for (j = 0, di = txq->ift_ifdi; j < rxq->ifr_nfl; j++, di++) + for (j = 0, di = rxq->ifr_ifdi; j < rxq->ifr_nfl; j++, di++) bzero((void *)di->idi_vaddr, di->idi_size); /* also resets the free lists pidx/cidx */ for (j = 0, fl = rxq->ifr_fl; j < rxq->ifr_nfl; j++, fl++) From owner-svn-src-head@freebsd.org Thu Apr 12 07:20:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A2489F9BCF1; Thu, 12 Apr 2018 07:20:51 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4249F6A77B; Thu, 12 Apr 2018 07:20:51 +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 3CF4227CA5; Thu, 12 Apr 2018 07:20:51 +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 w3C7KpY3032122; Thu, 12 Apr 2018 07:20:51 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3C7Koe4032111; Thu, 12 Apr 2018 07:20:50 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201804120720.w3C7Koe4032111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Thu, 12 Apr 2018 07:20:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332423 - in head/sys: conf dev/cxgbe dev/ixgbe dev/ixl dev/netmap dev/re modules/netmap net sys X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in head/sys: conf dev/cxgbe dev/ixgbe dev/ixl dev/netmap dev/re modules/netmap net sys X-SVN-Commit-Revision: 332423 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 07:20:52 -0000 Author: vmaffione Date: Thu Apr 12 07:20:50 2018 New Revision: 332423 URL: https://svnweb.freebsd.org/changeset/base/332423 Log: netmap: align codebase to the current upstream (commit id 3fb001303718146) Changelist: - Turn tx_rings and rx_rings arrays into arrays of pointers to kring structs. This patch includes fixes for ixv, ixl, ix, re, cxgbe, iflib, vtnet and ptnet drivers to cope with the change. - Generalize the nm_config() callback to accept a struct containing many parameters. - Introduce NKR_FAKERING to support buffers sharing (used for netmap pipes) - Improved API for external VALE modules. - Various bug fixes and improvements to the netmap memory allocator, including support for externally (userspace) allocated memory. - Refactoring of netmap pipes: now linked rings share the same netmap buffers, with a separate set of kring pointers (rhead, rcur, rtail). Buffer swapping does not need to happen anymore. - Large refactoring of the control API towards an extensible solution; the goal is to allow the addition of more commands and extension of existing ones (with new options) without the need of hacks or the risk of running out of configuration space. A new NIOCCTRL ioctl has been added to handle all the requests of the new control API, which cover all the functionalities so far supported. The netmap API bumps from 11 to 12 with this patch. Full backward compatibility is provided for the old control command (NIOCREGIF), by means of a new netmap_legacy module. Many parts of the old netmap.h header has now been moved to netmap_legacy.h (included by netmap.h). Approved by: hrs (mentor) Added: head/sys/dev/netmap/netmap_legacy.c (contents, props changed) head/sys/net/netmap_legacy.h (contents, props changed) Modified: head/sys/conf/files head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/ixgbe/if_ixv.c head/sys/dev/ixl/ixl_pf_main.c head/sys/dev/ixl/ixl_txrx.c head/sys/dev/netmap/if_ptnet.c head/sys/dev/netmap/if_re_netmap.h head/sys/dev/netmap/if_vtnet_netmap.h head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_freebsd.c head/sys/dev/netmap/netmap_generic.c head/sys/dev/netmap/netmap_kern.h head/sys/dev/netmap/netmap_mem2.c head/sys/dev/netmap/netmap_mem2.h head/sys/dev/netmap/netmap_monitor.c head/sys/dev/netmap/netmap_pipe.c head/sys/dev/netmap/netmap_pt.c head/sys/dev/netmap/netmap_vale.c head/sys/dev/re/if_re.c head/sys/modules/netmap/Makefile head/sys/net/iflib.c head/sys/net/netmap.h head/sys/net/netmap_user.h head/sys/net/netmap_virt.h head/sys/sys/param.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Apr 12 04:11:37 2018 (r332422) +++ head/sys/conf/files Thu Apr 12 07:20:50 2018 (r332423) @@ -2535,6 +2535,7 @@ dev/netmap/netmap_offloadings.c optional netmap dev/netmap/netmap_pipe.c optional netmap dev/netmap/netmap_pt.c optional netmap dev/netmap/netmap_vale.c optional netmap +dev/netmap/netmap_legacy.c optional netmap # compile-with "${NORMAL_C} -Wconversion -Wextra" dev/nfsmb/nfsmb.c optional nfsmb pci dev/nge/if_nge.c optional nge Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Thu Apr 12 04:11:37 2018 (r332422) +++ head/sys/dev/cxgbe/t4_netmap.c Thu Apr 12 07:20:50 2018 (r332423) @@ -344,7 +344,7 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi for_each_nm_rxq(vi, i, nm_rxq) { struct irq *irq = &sc->irq[vi->first_intr + i]; - kring = &na->rx_rings[nm_rxq->nid]; + kring = na->rx_rings[nm_rxq->nid]; if (!nm_kring_pending_on(kring) || nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID) continue; @@ -375,7 +375,7 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi } for_each_nm_txq(vi, i, nm_txq) { - kring = &na->tx_rings[nm_txq->nid]; + kring = na->tx_rings[nm_txq->nid]; if (!nm_kring_pending_on(kring) || nm_txq->cntxt_id != INVALID_NM_TXQ_CNTXT_ID) continue; @@ -427,7 +427,7 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *v for_each_nm_txq(vi, i, nm_txq) { struct sge_qstat *spg = (void *)&nm_txq->desc[nm_txq->sidx]; - kring = &na->tx_rings[nm_txq->nid]; + kring = na->tx_rings[nm_txq->nid]; if (!nm_kring_pending_off(kring) || nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID) continue; @@ -445,7 +445,7 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *v for_each_nm_rxq(vi, i, nm_rxq) { struct irq *irq = &sc->irq[vi->first_intr + i]; - kring = &na->rx_rings[nm_rxq->nid]; + kring = na->rx_rings[nm_rxq->nid]; if (!nm_kring_pending_off(kring) || nm_rxq->iq_cntxt_id == INVALID_NM_RXQ_CNTXT_ID) continue; @@ -933,7 +933,7 @@ t4_nm_intr(void *arg) struct adapter *sc = vi->pi->adapter; struct ifnet *ifp = vi->ifp; struct netmap_adapter *na = NA(ifp); - struct netmap_kring *kring = &na->rx_rings[nm_rxq->nid]; + struct netmap_kring *kring = na->rx_rings[nm_rxq->nid]; struct netmap_ring *ring = kring->ring; struct iq_desc *d = &nm_rxq->iq_desc[nm_rxq->iq_cidx]; const void *cpl; Modified: head/sys/dev/ixgbe/if_ixv.c ============================================================================== --- head/sys/dev/ixgbe/if_ixv.c Thu Apr 12 04:11:37 2018 (r332422) +++ head/sys/dev/ixgbe/if_ixv.c Thu Apr 12 07:20:50 2018 (r332423) @@ -1450,7 +1450,7 @@ ixv_initialize_receive_units(if_ctx_t ctx) */ if (ifp->if_capenable & IFCAP_NETMAP) { struct netmap_adapter *na = NA(ifp); - struct netmap_kring *kring = &na->rx_rings[j]; + struct netmap_kring *kring = na->rx_rings[j]; int t = na->num_rx_desc - 1 - nm_kr_rxspace(kring); IXGBE_WRITE_REG(hw, IXGBE_VFRDT(rxr->me), t); Modified: head/sys/dev/ixl/ixl_pf_main.c ============================================================================== --- head/sys/dev/ixl/ixl_pf_main.c Thu Apr 12 04:11:37 2018 (r332422) +++ head/sys/dev/ixl/ixl_pf_main.c Thu Apr 12 07:20:50 2018 (r332423) @@ -2240,7 +2240,7 @@ ixl_initialize_vsi(struct ixl_vsi *vsi) /* preserve queue */ if (vsi->ifp->if_capenable & IFCAP_NETMAP) { struct netmap_adapter *na = NA(vsi->ifp); - struct netmap_kring *kring = &na->rx_rings[i]; + struct netmap_kring *kring = na->rx_rings[i]; int t = na->num_rx_desc - 1 - nm_kr_rxspace(kring); wr32(vsi->hw, I40E_QRX_TAIL(que->me), t); } else Modified: head/sys/dev/ixl/ixl_txrx.c ============================================================================== --- head/sys/dev/ixl/ixl_txrx.c Thu Apr 12 04:11:37 2018 (r332422) +++ head/sys/dev/ixl/ixl_txrx.c Thu Apr 12 07:20:50 2018 (r332423) @@ -547,7 +547,7 @@ ixl_init_tx_ring(struct ixl_queue *que) * netmap slot index, si */ if (slot) { - int si = netmap_idx_n2k(&na->tx_rings[que->me], i); + int si = netmap_idx_n2k(na->tx_rings[que->me], i); netmap_load_map(na, buf->tag, buf->map, NMB(na, slot + si)); } #endif /* DEV_NETMAP */ @@ -1214,7 +1214,7 @@ ixl_init_rx_ring(struct ixl_queue *que) * an mbuf, so end the block with a continue; */ if (slot) { - int sj = netmap_idx_n2k(&na->rx_rings[que->me], j); + int sj = netmap_idx_n2k(na->rx_rings[que->me], j); uint64_t paddr; void *addr; Modified: head/sys/dev/netmap/if_ptnet.c ============================================================================== --- head/sys/dev/netmap/if_ptnet.c Thu Apr 12 04:11:37 2018 (r332422) +++ head/sys/dev/netmap/if_ptnet.c Thu Apr 12 07:20:50 2018 (r332423) @@ -210,8 +210,8 @@ static int ptnet_irqs_init(struct ptnet_softc *sc); static void ptnet_irqs_fini(struct ptnet_softc *sc); static uint32_t ptnet_nm_ptctl(if_t ifp, uint32_t cmd); -static int ptnet_nm_config(struct netmap_adapter *na, unsigned *txr, - unsigned *txd, unsigned *rxr, unsigned *rxd); +static int ptnet_nm_config(struct netmap_adapter *na, + struct nm_config_info *info); static void ptnet_update_vnet_hdr(struct ptnet_softc *sc); static int ptnet_nm_register(struct netmap_adapter *na, int onoff); static int ptnet_nm_txsync(struct netmap_kring *kring, int flags); @@ -1104,18 +1104,20 @@ ptnet_nm_ptctl(if_t ifp, uint32_t cmd) } static int -ptnet_nm_config(struct netmap_adapter *na, unsigned *txr, unsigned *txd, - unsigned *rxr, unsigned *rxd) +ptnet_nm_config(struct netmap_adapter *na, struct nm_config_info *info) { struct ptnet_softc *sc = if_getsoftc(na->ifp); - *txr = bus_read_4(sc->iomem, PTNET_IO_NUM_TX_RINGS); - *rxr = bus_read_4(sc->iomem, PTNET_IO_NUM_RX_RINGS); - *txd = bus_read_4(sc->iomem, PTNET_IO_NUM_TX_SLOTS); - *rxd = bus_read_4(sc->iomem, PTNET_IO_NUM_RX_SLOTS); + info->num_tx_rings = bus_read_4(sc->iomem, PTNET_IO_NUM_TX_RINGS); + info->num_rx_rings = bus_read_4(sc->iomem, PTNET_IO_NUM_RX_RINGS); + info->num_tx_descs = bus_read_4(sc->iomem, PTNET_IO_NUM_TX_SLOTS); + info->num_rx_descs = bus_read_4(sc->iomem, PTNET_IO_NUM_RX_SLOTS); + info->rx_buf_maxsize = NETMAP_BUF_SIZE(na); - device_printf(sc->dev, "txr %u, rxr %u, txd %u, rxd %u\n", - *txr, *rxr, *txd, *rxd); + device_printf(sc->dev, "txr %u, rxr %u, txd %u, rxd %u, rxbufsz %u\n", + info->num_tx_rings, info->num_rx_rings, + info->num_tx_descs, info->num_rx_descs, + info->rx_buf_maxsize); return 0; } @@ -1133,9 +1135,9 @@ ptnet_sync_from_csb(struct ptnet_softc *sc, struct net struct netmap_kring *kring; if (i < na->num_tx_rings) { - kring = na->tx_rings + i; + kring = na->tx_rings[i]; } else { - kring = na->rx_rings + i - na->num_tx_rings; + kring = na->rx_rings[i - na->num_tx_rings]; } kring->rhead = kring->ring->head = ptgh->head; kring->rcur = kring->ring->cur = ptgh->cur; @@ -1228,7 +1230,7 @@ ptnet_nm_register(struct netmap_adapter *na, int onoff if (native) { for_rx_tx(t) { for (i = 0; i <= nma_get_nrings(na, t); i++) { - struct netmap_kring *kring = &NMR(na, t)[i]; + struct netmap_kring *kring = NMR(na, t)[i]; if (nm_kring_pending_on(kring)) { kring->nr_mode = NKR_NETMAP_ON; @@ -1243,7 +1245,7 @@ ptnet_nm_register(struct netmap_adapter *na, int onoff nm_clear_native_flags(na); for_rx_tx(t) { for (i = 0; i <= nma_get_nrings(na, t); i++) { - struct netmap_kring *kring = &NMR(na, t)[i]; + struct netmap_kring *kring = NMR(na, t)[i]; if (nm_kring_pending_off(kring)) { kring->nr_mode = NKR_NETMAP_OFF; @@ -1758,7 +1760,7 @@ ptnet_drain_transmit_queue(struct ptnet_queue *pq, uns ptgh = pq->ptgh; pthg = pq->pthg; - kring = na->tx_rings + pq->kring_id; + kring = na->tx_rings[pq->kring_id]; ring = kring->ring; lim = kring->nkr_num_slots - 1; head = ring->head; @@ -2021,7 +2023,7 @@ ptnet_rx_eof(struct ptnet_queue *pq, unsigned int budg struct ptnet_csb_gh *ptgh = pq->ptgh; struct ptnet_csb_hg *pthg = pq->pthg; struct netmap_adapter *na = &sc->ptna->dr.up; - struct netmap_kring *kring = na->rx_rings + pq->kring_id; + struct netmap_kring *kring = na->rx_rings[pq->kring_id]; struct netmap_ring *ring = kring->ring; unsigned int const lim = kring->nkr_num_slots - 1; unsigned int batch_count = 0; Modified: head/sys/dev/netmap/if_re_netmap.h ============================================================================== --- head/sys/dev/netmap/if_re_netmap.h Thu Apr 12 04:11:37 2018 (r332422) +++ head/sys/dev/netmap/if_re_netmap.h Thu Apr 12 07:20:50 2018 (r332423) @@ -304,7 +304,7 @@ re_netmap_tx_init(struct rl_softc *sc) /* l points in the netmap ring, i points in the NIC ring */ for (i = 0; i < n; i++) { uint64_t paddr; - int l = netmap_idx_n2k(&na->tx_rings[0], i); + int l = netmap_idx_n2k(na->tx_rings[0], i); void *addr = PNMB(na, slot + l, &paddr); desc[i].rl_bufaddr_lo = htole32(RL_ADDR_LO(paddr)); @@ -330,11 +330,11 @@ re_netmap_rx_init(struct rl_softc *sc) * Do not release the slots owned by userspace, * and also keep one empty. */ - max_avail = n - 1 - nm_kr_rxspace(&na->rx_rings[0]); + max_avail = n - 1 - nm_kr_rxspace(na->rx_rings[0]); for (nic_i = 0; nic_i < n; nic_i++) { void *addr; uint64_t paddr; - uint32_t nm_i = netmap_idx_n2k(&na->rx_rings[0], nic_i); + uint32_t nm_i = netmap_idx_n2k(na->rx_rings[0], nic_i); addr = PNMB(na, slot + nm_i, &paddr); Modified: head/sys/dev/netmap/if_vtnet_netmap.h ============================================================================== --- head/sys/dev/netmap/if_vtnet_netmap.h Thu Apr 12 04:11:37 2018 (r332422) +++ head/sys/dev/netmap/if_vtnet_netmap.h Thu Apr 12 07:20:50 2018 (r332423) @@ -383,7 +383,7 @@ vtnet_netmap_init_rx_buffers(struct SOFTC_T *sc) if (!nm_native_on(na)) return 0; for (r = 0; r < na->num_rx_rings; r++) { - struct netmap_kring *kring = &na->rx_rings[r]; + struct netmap_kring *kring = na->rx_rings[r]; struct vtnet_rxq *rxq = &sc->vtnet_rxqs[r]; struct virtqueue *vq = rxq->vtnrx_vq; struct netmap_slot* slot; @@ -407,29 +407,6 @@ vtnet_netmap_init_rx_buffers(struct SOFTC_T *sc) return 1; } -/* Update the virtio-net device configurations. Number of queues can - * change dinamically, by 'ethtool --set-channels $IFNAME combined $N'. - * This is actually the only way virtio-net can currently enable - * the multiqueue mode. - * XXX note that we seem to lose packets if the netmap ring has more - * slots than the queue - */ -static int -vtnet_netmap_config(struct netmap_adapter *na, u_int *txr, u_int *txd, - u_int *rxr, u_int *rxd) -{ - struct ifnet *ifp = na->ifp; - struct SOFTC_T *sc = ifp->if_softc; - - *txr = *rxr = sc->vtnet_max_vq_pairs; - *rxd = 512; // sc->vtnet_rx_nmbufs; - *txd = *rxd; // XXX - D("vtnet config txq=%d, txd=%d rxq=%d, rxd=%d", - *txr, *txd, *rxr, *rxd); - - return 0; -} - static void vtnet_netmap_attach(struct SOFTC_T *sc) { @@ -443,7 +420,6 @@ vtnet_netmap_attach(struct SOFTC_T *sc) na.nm_register = vtnet_netmap_reg; na.nm_txsync = vtnet_netmap_txsync; na.nm_rxsync = vtnet_netmap_rxsync; - na.nm_config = vtnet_netmap_config; na.nm_intr = vtnet_netmap_intr; na.num_tx_rings = na.num_rx_rings = sc->vtnet_max_vq_pairs; D("max rings %d", sc->vtnet_max_vq_pairs); Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Thu Apr 12 04:11:37 2018 (r332422) +++ head/sys/dev/netmap/netmap.c Thu Apr 12 07:20:50 2018 (r332423) @@ -262,7 +262,7 @@ ports attached to the switch) * * Any network interface known to the system (including a persistent VALE * port) can be attached to a VALE switch by issuing the - * NETMAP_BDG_ATTACH subcommand. After the attachment, persistent VALE ports + * NETMAP_REQ_VALE_ATTACH command. After the attachment, persistent VALE ports * look exactly like ephemeral VALE ports (as created in step 2 above). The * attachment of other interfaces, instead, requires the creation of a * netmap_bwrap_adapter. Moreover, the attached interface must be put in @@ -591,9 +591,9 @@ void netmap_set_ring(struct netmap_adapter *na, u_int ring_id, enum txrx t, int stopped) { if (stopped) - netmap_disable_ring(NMR(na, t) + ring_id, stopped); + netmap_disable_ring(NMR(na, t)[ring_id], stopped); else - NMR(na, t)[ring_id].nkr_stopped = 0; + NMR(na, t)[ring_id]->nkr_stopped = 0; } @@ -745,39 +745,42 @@ nm_dump_buf(char *p, int len, int lim, char *dst) int netmap_update_config(struct netmap_adapter *na) { - u_int txr, txd, rxr, rxd; + struct nm_config_info info; - txr = txd = rxr = rxd = 0; + bzero(&info, sizeof(info)); if (na->nm_config == NULL || - na->nm_config(na, &txr, &txd, &rxr, &rxd)) - { + na->nm_config(na, &info)) { /* take whatever we had at init time */ - txr = na->num_tx_rings; - txd = na->num_tx_desc; - rxr = na->num_rx_rings; - rxd = na->num_rx_desc; + info.num_tx_rings = na->num_tx_rings; + info.num_tx_descs = na->num_tx_desc; + info.num_rx_rings = na->num_rx_rings; + info.num_rx_descs = na->num_rx_desc; + info.rx_buf_maxsize = na->rx_buf_maxsize; } - if (na->num_tx_rings == txr && na->num_tx_desc == txd && - na->num_rx_rings == rxr && na->num_rx_desc == rxd) + if (na->num_tx_rings == info.num_tx_rings && + na->num_tx_desc == info.num_tx_descs && + na->num_rx_rings == info.num_rx_rings && + na->num_rx_desc == info.num_rx_descs && + na->rx_buf_maxsize == info.rx_buf_maxsize) return 0; /* nothing changed */ - if (netmap_verbose || na->active_fds > 0) { - D("stored config %s: txring %d x %d, rxring %d x %d", - na->name, - na->num_tx_rings, na->num_tx_desc, - na->num_rx_rings, na->num_rx_desc); - D("new config %s: txring %d x %d, rxring %d x %d", - na->name, txr, txd, rxr, rxd); - } if (na->active_fds == 0) { - D("configuration changed (but fine)"); - na->num_tx_rings = txr; - na->num_tx_desc = txd; - na->num_rx_rings = rxr; - na->num_rx_desc = rxd; + D("configuration changed for %s: txring %d x %d, " + "rxring %d x %d, rxbufsz %d", + na->name, na->num_tx_rings, na->num_tx_desc, + na->num_rx_rings, na->num_rx_desc, na->rx_buf_maxsize); + na->num_tx_rings = info.num_tx_rings; + na->num_tx_desc = info.num_tx_descs; + na->num_rx_rings = info.num_rx_rings; + na->num_rx_desc = info.num_rx_descs; + na->rx_buf_maxsize = info.rx_buf_maxsize; return 0; } - D("configuration changed while active, this is bad..."); + D("WARNING: configuration changed for %s while active: " + "txring %d x %d, rxring %d x %d, rxbufsz %d", + na->name, info.num_tx_rings, info.num_tx_descs, + info.num_rx_rings, info.num_rx_descs, + info.rx_buf_maxsize); return 1; } @@ -827,7 +830,9 @@ netmap_krings_create(struct netmap_adapter *na, u_int n[NR_TX] = na->num_tx_rings + 1; n[NR_RX] = na->num_rx_rings + 1; - len = (n[NR_TX] + n[NR_RX]) * sizeof(struct netmap_kring) + tailroom; + len = (n[NR_TX] + n[NR_RX]) * + (sizeof(struct netmap_kring) + sizeof(struct netmap_kring *)) + + tailroom; na->tx_rings = nm_os_malloc((size_t)len); if (na->tx_rings == NULL) { @@ -835,6 +840,14 @@ netmap_krings_create(struct netmap_adapter *na, u_int return ENOMEM; } na->rx_rings = na->tx_rings + n[NR_TX]; + na->tailroom = na->rx_rings + n[NR_RX]; + + /* link the krings in the krings array */ + kring = (struct netmap_kring *)((char *)na->tailroom + tailroom); + for (i = 0; i < n[NR_TX] + n[NR_RX]; i++) { + na->tx_rings[i] = kring; + kring++; + } /* * All fields in krings are 0 except the one initialized below. @@ -843,9 +856,10 @@ netmap_krings_create(struct netmap_adapter *na, u_int for_rx_tx(t) { ndesc = nma_get_ndesc(na, t); for (i = 0; i < n[t]; i++) { - kring = &NMR(na, t)[i]; + kring = NMR(na, t)[i]; bzero(kring, sizeof(*kring)); kring->na = na; + kring->notify_na = na; kring->ring_id = i; kring->tx = t; kring->nkr_num_slots = ndesc; @@ -854,6 +868,8 @@ netmap_krings_create(struct netmap_adapter *na, u_int if (i < nma_get_nrings(na, t)) { kring->nm_sync = (t == NR_TX ? na->nm_txsync : na->nm_rxsync); } else { + if (!(na->na_flags & NAF_HOST_RINGS)) + kring->nr_kflags |= NKR_FAKERING; kring->nm_sync = (t == NR_TX ? netmap_txsync_to_host: netmap_rxsync_from_host); @@ -874,7 +890,6 @@ netmap_krings_create(struct netmap_adapter *na, u_int nm_os_selinfo_init(&na->si[t]); } - na->tailroom = na->rx_rings + n[NR_RX]; return 0; } @@ -885,7 +900,7 @@ netmap_krings_create(struct netmap_adapter *na, u_int void netmap_krings_delete(struct netmap_adapter *na) { - struct netmap_kring *kring = na->tx_rings; + struct netmap_kring **kring = na->tx_rings; enum txrx t; if (na->tx_rings == NULL) { @@ -898,8 +913,8 @@ netmap_krings_delete(struct netmap_adapter *na) /* we rely on the krings layout described above */ for ( ; kring != na->tailroom; kring++) { - mtx_destroy(&kring->q_lock); - nm_os_selinfo_uninit(&kring->si); + mtx_destroy(&(*kring)->q_lock); + nm_os_selinfo_uninit(&(*kring)->si); } nm_os_free(na->tx_rings); na->tx_rings = na->rx_rings = na->tailroom = NULL; @@ -915,7 +930,7 @@ netmap_krings_delete(struct netmap_adapter *na) void netmap_hw_krings_delete(struct netmap_adapter *na) { - struct mbq *q = &na->rx_rings[na->num_rx_rings].rx_queue; + struct mbq *q = &na->rx_rings[na->num_rx_rings]->rx_queue; ND("destroy sw mbq with len %d", mbq_len(q)); mbq_purge(q); @@ -1196,7 +1211,7 @@ nm_may_forward_down(struct netmap_kring *kring, int sy static u_int netmap_sw_to_nic(struct netmap_adapter *na) { - struct netmap_kring *kring = &na->rx_rings[na->num_rx_rings]; + struct netmap_kring *kring = na->rx_rings[na->num_rx_rings]; struct netmap_slot *rxslot = kring->ring->slot; u_int i, rxcur = kring->nr_hwcur; u_int const head = kring->rhead; @@ -1205,7 +1220,7 @@ netmap_sw_to_nic(struct netmap_adapter *na) /* scan rings to find space, then fill as much as possible */ for (i = 0; i < na->num_tx_rings; i++) { - struct netmap_kring *kdst = &na->tx_rings[i]; + struct netmap_kring *kdst = na->tx_rings[i]; struct netmap_ring *rdst = kdst->ring; u_int const dst_lim = kdst->nkr_num_slots - 1; @@ -1443,7 +1458,7 @@ assign_mem: * MUST BE CALLED UNDER NMG_LOCK() * * Get a refcounted reference to a netmap adapter attached - * to the interface specified by nmr. + * to the interface specified by req. * This is always called in the execution of an ioctl(). * * Return ENXIO if the interface specified by the request does @@ -1453,13 +1468,15 @@ assign_mem: * could not be allocated. * If successful, hold a reference to the netmap adapter. * - * If the interface specified by nmr is a system one, also keep + * If the interface specified by req is a system one, also keep * a reference to it and return a valid *ifp. */ int -netmap_get_na(struct nmreq *nmr, struct netmap_adapter **na, - struct ifnet **ifp, struct netmap_mem_d *nmd, int create) +netmap_get_na(struct nmreq_header *hdr, + struct netmap_adapter **na, struct ifnet **ifp, + struct netmap_mem_d *nmd, int create) { + struct nmreq_register *req = (struct nmreq_register *)hdr->nr_body; int error = 0; struct netmap_adapter *ret = NULL; int nmd_ref = 0; @@ -1467,13 +1484,24 @@ netmap_get_na(struct nmreq *nmr, struct netmap_adapter *na = NULL; /* default return value */ *ifp = NULL; + if (hdr->nr_reqtype != NETMAP_REQ_REGISTER) { + return EINVAL; + } + + if (req->nr_mode == NR_REG_PIPE_MASTER || + req->nr_mode == NR_REG_PIPE_SLAVE) { + /* Do not accept deprecated pipe modes. */ + D("Deprecated pipe nr_mode, use xx{yy or xx}yy syntax"); + return EINVAL; + } + NMG_LOCK_ASSERT(); /* if the request contain a memid, try to find the * corresponding memory region */ - if (nmd == NULL && nmr->nr_arg2) { - nmd = netmap_mem_find(nmr->nr_arg2); + if (nmd == NULL && req->nr_mem_id) { + nmd = netmap_mem_find(req->nr_mem_id); if (nmd == NULL) return EINVAL; /* keep the rereference */ @@ -1492,22 +1520,22 @@ netmap_get_na(struct nmreq *nmr, struct netmap_adapter */ /* try to see if this is a ptnetmap port */ - error = netmap_get_pt_host_na(nmr, na, nmd, create); + error = netmap_get_pt_host_na(hdr, na, nmd, create); if (error || *na != NULL) goto out; /* try to see if this is a monitor port */ - error = netmap_get_monitor_na(nmr, na, nmd, create); + error = netmap_get_monitor_na(hdr, na, nmd, create); if (error || *na != NULL) goto out; /* try to see if this is a pipe port */ - error = netmap_get_pipe_na(nmr, na, nmd, create); + error = netmap_get_pipe_na(hdr, na, nmd, create); if (error || *na != NULL) goto out; /* try to see if this is a bridge port */ - error = netmap_get_bdg_na(nmr, na, nmd, create); + error = netmap_get_bdg_na(hdr, na, nmd, create); if (error) goto out; @@ -1520,7 +1548,7 @@ netmap_get_na(struct nmreq *nmr, struct netmap_adapter * This may still be a tap, a veth/epair, or even a * persistent VALE port. */ - *ifp = ifunit_ref(nmr->nr_name); + *ifp = ifunit_ref(hdr->nr_name); if (*ifp == NULL) { error = ENXIO; goto out; @@ -1765,42 +1793,27 @@ netmap_ring_reinit(struct netmap_kring *kring) * */ int -netmap_interp_ringid(struct netmap_priv_d *priv, uint16_t ringid, uint32_t flags) +netmap_interp_ringid(struct netmap_priv_d *priv, uint32_t nr_mode, + uint16_t nr_ringid, uint64_t nr_flags) { struct netmap_adapter *na = priv->np_na; - u_int j, i = ringid & NETMAP_RING_MASK; - u_int reg = flags & NR_REG_MASK; int excluded_direction[] = { NR_TX_RINGS_ONLY, NR_RX_RINGS_ONLY }; enum txrx t; + u_int j; - if (reg == NR_REG_DEFAULT) { - /* convert from old ringid to flags */ - if (ringid & NETMAP_SW_RING) { - reg = NR_REG_SW; - } else if (ringid & NETMAP_HW_RING) { - reg = NR_REG_ONE_NIC; - } else { - reg = NR_REG_ALL_NIC; - } - D("deprecated API, old ringid 0x%x -> ringid %x reg %d", ringid, i, reg); - } - - if ((flags & NR_PTNETMAP_HOST) && ((reg != NR_REG_ALL_NIC && - reg != NR_REG_PIPE_MASTER && reg != NR_REG_PIPE_SLAVE) || - flags & (NR_RX_RINGS_ONLY|NR_TX_RINGS_ONLY))) { + if ((nr_flags & NR_PTNETMAP_HOST) && ((nr_mode != NR_REG_ALL_NIC) || + nr_flags & (NR_RX_RINGS_ONLY|NR_TX_RINGS_ONLY))) { D("Error: only NR_REG_ALL_NIC supported with netmap passthrough"); return EINVAL; } for_rx_tx(t) { - if (flags & excluded_direction[t]) { + if (nr_flags & excluded_direction[t]) { priv->np_qfirst[t] = priv->np_qlast[t] = 0; continue; } - switch (reg) { + switch (nr_mode) { case NR_REG_ALL_NIC: - case NR_REG_PIPE_MASTER: - case NR_REG_PIPE_SLAVE: priv->np_qfirst[t] = 0; priv->np_qlast[t] = nma_get_nrings(na, t); ND("ALL/PIPE: %s %d %d", nm_txrx2str(t), @@ -1812,20 +1825,21 @@ netmap_interp_ringid(struct netmap_priv_d *priv, uint1 D("host rings not supported"); return EINVAL; } - priv->np_qfirst[t] = (reg == NR_REG_SW ? + priv->np_qfirst[t] = (nr_mode == NR_REG_SW ? nma_get_nrings(na, t) : 0); priv->np_qlast[t] = nma_get_nrings(na, t) + 1; - ND("%s: %s %d %d", reg == NR_REG_SW ? "SW" : "NIC+SW", + ND("%s: %s %d %d", nr_mode == NR_REG_SW ? "SW" : "NIC+SW", nm_txrx2str(t), priv->np_qfirst[t], priv->np_qlast[t]); break; case NR_REG_ONE_NIC: - if (i >= na->num_tx_rings && i >= na->num_rx_rings) { - D("invalid ring id %d", i); + if (nr_ringid >= na->num_tx_rings && + nr_ringid >= na->num_rx_rings) { + D("invalid ring id %d", nr_ringid); return EINVAL; } /* if not enough rings, use the first one */ - j = i; + j = nr_ringid; if (j >= nma_get_nrings(na, t)) j = 0; priv->np_qfirst[t] = j; @@ -1834,11 +1848,11 @@ netmap_interp_ringid(struct netmap_priv_d *priv, uint1 priv->np_qfirst[t], priv->np_qlast[t]); break; default: - D("invalid regif type %d", reg); + D("invalid regif type %d", nr_mode); return EINVAL; } } - priv->np_flags = (flags & ~NR_REG_MASK) | reg; + priv->np_flags = nr_flags | nr_mode; // TODO /* Allow transparent forwarding mode in the host --> nic * direction only if all the TX hw rings have been opened. */ @@ -1854,7 +1868,7 @@ netmap_interp_ringid(struct netmap_priv_d *priv, uint1 priv->np_qlast[NR_TX], priv->np_qfirst[NR_RX], priv->np_qlast[NR_RX], - i); + nr_ringid); } return 0; } @@ -1865,18 +1879,19 @@ netmap_interp_ringid(struct netmap_priv_d *priv, uint1 * for all rings is the same as a single ring. */ static int -netmap_set_ringid(struct netmap_priv_d *priv, uint16_t ringid, uint32_t flags) +netmap_set_ringid(struct netmap_priv_d *priv, uint32_t nr_mode, + uint16_t nr_ringid, uint64_t nr_flags) { struct netmap_adapter *na = priv->np_na; int error; enum txrx t; - error = netmap_interp_ringid(priv, ringid, flags); + error = netmap_interp_ringid(priv, nr_mode, nr_ringid, nr_flags); if (error) { return error; } - priv->np_txpoll = (ringid & NETMAP_NO_TX_POLL) ? 0 : 1; + priv->np_txpoll = (nr_flags & NR_NO_TX_POLL) ? 0 : 1; /* optimization: count the users registered for more than * one ring, which are the ones sleeping on the global queue. @@ -1933,7 +1948,7 @@ netmap_krings_get(struct netmap_priv_d *priv) */ for_rx_tx(t) { for (i = priv->np_qfirst[t]; i < priv->np_qlast[t]; i++) { - kring = &NMR(na, t)[i]; + kring = NMR(na, t)[i]; if ((kring->nr_kflags & NKR_EXCLUSIVE) || (kring->users && excl)) { @@ -1948,7 +1963,7 @@ netmap_krings_get(struct netmap_priv_d *priv) */ for_rx_tx(t) { for (i = priv->np_qfirst[t]; i < priv->np_qlast[t]; i++) { - kring = &NMR(na, t)[i]; + kring = NMR(na, t)[i]; kring->users++; if (excl) kring->nr_kflags |= NKR_EXCLUSIVE; @@ -1979,10 +1994,9 @@ netmap_krings_put(struct netmap_priv_d *priv) priv->np_qfirst[NR_RX], priv->np_qlast[MR_RX]); - for_rx_tx(t) { for (i = priv->np_qfirst[t]; i < priv->np_qlast[t]; i++) { - kring = &NMR(na, t)[i]; + kring = NMR(na, t)[i]; if (excl) kring->nr_kflags &= ~NKR_EXCLUSIVE; kring->users--; @@ -1992,6 +2006,12 @@ netmap_krings_put(struct netmap_priv_d *priv) } } +static int +nm_priv_rx_enabled(struct netmap_priv_d *priv) +{ + return (priv->np_qfirst[NR_RX] != priv->np_qlast[NR_RX]); +} + /* * possibly move the interface to netmap-mode. * If success it returns a pointer to netmap_if, otherwise NULL. @@ -2064,16 +2084,14 @@ netmap_krings_put(struct netmap_priv_d *priv) */ int netmap_do_regif(struct netmap_priv_d *priv, struct netmap_adapter *na, - uint16_t ringid, uint32_t flags) + uint32_t nr_mode, uint16_t nr_ringid, uint64_t nr_flags) { struct netmap_if *nifp = NULL; int error; NMG_LOCK_ASSERT(); - /* ring configuration may have changed, fetch from the card */ - netmap_update_config(na); priv->np_na = na; /* store the reference */ - error = netmap_set_ringid(priv, ringid, flags); + error = netmap_set_ringid(priv, nr_mode, nr_ringid, nr_flags); if (error) goto err; error = netmap_mem_finalize(na->nm_mem, na); @@ -2081,27 +2099,38 @@ netmap_do_regif(struct netmap_priv_d *priv, struct net goto err; if (na->active_fds == 0) { + + /* cache the allocator info in the na */ + error = netmap_mem_get_lut(na->nm_mem, &na->na_lut); + if (error) + goto err_drop_mem; + ND("lut %p bufs %u size %u", na->na_lut.lut, na->na_lut.objtotal, + na->na_lut.objsize); + + /* ring configuration may have changed, fetch from the card */ + netmap_update_config(na); + /* * If this is the first registration of the adapter, * perform sanity checks and create the in-kernel view * of the netmap rings (the netmap krings). */ - if (na->ifp) { + if (na->ifp && nm_priv_rx_enabled(priv)) { /* This netmap adapter is attached to an ifnet. */ unsigned nbs = netmap_mem_bufsize(na->nm_mem); unsigned mtu = nm_os_ifnet_mtu(na->ifp); - /* The maximum amount of bytes that a single - * receive or transmit NIC descriptor can hold. */ - unsigned hw_max_slot_len = 4096; - if (mtu <= hw_max_slot_len) { + ND("mtu %d rx_buf_maxsize %d netmap_buf_size %d", + mtu, na->rx_buf_maxsize, nbs); + + if (mtu <= na->rx_buf_maxsize) { /* The MTU fits a single NIC slot. We only * Need to check that netmap buffers are * large enough to hold an MTU. NS_MOREFRAG * cannot be used in this case. */ if (nbs < mtu) { nm_prerr("error: netmap buf size (%u) " - "< device MTU (%u)", nbs, mtu); + "< device MTU (%u)\n", nbs, mtu); error = EINVAL; goto err_drop_mem; } @@ -2114,22 +2143,22 @@ netmap_do_regif(struct netmap_priv_d *priv, struct net if (!(na->na_flags & NAF_MOREFRAG)) { nm_prerr("error: large MTU (%d) needed " "but %s does not support " - "NS_MOREFRAG", mtu, + "NS_MOREFRAG\n", mtu, na->ifp->if_xname); error = EINVAL; goto err_drop_mem; - } else if (nbs < hw_max_slot_len) { + } else if (nbs < na->rx_buf_maxsize) { nm_prerr("error: using NS_MOREFRAG on " "%s requires netmap buf size " - ">= %u", na->ifp->if_xname, - hw_max_slot_len); + ">= %u\n", na->ifp->if_xname, + na->rx_buf_maxsize); error = EINVAL; goto err_drop_mem; } else { nm_prinf("info: netmap application on " "%s needs to support " "NS_MOREFRAG " - "(MTU=%u,netmap_buf_size=%u)", + "(MTU=%u,netmap_buf_size=%u)\n", na->ifp->if_xname, mtu, nbs); } } @@ -2141,7 +2170,7 @@ netmap_do_regif(struct netmap_priv_d *priv, struct net */ error = na->nm_krings_create(na); if (error) - goto err_drop_mem; + goto err_put_lut; } @@ -2165,21 +2194,12 @@ netmap_do_regif(struct netmap_priv_d *priv, struct net goto err_del_rings; } - if (na->active_fds == 0) { - /* cache the allocator info in the na */ - error = netmap_mem_get_lut(na->nm_mem, &na->na_lut); - if (error) - goto err_del_if; - ND("lut %p bufs %u size %u", na->na_lut.lut, na->na_lut.objtotal, - na->na_lut.objsize); - } - if (nm_kring_pending(priv)) { /* Some kring is switching mode, tell the adapter to * react on this. */ error = na->nm_register(na, 1); if (error) - goto err_put_lut; + goto err_del_if; } /* Commit the reference. */ @@ -2195,9 +2215,6 @@ netmap_do_regif(struct netmap_priv_d *priv, struct net return 0; -err_put_lut: - if (na->active_fds == 0) - memset(&na->na_lut, 0, sizeof(na->na_lut)); err_del_if: netmap_mem_if_delete(na, nifp); err_del_rings: @@ -2207,6 +2224,9 @@ err_rel_excl: err_del_krings: if (na->active_fds == 0) na->nm_krings_delete(na); +err_put_lut: + if (na->active_fds == 0) + memset(&na->na_lut, 0, sizeof(na->na_lut)); err_drop_mem: netmap_mem_drop(na); err: @@ -2242,246 +2262,367 @@ ring_timestamp_set(struct netmap_ring *ring) } } +static int nmreq_copyin(struct nmreq_header *, int); +static int nmreq_copyout(struct nmreq_header *, int); +static int nmreq_checkoptions(struct nmreq_header *); /* * ioctl(2) support for the "netmap" device. * * Following a list of accepted commands: - * - NIOCGINFO + * - NIOCCTRL device control API + * - NIOCTXSYNC sync TX rings + * - NIOCRXSYNC sync RX rings * - SIOCGIFADDR just for convenience - * - NIOCREGIF - * - NIOCTXSYNC - * - NIOCRXSYNC + * - NIOCGINFO deprecated (legacy API) + * - NIOCREGIF deprecated (legacy API) * * Return 0 on success, errno otherwise. */ int -netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, struct thread *td) +netmap_ioctl(struct netmap_priv_d *priv, u_long cmd, caddr_t data, + struct thread *td, int nr_body_is_user) { struct mbq q; /* packets from RX hw queues to host stack */ - struct nmreq *nmr = (struct nmreq *) data; struct netmap_adapter *na = NULL; struct netmap_mem_d *nmd = NULL; struct ifnet *ifp = NULL; int error = 0; u_int i, qfirst, qlast; struct netmap_if *nifp; - struct netmap_kring *krings; + struct netmap_kring **krings; int sync_flags; enum txrx t; - if (cmd == NIOCGINFO || cmd == NIOCREGIF) { - /* truncate name */ - nmr->nr_name[sizeof(nmr->nr_name) - 1] = '\0'; - if (nmr->nr_version != NETMAP_API) { - D("API mismatch for %s got %d need %d", - nmr->nr_name, - nmr->nr_version, NETMAP_API); - nmr->nr_version = NETMAP_API; + switch (cmd) { + case NIOCCTRL: { + struct nmreq_header *hdr = (struct nmreq_header *)data; + + if (hdr->nr_version != NETMAP_API) { + D("API mismatch for reqtype %d: got %d need %d", + hdr->nr_version, + hdr->nr_version, NETMAP_API); + hdr->nr_version = NETMAP_API; } - if (nmr->nr_version < NETMAP_MIN_API || - nmr->nr_version > NETMAP_MAX_API) { + if (hdr->nr_version < NETMAP_MIN_API || + hdr->nr_version > NETMAP_MAX_API) { return EINVAL; } - } - switch (cmd) { - case NIOCGINFO: /* return capabilities etc */ - if (nmr->nr_cmd == NETMAP_BDG_LIST) { - error = netmap_bdg_ctl(nmr, NULL); - break; + /* Make a kernel-space copy of the user-space nr_body. + * For convenince, the nr_body pointer and the pointers + * in the options list will be replaced with their + * kernel-space counterparts. The original pointers are + * saved internally and later restored by nmreq_copyout + */ + error = nmreq_copyin(hdr, nr_body_is_user); + if (error) { + return error; } - NMG_LOCK(); - do { - /* memsize is always valid */ - u_int memflags; - uint64_t memsize; + /* Sanitize hdr->nr_name. */ + hdr->nr_name[sizeof(hdr->nr_name) - 1] = '\0'; - if (nmr->nr_name[0] != '\0') { + switch (hdr->nr_reqtype) { + case NETMAP_REQ_REGISTER: { + struct nmreq_register *req = + (struct nmreq_register *)hdr->nr_body; + /* Protect access to priv from concurrent requests. */ + NMG_LOCK(); + do { + u_int memflags; +#ifdef WITH_EXTMEM + struct nmreq_option *opt; +#endif /* WITH_EXTMEM */ - /* get a refcount */ - error = netmap_get_na(nmr, &na, &ifp, NULL, 1 /* create */); + if (priv->np_nifp != NULL) { /* thread already registered */ + error = EBUSY; + break; + } + +#ifdef WITH_EXTMEM + opt = nmreq_findoption((struct nmreq_option *)hdr->nr_options, + NETMAP_REQ_OPT_EXTMEM); + if (opt != NULL) { + struct nmreq_opt_extmem *e = + (struct nmreq_opt_extmem *)opt; + + error = nmreq_checkduplicate(opt); + if (error) { + opt->nro_status = error; + break; + } + nmd = netmap_mem_ext_create(e->nro_usrptr, + &e->nro_info, &error); + opt->nro_status = error; + if (nmd == NULL) + break; + } +#endif /* WITH_EXTMEM */ + + if (nmd == NULL && req->nr_mem_id) { + /* find the allocator and get a reference */ + nmd = netmap_mem_find(req->nr_mem_id); + if (nmd == NULL) { + error = EINVAL; + break; + } + } + /* find the interface and a reference */ + error = netmap_get_na(hdr, &na, &ifp, nmd, + 1 /* create */); /* keep reference */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Apr 12 07:25:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 98AC4F9C341; Thu, 12 Apr 2018 07:25:37 +0000 (UTC) (envelope-from thj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4B4896AF4B; Thu, 12 Apr 2018 07:25:37 +0000 (UTC) (envelope-from thj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 448CC27E1F; Thu, 12 Apr 2018 07:25:37 +0000 (UTC) (envelope-from thj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3C7PbaL037263; Thu, 12 Apr 2018 07:25:37 GMT (envelope-from thj@FreeBSD.org) Received: (from thj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3C7PboR037262; Thu, 12 Apr 2018 07:25:37 GMT (envelope-from thj@FreeBSD.org) Message-Id: <201804120725.w3C7PboR037262@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: thj set sender to thj@FreeBSD.org using -f From: Tom Jones Date: Thu, 12 Apr 2018 07:25:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332424 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: thj X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 332424 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 07:25:37 -0000 Author: thj Date: Thu Apr 12 07:25:36 2018 New Revision: 332424 URL: https://svnweb.freebsd.org/changeset/base/332424 Log: Add myself to committers-src.dot Approved by: jtl (mentor) Differential Revision: https://reviews.freebsd.org/D15042 Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Thu Apr 12 07:20:50 2018 (r332423) +++ head/share/misc/committers-src.dot Thu Apr 12 07:25:36 2018 (r332424) @@ -328,6 +328,7 @@ suz [label="SUZUKI Shinsuke\nsuz@FreeBSD.org\n2002/03/ syrinx [label="Shteryana Shopova\nsyrinx@FreeBSD.org\n2006/10/07"] takawata [label="Takanori Watanabe\ntakawata@FreeBSD.org\n2000/07/06"] theraven [label="David Chisnall\ntheraven@FreeBSD.org\n2011/11/11"] +thj [label="Tom Jones\nthj@FreeBSD.org\n2018/04/07"] thompsa [label="Andrew Thompson\nthompsa@FreeBSD.org\n2005/05/25"] ticso [label="Bernd Walter\nticso@FreeBSD.org\n2002/01/31"] tijl [label="Tijl Coosemans\ntijl@FreeBSD.org\n2010/07/16"] @@ -618,6 +619,8 @@ joerg -> jmg joerg -> le joerg -> netchild joerg -> schweikh + +jtl -> thj julian -> glebius julian -> davidxu From owner-svn-src-head@freebsd.org Thu Apr 12 07:39:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8D31AF9D8C5; Thu, 12 Apr 2018 07:39:25 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 40AAD6F561; Thu, 12 Apr 2018 07:39:25 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3BAB427FF0; Thu, 12 Apr 2018 07:39:25 +0000 (UTC) (envelope-from maxim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3C7dPkZ042379; Thu, 12 Apr 2018 07:39:25 GMT (envelope-from maxim@FreeBSD.org) Received: (from maxim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3C7dPQs042378; Thu, 12 Apr 2018 07:39:25 GMT (envelope-from maxim@FreeBSD.org) Message-Id: <201804120739.w3C7dPQs042378@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: maxim set sender to maxim@FreeBSD.org using -f From: Maxim Konovalov Date: Thu, 12 Apr 2018 07:39:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332425 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: maxim X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 332425 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 07:39:25 -0000 Author: maxim Date: Thu Apr 12 07:39:24 2018 New Revision: 332425 URL: https://svnweb.freebsd.org/changeset/base/332425 Log: o OpenBSD 6.3 and DragonFly BSD 5.2.0 releases added. Modified: head/share/misc/bsd-family-tree Modified: head/share/misc/bsd-family-tree ============================================================================== --- head/share/misc/bsd-family-tree Thu Apr 12 07:25:36 2018 (r332424) +++ head/share/misc/bsd-family-tree Thu Apr 12 07:39:24 2018 (r332425) @@ -367,6 +367,8 @@ FreeBSD 5.2 | | | | | | | | | | | | | | NetBSD 7.1.2 | | | | | | | | | + | | | | | OpenBSD 6.3 | + | | | | | | DragonFly 5.2.0 | | | | v | | | v | | | | | | | | | @@ -739,6 +741,8 @@ DragonFly 5.0.1 2017-11-06 [DFB] DragonFly 5.0.2 2017-12-04 [DFB] NetBSD 7.1.1 2017-12-22 [NBD] NetBSD 7.1.2 2018-03-15 [NBD] +OpenBSD 6.3 2018-04-02 [OBD] +DragonFly 5.2.0 2018-04-10 [DFB] Bibliography ------------------------ From owner-svn-src-head@freebsd.org Thu Apr 12 10:37:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 746A9F87BB9; Thu, 12 Apr 2018 10:37:27 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B8917A649; Thu, 12 Apr 2018 10:37:27 +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 143621E5F; Thu, 12 Apr 2018 10:37:27 +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 w3CAbRJi033434; Thu, 12 Apr 2018 10:37:27 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CAbQca033427; Thu, 12 Apr 2018 10:37:26 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201804121037.w3CAbQca033427@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 12 Apr 2018 10:37:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332426 - in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs s... X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/common/zfs sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolar... X-SVN-Commit-Revision: 332426 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 10:37:27 -0000 Author: avg Date: Thu Apr 12 10:37:26 2018 New Revision: 332426 URL: https://svnweb.freebsd.org/changeset/base/332426 Log: allow ZFS pool to have temporary name for duration of current import The change adds -t option to zpool create and -t option to zpool import in its form with an old name and a new name. This allows to import (or create) a pool under a name that's different from its real, permanent name without affecting that name. This is useful when working with VM images or images of other physical systems if they happen to have a ZFS pool with the same name as the host system. The changes come from ZoL with some small tweaks. The porting has been done by julian. The change is being submitted to OpenZFS: https://github.com/openzfs/openzfs/pull/600 Submitted by: julian Reviewed by: smh MFC after: 2 weeks Sponsored by: Panzura (porting) Differential Revision: https://reviews.freebsd.org/D14972 Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Apr 12 07:39:24 2018 (r332425) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 Thu Apr 12 10:37:26 2018 (r332426) @@ -62,6 +62,7 @@ .Ar ... .Op Fl m Ar mountpoint .Op Fl R Ar root +.Op Fl t Ar tempname .Ar pool vdev ... .Nm .Cm destroy @@ -115,6 +116,7 @@ .Op Fl m .Op Fl N .Op Fl R Ar root +.Op Fl t .Op Fl F Op Fl n .Ar pool | id .Op Ar newpool @@ -961,6 +963,7 @@ do not actually discard any transactions. .Ar ... .Op Fl m Ar mountpoint .Op Fl R Ar root +.Op Fl t Ar tempname .Ar pool vdev ... .Xc .Pp @@ -1062,6 +1065,18 @@ or .Qq Cm none . For more information on dataset mount points, see .Xr zfs 8 . +.It Fl t Ar tempname +Sets the in-core pool name to +.Pa tempname +while the on-disk name will be the name specified as the pool name +.Pa pool . +This will set the default +.Sy cachefile +property to +.Sy none . +This is intended to handle name space collisions when creating pools +for other systems, such as virtual machines or physical machines +whose pools live on network block devices. .El .It Xo .Nm @@ -1316,6 +1331,7 @@ Searches for and imports all pools found. .Op Fl m .Op Fl N .Op Fl R Ar root +.Op Fl t .Op Fl F Op Fl n .Ar pool | id .Op Ar newpool @@ -1375,6 +1391,20 @@ Import the pool without mounting any file systems. .It Fl R Ar root Equivalent to .Qq Fl o Cm cachefile=none,altroot= Ns Pa root +.It Fl t +Used with +.Ar newpool . +Specifies that +.Ar newpool +is temporary. +Temporary pool names last until export. +Ensures that the original pool name will be used in all label updates and +therefore is retained upon export. +Will also set +.Sy cachefile +property to +.Sy none +when not explicitly specified. .It Fl F Recovery mode for a non-importable pool. Attempt to return the pool to an importable state by discarding the last few transactions. Not all damaged pools Modified: head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Apr 12 07:39:24 2018 (r332425) +++ head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c Thu Apr 12 10:37:26 2018 (r332426) @@ -220,8 +220,9 @@ get_usage(zpool_help_t idx) case HELP_CREATE: return (gettext("\tcreate [-fnd] [-B] " "[-o property=value] ... \n" - "\t [-O file-system-property=value] ... \n" - "\t [-m mountpoint] [-R root] ...\n")); + "\t [-O file-system-property=value] ...\n" + "\t [-m mountpoint] [-R root] [-t tempname] " + " ...\n")); case HELP_CHECKPOINT: return (gettext("\tcheckpoint [--discard] ...\n")); case HELP_DESTROY: @@ -239,7 +240,7 @@ get_usage(zpool_help_t idx) "[-R root] [-F [-n]] -a\n" "\timport [-o mntopts] [-o property=value] ... \n" "\t [-d dir | -c cachefile] [-D] [-f] [-m] [-N] " - "[-R root] [-F [-n]]\n" + "[-R root] [-F [-n]] [-t]\n" "\t [--rewind-to-checkpoint] [newpool]\n")); case HELP_IOSTAT: return (gettext("\tiostat [-v] [-T d|u] [pool] ... [interval " @@ -489,6 +490,21 @@ add_prop_list(const char *propname, char *propval, nvl } /* + * Set a default property pair (name, string-value) in a property nvlist + */ +static int +add_prop_list_default(const char *propname, char *propval, nvlist_t **props, + boolean_t poolprop) +{ + char *pval; + + if (nvlist_lookup_string(*props, propname, &pval) == 0) + return (0); + + return (add_prop_list(propname, propval, props, poolprop)); +} + +/* * zpool add [-fn] ... * * -f Force addition of devices, even if they appear in use @@ -850,15 +866,16 @@ errout: /* * zpool create [-fnd] [-B] [-o property=value] ... * [-O file-system-property=value] ... - * [-R root] [-m mountpoint] ... + * [-R root] [-m mountpoint] [-t tempname] ... * * -B Create boot partition. * -f Force creation, even if devices appear in use * -n Do not create the pool, but display the resulting layout if it * were to be created. - * -R Create a pool under an alternate root - * -m Set default mountpoint for the root dataset. By default it's + * -R Create a pool under an alternate root + * -m Set default mountpoint for the root dataset. By default it's * '/' + * -t Use the temporary name until the pool is exported. * -o Set property=value. * -d Don't automatically enable all supported pool features * (individual features can be enabled with -o). @@ -882,6 +899,7 @@ zpool_do_create(int argc, char **argv) int c; nvlist_t *nvroot = NULL; char *poolname; + char *tname = NULL; int ret = 1; char *altroot = NULL; char *mountpoint = NULL; @@ -890,7 +908,7 @@ zpool_do_create(int argc, char **argv) char *propval; /* check options */ - while ((c = getopt(argc, argv, ":fndBR:m:o:O:")) != -1) { + while ((c = getopt(argc, argv, ":fndBR:m:o:O:t:")) != -1) { switch (c) { case 'f': force = B_TRUE; @@ -922,11 +940,7 @@ zpool_do_create(int argc, char **argv) if (add_prop_list(zpool_prop_to_name( ZPOOL_PROP_ALTROOT), optarg, &props, B_TRUE)) goto errout; - if (nvlist_lookup_string(props, - zpool_prop_to_name(ZPOOL_PROP_CACHEFILE), - &propval) == 0) - break; - if (add_prop_list(zpool_prop_to_name( + if (add_prop_list_default(zpool_prop_to_name( ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE)) goto errout; break; @@ -999,6 +1013,27 @@ zpool_do_create(int argc, char **argv) goto errout; } break; + case 't': + /* + * Sanity check temporary pool name. + */ + if (strchr(optarg, '/') != NULL) { + (void) fprintf(stderr, gettext("cannot create " + "'%s': invalid character '/' in temporary " + "name\n"), optarg); + (void) fprintf(stderr, gettext("use 'zfs " + "create' to create a dataset\n")); + goto errout; + } + + if (add_prop_list(zpool_prop_to_name( + ZPOOL_PROP_TNAME), optarg, &props, B_TRUE)) + goto errout; + if (add_prop_list_default(zpool_prop_to_name( + ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE)) + goto errout; + tname = optarg; + break; case ':': (void) fprintf(stderr, gettext("missing argument for " "'%c' option\n"), optopt); @@ -1205,8 +1240,8 @@ zpool_do_create(int argc, char **argv) ret = 1; if (zpool_create(g_zfs, poolname, nvroot, props, fsprops) == 0) { - zfs_handle_t *pool = zfs_open(g_zfs, poolname, - ZFS_TYPE_FILESYSTEM); + zfs_handle_t *pool = zfs_open(g_zfs, + tname ? tname : poolname, ZFS_TYPE_FILESYSTEM); if (pool != NULL) { if (zfs_mount(pool, NULL, 0) == 0) ret = zfs_shareall(pool); @@ -2162,7 +2197,8 @@ zpool_do_checkpoint(int argc, char **argv) * import [-o mntopts] [-o prop=value] ... [-R root] [-D] * [-d dir | -c cachefile] [-f] -a * import [-o mntopts] [-o prop=value] ... [-R root] [-D] - * [-d dir | -c cachefile] [-f] [-n] [-F] [newpool] + * [-d dir | -c cachefile] [-f] [-n] [-F] [-t] + * [newpool] * * -c Read pool information from a cachefile instead of searching * devices. @@ -2191,6 +2227,9 @@ zpool_do_checkpoint(int argc, char **argv) * * -N Import the pool but don't mount datasets. * + * -t Use newpool as a temporary pool name instead of renaming + * the pool. + * * -T Specify a starting txg to use for import. This option is * intentionally undocumented option for testing purposes. * @@ -2241,7 +2280,7 @@ zpool_do_import(int argc, char **argv) }; /* check options */ - while ((c = getopt_long(argc, argv, ":aCc:d:DEfFmnNo:rR:T:VX", + while ((c = getopt_long(argc, argv, ":aCc:d:DEfFmnNo:rR:tT:VX", long_options, NULL)) != -1) { switch (c) { case 'a': @@ -2296,14 +2335,16 @@ zpool_do_import(int argc, char **argv) if (add_prop_list(zpool_prop_to_name( ZPOOL_PROP_ALTROOT), optarg, &props, B_TRUE)) goto error; - if (nvlist_lookup_string(props, - zpool_prop_to_name(ZPOOL_PROP_CACHEFILE), - &propval) == 0) - break; - if (add_prop_list(zpool_prop_to_name( + if (add_prop_list_default(zpool_prop_to_name( ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE)) goto error; break; + case 't': + flags |= ZFS_IMPORT_TEMP_NAME; + if (add_prop_list_default(zpool_prop_to_name( + ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE)) + goto error; + break; case 'T': errno = 0; txg = strtoull(optarg, &endptr, 0); @@ -2439,9 +2480,9 @@ zpool_do_import(int argc, char **argv) (void) fprintf(stderr, gettext("cannot import '%s': " "a pool with that name already exists\n"), argv[0]); - (void) fprintf(stderr, gettext("use the form '%s " - " ' to give it a new name\n"), - "zpool import"); + (void) fprintf(stderr, gettext("use the form 'zpool import " + "[-t] ' to give it a new temporary " + "or permanent name\n")); err = 1; } else if (pools == NULL && idata.exists) { (void) fprintf(stderr, gettext("cannot import '%s': " Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Apr 12 07:39:24 2018 (r332425) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c Thu Apr 12 10:37:26 2018 (r332426) @@ -644,11 +644,22 @@ zpool_valid_proplist(libzfs_handle_t *hdl, const char goto error; } break; + case ZPOOL_PROP_READONLY: if (!flags.import) { zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, "property '%s' can only be set at " "import time"), propname); + (void) zfs_error(hdl, EZFS_BADPROP, errbuf); + goto error; + } + break; + + case ZPOOL_PROP_TNAME: + if (!flags.create) { + zfs_error_aux(hdl, dgettext(TEXT_DOMAIN, + "property '%s' can only be set at " + "creation time"), propname); (void) zfs_error(hdl, EZFS_BADPROP, errbuf); goto error; } Modified: head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Thu Apr 12 07:39:24 2018 (r332425) +++ head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c Thu Apr 12 10:37:26 2018 (r332426) @@ -136,6 +136,8 @@ zpool_prop_init(void) PROP_READONLY, ZFS_TYPE_POOL, "NAME"); zprop_register_hidden(ZPOOL_PROP_MAXBLOCKSIZE, "maxblocksize", PROP_TYPE_NUMBER, PROP_READONLY, ZFS_TYPE_POOL, "MAXBLOCKSIZE"); + zprop_register_hidden(ZPOOL_PROP_TNAME, "tname", PROP_TYPE_STRING, + PROP_ONETIME, ZFS_TYPE_POOL, "TNAME"); } /* Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Apr 12 07:39:24 2018 (r332425) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c Thu Apr 12 10:37:26 2018 (r332426) @@ -4666,12 +4666,18 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ uint_t nspares, nl2cache; uint64_t version, obj; boolean_t has_features; + char *poolname; + nvlist_t *nvl; + if (nvlist_lookup_string(props, + zpool_prop_to_name(ZPOOL_PROP_TNAME), &poolname) != 0) + poolname = (char *)pool; + /* * If this pool already exists, return failure. */ mutex_enter(&spa_namespace_lock); - if (spa_lookup(pool) != NULL) { + if (spa_lookup(poolname) != NULL) { mutex_exit(&spa_namespace_lock); return (SET_ERROR(EEXIST)); } @@ -4679,9 +4685,12 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ /* * Allocate a new spa_t structure. */ + nvl = fnvlist_alloc(); + fnvlist_add_string(nvl, ZPOOL_CONFIG_POOL_NAME, pool); (void) nvlist_lookup_string(props, zpool_prop_to_name(ZPOOL_PROP_ALTROOT), &altroot); - spa = spa_add(pool, NULL, altroot); + spa = spa_add(poolname, nvl, altroot); + fnvlist_free(nvl); spa_activate(spa, spa_mode_global); if (props && (error = spa_prop_validate(spa, props))) { @@ -4690,6 +4699,12 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_ mutex_exit(&spa_namespace_lock); return (error); } + + /* + * Temporary pool names should never be written to disk. + */ + if (poolname != pool) + spa->spa_import_flags |= ZFS_IMPORT_TEMP_NAME; has_features = B_FALSE; for (nvpair_t *elem = nvlist_next_nvpair(props, NULL); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Thu Apr 12 07:39:24 2018 (r332425) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c Thu Apr 12 10:37:26 2018 (r332426) @@ -226,6 +226,7 @@ spa_write_cachefile(spa_t *target, boolean_t removing, nvlist_t *nvl; boolean_t ccw_failure; int error; + char *pool_name; ASSERT(MUTEX_HELD(&spa_namespace_lock)); @@ -274,11 +275,18 @@ spa_write_cachefile(spa_t *target, boolean_t removing, if (nvl == NULL) nvl = fnvlist_alloc(); - fnvlist_add_nvlist(nvl, spa->spa_name, + if (spa->spa_import_flags & ZFS_IMPORT_TEMP_NAME) { + pool_name = fnvlist_lookup_string(spa->spa_config, + ZPOOL_CONFIG_POOL_NAME); + } else { + pool_name = spa_name(spa); + } + + fnvlist_add_nvlist(nvl, pool_name, spa->spa_config); mutex_exit(&spa->spa_props_lock); - if (nvlist_lookup_nvlist(nvl, spa->spa_name, &nvroot) == 0) + if (nvlist_lookup_nvlist(nvl, pool_name, &nvroot) == 0) spa_config_clean(nvroot); } @@ -382,6 +390,7 @@ spa_config_generate(spa_t *spa, vdev_t *vd, uint64_t t unsigned long hostid = 0; boolean_t locked = B_FALSE; uint64_t split_guid; + char *pool_name; if (vd == NULL) { vd = rvd; @@ -398,10 +407,27 @@ spa_config_generate(spa_t *spa, vdev_t *vd, uint64_t t if (txg == -1ULL) txg = spa->spa_config_txg; + /* + * Originally, users had to handle spa namespace collisions by either + * exporting the already imported pool or by specifying a new name for + * the pool with a conflicting name. In the case of root pools from + * virtual guests, neither approach to collision resolution is + * reasonable. This is addressed by extending the new name syntax with + * an option to specify that the new name is temporary. When specified, + * ZFS_IMPORT_TEMP_NAME will be set in spa->spa_import_flags to tell us + * to use the previous name, which we do below. + */ + if (spa->spa_import_flags & ZFS_IMPORT_TEMP_NAME) { + pool_name = fnvlist_lookup_string(spa->spa_config, + ZPOOL_CONFIG_POOL_NAME); + } else { + pool_name = spa_name(spa); + } + config = fnvlist_alloc(); fnvlist_add_uint64(config, ZPOOL_CONFIG_VERSION, spa_version(spa)); - fnvlist_add_string(config, ZPOOL_CONFIG_POOL_NAME, spa_name(spa)); + fnvlist_add_string(config, ZPOOL_CONFIG_POOL_NAME, pool_name); fnvlist_add_uint64(config, ZPOOL_CONFIG_POOL_STATE, spa_state(spa)); fnvlist_add_uint64(config, ZPOOL_CONFIG_POOL_TXG, txg); fnvlist_add_uint64(config, ZPOOL_CONFIG_POOL_GUID, spa_guid(spa)); Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu Apr 12 07:39:24 2018 (r332425) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Thu Apr 12 10:37:26 2018 (r332426) @@ -214,6 +214,7 @@ typedef enum { ZPOOL_PROP_MAXBLOCKSIZE, ZPOOL_PROP_BOOTSIZE, ZPOOL_PROP_CHECKPOINT, + ZPOOL_PROP_TNAME, ZPOOL_NUM_PROPS } zpool_prop_t; @@ -1047,6 +1048,7 @@ typedef enum { #define ZFS_IMPORT_MISSING_LOG 0x4 #define ZFS_IMPORT_ONLY 0x8 #define ZFS_IMPORT_CHECKPOINT 0x10 +#define ZFS_IMPORT_TEMP_NAME 0x20 /* * Channel program argument/return nvlist keys and defaults. From owner-svn-src-head@freebsd.org Thu Apr 12 10:50:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4B21F89266 for ; Thu, 12 Apr 2018 10:50:56 +0000 (UTC) (envelope-from ram.vegesna@broadcom.com) Received: from mail-lf0-x235.google.com (mail-lf0-x235.google.com [IPv6:2a00:1450:4010:c07::235]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1AD9D7E9A1 for ; Thu, 12 Apr 2018 10:50:56 +0000 (UTC) (envelope-from ram.vegesna@broadcom.com) Received: by mail-lf0-x235.google.com with SMTP id m200-v6so7022673lfm.4 for ; Thu, 12 Apr 2018 03:50: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:in-reply-to:references:from:date :message-id:subject:to:cc; bh=pXGCaCfGA+Ommy5ZGatqT/F2lTqllrIrZODeXim7588=; b=IQXt5AFIyJqhTJXSOinmSmbru1VR0kAsX1CmKqAeYmUrJiZGDxsTfti++aVtQN1FXr BXszFA0wqF/wMeYhSixY8Ob8ccmBYQ0aM4vSFaFiezjro7E8ynlPBwvBa1+o38cn1Npn i5EAYVNO0JgmG2qxAJDwbZWws4h1mdNalcBnaGWGONQ8YJEZWFtgtKLtYvx1M5LuRJl1 /qM5rkcKLhHSjFk1xA7acFMarPiNApThpTBY+akz0Z1XZgd8VETHtIs4fgoJK35k7fCe 9rMFQtA0RW2AzdIM6WpHtsrnkjx18bezAismyYypC3dsQwVdH1YwW9PzBfgLjL0BHExm 7lNQ== X-Gm-Message-State: ALQs6tBYlc5Jm80WeTXzMHpGE/Y++uj5OxPuc1xG+iQDqaAGU1xV4ZJi AZ/R5qm6bBpf9TwyIF1hbgFsQZC6ZcOtoTj6CX1PQQ== X-Google-Smtp-Source: AIpwx48T7GnngMiYJC7jtjcgluajZL3KkjnprlR8yqiG49OPTnO99kw+zLlzIeJRbDd3adZkOtSF9wquM0gWbW3v344= X-Received: by 10.46.108.3 with SMTP id h3mr335121ljc.30.1523530254395; Thu, 12 Apr 2018 03:50:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.46.134.205 with HTTP; Thu, 12 Apr 2018 03:50:53 -0700 (PDT) In-Reply-To: <20180411142720.GB36126@mithlond.kdm.org> References: <201804101839.w3AIdKZk026212@repo.freebsd.org> <201804101922.w3AJMvSL024594@pdx.rh.CN85.dnsmgr.net> <20180411142720.GB36126@mithlond.kdm.org> From: Ram Kishore Vegesna Date: Thu, 12 Apr 2018 16:20:53 +0530 Message-ID: Subject: Re: svn commit: r332386 - head/share/misc To: "Kenneth D. Merry" Cc: Kyle Evans , Ram Kishore Vegesna , "Rodney W. Grimes" , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 10:50:56 -0000 oho, my bad added to the wrong section. Will fix and update. Ken, I will send you the patch. Thanks, Ram On Wed, Apr 11, 2018 at 7:57 PM, Kenneth D. Merry wrote: > On Tue, Apr 10, 2018 at 14:27:26 -0500, Kyle Evans wrote: > > On Tue, Apr 10, 2018 at 2:22 PM, Rodney W. Grimes > > wrote: > > > [ Charset UTF-8 unsupported, converting... ] > > >> Author: ram > > >> Date: Tue Apr 10 18:39:20 2018 > > >> New Revision: 332386 > > >> URL: https://svnweb.freebsd.org/changeset/base/332386 > > >> > > >> Log: > > >> Updated mentors information. > > >> > > >> Approved by: ken, mav > > >> > > >> Modified: > > >> head/share/misc/committers-src.dot > > >> > > >> Modified: head/share/misc/committers-src.dot > > >> ============================================================ > ================== > > >> --- head/share/misc/committers-src.dot Tue Apr 10 18:05:02 > 2018 (r332385) > > >> +++ head/share/misc/committers-src.dot Tue Apr 10 18:39:20 > 2018 (r332386) > > >> @@ -76,6 +76,7 @@ nate [label="Nate Willams\nnate@FreeBSD.org\ > n1993/06/1 > > >> njl [label="Nate Lawson\nnjl@FreeBSD.org\n2002/08/07\n2008/02/16"] > > >> non [label="Noriaki Mitsnaga\nnon@FreeBSD.org\ > n2000/06/19\n2007/03/06"] > > >> onoe [label="Atsushi Onoe\nonoe@FreeBSD.org\n2000/ > 07/21\n2008/11/10"] > > >> +ram [label="Ram Kishore Vegesna\nram@FreeBSD.org\ > n2018/04/04\n???/??/??"] > > > > ^^^^^^^^^ > > > That should be removed, you only have a start date. > > > Oh and Welcome ram to the project! > > > > > > > The entry is also smack dab in the middle of the alumni section, > > rather than the later 'active' section. =) > > Oops. My fault for not paying attention. :( > > Pointy hat to: ken > > Ram, could you fix this and send me the diffs for approval before you > commit it? > > Thanks, > > Ken > -- > Kenneth Merry > ken@FreeBSD.ORG > From owner-svn-src-head@freebsd.org Thu Apr 12 13:52:56 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 40C6CF972E2; Thu, 12 Apr 2018 13:52:56 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E903F6C7CB; Thu, 12 Apr 2018 13:52:55 +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 E3C8F439A; Thu, 12 Apr 2018 13:52:55 +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 w3CDqtPi034494; Thu, 12 Apr 2018 13:52:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CDqtMS034493; Thu, 12 Apr 2018 13:52:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804121352.w3CDqtMS034493@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 12 Apr 2018 13:52:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332429 - head/usr.sbin/cron/cron X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/cron/cron X-SVN-Commit-Revision: 332429 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 13:52:56 -0000 Author: kevans Date: Thu Apr 12 13:52:55 2018 New Revision: 332429 URL: https://svnweb.freebsd.org/changeset/base/332429 Log: cron(8): Reload database if an existing job in cron.d changed as well Directory mtime will only change if a file is added or removed, not modified. For /var/cron/tabs, this is fine because of how crontab(1) manages it using temp files so all crontab(1) changes will trigger a reload of the database. For /etc/cron.d and /usr/local/etc/cron.d, this is not necessarily the case. Instead of checking their mtime, we should descend into them and check mtime on all jobs also. Reported by: des Reviewed by: bapt MFC after: 1 week Modified: head/usr.sbin/cron/cron/database.c Modified: head/usr.sbin/cron/cron/database.c ============================================================================== --- head/usr.sbin/cron/cron/database.c Thu Apr 12 13:40:02 2018 (r332428) +++ head/usr.sbin/cron/cron/database.c Thu Apr 12 13:52:55 2018 (r332429) @@ -56,7 +56,7 @@ load_database(old_db) { SYSCRONTABS }, { LOCALSYSCRONTABS } }; - int i; + int i, ret; Debug(DLOAD, ("[%d] load_database()\n", getpid())) @@ -79,6 +79,18 @@ load_database(old_db) for (i = 0; i < nitems(syscrontabs); i++) { if (stat(syscrontabs[i].name, &syscrontabs[i].st) != -1) { maxmtime = TMAX(syscrontabs[i].st.st_mtime, maxmtime); + /* Traverse into directory */ + if (!(dir = opendir(syscrontabs[i].name))) + continue; + while (NULL != (dp = readdir(dir))) { + if (dp->d_name[0] == '.') + continue; + ret = fstatat(dirfd(dir), dp->d_name, &st, 0); + if (ret == 0 && !S_ISREG(st.st_mode)) + continue; + maxmtime = TMAX(st.st_mtime, maxmtime); + } + closedir(dir); } else { syscrontabs[i].st.st_mtime = 0; } From owner-svn-src-head@freebsd.org Thu Apr 12 14:05:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6DE11F97F8C; Thu, 12 Apr 2018 14:05:28 +0000 (UTC) (envelope-from ram@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1B6726F6ED; Thu, 12 Apr 2018 14:05:28 +0000 (UTC) (envelope-from ram@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 167B8452A; Thu, 12 Apr 2018 14:05:28 +0000 (UTC) (envelope-from ram@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CE5Rpe039653; Thu, 12 Apr 2018 14:05:27 GMT (envelope-from ram@FreeBSD.org) Received: (from ram@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CE5RgP039652; Thu, 12 Apr 2018 14:05:27 GMT (envelope-from ram@FreeBSD.org) Message-Id: <201804121405.w3CE5RgP039652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ram set sender to ram@FreeBSD.org using -f From: Ram Kishore Vegesna Date: Thu, 12 Apr 2018 14:05:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332430 - head/share/misc X-SVN-Group: head X-SVN-Commit-Author: ram X-SVN-Commit-Paths: head/share/misc X-SVN-Commit-Revision: 332430 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 14:05:28 -0000 Author: ram Date: Thu Apr 12 14:05:27 2018 New Revision: 332430 URL: https://svnweb.freebsd.org/changeset/base/332430 Log: Added entry in the correct section. Reported by: Rodney,kevans Approved by: ken Modified: head/share/misc/committers-src.dot Modified: head/share/misc/committers-src.dot ============================================================================== --- head/share/misc/committers-src.dot Thu Apr 12 13:52:55 2018 (r332429) +++ head/share/misc/committers-src.dot Thu Apr 12 14:05:27 2018 (r332430) @@ -76,7 +76,6 @@ nate [label="Nate Willams\nnate@FreeBSD.org\n1993/06/1 njl [label="Nate Lawson\nnjl@FreeBSD.org\n2002/08/07\n2008/02/16"] non [label="Noriaki Mitsnaga\nnon@FreeBSD.org\n2000/06/19\n2007/03/06"] onoe [label="Atsushi Onoe\nonoe@FreeBSD.org\n2000/07/21\n2008/11/10"] -ram [label="Ram Kishore Vegesna\nram@FreeBSD.org\n2018/04/04\n???/??/??"] rafan [label="Rong-En Fan\nrafan@FreeBSD.org\n2007/01/31\n2012/07/23"] randi [label="Randi Harper\nrandi@FreeBSD.org\n2010/04/20\n2012/05/10"] rink [label="Rink Springer\nrink@FreeBSD.org\n2006/01/16\n2010/11/04"] @@ -283,6 +282,7 @@ pkelsey [label="Patrick Kelsey\pkelsey@FreeBSD.org\n20 pluknet [label="Sergey Kandaurov\npluknet@FreeBSD.org\n2010/10/05"] ps [label="Paul Saab\nps@FreeBSD.org\n2000/02/23"] qingli [label="Qing Li\nqingli@FreeBSD.org\n2005/04/13"] +ram [label="Ram Kishore Vegesna\nram@FreeBSD.org\n2018/04/04"] ray [label="Aleksandr Rybalko\nray@FreeBSD.org\n2011/05/25"] rdivacky [label="Roman Divacky\nrdivacky@FreeBSD.org\n2008/03/13"] remko [label="Remko Lodder\nremko@FreeBSD.org\n2007/02/23"] From owner-svn-src-head@freebsd.org Thu Apr 12 14:32:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 35799F99CD8; Thu, 12 Apr 2018 14:32:27 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DB60D7500A; Thu, 12 Apr 2018 14:32: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 D5D3F49DB; Thu, 12 Apr 2018 14:32: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 w3CEWQMs054116; Thu, 12 Apr 2018 14:32:26 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CEWQek054115; Thu, 12 Apr 2018 14:32:26 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804121432.w3CEWQek054115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 12 Apr 2018 14:32:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332431 - head/usr.sbin/cron/cron X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.sbin/cron/cron X-SVN-Commit-Revision: 332431 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 14:32:27 -0000 Author: kevans Date: Thu Apr 12 14:32:26 2018 New Revision: 332431 URL: https://svnweb.freebsd.org/changeset/base/332431 Log: cron(8): Correct test sense We're about to use the result of fstat(2) either way, so don't do that if it fails... X-MFC-With: r332429 Modified: head/usr.sbin/cron/cron/database.c Modified: head/usr.sbin/cron/cron/database.c ============================================================================== --- head/usr.sbin/cron/cron/database.c Thu Apr 12 14:05:27 2018 (r332430) +++ head/usr.sbin/cron/cron/database.c Thu Apr 12 14:32:26 2018 (r332431) @@ -86,7 +86,7 @@ load_database(old_db) if (dp->d_name[0] == '.') continue; ret = fstatat(dirfd(dir), dp->d_name, &st, 0); - if (ret == 0 && !S_ISREG(st.st_mode)) + if (ret != 0 || !S_ISREG(st.st_mode)) continue; maxmtime = TMAX(st.st_mtime, maxmtime); } From owner-svn-src-head@freebsd.org Thu Apr 12 14:35:38 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2824DF99FC5; Thu, 12 Apr 2018 14:35:38 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D245375539; Thu, 12 Apr 2018 14:35:37 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD3AB49EB; Thu, 12 Apr 2018 14:35:37 +0000 (UTC) (envelope-from sbruno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CEZbVq054304; Thu, 12 Apr 2018 14:35:37 GMT (envelope-from sbruno@FreeBSD.org) Received: (from sbruno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CEZbCx054303; Thu, 12 Apr 2018 14:35:37 GMT (envelope-from sbruno@FreeBSD.org) Message-Id: <201804121435.w3CEZbCx054303@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sbruno set sender to sbruno@FreeBSD.org using -f From: Sean Bruno Date: Thu, 12 Apr 2018 14:35:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332432 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: sbruno X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 332432 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 14:35:38 -0000 Author: sbruno Date: Thu Apr 12 14:35:37 2018 New Revision: 332432 URL: https://svnweb.freebsd.org/changeset/base/332432 Log: Restore r332389 after resolution of locking fixes. Add one extra lock initialization to iflib_register() that was missed in the git<->phab conversion. Split out flag manipulation from general context manipulation in iflib To avoid blocking on the context lock in the swi thread and risk potential deadlocks, this change protects lighter weight updates that only need to be consistent with each other with their own lock. Submitted by: Matthew Macy Reviewed by: shurd Sponsored by: Limelight Networks Differential Revision: https://reviews.freebsd.org/D14967 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Thu Apr 12 14:32:26 2018 (r332431) +++ head/sys/net/iflib.c Thu Apr 12 14:35:37 2018 (r332432) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2014-2017, Matthew Macy + * Copyright (c) 2014-2018, Matthew Macy * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -163,7 +163,8 @@ struct iflib_ctx { if_shared_ctx_t ifc_sctx; struct if_softc_ctx ifc_softc_ctx; - struct mtx ifc_mtx; + struct mtx ifc_ctx_mtx; + struct mtx ifc_state_mtx; uint16_t ifc_nhwtxqs; @@ -317,8 +318,10 @@ typedef struct iflib_sw_tx_desc_array { #define IFC_INIT_DONE 0x020 #define IFC_PREFETCH 0x040 #define IFC_DO_RESET 0x080 -#define IFC_CHECK_HUNG 0x100 +#define IFC_DO_WATCHDOG 0x100 +#define IFC_CHECK_HUNG 0x200 + #define CSUM_OFFLOAD (CSUM_IP_TSO|CSUM_IP6_TSO|CSUM_IP| \ CSUM_IP_UDP|CSUM_IP_TCP|CSUM_IP_SCTP| \ CSUM_IP6_UDP|CSUM_IP6_TCP|CSUM_IP6_SCTP) @@ -534,13 +537,19 @@ rxd_info_zero(if_rxd_info_t ri) #define CTX_ACTIVE(ctx) ((if_getdrvflags((ctx)->ifc_ifp) & IFF_DRV_RUNNING)) -#define CTX_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_mtx, _name, "iflib ctx lock", MTX_DEF) +#define CTX_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_ctx_mtx, _name, "iflib ctx lock", MTX_DEF) +#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_ctx_mtx) +#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_ctx_mtx) +#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_ctx_mtx) -#define CTX_LOCK(ctx) mtx_lock(&(ctx)->ifc_mtx) -#define CTX_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_mtx) -#define CTX_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_mtx) +#define STATE_LOCK_INIT(_sc, _name) mtx_init(&(_sc)->ifc_state_mtx, _name, "iflib state lock", MTX_DEF) +#define STATE_LOCK(ctx) mtx_lock(&(ctx)->ifc_state_mtx) +#define STATE_UNLOCK(ctx) mtx_unlock(&(ctx)->ifc_state_mtx) +#define STATE_LOCK_DESTROY(ctx) mtx_destroy(&(ctx)->ifc_state_mtx) + + #define CALLOUT_LOCK(txq) mtx_lock(&txq->ift_mtx) #define CALLOUT_UNLOCK(txq) mtx_unlock(&txq->ift_mtx) @@ -2143,18 +2152,14 @@ iflib_timer(void *arg) if (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING) callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, txq->ift_timer.c_cpu); return; -hung: - CTX_LOCK(ctx); - if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); + hung: device_printf(ctx->ifc_dev, "TX(%d) desc avail = %d, pidx = %d\n", txq->ift_id, TXQ_AVAIL(txq), txq->ift_pidx); - - IFDI_WATCHDOG_RESET(ctx); - ctx->ifc_watchdog_events++; - - ctx->ifc_flags |= IFC_DO_RESET; + STATE_LOCK(ctx); + if_setdrvflagbits(ctx->ifc_ifp, IFF_DRV_OACTIVE, IFF_DRV_RUNNING); + ctx->ifc_flags |= (IFC_DO_WATCHDOG|IFC_DO_RESET); iflib_admin_intr_deferred(ctx); - CTX_UNLOCK(ctx); + STATE_UNLOCK(ctx); } static void @@ -2672,10 +2677,10 @@ iflib_rxeof(iflib_rxq_t rxq, qidx_t budget) return true; return (iflib_rxd_avail(ctx, rxq, *cidxp, 1)); err: - CTX_LOCK(ctx); + STATE_LOCK(ctx); ctx->ifc_flags |= IFC_DO_RESET; iflib_admin_intr_deferred(ctx); - CTX_UNLOCK(ctx); + STATE_UNLOCK(ctx); return (false); } @@ -3705,27 +3710,35 @@ _task_fn_admin(void *context) if_softc_ctx_t sctx = &ctx->ifc_softc_ctx; iflib_txq_t txq; int i; + bool oactive, running, do_reset, do_watchdog; - if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING)) { - if (!(if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE)) { - return; - } - } + STATE_LOCK(ctx); + running = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_RUNNING); + oactive = (if_getdrvflags(ctx->ifc_ifp) & IFF_DRV_OACTIVE); + do_reset = (ctx->ifc_flags & IFC_DO_RESET); + do_watchdog = (ctx->ifc_flags & IFC_DO_WATCHDOG); + ctx->ifc_flags &= ~(IFC_DO_RESET|IFC_DO_WATCHDOG); + STATE_UNLOCK(ctx); + if (!running & !oactive) + return; + CTX_LOCK(ctx); for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) { CALLOUT_LOCK(txq); callout_stop(&txq->ift_timer); CALLOUT_UNLOCK(txq); } + if (do_watchdog) { + ctx->ifc_watchdog_events++; + IFDI_WATCHDOG_RESET(ctx); + } IFDI_UPDATE_ADMIN_STATUS(ctx); for (txq = ctx->ifc_txqs, i = 0; i < sctx->isc_ntxqsets; i++, txq++) callout_reset_on(&txq->ift_timer, hz/2, iflib_timer, txq, txq->ift_timer.c_cpu); IFDI_LINK_INTR_ENABLE(ctx); - if (ctx->ifc_flags & IFC_DO_RESET) { - ctx->ifc_flags &= ~IFC_DO_RESET; + if (do_reset) iflib_if_init_locked(ctx); - } CTX_UNLOCK(ctx); if (LINK_ACTIVE(ctx) == 0) @@ -3869,15 +3882,15 @@ iflib_if_qflush(if_t ifp) iflib_txq_t txq = ctx->ifc_txqs; int i; - CTX_LOCK(ctx); + STATE_LOCK(ctx); ctx->ifc_flags |= IFC_QFLUSH; - CTX_UNLOCK(ctx); + STATE_UNLOCK(ctx); for (i = 0; i < NTXQSETS(ctx); i++, txq++) while (!(ifmp_ring_is_idle(txq->ift_br) || ifmp_ring_is_stalled(txq->ift_br))) iflib_txq_check_drain(txq, 0); - CTX_LOCK(ctx); + STATE_LOCK(ctx); ctx->ifc_flags &= ~IFC_QFLUSH; - CTX_UNLOCK(ctx); + STATE_UNLOCK(ctx); if_qflush(ifp); } @@ -3934,14 +3947,18 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) iflib_stop(ctx); if ((err = IFDI_MTU_SET(ctx, ifr->ifr_mtu)) == 0) { + STATE_LOCK(ctx); if (ifr->ifr_mtu > ctx->ifc_max_fl_buf_size) ctx->ifc_flags |= IFC_MULTISEG; else ctx->ifc_flags &= ~IFC_MULTISEG; + STATE_UNLOCK(ctx); err = if_setmtu(ifp, ifr->ifr_mtu); } iflib_init_locked(ctx); + STATE_LOCK(ctx); if_setdrvflags(ifp, bits); + STATE_UNLOCK(ctx); CTX_UNLOCK(ctx); break; case SIOCSIFFLAGS: @@ -4025,10 +4042,14 @@ iflib_if_ioctl(if_t ifp, u_long command, caddr_t data) bits = if_getdrvflags(ifp); if (bits & IFF_DRV_RUNNING) iflib_stop(ctx); + STATE_LOCK(ctx); if_togglecapenable(ifp, setmask); + STATE_UNLOCK(ctx); if (bits & IFF_DRV_RUNNING) iflib_init_locked(ctx); + STATE_LOCK(ctx); if_setdrvflags(ifp, bits); + STATE_UNLOCK(ctx); CTX_UNLOCK(ctx); } break; @@ -4683,6 +4704,7 @@ iflib_register(if_ctx_t ctx) CTX_LOCK_INIT(ctx, device_get_nameunit(ctx->ifc_dev)); + STATE_LOCK_INIT(ctx, device_get_nameunit(ctx->ifc_dev)); ifp = ctx->ifc_ifp = if_gethandle(IFT_ETHER); if (ifp == NULL) { device_printf(dev, "can not allocate ifnet structure\n"); @@ -5431,9 +5453,11 @@ iflib_link_state_change(if_ctx_t ctx, int link_state, iflib_txq_t txq = ctx->ifc_txqs; if_setbaudrate(ifp, baudrate); - if (baudrate >= IF_Gbps(10)) + if (baudrate >= IF_Gbps(10)) { + STATE_LOCK(ctx); ctx->ifc_flags |= IFC_PREFETCH; - + STATE_UNLOCK(ctx); + } /* If link down, disable watchdog */ if ((ctx->ifc_link_state == LINK_STATE_UP) && (link_state == LINK_STATE_DOWN)) { for (int i = 0; i < ctx->ifc_softc_ctx.isc_ntxqsets; i++, txq++) @@ -5492,7 +5516,7 @@ struct mtx * iflib_ctx_lock_get(if_ctx_t ctx) { - return (&ctx->ifc_mtx); + return (&ctx->ifc_ctx_mtx); } static int From owner-svn-src-head@freebsd.org Thu Apr 12 14:57:49 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1626CF9B6F3; Thu, 12 Apr 2018 14:57:49 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BB9497B2E0; Thu, 12 Apr 2018 14:57: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 B1F0A4D17; Thu, 12 Apr 2018 14:57: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 w3CEvmSO064473; Thu, 12 Apr 2018 14:57:48 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CEvmR6064472; Thu, 12 Apr 2018 14:57:48 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201804121457.w3CEvmR6064472@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 12 Apr 2018 14:57:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332433 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 332433 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 14:57:49 -0000 Author: bz Date: Thu Apr 12 14:57:48 2018 New Revision: 332433 URL: https://svnweb.freebsd.org/changeset/base/332433 Log: Fix a typo. Sponsored by: iXsystems, Inc. Modified: head/sys/sys/proc.h Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Thu Apr 12 14:35:37 2018 (r332432) +++ head/sys/sys/proc.h Thu Apr 12 14:57:48 2018 (r332433) @@ -668,7 +668,7 @@ struct proc { struct racct *p_racct; /* (b) Resource accounting. */ int p_throttled; /* (c) Flag for racct pcpu throttling */ /* - * An orphan is the child that has beed re-parented to the + * An orphan is the child that has been re-parented to the * debugger as a result of attaching to it. Need to keep * track of them for parent to be able to collect the exit * status of what used to be children. From owner-svn-src-head@freebsd.org Thu Apr 12 15:12:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1AE3CF9C890; Thu, 12 Apr 2018 15:12:41 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BC1FD7E3D6; Thu, 12 Apr 2018 15:12:40 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B6E905041; Thu, 12 Apr 2018 15:12:40 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CFCeGj074172; Thu, 12 Apr 2018 15:12:40 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CFCeHD074171; Thu, 12 Apr 2018 15:12:40 GMT (envelope-from br@FreeBSD.org) Message-Id: <201804121512.w3CFCeHD074171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 12 Apr 2018 15:12:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332434 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 332434 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 15:12:41 -0000 Author: br Date: Thu Apr 12 15:12:40 2018 New Revision: 332434 URL: https://svnweb.freebsd.org/changeset/base/332434 Log: Add ld emulation types for hard-float mipses. Sponsored by: DARPA, AFRL Modified: head/sys/conf/kern.mk Modified: head/sys/conf/kern.mk ============================================================================== --- head/sys/conf/kern.mk Thu Apr 12 14:57:48 2018 (r332433) +++ head/sys/conf/kern.mk Thu Apr 12 15:12:40 2018 (r332434) @@ -276,9 +276,13 @@ LD_EMULATION_armv6=armelf_fbsd LD_EMULATION_armv7=armelf_fbsd LD_EMULATION_i386=elf_i386_fbsd LD_EMULATION_mips= elf32btsmip_fbsd +LD_EMULATION_mipshf= elf32btsmip_fbsd LD_EMULATION_mips64= elf64btsmip_fbsd +LD_EMULATION_mips64hf= elf64btsmip_fbsd LD_EMULATION_mipsel= elf32ltsmip_fbsd +LD_EMULATION_mipselhf= elf32ltsmip_fbsd LD_EMULATION_mips64el= elf64ltsmip_fbsd +LD_EMULATION_mips64elhf= elf64ltsmip_fbsd LD_EMULATION_mipsn32= elf32btsmipn32_fbsd LD_EMULATION_mipsn32el= elf32btsmipn32_fbsd # I don't think this is a thing that works LD_EMULATION_powerpc= elf32ppc_fbsd From owner-svn-src-head@freebsd.org Thu Apr 12 15:36:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C8B53F9E46C; Thu, 12 Apr 2018 15:36:25 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7873183749; Thu, 12 Apr 2018 15:36:25 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6ABA85371; Thu, 12 Apr 2018 15:36:25 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CFaPSI084195; Thu, 12 Apr 2018 15:36:25 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CFaOUo084189; Thu, 12 Apr 2018 15:36:24 GMT (envelope-from br@FreeBSD.org) Message-Id: <201804121536.w3CFaOUo084189@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 12 Apr 2018 15:36:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332435 - in head/sys: conf dev/xdma mips/ingenic X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: conf dev/xdma mips/ingenic X-SVN-Commit-Revision: 332435 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 15:36:26 -0000 Author: br Date: Thu Apr 12 15:36:24 2018 New Revision: 332435 URL: https://svnweb.freebsd.org/changeset/base/332435 Log: Tune xDMA interface slightly: o Move descriptors allocation to DMA engine driver o Add generic xdma_request() routine o Add less-generic scatter-gather application based on xdma interface Typical operation flow in peripheral device driver is: 1. Get xDMA controller sc->xdma_tx = xdma_ofw_get(sc->dev, "tx"); 2. Allocate virtual channel sc->xchan_tx = xdma_channel_alloc(sc->xdma_tx, caps); 3. Setup transfer status callback xdma_setup_intr(sc->xchan_tx, my_tx_intr, sc, &sc->ih_tx); 4. Request a transfer(s) ret = xdma_request(sc->xchan_tx, &req); 5. Free the channel xdma_channel_free(sc->xdma_tx); 6. Free the controller xdma_put(sc->xdma_tx); Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D14971 Added: head/sys/dev/xdma/xdma_bank.c (contents, props changed) head/sys/dev/xdma/xdma_bio.c (contents, props changed) head/sys/dev/xdma/xdma_mbuf.c (contents, props changed) head/sys/dev/xdma/xdma_queue.c (contents, props changed) head/sys/dev/xdma/xdma_sg.c (contents, props changed) head/sys/dev/xdma/xdma_sglist.c (contents, props changed) Modified: head/sys/conf/files head/sys/dev/xdma/xdma.c head/sys/dev/xdma/xdma.h head/sys/dev/xdma/xdma_fdt_test.c head/sys/dev/xdma/xdma_if.m head/sys/mips/ingenic/jz4780_aic.c head/sys/mips/ingenic/jz4780_pdma.c head/sys/mips/ingenic/jz4780_pdma.h Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Thu Apr 12 15:12:40 2018 (r332434) +++ head/sys/conf/files Thu Apr 12 15:36:24 2018 (r332435) @@ -3511,8 +3511,14 @@ wpi.fw optional wpifw \ no-obj no-implicit-rule \ clean "wpi.fw" dev/xdma/xdma.c optional xdma -dev/xdma/xdma_if.m optional xdma +dev/xdma/xdma_bank.c optional xdma +dev/xdma/xdma_bio.c optional xdma dev/xdma/xdma_fdt_test.c optional xdma xdma_test fdt +dev/xdma/xdma_if.m optional xdma +dev/xdma/xdma_mbuf.c optional xdma +dev/xdma/xdma_queue.c optional xdma +dev/xdma/xdma_sg.c optional xdma +dev/xdma/xdma_sglist.c optional xdma dev/xe/if_xe.c optional xe dev/xe/if_xe_pccard.c optional xe pccard dev/xen/balloon/balloon.c optional xenhvm Modified: head/sys/dev/xdma/xdma.c ============================================================================== --- head/sys/dev/xdma/xdma.c Thu Apr 12 15:12:40 2018 (r332434) +++ head/sys/dev/xdma/xdma.c Thu Apr 12 15:36:24 2018 (r332435) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Ruslan Bukin + * Copyright (c) 2016-2018 Ruslan Bukin * All rights reserved. * * This software was developed by SRI International and the University of @@ -39,7 +39,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include #include @@ -58,40 +57,28 @@ __FBSDID("$FreeBSD$"); #include -MALLOC_DEFINE(M_XDMA, "xdma", "xDMA framework"); - /* * Multiple xDMA controllers may work with single DMA device, * so we have global lock for physical channel management. */ -static struct mtx xdma_mtx; -#define XDMA_LOCK() mtx_lock(&xdma_mtx) -#define XDMA_UNLOCK() mtx_unlock(&xdma_mtx) -#define XDMA_ASSERT_LOCKED() mtx_assert(&xdma_mtx, MA_OWNED) +static struct sx xdma_sx; -/* - * Per channel locks. - */ -#define XCHAN_LOCK(xchan) mtx_lock(&(xchan)->mtx_lock) -#define XCHAN_UNLOCK(xchan) mtx_unlock(&(xchan)->mtx_lock) -#define XCHAN_ASSERT_LOCKED(xchan) mtx_assert(&(xchan)->mtx_lock, MA_OWNED) +#define XDMA_LOCK() sx_xlock(&xdma_sx) +#define XDMA_UNLOCK() sx_xunlock(&xdma_sx) +#define XDMA_ASSERT_LOCKED() sx_xassert(&xdma_sx, MA_OWNED) /* * Allocate virtual xDMA channel. */ xdma_channel_t * -xdma_channel_alloc(xdma_controller_t *xdma) +xdma_channel_alloc(xdma_controller_t *xdma, uint32_t caps) { xdma_channel_t *xchan; int ret; xchan = malloc(sizeof(xdma_channel_t), M_XDMA, M_WAITOK | M_ZERO); - if (xchan == NULL) { - device_printf(xdma->dev, - "%s: Can't allocate memory for channel.\n", __func__); - return (NULL); - } xchan->xdma = xdma; + xchan->caps = caps; XDMA_LOCK(); @@ -107,8 +94,18 @@ xdma_channel_alloc(xdma_controller_t *xdma) } TAILQ_INIT(&xchan->ie_handlers); - mtx_init(&xchan->mtx_lock, "xDMA", NULL, MTX_DEF); + sx_init(&xchan->sx_lock, "xDMA chan"); + sx_init(&xchan->sx_qin_lock, "xDMA qin"); + sx_init(&xchan->sx_qout_lock, "xDMA qout"); + sx_init(&xchan->sx_bank_lock, "xDMA bank"); + sx_init(&xchan->sx_proc_lock, "xDMA proc"); + + TAILQ_INIT(&xchan->bank); + TAILQ_INIT(&xchan->queue_in); + TAILQ_INIT(&xchan->queue_out); + TAILQ_INIT(&xchan->processing); + TAILQ_INSERT_TAIL(&xdma->channels, xchan, xchan_next); XDMA_UNLOCK(); @@ -123,6 +120,7 @@ xdma_channel_free(xdma_channel_t *xchan) int err; xdma = xchan->xdma; + KASSERT(xdma != NULL, ("xdma is NULL")); XDMA_LOCK(); @@ -135,13 +133,17 @@ xdma_channel_free(xdma_channel_t *xchan) return (-1); } + if (xchan->flags & XCHAN_TYPE_SG) + xdma_channel_free_sg(xchan); + xdma_teardown_all_intr(xchan); - /* Deallocate descriptors, if any. */ - xdma_desc_free(xchan); + sx_destroy(&xchan->sx_lock); + sx_destroy(&xchan->sx_qin_lock); + sx_destroy(&xchan->sx_qout_lock); + sx_destroy(&xchan->sx_bank_lock); + sx_destroy(&xchan->sx_proc_lock); - mtx_destroy(&xchan->mtx_lock); - TAILQ_REMOVE(&xdma->channels, xchan, xchan_next); free(xchan, M_XDMA); @@ -152,8 +154,9 @@ xdma_channel_free(xdma_channel_t *xchan) } int -xdma_setup_intr(xdma_channel_t *xchan, int (*cb)(void *), void *arg, - void **ihandler) +xdma_setup_intr(xdma_channel_t *xchan, + int (*cb)(void *, xdma_transfer_status_t *), + void *arg, void **ihandler) { struct xdma_intr_handler *ih; xdma_controller_t *xdma; @@ -172,22 +175,15 @@ xdma_setup_intr(xdma_channel_t *xchan, int (*cb)(void ih = malloc(sizeof(struct xdma_intr_handler), M_XDMA, M_WAITOK | M_ZERO); - if (ih == NULL) { - device_printf(xdma->dev, - "%s: Can't allocate memory for interrupt handler.\n", - __func__); - - return (-1); - } - ih->cb = cb; ih->cb_user = arg; + XCHAN_LOCK(xchan); TAILQ_INSERT_TAIL(&xchan->ie_handlers, ih, ih_next); + XCHAN_UNLOCK(xchan); - if (ihandler != NULL) { + if (ihandler != NULL) *ihandler = ih; - } return (0); } @@ -231,326 +227,67 @@ xdma_teardown_all_intr(xdma_channel_t *xchan) return (0); } -static void -xdma_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err) -{ - xdma_channel_t *xchan; - int i; - - xchan = (xdma_channel_t *)arg; - KASSERT(xchan != NULL, ("xchan is NULL")); - - if (err) { - xchan->map_err = 1; - return; - } - - for (i = 0; i < nseg; i++) { - xchan->descs_phys[i].ds_addr = segs[i].ds_addr; - xchan->descs_phys[i].ds_len = segs[i].ds_len; - } -} - -static int -xdma_desc_alloc_bus_dma(xdma_channel_t *xchan, uint32_t desc_size, - uint32_t align) -{ - xdma_controller_t *xdma; - bus_size_t all_desc_sz; - xdma_config_t *conf; - int nsegments; - int err; - - xdma = xchan->xdma; - conf = &xchan->conf; - - nsegments = conf->block_num; - all_desc_sz = (nsegments * desc_size); - - err = bus_dma_tag_create( - bus_get_dma_tag(xdma->dev), - align, desc_size, /* alignment, boundary */ - BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ - BUS_SPACE_MAXADDR, /* highaddr */ - NULL, NULL, /* filter, filterarg */ - all_desc_sz, nsegments, /* maxsize, nsegments*/ - desc_size, 0, /* maxsegsize, flags */ - NULL, NULL, /* lockfunc, lockarg */ - &xchan->dma_tag); - if (err) { - device_printf(xdma->dev, - "%s: Can't create bus_dma tag.\n", __func__); - return (-1); - } - - err = bus_dmamem_alloc(xchan->dma_tag, (void **)&xchan->descs, - BUS_DMA_WAITOK | BUS_DMA_COHERENT, &xchan->dma_map); - if (err) { - device_printf(xdma->dev, - "%s: Can't allocate memory for descriptors.\n", __func__); - return (-1); - } - - xchan->descs_phys = malloc(nsegments * sizeof(xdma_descriptor_t), M_XDMA, - (M_WAITOK | M_ZERO)); - - xchan->map_err = 0; - err = bus_dmamap_load(xchan->dma_tag, xchan->dma_map, xchan->descs, - all_desc_sz, xdma_dmamap_cb, xchan, BUS_DMA_WAITOK); - if (err) { - device_printf(xdma->dev, - "%s: Can't load DMA map.\n", __func__); - return (-1); - } - - if (xchan->map_err != 0) { - device_printf(xdma->dev, - "%s: Can't load DMA map.\n", __func__); - return (-1); - } - - return (0); -} - -/* - * This function called by DMA controller driver. - */ int -xdma_desc_alloc(xdma_channel_t *xchan, uint32_t desc_size, uint32_t align) +xdma_request(xdma_channel_t *xchan, struct xdma_request *req) { xdma_controller_t *xdma; - xdma_config_t *conf; int ret; - XCHAN_ASSERT_LOCKED(xchan); - xdma = xchan->xdma; - if (xdma == NULL) { - device_printf(xdma->dev, - "%s: Channel was not allocated properly.\n", __func__); - return (-1); - } - if (xchan->flags & XCHAN_DESC_ALLOCATED) { - device_printf(xdma->dev, - "%s: Descriptors already allocated.\n", __func__); - return (-1); - } - - if ((xchan->flags & XCHAN_CONFIGURED) == 0) { - device_printf(xdma->dev, - "%s: Channel has no configuration.\n", __func__); - return (-1); - } - - conf = &xchan->conf; - - XCHAN_UNLOCK(xchan); - ret = xdma_desc_alloc_bus_dma(xchan, desc_size, align); - XCHAN_LOCK(xchan); - if (ret != 0) { - device_printf(xdma->dev, - "%s: Can't allocate memory for descriptors.\n", - __func__); - return (-1); - } - - xchan->flags |= XCHAN_DESC_ALLOCATED; - - /* We are going to write to descriptors. */ - bus_dmamap_sync(xchan->dma_tag, xchan->dma_map, BUS_DMASYNC_PREWRITE); - - return (0); -} - -int -xdma_desc_free(xdma_channel_t *xchan) -{ - - if ((xchan->flags & XCHAN_DESC_ALLOCATED) == 0) { - /* No descriptors allocated. */ - return (-1); - } - - bus_dmamap_unload(xchan->dma_tag, xchan->dma_map); - bus_dmamem_free(xchan->dma_tag, xchan->descs, xchan->dma_map); - bus_dma_tag_destroy(xchan->dma_tag); - free(xchan->descs_phys, M_XDMA); - - xchan->flags &= ~(XCHAN_DESC_ALLOCATED); - - return (0); -} - -int -xdma_prep_memcpy(xdma_channel_t *xchan, uintptr_t src_addr, - uintptr_t dst_addr, size_t len) -{ - xdma_controller_t *xdma; - xdma_config_t *conf; - int ret; - - xdma = xchan->xdma; KASSERT(xdma != NULL, ("xdma is NULL")); - conf = &xchan->conf; - conf->direction = XDMA_MEM_TO_MEM; - conf->src_addr = src_addr; - conf->dst_addr = dst_addr; - conf->block_len = len; - conf->block_num = 1; - - xchan->flags |= (XCHAN_CONFIGURED | XCHAN_TYPE_MEMCPY); - XCHAN_LOCK(xchan); - - /* Deallocate old descriptors, if any. */ - xdma_desc_free(xchan); - - ret = XDMA_CHANNEL_PREP_MEMCPY(xdma->dma_dev, xchan); + ret = XDMA_CHANNEL_REQUEST(xdma->dma_dev, xchan, req); if (ret != 0) { device_printf(xdma->dev, - "%s: Can't prepare memcpy transfer.\n", __func__); + "%s: Can't request a transfer.\n", __func__); XCHAN_UNLOCK(xchan); return (-1); } - - if (xchan->flags & XCHAN_DESC_ALLOCATED) { - /* Driver created xDMA descriptors. */ - bus_dmamap_sync(xchan->dma_tag, xchan->dma_map, - BUS_DMASYNC_POSTWRITE); - } - XCHAN_UNLOCK(xchan); return (0); } int -xdma_prep_cyclic(xdma_channel_t *xchan, enum xdma_direction dir, - uintptr_t src_addr, uintptr_t dst_addr, int block_len, - int block_num, int src_width, int dst_width) +xdma_control(xdma_channel_t *xchan, enum xdma_command cmd) { xdma_controller_t *xdma; - xdma_config_t *conf; int ret; xdma = xchan->xdma; KASSERT(xdma != NULL, ("xdma is NULL")); - conf = &xchan->conf; - conf->direction = dir; - conf->src_addr = src_addr; - conf->dst_addr = dst_addr; - conf->block_len = block_len; - conf->block_num = block_num; - conf->src_width = src_width; - conf->dst_width = dst_width; - - xchan->flags |= (XCHAN_CONFIGURED | XCHAN_TYPE_CYCLIC); - - XCHAN_LOCK(xchan); - - /* Deallocate old descriptors, if any. */ - xdma_desc_free(xchan); - - ret = XDMA_CHANNEL_PREP_CYCLIC(xdma->dma_dev, xchan); + ret = XDMA_CHANNEL_CONTROL(xdma->dma_dev, xchan, cmd); if (ret != 0) { device_printf(xdma->dev, - "%s: Can't prepare cyclic transfer.\n", __func__); - XCHAN_UNLOCK(xchan); - + "%s: Can't process command.\n", __func__); return (-1); } - if (xchan->flags & XCHAN_DESC_ALLOCATED) { - /* Driver has created xDMA descriptors. */ - bus_dmamap_sync(xchan->dma_tag, xchan->dma_map, - BUS_DMASYNC_POSTWRITE); - } - - XCHAN_UNLOCK(xchan); - return (0); } -int -xdma_begin(xdma_channel_t *xchan) +void +xdma_callback(xdma_channel_t *xchan, xdma_transfer_status_t *status) { + struct xdma_intr_handler *ih_tmp; + struct xdma_intr_handler *ih; xdma_controller_t *xdma; - int ret; xdma = xchan->xdma; + KASSERT(xdma != NULL, ("xdma is NULL")); - ret = XDMA_CHANNEL_CONTROL(xdma->dma_dev, xchan, XDMA_CMD_BEGIN); - if (ret != 0) { - device_printf(xdma->dev, - "%s: Can't begin the channel operation.\n", __func__); - return (-1); - } + TAILQ_FOREACH_SAFE(ih, &xchan->ie_handlers, ih_next, ih_tmp) + if (ih->cb != NULL) + ih->cb(ih->cb_user, status); - return (0); + if (xchan->flags & XCHAN_TYPE_SG) + xdma_queue_submit(xchan); } -int -xdma_terminate(xdma_channel_t *xchan) -{ - xdma_controller_t *xdma; - int ret; - - xdma = xchan->xdma; - - ret = XDMA_CHANNEL_CONTROL(xdma->dma_dev, xchan, XDMA_CMD_TERMINATE); - if (ret != 0) { - device_printf(xdma->dev, - "%s: Can't terminate the channel operation.\n", __func__); - return (-1); - } - - return (0); -} - -int -xdma_pause(xdma_channel_t *xchan) -{ - xdma_controller_t *xdma; - int ret; - - xdma = xchan->xdma; - - ret = XDMA_CHANNEL_CONTROL(xdma->dma_dev, xchan, XDMA_CMD_PAUSE); - if (ret != 0) { - device_printf(xdma->dev, - "%s: Can't pause the channel operation.\n", __func__); - return (-1); - } - - return (ret); -} - -int -xdma_callback(xdma_channel_t *xchan) -{ - struct xdma_intr_handler *ih_tmp; - struct xdma_intr_handler *ih; - - TAILQ_FOREACH_SAFE(ih, &xchan->ie_handlers, ih_next, ih_tmp) { - if (ih->cb != NULL) { - ih->cb(ih->cb_user); - } - } - - return (0); -} - -void -xdma_assert_locked(void) -{ - - XDMA_ASSERT_LOCKED(); -} - #ifdef FDT /* * Notify the DMA driver we have machine-dependent data in FDT. @@ -560,7 +297,8 @@ xdma_ofw_md_data(xdma_controller_t *xdma, pcell_t *cel { uint32_t ret; - ret = XDMA_OFW_MD_DATA(xdma->dma_dev, cells, ncells, (void **)&xdma->data); + ret = XDMA_OFW_MD_DATA(xdma->dma_dev, + cells, ncells, (void **)&xdma->data); return (ret); } @@ -581,10 +319,9 @@ xdma_ofw_get(device_t dev, const char *prop) int idx; node = ofw_bus_get_node(dev); - if (node <= 0) { + if (node <= 0) device_printf(dev, "%s called on not ofw based device.\n", __func__); - } error = ofw_bus_parse_xref_list_get_length(node, "dmas", "#dma-cells", &ndmas); @@ -622,12 +359,8 @@ xdma_ofw_get(device_t dev, const char *prop) return (NULL); } - xdma = malloc(sizeof(struct xdma_controller), M_XDMA, M_WAITOK | M_ZERO); - if (xdma == NULL) { - device_printf(dev, - "%s can't allocate memory for xdma.\n", __func__); - return (NULL); - } + xdma = malloc(sizeof(struct xdma_controller), + M_XDMA, M_WAITOK | M_ZERO); xdma->dev = dev; xdma->dma_dev = dma_dev; @@ -667,7 +400,7 @@ static void xdma_init(void) { - mtx_init(&xdma_mtx, "xDMA", NULL, MTX_DEF); + sx_init(&xdma_sx, "xDMA"); } SYSINIT(xdma, SI_SUB_DRIVERS, SI_ORDER_FIRST, xdma_init, NULL); Modified: head/sys/dev/xdma/xdma.h ============================================================================== --- head/sys/dev/xdma/xdma.h Thu Apr 12 15:12:40 2018 (r332434) +++ head/sys/dev/xdma/xdma.h Thu Apr 12 15:36:24 2018 (r332435) @@ -1,5 +1,5 @@ /*- - * Copyright (c) 2016 Ruslan Bukin + * Copyright (c) 2016-2018 Ruslan Bukin * All rights reserved. * * This software was developed by SRI International and the University of @@ -30,9 +30,11 @@ * $FreeBSD$ */ -#ifndef _DEV_EXTRES_XDMA_H_ -#define _DEV_EXTRES_XDMA_H_ +#ifndef _DEV_XDMA_XDMA_H_ +#define _DEV_XDMA_XDMA_H_ +#include + enum xdma_direction { XDMA_MEM_TO_MEM, XDMA_MEM_TO_DEV, @@ -42,17 +44,31 @@ enum xdma_direction { enum xdma_operation_type { XDMA_MEMCPY, - XDMA_SG, XDMA_CYCLIC, + XDMA_FIFO, + XDMA_SG, }; +enum xdma_request_type { + XR_TYPE_PHYS, + XR_TYPE_VIRT, + XR_TYPE_MBUF, + XR_TYPE_BIO, +}; + enum xdma_command { XDMA_CMD_BEGIN, XDMA_CMD_PAUSE, XDMA_CMD_TERMINATE, - XDMA_CMD_TERMINATE_ALL, }; +struct xdma_transfer_status { + uint32_t transferred; + int error; +}; + +typedef struct xdma_transfer_status xdma_transfer_status_t; + struct xdma_controller { device_t dev; /* DMA consumer device_t. */ device_t dma_dev; /* A real DMA device_t. */ @@ -64,85 +80,185 @@ struct xdma_controller { typedef struct xdma_controller xdma_controller_t; -struct xdma_channel_config { - enum xdma_direction direction; - uintptr_t src_addr; /* Physical address. */ - uintptr_t dst_addr; /* Physical address. */ - int block_len; /* In bytes. */ - int block_num; /* Count of blocks. */ - int src_width; /* In bytes. */ - int dst_width; /* In bytes. */ +struct xchan_buf { + bus_dmamap_t map; + uint32_t nsegs; + uint32_t nsegs_left; + void *cbuf; }; -typedef struct xdma_channel_config xdma_config_t; +struct xdma_request { + struct mbuf *m; + struct bio *bp; + enum xdma_operation_type operation; + enum xdma_request_type req_type; + enum xdma_direction direction; + bus_addr_t src_addr; + bus_addr_t dst_addr; + uint8_t src_width; + uint8_t dst_width; + bus_size_t block_num; + bus_size_t block_len; + xdma_transfer_status_t status; + void *user; + TAILQ_ENTRY(xdma_request) xr_next; + struct xchan_buf buf; +}; -struct xdma_descriptor { - bus_addr_t ds_addr; - bus_size_t ds_len; +struct xdma_sglist { + bus_addr_t src_addr; + bus_addr_t dst_addr; + size_t len; + uint8_t src_width; + uint8_t dst_width; + enum xdma_direction direction; + bool first; + bool last; }; -typedef struct xdma_descriptor xdma_descriptor_t; - struct xdma_channel { xdma_controller_t *xdma; - xdma_config_t conf; - uint8_t flags; -#define XCHAN_DESC_ALLOCATED (1 << 0) -#define XCHAN_CONFIGURED (1 << 1) -#define XCHAN_TYPE_CYCLIC (1 << 2) -#define XCHAN_TYPE_MEMCPY (1 << 3) + uint32_t flags; +#define XCHAN_BUFS_ALLOCATED (1 << 0) +#define XCHAN_SGLIST_ALLOCATED (1 << 1) +#define XCHAN_CONFIGURED (1 << 2) +#define XCHAN_TYPE_CYCLIC (1 << 3) +#define XCHAN_TYPE_MEMCPY (1 << 4) +#define XCHAN_TYPE_FIFO (1 << 5) +#define XCHAN_TYPE_SG (1 << 6) + uint32_t caps; +#define XCHAN_CAP_BUSDMA (1 << 0) +#define XCHAN_CAP_BUSDMA_NOSEG (1 << 1) + /* A real hardware driver channel. */ void *chan; /* Interrupt handlers. */ TAILQ_HEAD(, xdma_intr_handler) ie_handlers; + TAILQ_ENTRY(xdma_channel) xchan_next; - /* Descriptors. */ - bus_dma_tag_t dma_tag; - bus_dmamap_t dma_map; - void *descs; - xdma_descriptor_t *descs_phys; - uint8_t map_err; + struct sx sx_lock; + struct sx sx_qin_lock; + struct sx sx_qout_lock; + struct sx sx_bank_lock; + struct sx sx_proc_lock; - struct mtx mtx_lock; + /* Request queue. */ + bus_dma_tag_t dma_tag_bufs; + struct xdma_request *xr_mem; + uint32_t xr_num; - TAILQ_ENTRY(xdma_channel) xchan_next; + /* Bus dma tag options. */ + bus_size_t maxsegsize; + bus_size_t maxnsegs; + bus_size_t alignment; + bus_addr_t boundary; + bus_addr_t lowaddr; + bus_addr_t highaddr; + + struct xdma_sglist *sg; + + TAILQ_HEAD(, xdma_request) bank; + TAILQ_HEAD(, xdma_request) queue_in; + TAILQ_HEAD(, xdma_request) queue_out; + TAILQ_HEAD(, xdma_request) processing; }; typedef struct xdma_channel xdma_channel_t; -/* xDMA controller alloc/free */ +struct xdma_intr_handler { + int (*cb)(void *cb_user, xdma_transfer_status_t *status); + void *cb_user; + TAILQ_ENTRY(xdma_intr_handler) ih_next; +}; + +static MALLOC_DEFINE(M_XDMA, "xdma", "xDMA framework"); + +#define XCHAN_LOCK(xchan) sx_xlock(&(xchan)->sx_lock) +#define XCHAN_UNLOCK(xchan) sx_xunlock(&(xchan)->sx_lock) +#define XCHAN_ASSERT_LOCKED(xchan) \ + sx_assert(&(xchan)->sx_lock, SX_XLOCKED) + +#define QUEUE_IN_LOCK(xchan) sx_xlock(&(xchan)->sx_qin_lock) +#define QUEUE_IN_UNLOCK(xchan) sx_xunlock(&(xchan)->sx_qin_lock) +#define QUEUE_IN_ASSERT_LOCKED(xchan) \ + sx_assert(&(xchan)->sx_qin_lock, SX_XLOCKED) + +#define QUEUE_OUT_LOCK(xchan) sx_xlock(&(xchan)->sx_qout_lock) +#define QUEUE_OUT_UNLOCK(xchan) sx_xunlock(&(xchan)->sx_qout_lock) +#define QUEUE_OUT_ASSERT_LOCKED(xchan) \ + sx_assert(&(xchan)->sx_qout_lock, SX_XLOCKED) + +#define QUEUE_BANK_LOCK(xchan) sx_xlock(&(xchan)->sx_bank_lock) +#define QUEUE_BANK_UNLOCK(xchan) sx_xunlock(&(xchan)->sx_bank_lock) +#define QUEUE_BANK_ASSERT_LOCKED(xchan) \ + sx_assert(&(xchan)->sx_bank_lock, SX_XLOCKED) + +#define QUEUE_PROC_LOCK(xchan) sx_xlock(&(xchan)->sx_proc_lock) +#define QUEUE_PROC_UNLOCK(xchan) sx_xunlock(&(xchan)->sx_proc_lock) +#define QUEUE_PROC_ASSERT_LOCKED(xchan) \ + sx_assert(&(xchan)->sx_proc_lock, SX_XLOCKED) + +#define XDMA_SGLIST_MAXLEN 2048 +#define XDMA_MAX_SEG 128 + +/* xDMA controller ops */ xdma_controller_t *xdma_ofw_get(device_t dev, const char *prop); int xdma_put(xdma_controller_t *xdma); -xdma_channel_t * xdma_channel_alloc(xdma_controller_t *); +/* xDMA channel ops */ +xdma_channel_t * xdma_channel_alloc(xdma_controller_t *, uint32_t caps); int xdma_channel_free(xdma_channel_t *); +int xdma_request(xdma_channel_t *xchan, struct xdma_request *r); -int xdma_prep_cyclic(xdma_channel_t *, enum xdma_direction, - uintptr_t, uintptr_t, int, int, int, int); -int xdma_prep_memcpy(xdma_channel_t *, uintptr_t, uintptr_t, size_t len); -int xdma_desc_alloc(xdma_channel_t *, uint32_t, uint32_t); -int xdma_desc_free(xdma_channel_t *xchan); +/* SG interface */ +int xdma_prep_sg(xdma_channel_t *, uint32_t, + bus_size_t, bus_size_t, bus_size_t, bus_addr_t, bus_addr_t, bus_addr_t); +void xdma_channel_free_sg(xdma_channel_t *xchan); +int xdma_queue_submit_sg(xdma_channel_t *xchan); +void xchan_seg_done(xdma_channel_t *xchan, xdma_transfer_status_t *); +/* Queue operations */ +int xdma_dequeue_mbuf(xdma_channel_t *xchan, struct mbuf **m, + xdma_transfer_status_t *); +int xdma_enqueue_mbuf(xdma_channel_t *xchan, struct mbuf **m, uintptr_t addr, + uint8_t, uint8_t, enum xdma_direction dir); +int xdma_dequeue_bio(xdma_channel_t *xchan, struct bio **bp, + xdma_transfer_status_t *status); +int xdma_enqueue_bio(xdma_channel_t *xchan, struct bio **bp, bus_addr_t addr, + uint8_t, uint8_t, enum xdma_direction dir); +int xdma_dequeue(xdma_channel_t *xchan, void **user, + xdma_transfer_status_t *status); +int xdma_enqueue(xdma_channel_t *xchan, uintptr_t src, uintptr_t dst, + uint8_t, uint8_t, bus_size_t, enum xdma_direction dir, void *); +int xdma_queue_submit(xdma_channel_t *xchan); + +/* Mbuf operations */ +uint32_t xdma_mbuf_defrag(xdma_channel_t *xchan, struct xdma_request *xr); +uint32_t xdma_mbuf_chain_count(struct mbuf *m0); + /* Channel Control */ -int xdma_begin(xdma_channel_t *xchan); -int xdma_pause(xdma_channel_t *xchan); -int xdma_terminate(xdma_channel_t *xchan); +int xdma_control(xdma_channel_t *xchan, enum xdma_command cmd); /* Interrupt callback */ -int xdma_setup_intr(xdma_channel_t *xchan, int (*cb)(void *), void *arg, void **); +int xdma_setup_intr(xdma_channel_t *xchan, int (*cb)(void *, + xdma_transfer_status_t *), void *arg, void **); int xdma_teardown_intr(xdma_channel_t *xchan, struct xdma_intr_handler *ih); int xdma_teardown_all_intr(xdma_channel_t *xchan); -int xdma_callback(struct xdma_channel *xchan); -void xdma_assert_locked(void); +void xdma_callback(struct xdma_channel *xchan, xdma_transfer_status_t *status); -struct xdma_intr_handler { - int (*cb)(void *); - void *cb_user; - struct mtx ih_lock; - TAILQ_ENTRY(xdma_intr_handler) ih_next; -}; +/* Sglist */ +int xchan_sglist_alloc(xdma_channel_t *xchan); +void xchan_sglist_free(xdma_channel_t *xchan); +int xdma_sglist_add(struct xdma_sglist *sg, struct bus_dma_segment *seg, + uint32_t nsegs, struct xdma_request *xr); -#endif /* !_DEV_EXTRES_XDMA_H_ */ +/* Requests bank */ +void xchan_bank_init(xdma_channel_t *xchan); +int xchan_bank_free(xdma_channel_t *xchan); +struct xdma_request * xchan_bank_get(xdma_channel_t *xchan); +int xchan_bank_put(xdma_channel_t *xchan, struct xdma_request *xr); + +#endif /* !_DEV_XDMA_XDMA_H_ */ Added: head/sys/dev/xdma/xdma_bank.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/xdma/xdma_bank.c Thu Apr 12 15:36:24 2018 (r332435) @@ -0,0 +1,99 @@ +/*- + * Copyright (c) 2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" +#include +#include +#include +#include +#include +#include + +#include + +#include + +void +xchan_bank_init(xdma_channel_t *xchan) +{ + struct xdma_request *xr; + xdma_controller_t *xdma; + int i; + + xdma = xchan->xdma; + KASSERT(xdma != NULL, ("xdma is NULL")); + + xchan->xr_mem = malloc(sizeof(struct xdma_request) * xchan->xr_num, + M_XDMA, M_WAITOK | M_ZERO); + + for (i = 0; i < xchan->xr_num; i++) { + xr = &xchan->xr_mem[i]; + TAILQ_INSERT_TAIL(&xchan->bank, xr, xr_next); + } +} + +int +xchan_bank_free(xdma_channel_t *xchan) +{ + + free(xchan->xr_mem, M_XDMA); + + return (0); +} + +struct xdma_request * +xchan_bank_get(xdma_channel_t *xchan) +{ + struct xdma_request *xr; + struct xdma_request *xr_tmp; + + QUEUE_BANK_LOCK(xchan); + TAILQ_FOREACH_SAFE(xr, &xchan->bank, xr_next, xr_tmp) { + TAILQ_REMOVE(&xchan->bank, xr, xr_next); + break; + } + QUEUE_BANK_UNLOCK(xchan); + + return (xr); +} + +int +xchan_bank_put(xdma_channel_t *xchan, struct xdma_request *xr) +{ + + QUEUE_BANK_LOCK(xchan); + TAILQ_INSERT_TAIL(&xchan->bank, xr, xr_next); + QUEUE_BANK_UNLOCK(xchan); + + return (0); +} Added: head/sys/dev/xdma/xdma_bio.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/xdma/xdma_bio.c Thu Apr 12 15:36:24 2018 (r332435) @@ -0,0 +1,105 @@ +/*- + * Copyright (c) 2017-2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" +#include +#include +#include +#include +#include +#include + +#include + +#include + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Apr 12 15:47:48 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 312B4F9F12F; Thu, 12 Apr 2018 15:47:48 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D834485EB8; Thu, 12 Apr 2018 15:47:47 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D3127552C; Thu, 12 Apr 2018 15:47:47 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CFllPp089097; Thu, 12 Apr 2018 15:47:47 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CFllRY089095; Thu, 12 Apr 2018 15:47:47 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201804121547.w3CFllRY089095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Thu, 12 Apr 2018 15:47:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332436 - head/usr.bin/mkimg X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/usr.bin/mkimg X-SVN-Commit-Revision: 332436 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 15:47:48 -0000 Author: benno Date: Thu Apr 12 15:47:47 2018 New Revision: 332436 URL: https://svnweb.freebsd.org/changeset/base/332436 Log: Add the ability to specify absolute and relative offsets to size partitions. To create hybrid boot media we want to specify a partition at a known location. This extends the syntax of size partitions to include an optional offset that can be absolute or relative. It also introduces validation to make sure that this hasn't resulted in overlapping partitions. I haven't added this to the file and process partition specifications yet but the mechanics are designed such that if someone comes up with a good way of specifying the offset it will be fairly easy to add in. Reviewed by: imp Sponsored by: iXsystems, Inc. Differential Revision: https://reviews.freebsd.org/D14916 Modified: head/usr.bin/mkimg/mkimg.c head/usr.bin/mkimg/scheme.h Modified: head/usr.bin/mkimg/mkimg.c ============================================================================== --- head/usr.bin/mkimg/mkimg.c Thu Apr 12 15:36:24 2018 (r332435) +++ head/usr.bin/mkimg/mkimg.c Thu Apr 12 15:47:47 2018 (r332436) @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -170,13 +171,14 @@ usage(const char *why) print_schemes(1); fputc('\n', stderr); fprintf(stderr, " partition specification:\n"); - fprintf(stderr, "\t[/]::\t- empty partition of given " - "size\n"); - fprintf(stderr, "\t[/]:=\t- partition content and size " - "are determined\n\t\t\t\t by the named file\n"); - fprintf(stderr, "\t[/]:-\t- partition content and size " - "are taken from\n\t\t\t\t the output of the command to run\n"); - fprintf(stderr, "\t-\t\t\t- unused partition entry\n"); + fprintf(stderr, "\t[/]::[:[+]]\t- " + "empty partition of given size and\n\t\t\t\t\t" + " optional relative or absolute offset\n"); + fprintf(stderr, "\t[/]:=\t\t- partition content and size " + "are\n\t\t\t\t\t determined by the named file\n"); + fprintf(stderr, "\t[/]:-\t\t- partition content and size " + "are taken\n\t\t\t\t\t from the output of the command to run\n"); + fprintf(stderr, "\t-\t\t\t\t- unused partition entry\n"); fprintf(stderr, "\t where:\n"); fprintf(stderr, "\t\t\t- scheme neutral partition type\n"); fprintf(stderr, "\t\t\t- optional scheme-dependent partition " @@ -397,12 +399,48 @@ capacity_resize(lba_t end) } static void +mkimg_validate(void) +{ + struct part *part, *part2; + lba_t start, end, start2, end2; + int i, j; + + i = 0; + + TAILQ_FOREACH(part, &partlist, link) { + start = part->block; + end = part->block + part->size; + j = i + 1; + part2 = TAILQ_NEXT(part, link); + if (part2 == NULL) + break; + + TAILQ_FOREACH_FROM(part2, &partlist, link) { + start2 = part2->block; + end2 = part2->block + part2->size; + + if ((start >= start2 && start < end2) || + (end > start2 && end <= end2)) { + errx(1, "partition %d overlaps partition %d", + i, j); + } + + j++; + } + + i++; + } +} + +static void mkimg(void) { FILE *fp; struct part *part; - lba_t block; - off_t bytesize; + lba_t block, blkoffset; + off_t bytesize, byteoffset; + char *size, *offset; + bool abs_offset; int error, fd; /* First check partition information */ @@ -413,17 +451,46 @@ mkimg(void) } block = scheme_metadata(SCHEME_META_IMG_START, 0); + abs_offset = false; TAILQ_FOREACH(part, &partlist, link) { - block = scheme_metadata(SCHEME_META_PART_BEFORE, block); - if (verbose) - fprintf(stderr, "partition %d: starting block %llu " - "... ", part->index + 1, (long long)block); - part->block = block; + byteoffset = blkoffset = 0; + abs_offset = false; + + /* Look for an offset. Set size too if we can. */ switch (part->kind) { case PART_KIND_SIZE: - if (expand_number(part->contents, &bytesize) == -1) + offset = part->contents; + size = strsep(&offset, ":"); + if (expand_number(size, &bytesize) == -1) error = errno; + if (offset != NULL) { + if (*offset != '+') { + abs_offset = true; + offset++; + } + if (expand_number(offset, &byteoffset) == -1) + error = errno; + } break; + } + + /* Work out exactly where the partition starts. */ + blkoffset = (byteoffset + secsz - 1) / secsz; + if (abs_offset) { + part->block = scheme_metadata(SCHEME_META_PART_ABSOLUTE, + blkoffset); + } else { + block = scheme_metadata(SCHEME_META_PART_BEFORE, + block + blkoffset); + part->block = block; + } + + if (verbose) + fprintf(stderr, "partition %d: starting block %llu " + "... ", part->index + 1, (long long)part->block); + + /* Pull in partition contents, set size if we haven't yet. */ + switch (part->kind) { case PART_KIND_FILE: fd = open(part->contents, O_RDONLY, 0); if (fd != -1) { @@ -449,10 +516,25 @@ mkimg(void) bytesize = part->size * secsz; fprintf(stderr, "size %llu bytes (%llu blocks)\n", (long long)bytesize, (long long)part->size); + if (abs_offset) { + fprintf(stderr, + " location %llu bytes (%llu blocks)\n", + (long long)byteoffset, + (long long)blkoffset); + } else if (blkoffset > 0) { + fprintf(stderr, + " offset %llu bytes (%llu blocks)\n", + (long long)byteoffset, + (long long)blkoffset); + } } - block = scheme_metadata(SCHEME_META_PART_AFTER, - part->block + part->size); + if (!abs_offset) { + block = scheme_metadata(SCHEME_META_PART_AFTER, + part->block + part->size); + } } + + mkimg_validate(); block = scheme_metadata(SCHEME_META_IMG_END, block); error = image_set_size(block); Modified: head/usr.bin/mkimg/scheme.h ============================================================================== --- head/usr.bin/mkimg/scheme.h Thu Apr 12 15:36:24 2018 (r332435) +++ head/usr.bin/mkimg/scheme.h Thu Apr 12 15:47:47 2018 (r332436) @@ -65,10 +65,11 @@ struct mkimg_scheme { const char *description; struct mkimg_alias *aliases; lba_t (*metadata)(u_int, lba_t); -#define SCHEME_META_IMG_START 1 -#define SCHEME_META_IMG_END 2 -#define SCHEME_META_PART_BEFORE 3 -#define SCHEME_META_PART_AFTER 4 +#define SCHEME_META_IMG_START 1 +#define SCHEME_META_IMG_END 2 +#define SCHEME_META_PART_BEFORE 3 +#define SCHEME_META_PART_AFTER 4 +#define SCHEME_META_PART_ABSOLUTE 5 int (*write)(lba_t, void *); u_int nparts; u_int labellen; From owner-svn-src-head@freebsd.org Thu Apr 12 15:50:20 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 84AF9F9F43D; Thu, 12 Apr 2018 15:50:20 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 37745860EE; Thu, 12 Apr 2018 15:50:20 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3264A5536; Thu, 12 Apr 2018 15:50:20 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CFoJ1p089243; Thu, 12 Apr 2018 15:50:19 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CFoJsE089242; Thu, 12 Apr 2018 15:50:19 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201804121550.w3CFoJsE089242@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Thu, 12 Apr 2018 15:50:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332437 - head/usr.bin/etdump X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/usr.bin/etdump X-SVN-Commit-Revision: 332437 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 15:50:20 -0000 Author: benno Date: Thu Apr 12 15:50:19 2018 New Revision: 332437 URL: https://svnweb.freebsd.org/changeset/base/332437 Log: Check the return value of fseek. Reported by: Coverity CID: 1388267 Sponsored by: iXsystems, Inc. Modified: head/usr.bin/etdump/etdump.c Modified: head/usr.bin/etdump/etdump.c ============================================================================== --- head/usr.bin/etdump/etdump.c Thu Apr 12 15:47:47 2018 (r332436) +++ head/usr.bin/etdump/etdump.c Thu Apr 12 15:50:19 2018 (r332437) @@ -80,7 +80,9 @@ static int read_sector(FILE *iso, daddr_t sector, char *buffer) { - fseek(iso, sector * ISO_DEFAULT_BLOCK_SIZE, SEEK_SET); + if (fseek(iso, sector * ISO_DEFAULT_BLOCK_SIZE, SEEK_SET) != 0) { + return (errno); + } if (fread(buffer, ISO_DEFAULT_BLOCK_SIZE, 1, iso) != 1) { return (errno); } From owner-svn-src-head@freebsd.org Thu Apr 12 16:55:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BDEBCFA3BFD; Thu, 12 Apr 2018 16:55:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 57B6074412; Thu, 12 Apr 2018 16:55:32 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id A158B10AFD2; Thu, 12 Apr 2018 12:55:31 -0400 (EDT) From: John Baldwin To: Ruslan Bukin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332434 - head/sys/conf Date: Thu, 12 Apr 2018 09:48:10 -0700 Message-ID: <1777044.OCjZ8thPIn@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201804121512.w3CFCeHD074171@repo.freebsd.org> References: <201804121512.w3CFCeHD074171@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Thu, 12 Apr 2018 12:55:31 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 16:55:32 -0000 On Thursday, April 12, 2018 03:12:40 PM Ruslan Bukin wrote: > Author: br > Date: Thu Apr 12 15:12:40 2018 > New Revision: 332434 > URL: https://svnweb.freebsd.org/changeset/base/332434 > > Log: > Add ld emulation types for hard-float mipses. > > Sponsored by: DARPA, AFRL We actually shouldn't need hf kernels anymore. HAVE_FPU has been removed and any mips kernel works fine with either hard or soft float userlands. -- John Baldwin From owner-svn-src-head@freebsd.org Thu Apr 12 17:00:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 012D5FA410E; Thu, 12 Apr 2018 17:00:37 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id AB7AA764E6; Thu, 12 Apr 2018 17:00:36 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A679C60A1; Thu, 12 Apr 2018 17:00:36 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CH0aGd024977; Thu, 12 Apr 2018 17:00:36 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CH0aDk024976; Thu, 12 Apr 2018 17:00:36 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201804121700.w3CH0aDk024976@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Thu, 12 Apr 2018 17:00:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332438 - head/usr.bin/etdump X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/usr.bin/etdump X-SVN-Commit-Revision: 332438 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 17:00:37 -0000 Author: benno Date: Thu Apr 12 17:00:36 2018 New Revision: 332438 URL: https://svnweb.freebsd.org/changeset/base/332438 Log: Remove a debugging printf that crept in. Sponsored by: iXsystems, Inc. Modified: head/usr.bin/etdump/etdump.c Modified: head/usr.bin/etdump/etdump.c ============================================================================== --- head/usr.bin/etdump/etdump.c Thu Apr 12 15:50:19 2018 (r332437) +++ head/usr.bin/etdump/etdump.c Thu Apr 12 17:00:36 2018 (r332438) @@ -257,7 +257,6 @@ main(int argc, char **argv) argv += optind; for (i = 0; i < argc; i++) { - printf("%d %s\n", optind, argv[i]); if (strcmp(argv[i], "-") == 0) { iso = stdin; } else { From owner-svn-src-head@freebsd.org Thu Apr 12 17:05:28 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B16D6FA46DF; Thu, 12 Apr 2018 17:05:28 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6271A76C4B; Thu, 12 Apr 2018 17:05:28 +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 5B94F6226; Thu, 12 Apr 2018 17:05:28 +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 w3CH5SEA029717; Thu, 12 Apr 2018 17:05:28 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CH5S8H029716; Thu, 12 Apr 2018 17:05:28 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804121705.w3CH5S8H029716@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 12 Apr 2018 17:05:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332439 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 332439 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 17:05:28 -0000 Author: gonzo Date: Thu Apr 12 17:05:27 2018 New Revision: 332439 URL: https://svnweb.freebsd.org/changeset/base/332439 Log: Fix quotes in the example code in syslog(3) BUGS section mdoc treats verbatim quotes in .Dl as a string delimiter and does not pass them to the rendered output. Use special char \*q to specify double quote PR: 216755 MFC after: 3 days Modified: head/lib/libc/gen/syslog.3 Modified: head/lib/libc/gen/syslog.3 ============================================================================== --- head/lib/libc/gen/syslog.3 Thu Apr 12 17:00:36 2018 (r332438) +++ head/lib/libc/gen/syslog.3 Thu Apr 12 17:05:27 2018 (r332439) @@ -295,4 +295,4 @@ for later interpolation by .Pp Always use the proper secure idiom: .Pp -.Dl syslog(priority, "%s", string); +.Dl syslog(priority, \*q%s\*q, string); From owner-svn-src-head@freebsd.org Thu Apr 12 17:16:14 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 288B4FA51B0; Thu, 12 Apr 2018 17:16:14 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id CC8957A0DA; Thu, 12 Apr 2018 17:16:13 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C529063B9; Thu, 12 Apr 2018 17:16:13 +0000 (UTC) (envelope-from benno@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CHGD2r034588; Thu, 12 Apr 2018 17:16:13 GMT (envelope-from benno@FreeBSD.org) Received: (from benno@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CHGDcC034587; Thu, 12 Apr 2018 17:16:13 GMT (envelope-from benno@FreeBSD.org) Message-Id: <201804121716.w3CHGDcC034587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: benno set sender to benno@FreeBSD.org using -f From: Benno Rice Date: Thu, 12 Apr 2018 17:16:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332440 - head/usr.bin/mkimg X-SVN-Group: head X-SVN-Commit-Author: benno X-SVN-Commit-Paths: head/usr.bin/mkimg X-SVN-Commit-Revision: 332440 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 17:16:14 -0000 Author: benno Date: Thu Apr 12 17:16:13 2018 New Revision: 332440 URL: https://svnweb.freebsd.org/changeset/base/332440 Log: Fix a conditional that got mucked up. Sponsored by: iXsystems, Inc. Modified: head/usr.bin/mkimg/mkimg.c Modified: head/usr.bin/mkimg/mkimg.c ============================================================================== --- head/usr.bin/mkimg/mkimg.c Thu Apr 12 17:05:27 2018 (r332439) +++ head/usr.bin/mkimg/mkimg.c Thu Apr 12 17:16:13 2018 (r332440) @@ -464,10 +464,10 @@ mkimg(void) if (expand_number(size, &bytesize) == -1) error = errno; if (offset != NULL) { - if (*offset != '+') { + if (*offset != '+') abs_offset = true; + else offset++; - } if (expand_number(offset, &byteoffset) == -1) error = errno; } From owner-svn-src-head@freebsd.org Thu Apr 12 17:43:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2E401F8116A; Thu, 12 Apr 2018 17:43:21 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C88BA824C9; Thu, 12 Apr 2018 17:43:20 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AAFAC689A; Thu, 12 Apr 2018 17:43:20 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CHhKoh050021; Thu, 12 Apr 2018 17:43:20 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CHhJnu050013; Thu, 12 Apr 2018 17:43:19 GMT (envelope-from br@FreeBSD.org) Message-Id: <201804121743.w3CHhJnu050013@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Thu, 12 Apr 2018 17:43:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332441 - in head/sys: conf mips/beri mips/include mips/mips X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: conf mips/beri mips/include mips/mips X-SVN-Commit-Revision: 332441 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 17:43:21 -0000 Author: br Date: Thu Apr 12 17:43:19 2018 New Revision: 332441 URL: https://svnweb.freebsd.org/changeset/base/332441 Log: Add SMP support for BERI CPU. Obtained from: CheriBSD Sponsored by: DARPA, AFRL Added: head/sys/mips/beri/beri_mp.c (contents, props changed) head/sys/mips/beri/beri_mp.h (contents, props changed) Modified: head/sys/conf/options.mips head/sys/mips/beri/files.beri head/sys/mips/beri/std.beri head/sys/mips/include/cpufunc.h head/sys/mips/include/hwfunc.h head/sys/mips/mips/mp_machdep.c Modified: head/sys/conf/options.mips ============================================================================== --- head/sys/conf/options.mips Thu Apr 12 17:16:13 2018 (r332440) +++ head/sys/conf/options.mips Thu Apr 12 17:43:19 2018 (r332441) @@ -99,6 +99,7 @@ OCTEON_BOARD_CAPK_0100ND opt_cvmx.h # Options specific to the BERI platform. # BERI_LARGE_TLB opt_global.h +PLATFORM_INIT_SECONDARY opt_global.h # # Options that control the NetFPGA-10G Embedded CPU Ethernet Core. Added: head/sys/mips/beri/beri_mp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/beri/beri_mp.c Thu Apr 12 17:43:19 2018 (r332441) @@ -0,0 +1,309 @@ +/*- + * Copyright (c) 2017 Ruslan Bukin + * Copyright (c) 2012-2015 Robert N. M. Watson + * Copyright (c) 2013 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-10-C-0237) + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +#include +#include + +#include + +#include + +struct spin_entry { + uint64_t entry_addr; + uint64_t a0; + uint32_t rsvd1; + uint32_t pir; + uint64_t rsvd2; +}; + +static phandle_t cpu_of_nodes[MAXCPU]; +static device_t picmap[MAXCPU]; + +int +platform_processor_id(void) +{ + int cpu; + + cpu = beri_get_cpu(); + + return (cpu); +} + +void +platform_cpu_mask(cpuset_t *mask) +{ + int ncores, ncpus, nthreads; + phandle_t cpus, cpu; + pcell_t reg; + char prop[16]; + struct spin_entry *se; + + ncores = beri_get_ncores(); + nthreads = beri_get_nthreads(); + KASSERT(ncores <= 0x10000, ("%s: too many cores %d", __func__, ncores)); + KASSERT(nthreads <= 0x10000, ("%s: too many threads %d", __func__, + nthreads)); + KASSERT(ncores < 0xffff || nthreads < 0xffff, + ("%s: cores x thread (%d x %d) would overflow", __func__, ncores, + nthreads)); + ncpus = ncores * nthreads; + if (MAXCPU > 1 && ncpus > MAXCPU) + printf("%s: Hardware supports more CPUs (%d) than kernel (%d)\n", + __func__, ncpus, MAXCPU); + printf("%s: hardware has %d cores with %d threads each\n", __func__, + ncores, nthreads); + + if ((cpus = OF_finddevice("/cpus")) <= 0) { + printf("%s: no \"/cpus\" device found in FDT\n", __func__); + goto error; + } + if ((cpu = OF_child(cpus)) <= 0) { + printf("%s: no children of \"/cpus\" found in FDT\n", __func__); + goto error; + } + CPU_ZERO(mask); + do { + if (OF_getprop(cpu, "reg", ®, sizeof(reg)) <= 0) { + printf("%s: cpu device with no reg property\n", + __func__); + goto error; + } + if (reg > MAXCPU) { + printf("%s: cpu ID too large (%d > %d)\n", __func__, + reg, MAXCPU); + continue; + } + cpu_of_nodes[reg] = cpu; + + if (reg != 0) { + if (OF_getprop(cpu, "enable-method", &prop, + sizeof(prop)) <= 0 && OF_getprop(OF_parent(cpu), + "enable-method", &prop, sizeof(prop)) <= 0) { + printf("%s: CPU %d has no enable-method " + "property\n", __func__, reg); + continue; + } + if (strcmp("spin-table", prop) != 0) { + printf("%s: CPU %d enable-method is '%s' not " + "'spin-table'\n", __func__, reg, prop); + continue; + } + + if (OF_getprop(cpu, "cpu-release-addr", &se, + sizeof(se)) <= 0) { + printf("%s: CPU %d has missing or invalid " + "cpu-release-addr\n", __func__, reg); + continue; + } + if (se->entry_addr != 1) { + printf("%s: CPU %d has uninitalized spin " + "entry\n", __func__, reg); + continue; + } + } + + CPU_SET(reg, mask); + } while ((cpu = OF_peer(cpu)) > 0); + return; + +error: + /* + * If we run into any problems determining the CPU layout, + * fall back to UP. + * + * XXX: panic instead? + */ + CPU_ZERO(mask); + CPU_SET(0, mask); +} + +void +platform_init_secondary(int cpuid) +{ + device_t ic; + int ipi; + + ipi = platform_ipi_hardintr_num(); + + ic = devclass_get_device(devclass_find("beripic"), cpuid); + picmap[cpuid] = ic; + beripic_setup_ipi(ic, cpuid, ipi); + + /* Unmask the interrupt */ + if (cpuid != 0) { + mips_wr_status(mips_rd_status() | (((1 << ipi) << 8) << 2)); + } +} + + +void +platform_ipi_send(int cpuid) +{ + + mips_sync(); /* Ordering, liveness. */ + + beripic_send_ipi(picmap[cpuid], cpuid); +} + +void +platform_ipi_clear(void) +{ + int cpuid; + + cpuid = platform_processor_id(); + + beripic_clear_ipi(picmap[cpuid], cpuid); +} + +/* + * XXXBED: Set via FDT? + */ +int +platform_ipi_hardintr_num(void) +{ + + return (4); +} + +int +platform_ipi_softintr_num(void) +{ + + return (-1); +} + +/* + * XXXBED: Fine for MT, will need something better for multi-core. + */ +struct cpu_group * +platform_smp_topo(void) +{ + + return (smp_topo_none()); +} + +void +platform_init_ap(int cpuid) +{ + uint32_t status; + u_int clock_int_mask; + + KASSERT(cpuid < MAXCPU, ("%s: invalid CPU id %d", __func__, cpuid)); + + /* Make sure coprocessors are enabled. */ + status = mips_rd_status(); + status |= (MIPS_SR_COP_0_BIT | MIPS_SR_COP_1_BIT); +#if defined(CPU_CHERI) + status |= MIPS_SR_COP_2_BIT; +#endif + mips_wr_status(status); + +#if 0 + register_t hwrena; + /* Enable HDWRD instruction in userspace. Also enables statcounters. */ + hwrena = mips_rd_hwrena(); + hwrena |= (MIPS_HWRENA_CC | MIPS_HWRENA_CCRES | MIPS_HWRENA_CPUNUM | + MIPS_HWRENA_BERI_STATCOUNTERS_MASK); + mips_wr_hwrena(hwrena); +#endif + + /* + * Enable per-thread timer. + */ + clock_int_mask = hard_int_mask(5); + set_intr_mask(clock_int_mask); +} + +/* + * BERI startup conforms to the spin-table start method defined in the + * ePAPR 1.0 spec. The initial spin waiting for an address is started + * by the CPU firmware. + */ +int +platform_start_ap(int cpuid) +{ + phandle_t cpu; + char prop[16]; + struct spin_entry *se; + + KASSERT(cpuid != 0, ("%s: can't start CPU 0!\n", __func__)); + KASSERT((cpuid > 0 && cpuid < MAXCPU), + ("%s: invalid CPU id %d", __func__, cpuid)); + + cpu = cpu_of_nodes[cpuid]; + if (OF_getprop(cpu, "status", &prop, sizeof(prop)) <= 0) { + if (bootverbose) + printf("%s: CPU %d has no status property, " + "trying parent\n", __func__, cpuid); + if (OF_getprop(OF_parent(cpu), "status", &prop, + sizeof(prop)) <= 0) + panic("%s: CPU %d has no status property", __func__, + cpuid); + } + if (strcmp("disabled", prop) != 0) + panic("%s: CPU %d status is '%s' not 'disabled'", + __func__, cpuid, prop); + + if (OF_getprop(cpu, "enable-method", &prop, sizeof(prop)) <= 0) { + if (bootverbose) + printf("%s: CPU %d has no enable-method, " + "trying parent\n", __func__, cpuid); + if (OF_getprop(OF_parent(cpu), "enable-method", &prop, + sizeof(prop)) <= 0) + panic("%s: CPU %d has no enable-method property", + __func__, cpuid); + } + if (strcmp("spin-table", prop) != 0) + panic("%s: CPU %d enable-method is '%s' not " + "'spin-table'", __func__, cpuid, prop); + + if (OF_getprop(cpu, "cpu-release-addr", &se, sizeof(se)) <= 0) + panic("%s: CPU %d has missing or invalid cpu-release-addr", + __func__, cpuid); + se->pir = cpuid; + if (bootverbose) + printf("%s: writing %p to %p\n", __func__, mpentry, + &se->entry_addr); + + mips_sync(); /* Ordering. */ + se->entry_addr = (intptr_t)mpentry; + mips_sync(); /* Liveness. */ + + return (0); +} Added: head/sys/mips/beri/beri_mp.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/mips/beri/beri_mp.h Thu Apr 12 17:43:19 2018 (r332441) @@ -0,0 +1,85 @@ +/*- + * Copyright (c) 2014 SRI International + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-11-C-0249) + * ("MRC2"), as part of the DARPA MRC research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +static inline int +beri_get_core(void) +{ + uint32_t cinfo; + + cinfo = mips_rd_cinfo(); + return (cinfo & 0xffff); +} + +static inline int +beri_get_ncores(void) +{ + uint32_t cinfo; + + cinfo = mips_rd_cinfo(); + return ((cinfo >> 16) + 1); +} + +static inline int +beri_get_thread(void) +{ + uint32_t tinfo; + + tinfo = mips_rd_tinfo(); + return (tinfo & 0xffff); +} + +static inline int +beri_get_nthreads(void) +{ + uint32_t tinfo; + + tinfo = mips_rd_tinfo(); + return ((tinfo >> 16) + 1); +} + +static inline int +beri_get_cpu(void) +{ + + return ((beri_get_core() * beri_get_nthreads()) + beri_get_thread()); +} + +static inline int +beri_get_ncpus(void) +{ + + return(beri_get_ncores() * beri_get_nthreads()); +} + +void beripic_setup_ipi(device_t dev, u_int tid, u_int ipi_irq); +void beripic_send_ipi(device_t dev, u_int tid); +void beripic_clear_ipi(device_t dev, u_int tid); Modified: head/sys/mips/beri/files.beri ============================================================================== --- head/sys/mips/beri/files.beri Thu Apr 12 17:16:13 2018 (r332440) +++ head/sys/mips/beri/files.beri Thu Apr 12 17:43:19 2018 (r332441) @@ -21,5 +21,6 @@ dev/terasic/mtl/terasic_mtl_syscons.c optional terasic dev/terasic/mtl/terasic_mtl_text.c optional terasic_mtl dev/terasic/mtl/terasic_mtl_vt.c optional terasic_mtl vt mips/beri/beri_machdep.c standard +mips/beri/beri_mp.c optional smp mips/beri/beri_pic.c optional fdt mips/mips/tick.c standard Modified: head/sys/mips/beri/std.beri ============================================================================== --- head/sys/mips/beri/std.beri Thu Apr 12 17:16:13 2018 (r332440) +++ head/sys/mips/beri/std.beri Thu Apr 12 17:43:19 2018 (r332441) @@ -4,3 +4,4 @@ files "../beri/files.beri" cpu CPU_MIPS4KC options BERI_LARGE_TLB +options PLATFORM_INIT_SECONDARY Modified: head/sys/mips/include/cpufunc.h ============================================================================== --- head/sys/mips/include/cpufunc.h Thu Apr 12 17:16:13 2018 (r332440) +++ head/sys/mips/include/cpufunc.h Thu Apr 12 17:43:19 2018 (r332441) @@ -279,6 +279,8 @@ MIPS_RW32_COP0(entrylo0, MIPS_COP_0_TLB_LO0); MIPS_RW32_COP0(entrylo1, MIPS_COP_0_TLB_LO1); #endif MIPS_RW32_COP0(prid, MIPS_COP_0_PRID); +MIPS_RW32_COP0_SEL(cinfo, MIPS_COP_0_PRID, 6); +MIPS_RW32_COP0_SEL(tinfo, MIPS_COP_0_PRID, 7); /* XXX 64-bit? */ MIPS_RW32_COP0_SEL(ebase, MIPS_COP_0_PRID, 1); Modified: head/sys/mips/include/hwfunc.h ============================================================================== --- head/sys/mips/include/hwfunc.h Thu Apr 12 17:16:13 2018 (r332440) +++ head/sys/mips/include/hwfunc.h Thu Apr 12 17:43:19 2018 (r332441) @@ -72,6 +72,13 @@ void platform_init_ap(int processor_id); int platform_ipi_hardintr_num(void); int platform_ipi_softintr_num(void); +#ifdef PLATFORM_INIT_SECONDARY +/* + * Set up IPIs for this CPU. + */ +void platform_init_secondary(int cpuid); +#endif + /* * Trigger a IPI interrupt on 'cpuid'. */ Modified: head/sys/mips/mips/mp_machdep.c ============================================================================== --- head/sys/mips/mips/mp_machdep.c Thu Apr 12 17:16:13 2018 (r332440) +++ head/sys/mips/mips/mp_machdep.c Thu Apr 12 17:43:19 2018 (r332441) @@ -304,6 +304,10 @@ smp_init_secondary(u_int32_t cpuid) while (!aps_ready) ; +#ifdef PLATFORM_INIT_SECONDARY + platform_init_secondary(cpuid); +#endif + /* Initialize curthread. */ KASSERT(PCPU_GET(idlethread) != NULL, ("no idle thread")); PCPU_SET(curthread, PCPU_GET(idlethread)); @@ -343,6 +347,10 @@ release_aps(void *dummy __unused) if (mp_ncpus == 1) return; + +#ifdef PLATFORM_INIT_SECONDARY + platform_init_secondary(0); +#endif /* * IPI handler From owner-svn-src-head@freebsd.org Thu Apr 12 17:47:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F409BF816F8; Thu, 12 Apr 2018 17:47:36 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A703682941; Thu, 12 Apr 2018 17:47:36 +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 A1AAE68A6; Thu, 12 Apr 2018 17:47:36 +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 w3CHlaNm050332; Thu, 12 Apr 2018 17:47:36 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CHla7Q050331; Thu, 12 Apr 2018 17:47:36 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201804121747.w3CHla7Q050331@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 12 Apr 2018 17:47:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332442 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 332442 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 17:47:37 -0000 Author: gonzo Date: Thu Apr 12 17:47:36 2018 New Revision: 332442 URL: https://svnweb.freebsd.org/changeset/base/332442 Log: Bump .Dd value (forgot to do this in r332439) MFC after: 3 days X-MFC-With: 332439 Modified: head/lib/libc/gen/syslog.3 Modified: head/lib/libc/gen/syslog.3 ============================================================================== --- head/lib/libc/gen/syslog.3 Thu Apr 12 17:43:19 2018 (r332441) +++ head/lib/libc/gen/syslog.3 Thu Apr 12 17:47:36 2018 (r332442) @@ -28,7 +28,7 @@ .\" @(#)syslog.3 8.1 (Berkeley) 6/4/93 .\" $FreeBSD$ .\" -.Dd April 6, 2018 +.Dd April 12, 2018 .Dt SYSLOG 3 .Os .Sh NAME From owner-svn-src-head@freebsd.org Thu Apr 12 17:51:03 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A98ACF81CFD; Thu, 12 Apr 2018 17:51:03 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-30.csi.cam.ac.uk (ppsw-30.csi.cam.ac.uk [131.111.8.130]) (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 4985B833D9; Thu, 12 Apr 2018 17:51:03 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:12413) by ppsw-30.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1f6gN6-00085K-fI (Exim 4.89_2) (return-path ); Thu, 12 Apr 2018 18:50:56 +0100 Date: Thu, 12 Apr 2018 18:41:37 +0100 From: Ruslan Bukin To: John Baldwin Cc: Ruslan Bukin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332434 - head/sys/conf Message-ID: <20180412174137.GA41515@bsdpad.com> References: <201804121512.w3CFCeHD074171@repo.freebsd.org> <1777044.OCjZ8thPIn@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1777044.OCjZ8thPIn@ralph.baldwin.cx> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 17:51:03 -0000 On Thu, Apr 12, 2018 at 09:48:10AM -0700, John Baldwin wrote: > On Thursday, April 12, 2018 03:12:40 PM Ruslan Bukin wrote: > > Author: br > > Date: Thu Apr 12 15:12:40 2018 > > New Revision: 332434 > > URL: https://svnweb.freebsd.org/changeset/base/332434 > > > > Log: > > Add ld emulation types for hard-float mipses. > > > > Sponsored by: DARPA, AFRL > > We actually shouldn't need hf kernels anymore. HAVE_FPU has been removed > and any mips kernel works fine with either hard or soft float userlands. > Ok I will work on removing hf targets. This should be kept I think until we remove them. Thanks Ruslan From owner-svn-src-head@freebsd.org Thu Apr 12 17:55:25 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0CDBF821BD; Thu, 12 Apr 2018 17:55:25 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) Received: from ppsw-30.csi.cam.ac.uk (ppsw-30.csi.cam.ac.uk [131.111.8.130]) (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 34BC985B18; Thu, 12 Apr 2018 17:55:25 +0000 (UTC) (envelope-from rb743@hermes.cam.ac.uk) X-Cam-AntiVirus: no malware found X-Cam-ScannerInfo: http://help.uis.cam.ac.uk/email-scanner-virus Received: from sc1.bsdpad.com ([163.172.212.18]:48337) by ppsw-30.csi.cam.ac.uk (smtp.hermes.cam.ac.uk [131.111.8.156]:587) with esmtpsa (LOGIN:rb743) (TLSv1:ECDHE-RSA-AES256-SHA:256) id 1f6gRP-000Avn-ft (Exim 4.89_2) (return-path ); Thu, 12 Apr 2018 18:55:24 +0100 Date: Thu, 12 Apr 2018 18:46:04 +0100 From: Ruslan Bukin To: John Baldwin Cc: Ruslan Bukin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332434 - head/sys/conf Message-ID: <20180412174604.GA41648@bsdpad.com> References: <201804121512.w3CFCeHD074171@repo.freebsd.org> <1777044.OCjZ8thPIn@ralph.baldwin.cx> <20180412174137.GA41515@bsdpad.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20180412174137.GA41515@bsdpad.com> User-Agent: Mutt/1.6.1 (2016-04-27) Sender: "R. Bukin" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 17:55:25 -0000 On Thu, Apr 12, 2018 at 06:41:37PM +0100, Ruslan Bukin wrote: > On Thu, Apr 12, 2018 at 09:48:10AM -0700, John Baldwin wrote: > > On Thursday, April 12, 2018 03:12:40 PM Ruslan Bukin wrote: > > > Author: br > > > Date: Thu Apr 12 15:12:40 2018 > > > New Revision: 332434 > > > URL: https://svnweb.freebsd.org/changeset/base/332434 > > > > > > Log: > > > Add ld emulation types for hard-float mipses. > > > > > > Sponsored by: DARPA, AFRL > > > > We actually shouldn't need hf kernels anymore. HAVE_FPU has been removed > > and any mips kernel works fine with either hard or soft float userlands. > > > > Ok I will work on removing hf targets. This should be kept I think until we remove them. > Oh sorry this is for kernels only. Ok I will revert this then. Ruslan From owner-svn-src-head@freebsd.org Thu Apr 12 18:23:16 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B6205F842F6; Thu, 12 Apr 2018 18:23:16 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 636A36BC35; Thu, 12 Apr 2018 18:23:16 +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 5E4156F01; Thu, 12 Apr 2018 18:23:16 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CINGwt070667; Thu, 12 Apr 2018 18:23:16 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CINEHl070653; Thu, 12 Apr 2018 18:23:14 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201804121823.w3CINEHl070653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 12 Apr 2018 18:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332443 - in head/lib/libc: amd64 amd64/sys gen i386 i386/sys mips/sys powerpc powerpc/sys powerpc64 powerpc64/sys sparc64 sparc64/sys X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/lib/libc: amd64 amd64/sys gen i386 i386/sys mips/sys powerpc powerpc/sys powerpc64 powerpc64/sys sparc64 sparc64/sys X-SVN-Commit-Revision: 332443 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 18:23:17 -0000 Author: brooks Date: Thu Apr 12 18:23:14 2018 New Revision: 332443 URL: https://svnweb.freebsd.org/changeset/base/332443 Log: Replace MD assembly exect() with a portable version. Originally, on the VAX exect() enable tracing once the new executable image was loaded. This was possible because tracing was controllable through user space code by setting the PSL_T flag. The following instruction is a system call that activated tracing (as all instructions do) by copying PSL_T to PSL_TP (trace pending). The first instruction of the new executable image would trigger a trace fault. This is not portable to all platforms and the behavior was replaced with ptrace(PT_TRACE_ME, ...) since FreeBSD forked off of the CSRG repository. Platforms either incorrectly call execve(), trigger trace faults inside the original executable, or do contain an implementation of this function. The exect() interfaces is deprecated or removed on NetBSD and OpenBSD. Submitted by: Ali Mashtizadeh Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D14989 Added: head/lib/libc/gen/exect.c (contents, props changed) Deleted: head/lib/libc/amd64/sys/exect.S head/lib/libc/i386/sys/exect.S head/lib/libc/mips/sys/exect.S head/lib/libc/powerpc/sys/exect.S head/lib/libc/powerpc64/sys/exect.S head/lib/libc/sparc64/sys/exect.S Modified: head/lib/libc/amd64/Symbol.map head/lib/libc/amd64/sys/Makefile.inc head/lib/libc/gen/Makefile.inc head/lib/libc/gen/Symbol.map head/lib/libc/i386/Symbol.map head/lib/libc/i386/sys/Makefile.inc head/lib/libc/mips/sys/Makefile.inc head/lib/libc/powerpc/Symbol.map head/lib/libc/powerpc/sys/Makefile.inc head/lib/libc/powerpc64/Symbol.map head/lib/libc/powerpc64/sys/Makefile.inc head/lib/libc/sparc64/Symbol.map head/lib/libc/sparc64/sys/Makefile.inc Modified: head/lib/libc/amd64/Symbol.map ============================================================================== --- head/lib/libc/amd64/Symbol.map Thu Apr 12 17:47:36 2018 (r332442) +++ head/lib/libc/amd64/Symbol.map Thu Apr 12 18:23:14 2018 (r332443) @@ -40,7 +40,6 @@ FBSD_1.0 { amd64_set_fsbase; amd64_set_gsbase; brk; - exect; sbrk; vfork; }; Modified: head/lib/libc/amd64/sys/Makefile.inc ============================================================================== --- head/lib/libc/amd64/sys/Makefile.inc Thu Apr 12 17:47:36 2018 (r332442) +++ head/lib/libc/amd64/sys/Makefile.inc Thu Apr 12 18:23:14 2018 (r332443) @@ -8,8 +8,7 @@ SRCS+= \ amd64_set_fsbase.c \ amd64_set_gsbase.c -MDASM= vfork.S brk.S cerror.S exect.S getcontext.S \ - sbrk.S +MDASM= vfork.S brk.S cerror.S getcontext.S sbrk.S # Don't generate default code for these syscalls: NOASM+= vfork.o Modified: head/lib/libc/gen/Makefile.inc ============================================================================== --- head/lib/libc/gen/Makefile.inc Thu Apr 12 17:47:36 2018 (r332442) +++ head/lib/libc/gen/Makefile.inc Thu Apr 12 18:23:14 2018 (r332443) @@ -41,6 +41,7 @@ SRCS+= __getosreldate.c \ errlst.c \ errno.c \ exec.c \ + exect.c \ fdevname.c \ feature_present.c \ fmtcheck.c \ Modified: head/lib/libc/gen/Symbol.map ============================================================================== --- head/lib/libc/gen/Symbol.map Thu Apr 12 17:47:36 2018 (r332442) +++ head/lib/libc/gen/Symbol.map Thu Apr 12 18:23:14 2018 (r332443) @@ -105,6 +105,7 @@ FBSD_1.0 { sys_errlist; sys_nerr; errno; + exect; execl; execle; execlp; Added: head/lib/libc/gen/exect.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/lib/libc/gen/exect.c Thu Apr 12 18:23:14 2018 (r332443) @@ -0,0 +1,45 @@ +/*- + * Copyright (c) 2018 Ali Mashtizadeh + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include + +#include +#include + +int +exect(const char *path, char *const argv[], char *const envp[]) +{ + + if (ptrace(PT_TRACE_ME, 0, 0, 0) != 0) { + if (errno != EBUSY) + return (-1); + } + + return (execve(path, argv, envp)); +} Modified: head/lib/libc/i386/Symbol.map ============================================================================== --- head/lib/libc/i386/Symbol.map Thu Apr 12 17:47:36 2018 (r332442) +++ head/lib/libc/i386/Symbol.map Thu Apr 12 18:23:14 2018 (r332443) @@ -31,7 +31,6 @@ FBSD_1.0 { ntohs; vfork; brk; - exect; i386_clr_watch; i386_get_fsbase; i386_get_gsbase; Modified: head/lib/libc/i386/sys/Makefile.inc ============================================================================== --- head/lib/libc/i386/sys/Makefile.inc Thu Apr 12 17:47:36 2018 (r332442) +++ head/lib/libc/i386/sys/Makefile.inc Thu Apr 12 18:23:14 2018 (r332443) @@ -7,8 +7,7 @@ SRCS+= i386_clr_watch.c i386_set_watch.c i386_vm86.c SRCS+= i386_get_fsbase.c i386_get_gsbase.c i386_get_ioperm.c i386_get_ldt.c \ i386_set_fsbase.c i386_set_gsbase.c i386_set_ioperm.c i386_set_ldt.c -MDASM= Ovfork.S brk.S cerror.S exect.S getcontext.S \ - sbrk.S syscall.S +MDASM= Ovfork.S brk.S cerror.S getcontext.S sbrk.S syscall.S NOASM+= vfork.o Modified: head/lib/libc/mips/sys/Makefile.inc ============================================================================== --- head/lib/libc/mips/sys/Makefile.inc Thu Apr 12 17:47:36 2018 (r332442) +++ head/lib/libc/mips/sys/Makefile.inc Thu Apr 12 18:23:14 2018 (r332443) @@ -2,8 +2,7 @@ SRCS+= trivial-vdso_tc.c -MDASM= Ovfork.S brk.S cerror.S exect.S \ - sbrk.S syscall.S +MDASM= Ovfork.S brk.S cerror.S sbrk.S syscall.S # Don't generate default code for these syscalls: NOASM+= vfork.o Modified: head/lib/libc/powerpc/Symbol.map ============================================================================== --- head/lib/libc/powerpc/Symbol.map Thu Apr 12 17:47:36 2018 (r332442) +++ head/lib/libc/powerpc/Symbol.map Thu Apr 12 18:23:14 2018 (r332443) @@ -33,7 +33,6 @@ FBSD_1.0 { ntohl; ntohs; brk; - exect; sbrk; vfork; }; Modified: head/lib/libc/powerpc/sys/Makefile.inc ============================================================================== --- head/lib/libc/powerpc/sys/Makefile.inc Thu Apr 12 17:47:36 2018 (r332442) +++ head/lib/libc/powerpc/sys/Makefile.inc Thu Apr 12 18:23:14 2018 (r332443) @@ -1,3 +1,3 @@ # $FreeBSD$ -MDASM+= brk.S cerror.S exect.S sbrk.S +MDASM+= brk.S cerror.S sbrk.S Modified: head/lib/libc/powerpc64/Symbol.map ============================================================================== --- head/lib/libc/powerpc64/Symbol.map Thu Apr 12 17:47:36 2018 (r332442) +++ head/lib/libc/powerpc64/Symbol.map Thu Apr 12 18:23:14 2018 (r332443) @@ -33,7 +33,6 @@ FBSD_1.0 { ntohl; ntohs; brk; - exect; sbrk; vfork; }; Modified: head/lib/libc/powerpc64/sys/Makefile.inc ============================================================================== --- head/lib/libc/powerpc64/sys/Makefile.inc Thu Apr 12 17:47:36 2018 (r332442) +++ head/lib/libc/powerpc64/sys/Makefile.inc Thu Apr 12 18:23:14 2018 (r332443) @@ -1,3 +1,3 @@ # $FreeBSD$ -MDASM+= brk.S cerror.S exect.S sbrk.S +MDASM+= brk.S cerror.S sbrk.S Modified: head/lib/libc/sparc64/Symbol.map ============================================================================== --- head/lib/libc/sparc64/Symbol.map Thu Apr 12 17:47:36 2018 (r332442) +++ head/lib/libc/sparc64/Symbol.map Thu Apr 12 18:23:14 2018 (r332443) @@ -33,7 +33,6 @@ FBSD_1.0 { ntohl; ntohs; brk; - exect; sbrk; vfork; @@ -82,8 +81,6 @@ FBSDprivate_1.0 { __siglongjmp; __sys_brk; _brk; - __sys_exect; - _exect; _end; __sys_sbrk; _sbrk; Modified: head/lib/libc/sparc64/sys/Makefile.inc ============================================================================== --- head/lib/libc/sparc64/sys/Makefile.inc Thu Apr 12 17:47:36 2018 (r332442) +++ head/lib/libc/sparc64/sys/Makefile.inc Thu Apr 12 18:23:14 2018 (r332443) @@ -12,4 +12,4 @@ SRCS+= __sparc_sigtramp_setup.c \ CFLAGS+= -I${LIBC_SRCTOP}/sparc64/fpu -MDASM+= brk.S cerror.S exect.S sbrk.S sigaction1.S +MDASM+= brk.S cerror.S sbrk.S sigaction1.S From owner-svn-src-head@freebsd.org Thu Apr 12 18:24:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1C0D1F843CC; Thu, 12 Apr 2018 18:24:01 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 9B38C6BDD6; Thu, 12 Apr 2018 18:24:00 +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 9630D6F0B; Thu, 12 Apr 2018 18:24:00 +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 w3CIO0DX070738; Thu, 12 Apr 2018 18:24:00 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CIO0GD070737; Thu, 12 Apr 2018 18:24:00 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201804121824.w3CIO0GD070737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 12 Apr 2018 18:24:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332444 - head X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 332444 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 18:24:01 -0000 Author: brooks Date: Thu Apr 12 18:24:00 2018 New Revision: 332444 URL: https://svnweb.freebsd.org/changeset/base/332444 Log: Allow -DNO_CLEAN builds across r332443. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Thu Apr 12 18:23:14 2018 (r332443) +++ head/Makefile.inc1 Thu Apr 12 18:24:00 2018 (r332444) @@ -808,7 +808,8 @@ _cleanobj_fast_depend_hack: .PHONY # 20180404 r332048 sigreturn # 20180405 r332080 shmat # 20180406 r332119 setlogin -.for f in fstat fstatat fstatfs getdirentries getfsstat setlogin shmat sigreturn statfs +# 20170411 r332443 exect +.for f in exect fstat fstatat fstatfs getdirentries getfsstat setlogin shmat sigreturn statfs .if exists(${OBJTOP}/lib/libc/.depend.${f}.o) @if egrep -qw '${f}\.[sS]' \ ${OBJTOP}/lib/libc/.depend.${f}.o; then \ From owner-svn-src-head@freebsd.org Thu Apr 12 18:25:53 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D8438F846C1; Thu, 12 Apr 2018 18:25:53 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 878A76C509; Thu, 12 Apr 2018 18:25:53 +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 7EEFB6F13; Thu, 12 Apr 2018 18:25: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 w3CIPr1Z070845; Thu, 12 Apr 2018 18:25:53 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CIPriX070844; Thu, 12 Apr 2018 18:25:53 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201804121825.w3CIPriX070844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 12 Apr 2018 18:25:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332445 - head X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 332445 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 18:25:54 -0000 Author: brooks Date: Thu Apr 12 18:25:53 2018 New Revision: 332445 URL: https://svnweb.freebsd.org/changeset/base/332445 Log: Add fpa.4.gz missing in the removal of FDDI in r332412. Reported by: trasz Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Thu Apr 12 18:24:00 2018 (r332444) +++ head/ObsoleteFiles.inc Thu Apr 12 18:25:53 2018 (r332445) @@ -40,6 +40,7 @@ # 20180409: remove FDDI support OLD_FILES+=usr/include/net/fddi.h +OLD_FILES+=usr/share/man/man4/fpa.4.gz # 20180319: remove /boot/overlays, replaced by /boot/dtb/overlays OLD_DIRS+=boot/overlays # 20180311: remove sys/sys/i386/include/pcaudioio.h From owner-svn-src-head@freebsd.org Thu Apr 12 19:00:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A55C2F87421; Thu, 12 Apr 2018 19:00:22 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C26375F86; Thu, 12 Apr 2018 19:00:22 +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 55DFD743D; Thu, 12 Apr 2018 19:00:22 +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 w3CJ0MbC087568; Thu, 12 Apr 2018 19:00:22 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CJ0MLL087567; Thu, 12 Apr 2018 19:00:22 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804121900.w3CJ0MLL087567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 12 Apr 2018 19:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332446 - head/release/i386 X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/release/i386 X-SVN-Commit-Revision: 332446 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 19:00:22 -0000 Author: emaste Date: Thu Apr 12 19:00:22 2018 New Revision: 332446 URL: https://svnweb.freebsd.org/changeset/base/332446 Log: switch i386 memstick installer images to MBR Some BIOSes have trouble booting from GPT in non-UEFI mode. This is commonly reported with Lenovo laptops, including my x220. As we do not currently support booting FreeBSD/i386 via UEFI there's no reason to prefer GPT. The "vestigial swap partition" was added in r265017 to work around an issue with loader's GPT support, so we should not need it when using MBR. We may want to make the same change to amd64, although the issue there is mitigated by such systems booting via UEFI in the common case. PR: 227422 Reviewed by: gjb MFC after: 3 weeks Relnotes: Yes Sponsored by: The FreeBSD Foundation Modified: head/release/i386/make-memstick.sh Modified: head/release/i386/make-memstick.sh ============================================================================== --- head/release/i386/make-memstick.sh Thu Apr 12 18:25:53 2018 (r332445) +++ head/release/i386/make-memstick.sh Thu Apr 12 19:00:22 2018 (r332446) @@ -36,11 +36,9 @@ makefs -B little -o label=FreeBSD_Install -o version=2 rm ${1}/etc/fstab rm ${1}/etc/rc.conf.local -mkimg -s gpt \ - -b ${1}/boot/pmbr \ - -p freebsd-boot:=${1}/boot/gptboot \ - -p freebsd-ufs:=${2}.part \ - -p freebsd-swap::1M \ +mkimg -s mbr \ + -b ${1}/boot/mbr \ + -p freebsd:-"mkimg -s bsd -b ${1}/boot/boot -p freebsd-ufs:=${2}.part" \ -o ${2} rm ${2}.part From owner-svn-src-head@freebsd.org Thu Apr 12 19:34:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B7CF3F89F94; Thu, 12 Apr 2018 19:34:35 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6A44E7EB67; Thu, 12 Apr 2018 19:34:35 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64E917A98; Thu, 12 Apr 2018 19:34:35 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CJYZRM007063; Thu, 12 Apr 2018 19:34:35 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CJYZrQ007062; Thu, 12 Apr 2018 19:34:35 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201804121934.w3CJYZrQ007062@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 12 Apr 2018 19:34:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332448 - head/sbin/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sbin/ipfw X-SVN-Commit-Revision: 332448 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 19:34:35 -0000 Author: ae Date: Thu Apr 12 19:34:35 2018 New Revision: 332448 URL: https://svnweb.freebsd.org/changeset/base/332448 Log: Remove printing of "not" keyword from print_ip() function. After r331668 handling of F_NOT flag done in one place by print_instruction() function. MFC after: 1 week Modified: head/sbin/ipfw/ipfw2.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Thu Apr 12 19:06:15 2018 (r332447) +++ head/sbin/ipfw/ipfw2.c Thu Apr 12 19:34:35 2018 (r332448) @@ -1192,11 +1192,10 @@ print_ip(struct buf_pr *bp, const struct format_opts * if (d < sizeof(lookup_key)/sizeof(lookup_key[0])) arg = match_value(rule_options, lookup_key[d]); t = table_search_ctlv(fo->tstate, ((ipfw_insn *)cmd)->arg1); - bprintf(bp, "%s lookup %s %s", cmd->o.len & F_NOT ? " not": "", - arg, t); + bprintf(bp, " lookup %s %s", arg, t); return; } - bprintf(bp, "%s%s ", cmd->o.len & F_NOT ? " not": "", s); + bprintf(bp, "%s ", s); if (cmd->o.opcode == O_IP_SRC_ME || cmd->o.opcode == O_IP_DST_ME) { bprintf(bp, "me"); From owner-svn-src-head@freebsd.org Thu Apr 12 19:44:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id C968CF8AA80; Thu, 12 Apr 2018 19:44:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7B8217F40F; Thu, 12 Apr 2018 19:44:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C59F7C2B; Thu, 12 Apr 2018 19:44:05 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CJi5l0011909; Thu, 12 Apr 2018 19:44:05 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CJi5jX011906; Thu, 12 Apr 2018 19:44:05 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201804121944.w3CJi5jX011906@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 12 Apr 2018 19:44:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332449 - head/sbin/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sbin/ipfw X-SVN-Commit-Revision: 332449 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 19:44:06 -0000 Author: ae Date: Thu Apr 12 19:44:04 2018 New Revision: 332449 URL: https://svnweb.freebsd.org/changeset/base/332449 Log: Remove printing of "not" keyword from print_ip6() function. After r331668 handling of F_NOT flag done in one place by print_instruction() function. Also remove unused argument from print_ip[6]() functions. MFC after: 1 week Modified: head/sbin/ipfw/ipfw2.c head/sbin/ipfw/ipfw2.h head/sbin/ipfw/ipv6.c Modified: head/sbin/ipfw/ipfw2.c ============================================================================== --- head/sbin/ipfw/ipfw2.c Thu Apr 12 19:34:35 2018 (r332448) +++ head/sbin/ipfw/ipfw2.c Thu Apr 12 19:44:04 2018 (r332449) @@ -1176,8 +1176,7 @@ print_flags(struct buf_pr *bp, char const *name, ipfw_ * Print the ip address contained in a command. */ static void -print_ip(struct buf_pr *bp, const struct format_opts *fo, ipfw_insn_ip *cmd, - char const *s) +print_ip(struct buf_pr *bp, const struct format_opts *fo, ipfw_insn_ip *cmd) { struct hostent *he = NULL; struct in_addr *ia; @@ -1185,6 +1184,7 @@ print_ip(struct buf_pr *bp, const struct format_opts * uint32_t *a = ((ipfw_insn_u32 *)cmd)->d; char *t; + bprintf(bp, " "); if (cmd->o.opcode == O_IP_DST_LOOKUP && len > F_INSN_SIZE(ipfw_insn_u32)) { uint32_t d = a[1]; const char *arg = ""; @@ -1192,11 +1192,9 @@ print_ip(struct buf_pr *bp, const struct format_opts * if (d < sizeof(lookup_key)/sizeof(lookup_key[0])) arg = match_value(rule_options, lookup_key[d]); t = table_search_ctlv(fo->tstate, ((ipfw_insn *)cmd)->arg1); - bprintf(bp, " lookup %s %s", arg, t); + bprintf(bp, "lookup %s %s", arg, t); return; } - bprintf(bp, "%s ", s); - if (cmd->o.opcode == O_IP_SRC_ME || cmd->o.opcode == O_IP_DST_ME) { bprintf(bp, "me"); return; @@ -1467,7 +1465,7 @@ print_instruction(struct buf_pr *bp, const struct form case O_IP_DST_MASK: case O_IP_DST_ME: case O_IP_DST_SET: - print_ip(bp, fo, insntod(cmd, ip), ""); + print_ip(bp, fo, insntod(cmd, ip)); break; case O_IP6_SRC: case O_IP6_SRC_MASK: @@ -1475,7 +1473,7 @@ print_instruction(struct buf_pr *bp, const struct form case O_IP6_DST: case O_IP6_DST_MASK: case O_IP6_DST_ME: - print_ip6(bp, insntod(cmd, ip6), ""); + print_ip6(bp, insntod(cmd, ip6)); break; case O_FLOW6ID: print_flow6id(bp, insntod(cmd, u32)); Modified: head/sbin/ipfw/ipfw2.h ============================================================================== --- head/sbin/ipfw/ipfw2.h Thu Apr 12 19:34:35 2018 (r332448) +++ head/sbin/ipfw/ipfw2.h Thu Apr 12 19:44:04 2018 (r332449) @@ -401,7 +401,7 @@ int ipfw_delete_pipe(int pipe_or_queue, int n); /* ipv6.c */ void print_unreach6_code(struct buf_pr *bp, uint16_t code); -void print_ip6(struct buf_pr *bp, struct _ipfw_insn_ip6 *cmd, char const *s); +void print_ip6(struct buf_pr *bp, struct _ipfw_insn_ip6 *cmd); void print_flow6id(struct buf_pr *bp, struct _ipfw_insn_u32 *cmd); void print_icmp6types(struct buf_pr *bp, struct _ipfw_insn_u32 *cmd); void print_ext6hdr(struct buf_pr *bp, struct _ipfw_insn *cmd ); Modified: head/sbin/ipfw/ipv6.c ============================================================================== --- head/sbin/ipfw/ipv6.c Thu Apr 12 19:34:35 2018 (r332448) +++ head/sbin/ipfw/ipv6.c Thu Apr 12 19:44:04 2018 (r332449) @@ -85,17 +85,15 @@ print_unreach6_code(struct buf_pr *bp, uint16_t code) * Print the ip address contained in a command. */ void -print_ip6(struct buf_pr *bp, ipfw_insn_ip6 *cmd, char const *s) +print_ip6(struct buf_pr *bp, ipfw_insn_ip6 *cmd) { struct hostent *he = NULL; int len = F_LEN((ipfw_insn *) cmd) - 1; struct in6_addr *a = &(cmd->addr6); char trad[255]; - bprintf(bp, "%s%s ", cmd->o.len & F_NOT ? " not": "", s); - if (cmd->o.opcode == O_IP6_SRC_ME || cmd->o.opcode == O_IP6_DST_ME) { - bprintf(bp, "me6"); + bprintf(bp, " me6"); return; } if (cmd->o.opcode == O_IP6) { @@ -108,7 +106,7 @@ print_ip6(struct buf_pr *bp, ipfw_insn_ip6 *cmd, char * addr/mask pairs have len = (2n+1). We convert len to n so we * use that to count the number of entries. */ - + bprintf(bp, " "); for (len = len / 4; len > 0; len -= 2, a += 2) { int mb = /* mask length */ (cmd->o.opcode == O_IP6_SRC || cmd->o.opcode == O_IP6_DST) ? From owner-svn-src-head@freebsd.org Thu Apr 12 19:59:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5A657F8B9BF; Thu, 12 Apr 2018 19:59:37 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 08FE38232C; Thu, 12 Apr 2018 19:59:37 +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 F40897DC1; Thu, 12 Apr 2018 19:59:36 +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 w3CJxaZQ017452; Thu, 12 Apr 2018 19:59:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CJxa1E017451; Thu, 12 Apr 2018 19:59:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201804121959.w3CJxa1E017451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 12 Apr 2018 19:59:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332450 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 332450 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 19:59:37 -0000 Author: kib Date: Thu Apr 12 19:59:36 2018 New Revision: 332450 URL: https://svnweb.freebsd.org/changeset/base/332450 Log: Optimize context switch for PTI on PCID pmap. In pti-enabled pmap, the PCID allocation scheme assigns temporal id for the kernel page table, and user page table twin PCID is calculating by setting high bit in the kernel PCID. So the kernel AS is mapped with per-vmspace PCID, and we must completely shut down all mappings in KVA when switching contexts, so that newly switched thread would see all changes in KVA occured while it was not executing. After all, KVA is same between all threads. Currently the pti context switch for the user part of the page table gets its TLB entries flushed too. It is excessive. The same PCID flushing algorithm that is used for non-pti pmap, correctly works for the UVA mappings. The only shared TLB entries are the pages from KVA accessed by the kernel entry trampoline. All of them are static except per-thread TSS and LDT. For TSS and LDT, the lifetime of newly allocated entries is the whole thread life, so it is fine as well. If not fine, then explicit shutdowns for current pmap of the newly allocated LDT and TSS pages would be enough. Also restore the constant value for the pm_pcid for the kernel_pmap. Before, for PTI pmap, pm_pcid was erronously rolled same as user pmap's pm_pcid, but it was not used. Reviewed by: markj (previous version) Discussed with: alc Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 month Differential revision: https://reviews.freebsd.org/D14961 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Thu Apr 12 19:44:04 2018 (r332449) +++ head/sys/amd64/amd64/pmap.c Thu Apr 12 19:59:36 2018 (r332450) @@ -7330,8 +7330,9 @@ pmap_pcid_alloc(pmap_t pmap, u_int cpuid) CRITICAL_ASSERT(curthread); gen = PCPU_GET(pcid_gen); - if (!pti && (pmap->pm_pcids[cpuid].pm_pcid == PMAP_PCID_KERN || - pmap->pm_pcids[cpuid].pm_gen == gen)) + if (pmap->pm_pcids[cpuid].pm_pcid == PMAP_PCID_KERN) + return (pti ? 0 : CR3_PCID_SAVE); + if (pmap->pm_pcids[cpuid].pm_gen == gen) return (CR3_PCID_SAVE); pcid_next = PCPU_GET(pcid_next); KASSERT((!pti && pcid_next <= PMAP_PCID_OVERMAX) || @@ -7358,7 +7359,7 @@ pmap_activate_sw(struct thread *td) { pmap_t oldpmap, pmap; struct invpcid_descr d; - uint64_t cached, cr3, kcr3, ucr3; + uint64_t cached, cr3, kcr3, kern_pti_cached, ucr3; register_t rflags; u_int cpuid; @@ -7407,11 +7408,10 @@ pmap_activate_sw(struct thread *td) if (!invpcid_works) rflags = intr_disable(); - if (!cached || (cr3 & ~CR3_PCID_MASK) != pmap->pm_cr3) { + kern_pti_cached = pti ? 0 : cached; + if (!kern_pti_cached || (cr3 & ~CR3_PCID_MASK) != pmap->pm_cr3) { load_cr3(pmap->pm_cr3 | pmap->pm_pcids[cpuid].pm_pcid | - cached); - if (cached) - PCPU_INC(pm_save_cnt); + kern_pti_cached); } PCPU_SET(curpmap, pmap); if (pti) { @@ -7419,13 +7419,13 @@ pmap_activate_sw(struct thread *td) ucr3 = pmap->pm_ucr3 | pmap->pm_pcids[cpuid].pm_pcid | PMAP_PCID_USER_PT; - /* - * Manually invalidate translations cached - * from the user page table, which are not - * flushed by reload of cr3 with the kernel - * page table pointer above. - */ - if (pmap->pm_ucr3 != PMAP_NO_CR3) { + if (!cached && pmap->pm_ucr3 != PMAP_NO_CR3) { + /* + * Manually invalidate translations cached + * from the user page table. They are not + * flushed by reload of cr3 with the kernel + * page table pointer above. + */ if (invpcid_works) { d.pcid = PMAP_PCID_USER_PT | pmap->pm_pcids[cpuid].pm_pcid; @@ -7442,6 +7442,8 @@ pmap_activate_sw(struct thread *td) } if (!invpcid_works) intr_restore(rflags); + if (cached) + PCPU_INC(pm_save_cnt); } else if (cr3 != pmap->pm_cr3) { load_cr3(pmap->pm_cr3); PCPU_SET(curpmap, pmap); From owner-svn-src-head@freebsd.org Thu Apr 12 20:05:27 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 062B1F8C64A; Thu, 12 Apr 2018 20:05:26 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 963678407B; Thu, 12 Apr 2018 20:05:26 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8D2057F52; Thu, 12 Apr 2018 20:05:26 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CK5QF3022085; Thu, 12 Apr 2018 20:05:26 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CK5Q92022084; Thu, 12 Apr 2018 20:05:26 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201804122005.w3CK5Q92022084@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 12 Apr 2018 20:05:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332451 - head/sbin/ipfw X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sbin/ipfw X-SVN-Commit-Revision: 332451 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 20:05:27 -0000 Author: ae Date: Thu Apr 12 20:05:26 2018 New Revision: 332451 URL: https://svnweb.freebsd.org/changeset/base/332451 Log: Fix indenting in ipv6.c file, use tabs instead of mixing tabs and spaces. MFC after: 1 week Modified: head/sbin/ipfw/ipv6.c Modified: head/sbin/ipfw/ipv6.c ============================================================================== --- head/sbin/ipfw/ipv6.c Thu Apr 12 19:59:36 2018 (r332450) +++ head/sbin/ipfw/ipv6.c Thu Apr 12 20:05:26 2018 (r332451) @@ -48,11 +48,11 @@ } while (0) static struct _s_x icmp6codes[] = { - { "no-route", ICMP6_DST_UNREACH_NOROUTE }, - { "admin-prohib", ICMP6_DST_UNREACH_ADMIN }, - { "address", ICMP6_DST_UNREACH_ADDR }, - { "port", ICMP6_DST_UNREACH_NOPORT }, - { NULL, 0 } + { "no-route", ICMP6_DST_UNREACH_NOROUTE }, + { "admin-prohib", ICMP6_DST_UNREACH_ADMIN }, + { "address", ICMP6_DST_UNREACH_ADDR }, + { "port", ICMP6_DST_UNREACH_NOPORT }, + { NULL, 0 } }; void @@ -87,50 +87,54 @@ print_unreach6_code(struct buf_pr *bp, uint16_t code) void print_ip6(struct buf_pr *bp, ipfw_insn_ip6 *cmd) { - struct hostent *he = NULL; - int len = F_LEN((ipfw_insn *) cmd) - 1; - struct in6_addr *a = &(cmd->addr6); - char trad[255]; + char trad[255]; + struct hostent *he = NULL; + struct in6_addr *a = &(cmd->addr6); + int len, mb; - if (cmd->o.opcode == O_IP6_SRC_ME || cmd->o.opcode == O_IP6_DST_ME) { - bprintf(bp, " me6"); - return; - } - if (cmd->o.opcode == O_IP6) { - bprintf(bp, " ip6"); - return; - } + len = F_LEN((ipfw_insn *) cmd) - 1; + if (cmd->o.opcode == O_IP6_SRC_ME || cmd->o.opcode == O_IP6_DST_ME) { + bprintf(bp, " me6"); + return; + } + if (cmd->o.opcode == O_IP6) { + bprintf(bp, " ip6"); + return; + } - /* - * len == 4 indicates a single IP, whereas lists of 1 or more - * addr/mask pairs have len = (2n+1). We convert len to n so we - * use that to count the number of entries. - */ + /* + * len == 4 indicates a single IP, whereas lists of 1 or more + * addr/mask pairs have len = (2n+1). We convert len to n so we + * use that to count the number of entries. + */ bprintf(bp, " "); - for (len = len / 4; len > 0; len -= 2, a += 2) { - int mb = /* mask length */ - (cmd->o.opcode == O_IP6_SRC || cmd->o.opcode == O_IP6_DST) ? - 128 : contigmask((uint8_t *)&(a[1]), 128); + for (len = len / 4; len > 0; len -= 2, a += 2) { + /* mask length */ + mb = (cmd->o.opcode == O_IP6_SRC || + cmd->o.opcode == O_IP6_DST) ? 128: + contigmask((uint8_t *)&(a[1]), 128); - if (mb == 128 && co.do_resolv) - he = gethostbyaddr((char *)a, sizeof(*a), AF_INET6); - if (he != NULL) /* resolved to name */ - bprintf(bp, "%s", he->h_name); - else if (mb == 0) /* any */ - bprintf(bp, "any"); - else { /* numeric IP followed by some kind of mask */ - if (inet_ntop(AF_INET6, a, trad, sizeof( trad ) ) == NULL) - bprintf(bp, "Error ntop in print_ip6\n"); - bprintf(bp, "%s", trad ); - if (mb < 0) /* mask not contiguous */ - bprintf(bp, "/%s", - inet_ntop(AF_INET6, &a[1], trad, sizeof(trad))); - else if (mb < 128) - bprintf(bp, "/%d", mb); - } - if (len > 2) - bprintf(bp, ","); - } + if (mb == 128 && co.do_resolv) + he = gethostbyaddr((char *)a, sizeof(*a), AF_INET6); + + if (he != NULL) /* resolved to name */ + bprintf(bp, "%s", he->h_name); + else if (mb == 0) /* any */ + bprintf(bp, "any"); + else { /* numeric IP followed by some kind of mask */ + if (inet_ntop(AF_INET6, a, trad, + sizeof(trad)) == NULL) + bprintf(bp, "Error ntop in print_ip6\n"); + bprintf(bp, "%s", trad ); + if (mb < 0) /* mask not contiguous */ + bprintf(bp, "/%s", inet_ntop(AF_INET6, &a[1], + trad, sizeof(trad))); + else if (mb < 128) + bprintf(bp, "/%d", mb); + } + if (len > 2) + bprintf(bp, ","); + } } void @@ -142,163 +146,154 @@ fill_icmp6types(ipfw_insn_icmp6 *cmd, char *av, int cb bzero(cmd, sizeof(*cmd)); while (*av) { - if (*av == ',') - av++; - type = strtoul(av, &av, 0); - if (*av != ',' && *av != '\0') - errx(EX_DATAERR, "invalid ICMP6 type"); - /* - * XXX: shouldn't this be 0xFF? I can't see any reason why - * we shouldn't be able to filter all possiable values - * regardless of the ability of the rest of the kernel to do - * anything useful with them. - */ - if (type > ICMP6_MAXTYPE) - errx(EX_DATAERR, "ICMP6 type out of range"); - cmd->d[type / 32] |= ( 1 << (type % 32)); + if (*av == ',') + av++; + type = strtoul(av, &av, 0); + if (*av != ',' && *av != '\0') + errx(EX_DATAERR, "invalid ICMP6 type"); + /* + * XXX: shouldn't this be 0xFF? I can't see any reason why + * we shouldn't be able to filter all possiable values + * regardless of the ability of the rest of the kernel to do + * anything useful with them. + */ + if (type > ICMP6_MAXTYPE) + errx(EX_DATAERR, "ICMP6 type out of range"); + cmd->d[type / 32] |= ( 1 << (type % 32)); } cmd->o.opcode = O_ICMP6TYPE; cmd->o.len |= F_INSN_SIZE(ipfw_insn_icmp6); } - void print_icmp6types(struct buf_pr *bp, ipfw_insn_u32 *cmd) { - int i, j; - char sep= ' '; + int i, j; + char sep= ' '; - bprintf(bp, " ip6 icmp6types"); - for (i = 0; i < 7; i++) - for (j=0; j < 32; ++j) { - if ( (cmd->d[i] & (1 << (j))) == 0) - continue; - bprintf(bp, "%c%d", sep, (i*32 + j)); - sep = ','; - } + bprintf(bp, " ip6 icmp6types"); + for (i = 0; i < 7; i++) + for (j=0; j < 32; ++j) { + if ( (cmd->d[i] & (1 << (j))) == 0) + continue; + bprintf(bp, "%c%d", sep, (i*32 + j)); + sep = ','; + } } void print_flow6id(struct buf_pr *bp, ipfw_insn_u32 *cmd) { - uint16_t i, limit = cmd->o.arg1; - char sep = ','; + uint16_t i, limit = cmd->o.arg1; + char sep = ','; - bprintf(bp, " flow-id "); - for( i=0; i < limit; ++i) { - if (i == limit - 1) - sep = ' '; - bprintf(bp, "%d%c", cmd->d[i], sep); - } + bprintf(bp, " flow-id "); + for( i=0; i < limit; ++i) { + if (i == limit - 1) + sep = ' '; + bprintf(bp, "%d%c", cmd->d[i], sep); + } } /* structure and define for the extension header in ipv6 */ static struct _s_x ext6hdrcodes[] = { - { "frag", EXT_FRAGMENT }, - { "hopopt", EXT_HOPOPTS }, - { "route", EXT_ROUTING }, - { "dstopt", EXT_DSTOPTS }, - { "ah", EXT_AH }, - { "esp", EXT_ESP }, - { "rthdr0", EXT_RTHDR0 }, - { "rthdr2", EXT_RTHDR2 }, - { NULL, 0 } + { "frag", EXT_FRAGMENT }, + { "hopopt", EXT_HOPOPTS }, + { "route", EXT_ROUTING }, + { "dstopt", EXT_DSTOPTS }, + { "ah", EXT_AH }, + { "esp", EXT_ESP }, + { "rthdr0", EXT_RTHDR0 }, + { "rthdr2", EXT_RTHDR2 }, + { NULL, 0 } }; /* fills command for the extension header filtering */ int fill_ext6hdr( ipfw_insn *cmd, char *av) { - int tok; - char *s = av; + int tok; + char *s = av; - cmd->arg1 = 0; - - while(s) { - av = strsep( &s, ",") ; - tok = match_token(ext6hdrcodes, av); - switch (tok) { - case EXT_FRAGMENT: - cmd->arg1 |= EXT_FRAGMENT; - break; - - case EXT_HOPOPTS: - cmd->arg1 |= EXT_HOPOPTS; - break; - - case EXT_ROUTING: - cmd->arg1 |= EXT_ROUTING; - break; - - case EXT_DSTOPTS: - cmd->arg1 |= EXT_DSTOPTS; - break; - - case EXT_AH: - cmd->arg1 |= EXT_AH; - break; - - case EXT_ESP: - cmd->arg1 |= EXT_ESP; - break; - - case EXT_RTHDR0: - cmd->arg1 |= EXT_RTHDR0; - break; - - case EXT_RTHDR2: - cmd->arg1 |= EXT_RTHDR2; - break; - - default: - errx( EX_DATAERR, "invalid option for ipv6 exten header" ); - break; - } - } - if (cmd->arg1 == 0 ) - return 0; - cmd->opcode = O_EXT_HDR; - cmd->len |= F_INSN_SIZE( ipfw_insn ); - return 1; + cmd->arg1 = 0; + while(s) { + av = strsep( &s, ",") ; + tok = match_token(ext6hdrcodes, av); + switch (tok) { + case EXT_FRAGMENT: + cmd->arg1 |= EXT_FRAGMENT; + break; + case EXT_HOPOPTS: + cmd->arg1 |= EXT_HOPOPTS; + break; + case EXT_ROUTING: + cmd->arg1 |= EXT_ROUTING; + break; + case EXT_DSTOPTS: + cmd->arg1 |= EXT_DSTOPTS; + break; + case EXT_AH: + cmd->arg1 |= EXT_AH; + break; + case EXT_ESP: + cmd->arg1 |= EXT_ESP; + break; + case EXT_RTHDR0: + cmd->arg1 |= EXT_RTHDR0; + break; + case EXT_RTHDR2: + cmd->arg1 |= EXT_RTHDR2; + break; + default: + errx(EX_DATAERR, + "invalid option for ipv6 exten header"); + break; + } + } + if (cmd->arg1 == 0) + return (0); + cmd->opcode = O_EXT_HDR; + cmd->len |= F_INSN_SIZE(ipfw_insn); + return (1); } void print_ext6hdr(struct buf_pr *bp, ipfw_insn *cmd ) { - char sep = ' '; + char sep = ' '; - bprintf(bp, " extension header:"); - if (cmd->arg1 & EXT_FRAGMENT ) { - bprintf(bp, "%cfragmentation", sep); - sep = ','; - } - if (cmd->arg1 & EXT_HOPOPTS ) { - bprintf(bp, "%chop options", sep); - sep = ','; - } - if (cmd->arg1 & EXT_ROUTING ) { - bprintf(bp, "%crouting options", sep); - sep = ','; - } - if (cmd->arg1 & EXT_RTHDR0 ) { - bprintf(bp, "%crthdr0", sep); - sep = ','; - } - if (cmd->arg1 & EXT_RTHDR2 ) { - bprintf(bp, "%crthdr2", sep); - sep = ','; - } - if (cmd->arg1 & EXT_DSTOPTS ) { - bprintf(bp, "%cdestination options", sep); - sep = ','; - } - if (cmd->arg1 & EXT_AH ) { - bprintf(bp, "%cauthentication header", sep); - sep = ','; - } - if (cmd->arg1 & EXT_ESP ) { - bprintf(bp, "%cencapsulated security payload", sep); - } + bprintf(bp, " extension header:"); + if (cmd->arg1 & EXT_FRAGMENT) { + bprintf(bp, "%cfragmentation", sep); + sep = ','; + } + if (cmd->arg1 & EXT_HOPOPTS) { + bprintf(bp, "%chop options", sep); + sep = ','; + } + if (cmd->arg1 & EXT_ROUTING) { + bprintf(bp, "%crouting options", sep); + sep = ','; + } + if (cmd->arg1 & EXT_RTHDR0) { + bprintf(bp, "%crthdr0", sep); + sep = ','; + } + if (cmd->arg1 & EXT_RTHDR2) { + bprintf(bp, "%crthdr2", sep); + sep = ','; + } + if (cmd->arg1 & EXT_DSTOPTS) { + bprintf(bp, "%cdestination options", sep); + sep = ','; + } + if (cmd->arg1 & EXT_AH) { + bprintf(bp, "%cauthentication header", sep); + sep = ','; + } + if (cmd->arg1 & EXT_ESP) { + bprintf(bp, "%cencapsulated security payload", sep); + } } /* Try to find ipv6 address by hostname */ @@ -312,7 +307,7 @@ lookup_host6 (char *host, struct in6_addr *ip6addr) return(-1); memcpy(ip6addr, he->h_addr_list[0], sizeof( struct in6_addr)); } - return(0); + return (0); } From owner-svn-src-head@freebsd.org Thu Apr 12 20:21:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BD96FF8D86C; Thu, 12 Apr 2018 20:21: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6F4A468466; Thu, 12 Apr 2018 20:21: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 515DC10123; Thu, 12 Apr 2018 20:21: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 w3CKL45E028822; Thu, 12 Apr 2018 20:21:04 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CKL4oa028821; Thu, 12 Apr 2018 20:21:04 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804122021.w3CKL4oa028821@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 12 Apr 2018 20:21:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332452 - head/sys/dev/vt/font X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/dev/vt/font X-SVN-Commit-Revision: 332452 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 20:21:05 -0000 Author: emaste Date: Thu Apr 12 20:21:04 2018 New Revision: 332452 URL: https://svnweb.freebsd.org/changeset/base/332452 Log: Update vt(4) "Terminus BSD Console" font to v4.46 "Terminus BSD Console" is a derivative of Terminus that is provided by Mr. Dimitar Zhekov under the 2-clause BSD license for use by the FreeBSD vt(4) console and other BSDs. PR: 227409 MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/dev/vt/font/vt_font_default.c Modified: head/sys/dev/vt/font/vt_font_default.c ============================================================================== --- head/sys/dev/vt/font/vt_font_default.c Thu Apr 12 20:05:26 2018 (r332451) +++ head/sys/dev/vt/font/vt_font_default.c Thu Apr 12 20:21:04 2018 (r332452) @@ -37,7 +37,7 @@ __FBSDID("$FreeBSD$"); #include -static uint8_t font_bytes[1477 * 16] = { +static uint8_t font_bytes[2224 * 16] = { 0x00, 0x00, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, @@ -188,9 +188,9 @@ static uint8_t font_bytes[1477 * 16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x7c, - 0x10, 0x10, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x08, - 0x10, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0x04, 0x18, 0x04, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x10, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x04, + 0x08, 0x10, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x38, 0x04, 0x18, 0x04, 0x04, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x46, 0x7a, 0x40, 0x40, 0x40, 0x00, @@ -198,7 +198,7 @@ static uint8_t font_bytes[1477 * 16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x20, 0x00, - 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x30, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x38, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x48, 0x24, 0x12, 0x24, 0x48, 0x90, 0x00, 0x00, 0x00, 0x00, @@ -340,7 +340,7 @@ static uint8_t font_bytes[1477 * 16] = { 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x40, 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0xff, 0x42, 0x42, 0x7e, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xf8, + 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xf0, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x32, 0x4c, 0x00, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x34, 0x58, 0x00, 0x30, 0x10, 0x10, @@ -496,222 +496,258 @@ static uint8_t font_bytes[1477 * 16] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x03, 0x00, 0x32, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, - 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x3c, 0x42, - 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x7e, 0x40, 0x40, 0x40, 0x78, 0x40, - 0x40, 0x40, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x42, 0x42, - 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x80, 0x38, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, - 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x00, 0x82, - 0x82, 0x44, 0x44, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x80, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x24, 0x66, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x48, 0x48, 0x00, 0x30, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, - 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x10, 0x28, 0x28, 0x44, 0x44, 0x44, 0x82, 0x82, 0xfe, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x5a, 0x42, - 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, - 0x28, 0x28, 0x44, 0x44, 0x44, 0x82, 0x82, 0x82, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, - 0x20, 0x10, 0x08, 0x08, 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x7c, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x7c, 0x10, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, - 0x92, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, + 0x18, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x40, 0x80, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x10, 0x00, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x7e, + 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x80, 0x7e, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x40, 0x7e, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x38, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00, + 0x40, 0x80, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x00, 0x82, 0x82, 0x44, 0x44, 0x28, + 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x24, 0x24, 0x66, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x08, 0x10, 0x00, 0x3a, 0x46, 0x44, 0x44, 0x44, 0x46, 0x3a, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x3c, 0x42, 0x40, - 0x38, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, - 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x02, 0x02, 0x02, 0x00, - 0x00, 0x00, 0x08, 0x10, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0c, - 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x24, 0x00, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x10, 0x48, 0x48, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, + 0x28, 0x28, 0x44, 0x44, 0x44, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x5a, 0x42, 0x42, 0x42, 0x42, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x28, 0x28, 0x44, 0x44, + 0x44, 0x82, 0x82, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, + 0x00, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x20, 0x10, 0x08, 0x08, + 0x10, 0x20, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x7c, + 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x7c, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x7c, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x24, 0x24, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x3a, 0x46, 0x44, 0x44, 0x44, 0x46, 0x3a, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x44, 0x44, 0x48, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x7c, - 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x44, - 0x44, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x3e, 0x10, - 0x08, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0x04, 0x08, 0x10, 0x20, 0x40, 0x40, 0x40, 0x40, 0x3c, - 0x02, 0x02, 0x04, 0x00, 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x7c, 0x44, + 0x00, 0x00, 0x08, 0x10, 0x00, 0x3c, 0x42, 0x40, 0x38, 0x40, 0x42, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x7c, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x08, 0x10, + 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x08, 0x10, 0x00, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3a, 0x46, 0x44, + 0x44, 0x44, 0x46, 0x3a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, + 0x44, 0x48, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, + 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x3e, 0x10, 0x08, 0x3c, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x04, + 0x08, 0x10, 0x20, 0x40, 0x40, 0x40, 0x40, 0x3c, 0x02, 0x02, 0x04, 0x00, + 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x44, 0x38, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, + 0x10, 0x10, 0x28, 0x28, 0x44, 0x44, 0x82, 0x82, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3e, 0x40, 0x40, 0x40, 0x3c, 0x40, 0x40, 0x40, 0x40, 0x3c, + 0x02, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x40, 0x40, 0x40, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x40, 0x3c, + 0x02, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x7c, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x7c, + 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x82, 0x92, + 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x20, 0x20, 0x10, 0x10, 0x28, 0x28, 0x44, 0x44, 0x82, 0x82, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x40, 0x40, 0x40, 0x3c, 0x40, - 0x40, 0x40, 0x40, 0x3c, 0x02, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, + 0x00, 0x44, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x38, 0x44, 0x44, 0x44, 0x3e, 0x04, 0xc4, 0x44, 0x44, 0x38, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x7c, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x7c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc2, 0x24, 0x18, 0x10, 0x30, 0x48, 0x86, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, - 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, - 0x40, 0x40, 0x40, 0x3c, 0x02, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x3e, 0x44, 0x44, 0x44, 0x44, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, + 0x40, 0x40, 0x3c, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x4c, 0x92, 0x92, 0x92, 0x92, 0x92, 0x7c, 0x10, 0x10, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x24, - 0x24, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x92, - 0x92, 0x92, 0x92, 0x7c, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x44, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x48, 0x48, 0x00, 0x30, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, - 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x08, 0x10, 0x00, 0x44, 0x82, 0x92, 0x92, 0x92, 0x92, 0x6c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x7e, 0x42, - 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x20, - 0x20, 0x3c, 0x22, 0x22, 0x22, 0x22, 0x22, 0x24, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x10, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x78, 0x40, - 0x40, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x50, - 0x90, 0x9c, 0x92, 0x92, 0x92, 0x92, 0x92, 0x9c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x90, 0x90, 0x90, 0x9c, 0xf2, 0x92, 0x92, 0x92, 0x92, 0x9c, + 0x00, 0x1e, 0x20, 0x40, 0x7c, 0x40, 0x20, 0x1e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0x04, 0x02, 0x3e, 0x02, 0x04, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x20, 0x20, 0x3c, 0x22, 0x22, - 0x22, 0x22, 0x22, 0x22, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x42, 0x44, - 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x08, 0x42, 0x42, 0x42, 0x46, 0x4a, 0x52, 0x62, 0x42, 0x42, 0x42, - 0x00, 0x00, 0x00, 0x00, 0x24, 0x18, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, - 0x02, 0x02, 0x02, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x18, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x44, 0x44, 0x44, 0x44, 0x44, - 0x44, 0x44, 0x44, 0xfe, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, - 0x92, 0x54, 0x38, 0x54, 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x42, 0x42, 0x42, 0x46, 0x4a, 0x52, 0x62, 0x42, 0x42, 0x42, - 0x00, 0x00, 0x00, 0x00, 0x24, 0x18, 0x42, 0x42, 0x42, 0x46, 0x4a, 0x52, - 0x62, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x12, - 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, 0x42, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x3c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x7c, 0x92, 0x92, 0x92, 0x92, 0x92, - 0x92, 0x92, 0x92, 0x7c, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3f, 0x01, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x02, + 0x22, 0x22, 0x22, 0x24, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x7e, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x42, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x50, 0x90, 0x9c, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90, + 0x90, 0x9c, 0xf2, 0x92, 0x92, 0x92, 0x92, 0x9c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xf8, 0x20, 0x20, 0x3c, 0x22, 0x22, 0x22, 0x22, 0x22, 0x22, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x42, 0x44, 0x48, 0x50, 0x60, 0x60, + 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x42, 0x42, + 0x42, 0x46, 0x4a, 0x52, 0x62, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, + 0x24, 0x18, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x7e, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x40, + 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0x44, 0xfe, + 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x92, 0x54, 0x38, 0x54, + 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, + 0x42, 0x46, 0x4a, 0x52, 0x62, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, + 0x24, 0x18, 0x42, 0x42, 0x42, 0x46, 0x4a, 0x52, 0x62, 0x42, 0x42, 0x42, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x12, 0x22, 0x22, 0x22, 0x22, + 0x22, 0x22, 0x22, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x10, 0x7c, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x7c, + 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x3f, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, - 0x92, 0x92, 0x92, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, - 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x7f, 0x01, 0x01, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0xf2, 0x8a, 0x8a, - 0x8a, 0x8a, 0x8a, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, - 0x02, 0x02, 0x1e, 0x02, 0x02, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x8c, 0x92, 0x92, 0x92, 0x92, 0xf2, 0x92, 0x92, 0x92, 0x8c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x3e, - 0x0a, 0x12, 0x22, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x40, + 0x92, 0x92, 0x92, 0x7f, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x44, 0x44, 0x48, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x7c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, + 0x00, 0x00, 0x82, 0x82, 0x82, 0xf2, 0x8a, 0x8a, 0x8a, 0x8a, 0x8a, 0xf2, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x02, 0x1e, 0x02, + 0x02, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x92, + 0x92, 0x92, 0x92, 0xf2, 0x92, 0x92, 0x92, 0x8c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3e, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x0a, 0x12, 0x22, 0x42, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x40, 0x40, 0x7c, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x44, + 0x44, 0x48, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x54, + 0x38, 0x54, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3c, 0x42, 0x02, 0x1c, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x22, 0x22, 0x22, 0x22, 0x22, 0x42, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0xc6, 0xaa, + 0x92, 0x82, 0x82, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x3f, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x7e, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x7f, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x60, 0x20, 0x3c, 0x22, 0x22, 0x22, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0xf2, 0x8a, 0x8a, 0x8a, 0xf2, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x78, + 0x44, 0x44, 0x44, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3c, 0x42, 0x02, 0x1e, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x92, 0x92, 0xf2, 0x92, 0x92, 0x8c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, + 0x3e, 0x12, 0x22, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xf0, + 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x02, 0x02, 0x0c, 0x00, + 0x00, 0x00, 0x08, 0x10, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, + 0x78, 0x40, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x70, 0x90, 0x9c, 0x92, 0x92, 0x92, 0x9c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, 0x90, 0x9c, 0xf2, 0x92, 0x92, 0x9c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x00, 0x42, 0x44, 0x48, + 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x18, + 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7e, + 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x40, 0xf0, 0x40, 0x7c, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, + 0x78, 0x20, 0x20, 0x3c, 0x22, 0x22, 0x22, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0x82, 0x44, 0x28, 0x38, 0x54, 0x92, 0x92, 0x92, 0x92, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x44, 0x28, + 0x38, 0x54, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x7e, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x02, 0x02, 0x7e, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0xf8, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x92, 0x92, 0x54, 0x38, 0x54, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x1c, 0x02, 0x42, 0x3c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x22, 0x22, - 0x22, 0x22, 0x22, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x82, 0xc6, 0xaa, 0x92, 0x82, 0x82, 0x82, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x7c, 0x92, 0x92, 0x92, 0x92, 0x92, 0x7c, 0x10, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3f, + 0x00, 0x7e, 0x40, 0x40, 0xf8, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, + 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, + 0x78, 0x44, 0x44, 0x44, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, + 0x92, 0x54, 0x38, 0x54, 0x92, 0x92, 0x92, 0x93, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x54, 0x38, 0x54, 0x92, 0x93, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x02, 0x1c, 0x02, + 0x02, 0x42, 0x42, 0x3c, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3c, 0x42, 0x02, 0x1c, 0x02, 0x42, 0x3c, 0x10, 0x10, 0x10, 0x00, + 0x00, 0x00, 0x42, 0x44, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x43, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x44, 0x48, + 0x70, 0x48, 0x44, 0x43, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, + 0x54, 0x58, 0x70, 0x70, 0x58, 0x54, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x54, 0x58, 0x70, 0x58, 0x54, 0x42, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x44, 0x48, 0x50, 0x60, 0x60, + 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0xc2, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x42, 0x43, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, - 0x3e, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x7e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, 0x7f, - 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x20, 0x3c, - 0x22, 0x22, 0x22, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x82, 0x82, 0xf2, 0x8a, 0x8a, 0x8a, 0xf2, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x78, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, - 0x1e, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x8c, 0x92, 0x92, 0xf2, 0x92, 0x92, 0x8c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x42, 0x42, 0x3e, 0x12, 0x22, 0x42, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xf8, 0x40, 0x7c, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x42, 0x02, 0x02, 0x0c, 0x00, 0x00, 0x00, 0x08, 0x10, - 0x00, 0x7e, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x78, 0x40, 0x42, 0x3c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x90, 0x9c, - 0x92, 0x92, 0x92, 0x9c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x90, 0x90, 0x9c, 0xf2, 0x92, 0x92, 0x9c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x08, 0x10, 0x00, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x18, 0x00, 0x42, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x18, 0x18, 0x00, 0x00, - 0x02, 0x02, 0x7e, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x7e, 0x40, 0x40, - 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, - 0x40, 0x40, 0xf8, 0x40, 0x40, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, 0xf8, 0x40, 0x40, 0x40, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x40, 0x7c, - 0x42, 0x42, 0x42, 0x42, 0x02, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7e, 0x40, 0x40, 0x78, 0x44, 0x44, 0x44, 0x04, 0x08, 0x00, 0x00, - 0x00, 0x00, 0x92, 0x92, 0x92, 0x54, 0x38, 0x54, 0x92, 0x92, 0x92, 0x93, - 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x92, 0x92, 0x54, - 0x38, 0x54, 0x92, 0x93, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, - 0x42, 0x02, 0x1c, 0x02, 0x02, 0x42, 0x42, 0x3c, 0x10, 0x10, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x02, 0x1c, 0x02, 0x42, 0x3c, - 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x42, 0x44, 0x48, 0x50, 0x60, 0x60, - 0x50, 0x48, 0x44, 0x43, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x43, 0x01, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x42, 0x42, 0x54, 0x58, 0x70, 0x70, 0x58, 0x54, 0x42, 0x42, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x54, 0x58, - 0x70, 0x58, 0x54, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x44, - 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc2, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x7e, 0x42, - 0x42, 0x42, 0x42, 0x43, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x43, 0x01, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x47, 0x44, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x44, 0x44, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x44, 0x44, - 0x7c, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, - 0x42, 0x40, 0x40, 0x40, 0x40, 0x42, 0x42, 0x3c, 0x10, 0x10, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3c, - 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x82, 0x82, 0x44, 0x44, 0x28, 0x10, - 0x7c, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x7c, 0x10, 0x10, 0x00, - 0x00, 0x00, 0x42, 0x42, 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x42, 0x43, - 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, - 0x18, 0x24, 0x42, 0x43, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, - 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x03, 0x01, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x03, - 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x4a, 0x4a, 0x3e, - 0x0a, 0x0a, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x42, 0x4a, 0x4a, 0x3e, 0x0a, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x7c, - 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, - 0x42, 0x02, 0x02, 0x7e, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, 0x02, 0x02, 0x7e, 0x42, 0x42, 0x3c, - 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x92, 0x92, 0x92, 0x54, 0x38, - 0x54, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, + 0x7e, 0x42, 0x42, 0x43, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x47, 0x44, + 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, 0x44, 0x44, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x47, 0x44, 0x44, 0x7c, 0x44, 0x44, 0x44, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x40, 0x40, 0x40, + 0x40, 0x42, 0x42, 0x3c, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3c, 0x42, 0x40, 0x40, 0x40, 0x42, 0x3c, 0x10, 0x10, 0x10, 0x00, + 0x00, 0x00, 0x82, 0x82, 0x44, 0x44, 0x28, 0x10, 0x7c, 0x10, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x44, + 0x44, 0x28, 0x28, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x42, 0x42, + 0x24, 0x24, 0x18, 0x18, 0x24, 0x24, 0x42, 0x43, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x24, 0x18, 0x24, 0x42, 0x43, + 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, + 0x02, 0x02, 0x02, 0x03, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x03, 0x01, 0x01, 0x00, 0x00, + 0x00, 0x00, 0x42, 0x42, 0x42, 0x4a, 0x4a, 0x3e, 0x0a, 0x0a, 0x02, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x4a, 0x4a, + 0x3e, 0x0a, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, + 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x7c, 0x42, 0x42, 0x42, 0x42, + 0x00, 0x00, 0x00, 0x00, 0x24, 0x18, 0x00, 0x92, 0x92, 0x92, 0x54, 0x38, + 0x54, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x18, 0x00, 0x92, 0x92, 0x54, 0x38, 0x54, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, - 0x24, 0x24, 0x00, 0x3c, 0x42, 0x42, 0x02, 0x1c, 0x02, 0x42, 0x42, 0x3c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, 0x42, 0x02, - 0x1c, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x42, 0x42, - 0x42, 0x46, 0x4a, 0x52, 0x62, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, - 0x24, 0x24, 0x00, 0x42, 0x42, 0x42, 0x46, 0x4a, 0x52, 0x62, 0x42, 0x42, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, + 0x24, 0x24, 0x00, 0x3c, 0x42, 0x02, 0x02, 0x7e, 0x42, 0x42, 0x42, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, 0x02, 0x02, + 0x7e, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, 0x00, 0x92, + 0x92, 0x92, 0x54, 0x38, 0x54, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x44, 0x44, 0x00, 0x92, 0x92, 0x54, 0x38, 0x54, 0x92, 0x92, + 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, 0x42, 0x42, 0x02, 0x1c, + 0x02, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, + 0x00, 0x3c, 0x42, 0x02, 0x1c, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x3c, 0x00, 0x42, 0x42, 0x42, 0x46, 0x4a, 0x52, 0x62, 0x42, 0x42, 0x42, + 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42, 0x46, 0x4a, + 0x52, 0x62, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x24, 0x24, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, - 0x42, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x42, 0x42, 0x3c, - 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, 0x42, 0x02, 0x02, 0x1e, - 0x02, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, - 0x00, 0x3c, 0x42, 0x02, 0x1e, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x3c, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x3c, - 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x3e, - 0x02, 0x02, 0x02, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x12, 0x24, 0x00, 0x42, + 0x42, 0x02, 0x02, 0x1e, 0x02, 0x02, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x24, 0x24, 0x00, 0x3c, 0x42, 0x02, 0x1e, 0x02, 0x42, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, + 0x02, 0x02, 0x02, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x3c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x12, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3e, - 0x02, 0x02, 0x3c, 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x3e, - 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, - 0x00, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x48, 0x48, 0x00, 0x82, 0x82, 0x82, 0xf2, 0x8a, 0x8a, 0x8a, 0x8a, 0xf2, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x00, 0x82, 0x82, 0xf2, - 0x8a, 0x8a, 0x8a, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x44, + 0x12, 0x24, 0x00, 0x42, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x3c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x24, 0x00, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x3c, 0x00, 0x24, 0x24, 0x00, 0x42, + 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x24, 0x24, 0x00, 0x42, 0x42, 0x42, 0x3e, 0x02, 0x02, 0x02, + 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, 0x00, 0x82, 0x82, 0x82, 0xf2, 0x8a, + 0x8a, 0x8a, 0x8a, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x48, 0x48, + 0x00, 0x82, 0x82, 0xf2, 0x8a, 0x8a, 0x8a, 0xf2, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x78, 0x44, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x44, 0x78, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x3e, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x3e, 0x00, 0x08, 0x08, 0x00, 0x00, 0x00, 0x42, 0x44, 0x48, 0x50, 0x60, 0x60, 0x50, 0x48, 0x44, 0x42, 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x42, 0x44, 0x48, 0x70, 0x48, 0x44, 0x42, - 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x78, 0x40, + 0x00, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x7e, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x30, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x10, 0x10, 0x00, + 0x10, 0x10, 0x82, 0xc6, 0xaa, 0x92, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0xfc, 0x92, 0x92, + 0x92, 0x92, 0x92, 0x92, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0xc6, + 0xaa, 0x92, 0x92, 0x82, 0x82, 0x82, 0x82, 0x82, 0x00, 0x10, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x92, 0x92, 0x92, 0x92, 0x92, 0x92, + 0x00, 0x10, 0x10, 0x00, 0x10, 0x10, 0x42, 0x42, 0x42, 0x62, 0x52, 0x4a, + 0x46, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, + 0x00, 0x7c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x42, 0x42, 0x42, 0x62, 0x52, 0x4a, 0x46, 0x42, 0x42, 0x42, + 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0xfe, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x00, + 0x00, 0x00, 0x10, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x10, 0x0e, + 0x00, 0x04, 0x04, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x40, 0x7e, 0x00, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x7e, 0x40, 0x40, 0x3c, 0x00, 0x10, 0x10, 0x00, 0x32, 0x4c, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x78, 0x40, 0x40, 0x40, 0x7e, @@ -755,26 +791,90 @@ static uint8_t font_bytes[1477 * 16] = { 0x20, 0x10, 0x08, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x24, 0x00, 0x24, 0x24, - 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x24, 0x24, - 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf0, 0x88, 0x88, 0x88, 0xf4, 0x84, 0x8e, 0x84, 0x84, 0x82, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x22, 0x40, 0xf8, 0x40, - 0xf8, 0x40, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x10, - 0x10, 0x1c, 0x70, 0x1c, 0x70, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, 0x18, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0x30, 0x10, + 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x04, 0x0c, 0x14, 0x3e, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x04, 0x04, 0x38, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x20, 0x38, + 0x24, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x3c, 0x04, 0x08, 0x08, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x18, 0x24, 0x24, 0x18, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, + 0x1c, 0x04, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, + 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x24, + 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x24, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, + 0x30, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x24, 0x04, 0x08, 0x10, 0x3c, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x04, 0x18, 0x04, 0x04, + 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, + 0x0c, 0x14, 0x3e, 0x04, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x38, 0x20, 0x38, 0x04, 0x04, 0x38, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x20, 0x38, 0x24, 0x24, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, + 0x04, 0x08, 0x08, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x18, 0x24, 0x18, 0x24, 0x24, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x1c, 0x04, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x7c, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, + 0x10, 0x10, 0x10, 0x10, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x10, 0x08, 0x08, 0x08, 0x08, 0x10, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x04, 0x1c, 0x24, + 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x24, 0x3c, 0x20, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x24, 0x24, 0x24, 0x18, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x28, 0x10, 0x28, + 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x38, 0x04, 0x3c, 0x24, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x20, 0x20, 0x38, 0x24, 0x24, 0x24, 0x24, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x24, 0x28, 0x30, 0x28, + 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x78, 0x54, 0x54, 0x54, 0x54, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x24, 0x24, 0x24, + 0x38, 0x20, 0x20, 0x00, 0x00, 0x00, 0xf0, 0x88, 0x88, 0x88, 0xf4, 0x84, + 0x8e, 0x84, 0x84, 0x82, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, + 0x22, 0x40, 0xf8, 0x40, 0xf8, 0x40, 0x22, 0x1c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfe, 0x10, 0x10, 0x1c, 0x70, 0x1c, 0x70, 0x10, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x52, 0x52, 0x50, 0x50, 0x50, + 0x50, 0x52, 0x52, 0x3c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, + 0x62, 0x52, 0x6a, 0x56, 0x4a, 0x46, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x96, 0x96, 0x96, 0xd0, 0xf0, 0xf0, 0xb0, 0x96, 0x90, 0x96, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb, 0x55, 0x55, 0x51, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x20, 0x40, 0xfe, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x10, 0x38, 0x54, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0xfe, - 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x54, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x42, 0xff, 0x42, 0x24, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x52, 0x52, 0x52, 0x52, 0x52, + 0x52, 0x52, 0x5a, 0x3c, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xa4, + 0xa4, 0xa4, 0xa4, 0xb8, 0xa8, 0xb4, 0xaa, 0xe6, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xfb, 0x55, 0x55, 0x51, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x02, 0x06, 0x0a, 0x14, 0x28, + 0x50, 0x60, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x44, 0x44, + 0x22, 0x22, 0x34, 0x58, 0x88, 0x88, 0x84, 0x44, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x40, 0xfe, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x54, 0x10, 0x10, 0x10, - 0x10, 0x54, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, + 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x08, 0x04, 0xfe, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x54, 0x38, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x42, 0xff, + 0x42, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, + 0x54, 0x10, 0x10, 0x10, 0x10, 0x54, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x22, 0x42, 0xfe, 0x42, 0x22, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x84, 0xfe, + 0x84, 0x88, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x54, 0x10, 0x10, 0x10, 0x54, 0x38, 0x10, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x02, 0x02, 0x02, 0x22, 0x42, 0xfe, 0x40, 0x20, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x30, 0x50, 0x92, 0x82, + 0x82, 0x44, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x20, 0x40, 0xfe, 0x00, 0xfe, 0x04, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x08, 0x04, 0xfe, 0x00, 0xfe, 0x40, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x7e, 0xc0, 0x7e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, @@ -783,34 +883,90 @@ static uint8_t font_bytes[1477 * 16] = { 0x28, 0x6c, 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x24, 0x7e, 0xc3, 0x7e, 0x24, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x38, 0x6c, 0x28, 0x28, 0x28, 0x28, 0x6c, 0x38, 0x10, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x02, 0x02, 0x02, 0x7e, - 0x02, 0x02, 0x02, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, - 0x7c, 0x8a, 0x92, 0x92, 0xa2, 0x7c, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x82, 0x7c, 0x44, 0x44, + 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, + 0x02, 0x02, 0x02, 0x7e, 0x02, 0x02, 0x02, 0x7e, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x04, 0x7e, 0x0a, 0x0a, 0x12, 0x7e, 0x12, 0x22, 0x22, 0x7e, + 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x04, 0x7c, 0x8a, 0x92, 0x92, + 0xa2, 0x7c, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x82, + 0x82, 0x44, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x20, 0x40, 0x40, 0x7e, 0x40, 0x40, 0x20, 0x1e, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x20, 0x40, 0x7e, - 0x40, 0x20, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x06, 0x04, 0x04, 0x04, 0x04, 0x44, 0x44, 0x44, 0x24, 0x14, 0x0c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x92, 0x92, - 0x92, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x40, 0x40, 0x40, 0x40, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x28, 0x28, 0x44, 0x44, 0x82, 0x82, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x44, 0x44, - 0x28, 0x28, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x4c, 0x00, - 0x32, 0x4c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x7e, 0x08, 0x10, 0x7e, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, - 0x08, 0x04, 0x00, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, - 0x10, 0x08, 0x04, 0x08, 0x10, 0x20, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x44, 0x82, 0x82, 0x82, 0x82, 0xfe, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, - 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x1e, 0x24, 0x44, 0x48, 0x7e, + 0x48, 0x50, 0x30, 0x3e, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x1e, 0x20, 0x40, 0x7e, 0x40, 0x20, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x78, 0x04, 0x02, 0x02, 0x7e, 0x02, 0x02, 0x04, 0x78, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x78, 0x24, 0x22, 0x12, 0x7e, + 0x12, 0x0a, 0x0c, 0x7c, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x78, 0x04, 0x02, 0x7e, 0x02, 0x04, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, 0x10, 0x10, 0x7c, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x00, 0x10, + 0x10, 0x7c, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, + 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x04, 0x04, + 0x04, 0x04, 0x44, 0x44, 0x44, 0x24, 0x14, 0x0c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x92, 0x92, 0x92, 0x7c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x10, 0x28, 0x28, 0x44, 0x44, 0x82, 0x82, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x82, 0x82, 0x44, 0x44, 0x28, 0x28, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, + 0x42, 0x42, 0x42, 0x42, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x3c, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x32, 0x4c, 0x00, 0x32, 0x4c, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x7e, 0x08, 0x10, + 0x7e, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x20, 0x10, 0x08, 0x04, 0x00, 0x3e, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x10, 0x08, 0x04, 0x08, + 0x10, 0x20, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x09, + 0x12, 0x24, 0x48, 0x90, 0x48, 0x24, 0x12, 0x09, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x90, 0x48, 0x24, 0x12, 0x09, 0x12, 0x24, 0x48, 0x90, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x7c, 0x02, 0x02, 0x02, 0x02, 0x02, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x3e, 0x40, 0x40, 0x40, 0x40, 0x40, 0x3e, 0x00, 0x7e, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x02, 0x02, 0x02, 0x02, + 0x02, 0x7c, 0x00, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xfe, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x3c, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, 0x42, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x28, 0x44, 0x82, + 0x82, 0x82, 0x82, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x38, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x40, 0x40, 0x40, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x40, 0x40, + 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x12, 0x12, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x90, 0x90, 0x60, + 0x00, 0x00, 0x00, 0x00, 0x04, 0x08, 0x10, 0x10, 0x20, 0x20, 0x20, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, + 0x10, 0x10, 0x08, 0x04, 0x40, 0x20, 0x10, 0x10, 0x08, 0x08, 0x08, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x08, 0x08, 0x08, + 0x10, 0x10, 0x20, 0x40, 0x7c, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, + 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x40, 0x7c, + 0x7c, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, + 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x04, 0x7c, 0x0e, 0x10, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0xc0, 0xc0, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x10, 0x0e, 0xe0, 0x10, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x06, 0x06, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, + 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0xe0, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, @@ -825,236 +981,584 @@ static uint8_t font_bytes[1477 * 16] = { 0x00, 0x70, 0x88, 0x80, 0x80, 0x88, 0x70, 0x00, 0x1e, 0x11, 0x11, 0x1e, 0x12, 0x11, 0x00, 0x00, 0x00, 0x88, 0xc8, 0xa8, 0x98, 0x88, 0x88, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x18, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, - 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, + 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xaa, 0xaa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10, 0x10, 0x00, - 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, - 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, - 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf0, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, + 0x10, 0x10, 0x10, 0x00, 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, + 0x18, 0x18, 0x18, 0x00, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f, - 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf0, + 0x00, 0x00, 0x00, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, + 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf8, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x10, 0x10, 0x1f, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, + 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, - 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f, 0x1f, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x18, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f, + 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, - 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x1f, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf0, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0xf0, 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf8, - 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x10, 0x10, 0x10, 0x10, + 0x18, 0x18, 0x18, 0x1f, 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f, 0x1f, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x1f, + 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf0, 0xf0, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, + 0xf8, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0xf8, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xf8, 0xf8, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x1f, 0x18, 0x18, 0x18, + 0xff, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, 0xf0, 0x00, 0x00, 0x00, + 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, - 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x00, 0x00, 0x00, 0x00, + 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, - 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0xff, 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, 0x1f, 0x10, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0xff, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x1f, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0xff, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, - 0xff, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0xff, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0xff, 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x1f, 0x10, 0x10, 0x10, + 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0xff, 0xff, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, - 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0xff, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xff, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, - 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0xff, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, - 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0x1f, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xf0, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, + 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0xff, 0xf8, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, - 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x10, - 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x3f, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, 0x2f, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x10, - 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf8, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x08, 0xe8, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f, 0x10, - 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x2f, 0x20, 0x3f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf0, 0x10, - 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0xe8, 0x08, 0xf8, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x1f, 0x10, - 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x28, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0x2f, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x2f, 0x20, 0x2f, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xf0, 0x10, - 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x28, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0xe8, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0xe8, 0x08, 0xe8, 0x28, 0x28, 0x28, + 0xff, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, 0xf8, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0xff, + 0x1f, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x18, 0x18, 0x18, 0xff, 0xff, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, 0x18, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, + 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x1f, 0x10, 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x28, 0x28, 0x28, 0x28, + 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x20, + 0x2f, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xf0, 0x10, 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x28, 0x28, 0x28, 0x28, + 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x08, + 0xe8, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x1f, 0x10, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x3f, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x2f, 0x20, + 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0xf0, 0x10, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0xf8, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0xe8, 0x08, + 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x1f, 0x10, 0x1f, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x2f, 0x28, 0x28, 0x28, 0x28, + 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x2f, 0x20, + 0x2f, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0xf0, 0x10, 0xf0, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0xe8, 0x28, 0x28, 0x28, 0x28, + 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0xe8, 0x08, + 0xe8, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0xff, 0x00, 0xff, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, - 0xff, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x00, 0xef, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, 0x00, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0xef, 0x00, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0xff, 0x10, - 0xff, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x28, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0xff, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0xef, 0x00, 0xef, 0x28, 0x28, 0x28, - 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, - 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0xc0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x08, 0x07, + 0xef, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0xff, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0xef, 0x00, + 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0xff, 0x10, 0xff, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0xff, 0x28, 0x28, 0x28, 0x28, + 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0xef, 0x00, + 0xef, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x28, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x07, 0x08, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x20, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x20, 0xc0, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, + 0x10, 0x10, 0x08, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x01, 0x01, 0x02, 0x02, 0x04, 0x04, 0x08, 0x08, 0x10, 0x10, 0x20, 0x20, + 0x40, 0x40, 0x80, 0x80, 0x80, 0x80, 0x40, 0x40, 0x20, 0x20, 0x10, 0x10, + 0x08, 0x08, 0x04, 0x04, 0x02, 0x02, 0x01, 0x01, 0x81, 0x81, 0x42, 0x42, + 0x24, 0x24, 0x18, 0x18, 0x18, 0x18, 0x24, 0x24, 0x42, 0x42, 0x81, 0x81, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, 0x10, *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Thu Apr 12 20:27:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AB31FF8E2CF; Thu, 12 Apr 2018 20:27:58 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5DB806A215; Thu, 12 Apr 2018 20:27:58 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 587E310291; Thu, 12 Apr 2018 20:27:58 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CKRwes032156; Thu, 12 Apr 2018 20:27:58 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CKRwVX032153; Thu, 12 Apr 2018 20:27:58 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201804122027.w3CKRwVX032153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 12 Apr 2018 20:27:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332453 - in head: share/mk sys/conf X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head: share/mk sys/conf X-SVN-Commit-Revision: 332453 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 20:27:58 -0000 Author: bdrewery Date: Thu Apr 12 20:27:57 2018 New Revision: 332453 URL: https://svnweb.freebsd.org/changeset/base/332453 Log: Fix using wrong SYSDIR after r331683. This was inadvertently overriding the first found SYSDIR with the last of /usr/src which could result in the wrong headers being used if not building from /usr/src. SYSDIR?= is not used here to avoid evaluating the exists() when unneeded. Reported by: rgrimes, sjg, Mark Millard Pointyhat to: bdrewery Sponsored by: Dell EMC Modified: head/share/mk/bsd.dtb.mk head/share/mk/bsd.kmod.mk head/sys/conf/kmod.mk Modified: head/share/mk/bsd.dtb.mk ============================================================================== --- head/share/mk/bsd.dtb.mk Thu Apr 12 20:21:04 2018 (r332452) +++ head/share/mk/bsd.dtb.mk Thu Apr 12 20:27:57 2018 (r332453) @@ -5,7 +5,7 @@ .if !defined(SYSDIR) .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \ ${.CURDIR}/../../../../.. /sys /usr/src/sys -.if exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk) +.if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk) SYSDIR= ${_dir} .endif .endfor Modified: head/share/mk/bsd.kmod.mk ============================================================================== --- head/share/mk/bsd.kmod.mk Thu Apr 12 20:21:04 2018 (r332452) +++ head/share/mk/bsd.kmod.mk Thu Apr 12 20:27:57 2018 (r332453) @@ -5,7 +5,7 @@ .if !defined(SYSDIR) .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \ ${.CURDIR}/../../../../.. /sys /usr/src/sys -.if exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk) +.if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk) SYSDIR= ${_dir:tA} .endif .endfor Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Thu Apr 12 20:21:04 2018 (r332452) +++ head/sys/conf/kmod.mk Thu Apr 12 20:27:57 2018 (r332453) @@ -84,7 +84,7 @@ OBJCOPY?= objcopy .if empty(KERNBUILDDIR) .if !defined(SYSDIR) .for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys -.if exists(${_dir}/kern/) +.if !defined(SYSDIR) && exists(${_dir}/kern/) SYSDIR= ${_dir:tA} .endif .endfor From owner-svn-src-head@freebsd.org Thu Apr 12 20:43:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 7221AF8F6BF; Thu, 12 Apr 2018 20:43: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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 2495B6DBC0; Thu, 12 Apr 2018 20:43: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 1E9B0105CA; Thu, 12 Apr 2018 20:43: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 w3CKhdr9041950; Thu, 12 Apr 2018 20:43:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CKhdFF041945; Thu, 12 Apr 2018 20:43:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201804122043.w3CKhdFF041945@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 12 Apr 2018 20:43:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332454 - in head/sys: amd64/amd64 amd64/ia32 amd64/linux amd64/linux32 i386/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/ia32 amd64/linux amd64/linux32 i386/i386 X-SVN-Commit-Revision: 332454 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 20:43:40 -0000 Author: kib Date: Thu Apr 12 20:43:39 2018 New Revision: 332454 URL: https://svnweb.freebsd.org/changeset/base/332454 Log: Fix PSL_T inheritance on exec for x86. The miscellaneous x86 sysent->sv_setregs() implementations tried to migrate PSL_T from the previous program to the new executed one, but they evaluated regs->tf_eflags after the whole regs structure was bzeroed. Make this functional by saving PSL_T value before zeroing. Note that if the debugger is not attached, executing the first instruction in the new program with PSL_T set results in SIGTRAP, and since all intercepted signals are reset to default dispostion on exec(2), this means that non-debugged process gets killed immediately if PSL_T is inherited. In particular, since suid images drop P_TRACED, attempt to set PSL_T for execution of such program would kill the process. Another issue with userspace PSL_T handling is that it is reset by trap(). It is reasonable to clear PSL_T when entering SIGTRAP handler, to allow the signal to be handled without recursion or delivery of blocked fault. But it is not reasonable to return back to the normal flow with PSL_T cleared. This is too late to change, I think. Discussed with: bde, Ali Mashtizadeh Sponsored by: The FreeBSD Foundation MFC after: 3 weeks Differential revision: https://reviews.freebsd.org/D14995 Modified: head/sys/amd64/amd64/machdep.c head/sys/amd64/ia32/ia32_signal.c head/sys/amd64/linux/linux_sysvec.c head/sys/amd64/linux32/linux32_sysvec.c head/sys/i386/i386/machdep.c Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Thu Apr 12 20:27:57 2018 (r332453) +++ head/sys/amd64/amd64/machdep.c Thu Apr 12 20:43:39 2018 (r332454) @@ -581,9 +581,13 @@ freebsd4_sigreturn(struct thread *td, struct freebsd4_ void exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { - struct trapframe *regs = td->td_frame; - struct pcb *pcb = td->td_pcb; + struct trapframe *regs; + struct pcb *pcb; + register_t saved_rflags; + regs = td->td_frame; + pcb = td->td_pcb; + if (td->td_proc->p_md.md_ldt != NULL) user_ldt_free(td); @@ -593,11 +597,12 @@ exec_setregs(struct thread *td, struct image_params *i clear_pcb_flags(pcb, PCB_32BIT); pcb->pcb_initial_fpucw = __INITIAL_FPUCW__; + saved_rflags = regs->tf_rflags & PSL_T; bzero((char *)regs, sizeof(struct trapframe)); regs->tf_rip = imgp->entry_addr; regs->tf_rsp = ((stack - 8) & ~0xFul) + 8; regs->tf_rdi = stack; /* argv */ - regs->tf_rflags = PSL_USER | (regs->tf_rflags & PSL_T); + regs->tf_rflags = PSL_USER | saved_rflags; regs->tf_ss = _udatasel; regs->tf_cs = _ucodesel; regs->tf_ds = _udatasel; Modified: head/sys/amd64/ia32/ia32_signal.c ============================================================================== --- head/sys/amd64/ia32/ia32_signal.c Thu Apr 12 20:27:57 2018 (r332453) +++ head/sys/amd64/ia32/ia32_signal.c Thu Apr 12 20:43:39 2018 (r332454) @@ -936,9 +936,13 @@ freebsd32_sigreturn(td, uap) void ia32_setregs(struct thread *td, struct image_params *imgp, u_long stack) { - struct trapframe *regs = td->td_frame; - struct pcb *pcb = td->td_pcb; + struct trapframe *regs; + struct pcb *pcb; + register_t saved_rflags; + regs = td->td_frame; + pcb = td->td_pcb; + if (td->td_proc->p_md.md_ldt != NULL) user_ldt_free(td); #ifdef COMPAT_43 @@ -949,10 +953,11 @@ ia32_setregs(struct thread *td, struct image_params *i pcb->pcb_gsbase = 0; pcb->pcb_initial_fpucw = __INITIAL_FPUCW_I386__; + saved_rflags = regs->tf_rflags & PSL_T; bzero((char *)regs, sizeof(struct trapframe)); regs->tf_rip = imgp->entry_addr; regs->tf_rsp = stack; - regs->tf_rflags = PSL_USER | (regs->tf_rflags & PSL_T); + regs->tf_rflags = PSL_USER | saved_rflags; regs->tf_ss = _udatasel; regs->tf_cs = _ucode32sel; regs->tf_rbx = imgp->ps_strings; Modified: head/sys/amd64/linux/linux_sysvec.c ============================================================================== --- head/sys/amd64/linux/linux_sysvec.c Thu Apr 12 20:27:57 2018 (r332453) +++ head/sys/amd64/linux/linux_sysvec.c Thu Apr 12 20:43:39 2018 (r332454) @@ -404,9 +404,13 @@ linux_copyout_strings(struct image_params *imgp) static void linux_exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { - struct trapframe *regs = td->td_frame; - struct pcb *pcb = td->td_pcb; + struct trapframe *regs; + struct pcb *pcb; + register_t saved_rflags; + regs = td->td_frame; + pcb = td->td_pcb; + if (td->td_proc->p_md.md_ldt != NULL) user_ldt_free(td); @@ -416,10 +420,11 @@ linux_exec_setregs(struct thread *td, struct image_par pcb->pcb_initial_fpucw = __LINUX_NPXCW__; set_pcb_flags(pcb, PCB_FULL_IRET); + saved_rflags = regs->tf_rflags & PSL_T; bzero((char *)regs, sizeof(struct trapframe)); regs->tf_rip = imgp->entry_addr; regs->tf_rsp = stack; - regs->tf_rflags = PSL_USER | (regs->tf_rflags & PSL_T); + regs->tf_rflags = PSL_USER | saved_rflags; regs->tf_ss = _udatasel; regs->tf_cs = _ucodesel; regs->tf_ds = _udatasel; Modified: head/sys/amd64/linux32/linux32_sysvec.c ============================================================================== --- head/sys/amd64/linux32/linux32_sysvec.c Thu Apr 12 20:27:57 2018 (r332453) +++ head/sys/amd64/linux32/linux32_sysvec.c Thu Apr 12 20:43:39 2018 (r332454) @@ -719,7 +719,11 @@ linux_exec_setregs(struct thread *td, struct image_par { struct trapframe *regs = td->td_frame; struct pcb *pcb = td->td_pcb; + register_t saved_rflags; + regs = td->td_frame; + pcb = td->td_pcb; + if (td->td_proc->p_md.md_ldt != NULL) user_ldt_free(td); @@ -731,10 +735,11 @@ linux_exec_setregs(struct thread *td, struct image_par critical_exit(); pcb->pcb_initial_fpucw = __LINUX_NPXCW__; + saved_rflags = regs->tf_rflags & PSL_T; bzero((char *)regs, sizeof(struct trapframe)); regs->tf_rip = imgp->entry_addr; regs->tf_rsp = stack; - regs->tf_rflags = PSL_USER | (regs->tf_rflags & PSL_T); + regs->tf_rflags = PSL_USER | saved_rflags; regs->tf_gs = _ugssel; regs->tf_fs = _ufssel; regs->tf_es = _udatasel; Modified: head/sys/i386/i386/machdep.c ============================================================================== --- head/sys/i386/i386/machdep.c Thu Apr 12 20:27:57 2018 (r332453) +++ head/sys/i386/i386/machdep.c Thu Apr 12 20:43:39 2018 (r332454) @@ -1104,9 +1104,13 @@ sys_sigreturn(td, uap) void exec_setregs(struct thread *td, struct image_params *imgp, u_long stack) { - struct trapframe *regs = td->td_frame; - struct pcb *pcb = td->td_pcb; + struct trapframe *regs; + struct pcb *pcb; + register_t saved_eflags; + regs = td->td_frame; + pcb = td->td_pcb; + /* Reset pc->pcb_gs and %gs before possibly invalidating it. */ pcb->pcb_gs = _udatasel; load_gs(_udatasel); @@ -1127,10 +1131,11 @@ exec_setregs(struct thread *td, struct image_params *i set_gsbase(td, 0); /* Make sure edx is 0x0 on entry. Linux binaries depend on it. */ + saved_eflags = regs->tf_eflags & PSL_T; bzero((char *)regs, sizeof(struct trapframe)); regs->tf_eip = imgp->entry_addr; regs->tf_esp = stack; - regs->tf_eflags = PSL_USER | (regs->tf_eflags & PSL_T); + regs->tf_eflags = PSL_USER | saved_eflags; regs->tf_ss = _udatasel; regs->tf_ds = _udatasel; regs->tf_es = _udatasel; From owner-svn-src-head@freebsd.org Thu Apr 12 20:48:18 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1B3EFF8FB2F; Thu, 12 Apr 2018 20:48:18 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C10346F84E; Thu, 12 Apr 2018 20:48:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B73B9105D7; Thu, 12 Apr 2018 20:48:17 +0000 (UTC) (envelope-from bdrewery@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CKmHSE042159; Thu, 12 Apr 2018 20:48:17 GMT (envelope-from bdrewery@FreeBSD.org) Received: (from bdrewery@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CKmHUC042156; Thu, 12 Apr 2018 20:48:17 GMT (envelope-from bdrewery@FreeBSD.org) Message-Id: <201804122048.w3CKmHUC042156@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdrewery set sender to bdrewery@FreeBSD.org using -f From: Bryan Drewery Date: Thu, 12 Apr 2018 20:48:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332455 - in head: share/mk sys/conf X-SVN-Group: head X-SVN-Commit-Author: bdrewery X-SVN-Commit-Paths: in head: share/mk sys/conf X-SVN-Commit-Revision: 332455 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 20:48:18 -0000 Author: bdrewery Date: Thu Apr 12 20:48:17 2018 New Revision: 332455 URL: https://svnweb.freebsd.org/changeset/base/332455 Log: Use known SRCTOP if possible to determine SYSDIR. Suggested by: sjg Sponsored by: Dell EMC Modified: head/share/mk/bsd.dtb.mk head/share/mk/bsd.kmod.mk head/sys/conf/kmod.mk Modified: head/share/mk/bsd.dtb.mk ============================================================================== --- head/share/mk/bsd.dtb.mk Thu Apr 12 20:43:39 2018 (r332454) +++ head/share/mk/bsd.dtb.mk Thu Apr 12 20:48:17 2018 (r332455) @@ -3,7 +3,8 @@ # Search for kernel source tree in standard places. .if empty(KERNBUILDDIR) .if !defined(SYSDIR) -.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \ +.for _dir in ${SRCTOP:D${SRCTOP}/sys} \ + ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \ ${.CURDIR}/../../../../.. /sys /usr/src/sys .if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk) SYSDIR= ${_dir} Modified: head/share/mk/bsd.kmod.mk ============================================================================== --- head/share/mk/bsd.kmod.mk Thu Apr 12 20:43:39 2018 (r332454) +++ head/share/mk/bsd.kmod.mk Thu Apr 12 20:48:17 2018 (r332455) @@ -3,7 +3,8 @@ # Search for kernel source tree in standard places. .if empty(KERNBUILDDIR) .if !defined(SYSDIR) -.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \ +.for _dir in ${SRCTOP:D${SRCTOP}/sys} \ + ${.CURDIR}/../.. ${.CURDIR}/../../.. ${.CURDIR}/../../../.. \ ${.CURDIR}/../../../../.. /sys /usr/src/sys .if !defined(SYSDIR) && exists(${_dir}/kern/) && exists(${_dir}/conf/kmod.mk) SYSDIR= ${_dir:tA} Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Thu Apr 12 20:43:39 2018 (r332454) +++ head/sys/conf/kmod.mk Thu Apr 12 20:48:17 2018 (r332455) @@ -83,7 +83,8 @@ OBJCOPY?= objcopy # Search for kernel source tree in standard places. .if empty(KERNBUILDDIR) .if !defined(SYSDIR) -.for _dir in ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys +.for _dir in ${SRCTOP:D${SRCTOP}/sys} \ + ${.CURDIR}/../.. ${.CURDIR}/../../.. /sys /usr/src/sys .if !defined(SYSDIR) && exists(${_dir}/kern/) SYSDIR= ${_dir:tA} .endif From owner-svn-src-head@freebsd.org Thu Apr 12 21:05:21 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id AA4FBF90F08; Thu, 12 Apr 2018 21:05:21 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5C82D7126A; Thu, 12 Apr 2018 21:05:21 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 52BFD108F0; Thu, 12 Apr 2018 21:05:21 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CL5L3g051931; Thu, 12 Apr 2018 21:05:21 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CL5Lcq051929; Thu, 12 Apr 2018 21:05:21 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201804122105.w3CL5Lcq051929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 12 Apr 2018 21:05:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332456 - head/sys/netpfil/ipfw/nat64 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 332456 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 21:05:22 -0000 Author: ae Date: Thu Apr 12 21:05:20 2018 New Revision: 332456 URL: https://svnweb.freebsd.org/changeset/base/332456 Log: Migrate NAT64 to FIB KPI. Obtained from: Yandex LLC MFC after: 1 week Modified: head/sys/netpfil/ipfw/nat64/nat64_translate.c head/sys/netpfil/ipfw/nat64/nat64_translate.h Modified: head/sys/netpfil/ipfw/nat64/nat64_translate.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64_translate.c Thu Apr 12 20:48:17 2018 (r332455) +++ head/sys/netpfil/ipfw/nat64/nat64_translate.c Thu Apr 12 21:05:20 2018 (r332456) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -60,6 +61,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -76,11 +78,12 @@ nat64_log(struct pfloghdr *logdata, struct mbuf *m, sa logdata->af = family; ipfw_bpf_mtap2(logdata, PFLOG_HDRLEN, m); } + #ifdef IPFIREWALL_NAT64_DIRECT_OUTPUT -static NAT64NOINLINE struct sockaddr* nat64_find_route4(struct route *ro, - in_addr_t dest, struct mbuf *m); -static NAT64NOINLINE struct sockaddr* nat64_find_route6(struct route_in6 *ro, - struct in6_addr *dest, struct mbuf *m); +static NAT64NOINLINE int nat64_find_route4(struct nhop4_basic *, + struct sockaddr_in *, struct mbuf *); +static NAT64NOINLINE int nat64_find_route6(struct nhop6_basic *, + struct sockaddr_in6 *, struct mbuf *); static NAT64NOINLINE int nat64_output(struct ifnet *ifp, struct mbuf *m, @@ -100,28 +103,38 @@ nat64_output(struct ifnet *ifp, struct mbuf *m, static NAT64NOINLINE int nat64_output_one(struct mbuf *m, nat64_stats_block *stats, void *logdata) { - struct route_in6 ro6; - struct route ro4, *ro; + struct nhop6_basic nh6; + struct nhop4_basic nh4; + struct sockaddr_in6 dst6; + struct sockaddr_in dst4; struct sockaddr *dst; - struct ifnet *ifp; struct ip6_hdr *ip6; struct ip *ip4; + struct ifnet *ifp; int error; ip4 = mtod(m, struct ip *); switch (ip4->ip_v) { case IPVERSION: - ro = &ro4; - dst = nat64_find_route4(&ro4, ip4->ip_dst.s_addr, m); - if (dst == NULL) + dst4.sin_addr = ip4->ip_dst; + error = nat64_find_route4(&nh4, &dst4, m); + if (error != 0) NAT64STAT_INC(stats, noroute4); + else { + ifp = nh4.nh_ifp; + dst = (struct sockaddr *)&dst4; + } break; case (IPV6_VERSION >> 4): - ip6 = (struct ip6_hdr *)ip4; - ro = (struct route *)&ro6; - dst = nat64_find_route6(&ro6, &ip6->ip6_dst, m); - if (dst == NULL) + ip6 = mtod(m, struct ip6_hdr *); + dst6.sin6_addr = ip6->ip6_dst; + error = nat64_find_route6(&nh6, &dst6, m); + if (error != 0) NAT64STAT_INC(stats, noroute6); + else { + ifp = nh6.nh_ifp; + dst = (struct sockaddr *)&dst6; + } break; default: m_freem(m); @@ -129,18 +142,15 @@ nat64_output_one(struct mbuf *m, nat64_stats_block *st DPRINTF(DP_DROPS, "dropped due to unknown IP version"); return (EAFNOSUPPORT); } - if (dst == NULL) { - FREE_ROUTE(ro); + if (error != 0) { m_freem(m); return (EHOSTUNREACH); } if (logdata != NULL) nat64_log(logdata, m, dst->sa_family); - ifp = ro->ro_rt->rt_ifp; - error = (*ifp->if_output)(ifp, m, dst, ro); + error = (*ifp->if_output)(ifp, m, dst, NULL); if (error != 0) NAT64STAT_INC(stats, oerrors); - FREE_ROUTE(ro); return (error); } #else /* !IPFIREWALL_NAT64_DIRECT_OUTPUT */ @@ -470,36 +480,31 @@ fail: return (ENOMEM); } -#if __FreeBSD_version < 1100000 -#define rt_expire rt_rmx.rmx_expire -#define rt_mtu rt_rmx.rmx_mtu -#endif -static NAT64NOINLINE struct sockaddr* -nat64_find_route6(struct route_in6 *ro, struct in6_addr *dest, struct mbuf *m) +static NAT64NOINLINE int +nat64_find_route6(struct nhop6_basic *pnh, struct sockaddr_in6 *dst, + struct mbuf *m) { - struct sockaddr_in6 *dst; - struct rtentry *rt; - bzero(ro, sizeof(*ro)); - dst = (struct sockaddr_in6 *)&ro->ro_dst; + if (fib6_lookup_nh_basic(M_GETFIB(m), &dst->sin6_addr, 0, 0, 0, + pnh) != 0) + return (EHOSTUNREACH); + if (pnh->nh_flags & (NHF_BLACKHOLE | NHF_REJECT)) + return (EHOSTUNREACH); + /* + * XXX: we need to use destination address with embedded scope + * zone id, because LLTABLE uses such form of addresses for lookup. + */ dst->sin6_family = AF_INET6; dst->sin6_len = sizeof(*dst); - dst->sin6_addr = *dest; - IN6_LOOKUP_ROUTE(ro, M_GETFIB(m)); - rt = ro->ro_rt; - if (rt && (rt->rt_flags & RTF_UP) && - (rt->rt_ifp->if_flags & IFF_UP) && - (rt->rt_ifp->if_drv_flags & IFF_DRV_RUNNING)) { - if (rt->rt_flags & RTF_GATEWAY) - dst = (struct sockaddr_in6 *)rt->rt_gateway; - } else - return (NULL); - if (((rt->rt_flags & RTF_REJECT) && - (rt->rt_expire == 0 || - time_uptime < rt->rt_expire)) || - rt->rt_ifp->if_link_state == LINK_STATE_DOWN) - return (NULL); - return ((struct sockaddr *)dst); + dst->sin6_addr = pnh->nh_addr; + if (IN6_IS_SCOPE_LINKLOCAL(&dst->sin6_addr)) + dst->sin6_addr.s6_addr16[1] = + htons(pnh->nh_ifp->if_index & 0xffff); + dst->sin6_port = 0; + dst->sin6_scope_id = 0; + dst->sin6_flowinfo = 0; + + return (0); } #define NAT64_ICMP6_PLEN 64 @@ -600,32 +605,21 @@ freeit: m_freem(m); } -static NAT64NOINLINE struct sockaddr* -nat64_find_route4(struct route *ro, in_addr_t dest, struct mbuf *m) +static NAT64NOINLINE int +nat64_find_route4(struct nhop4_basic *pnh, struct sockaddr_in *dst, + struct mbuf *m) { - struct sockaddr_in *dst; - struct rtentry *rt; - bzero(ro, sizeof(*ro)); - dst = (struct sockaddr_in *)&ro->ro_dst; + if (fib4_lookup_nh_basic(M_GETFIB(m), dst->sin_addr, 0, 0, pnh) != 0) + return (EHOSTUNREACH); + if (pnh->nh_flags & (NHF_BLACKHOLE | NHF_BROADCAST | NHF_REJECT)) + return (EHOSTUNREACH); + dst->sin_family = AF_INET; dst->sin_len = sizeof(*dst); - dst->sin_addr.s_addr = dest; - IN_LOOKUP_ROUTE(ro, M_GETFIB(m)); - rt = ro->ro_rt; - if (rt && (rt->rt_flags & RTF_UP) && - (rt->rt_ifp->if_flags & IFF_UP) && - (rt->rt_ifp->if_drv_flags & IFF_DRV_RUNNING)) { - if (rt->rt_flags & RTF_GATEWAY) - dst = (struct sockaddr_in *)rt->rt_gateway; - } else - return (NULL); - if (((rt->rt_flags & RTF_REJECT) && - (rt->rt_expire == 0 || - time_uptime < rt->rt_expire)) || - rt->rt_ifp->if_link_state == LINK_STATE_DOWN) - return (NULL); - return ((struct sockaddr *)dst); + dst->sin_addr = pnh->nh_addr; + dst->sin_port = 0; + return (0); } #define NAT64_ICMP_PLEN 64 @@ -1066,13 +1060,11 @@ nat64_do_handle_ip4(struct mbuf *m, struct in6_addr *s struct in6_addr *daddr, uint16_t lport, nat64_stats_block *stats, void *logdata) { - struct route_in6 ro; + struct nhop6_basic nh; struct ip6_hdr ip6; - struct ifnet *ifp; + struct sockaddr_in6 dst; struct ip *ip; struct mbufq mq; - struct sockaddr *dst; - uint32_t mtu; uint16_t ip_id, ip_off; uint16_t *csum; int plen, hlen; @@ -1110,23 +1102,17 @@ nat64_do_handle_ip4(struct mbuf *m, struct in6_addr *s return (NAT64MFREE); } - dst = nat64_find_route6(&ro, &ip6.ip6_dst, m); - if (dst == NULL) { - FREE_ROUTE(&ro); + dst.sin6_addr = ip6.ip6_dst; + if (nat64_find_route6(&nh, &dst, m) != 0) { NAT64STAT_INC(stats, noroute6); nat64_icmp_reflect(m, ICMP_UNREACH, ICMP_UNREACH_HOST, 0, stats, logdata); return (NAT64RETURN); } - ifp = ro.ro_rt->rt_ifp; - if (ro.ro_rt->rt_mtu != 0) - mtu = min(ro.ro_rt->rt_mtu, ifp->if_mtu); - else - mtu = ifp->if_mtu; - if (mtu < plen + sizeof(ip6) && (ip->ip_off & htons(IP_DF)) != 0) { - FREE_ROUTE(&ro); + if (nh.nh_mtu < plen + sizeof(ip6) && + (ip->ip_off & htons(IP_DF)) != 0) { nat64_icmp_reflect(m, ICMP_UNREACH, ICMP_UNREACH_NEEDFRAG, - FRAGSZ(mtu) + sizeof(struct ip), stats, logdata); + FRAGSZ(nh.nh_mtu) + sizeof(struct ip), stats, logdata); return (NAT64RETURN); } @@ -1162,24 +1148,20 @@ nat64_do_handle_ip4(struct mbuf *m, struct in6_addr *s break; case IPPROTO_ICMP: m = nat64_icmp_translate(m, &ip6, lport, hlen, stats); - if (m == NULL) { - FREE_ROUTE(&ro); - /* stats already accounted */ + if (m == NULL) /* stats already accounted */ return (NAT64RETURN); - } } m_adj(m, hlen); mbufq_init(&mq, 255); - nat64_fragment6(stats, &ip6, &mq, m, mtu, ip_id, ip_off); + nat64_fragment6(stats, &ip6, &mq, m, nh.nh_mtu, ip_id, ip_off); while ((m = mbufq_dequeue(&mq)) != NULL) { - if (nat64_output(ifp, m, dst, (struct route *)&ro, stats, - logdata) != 0) + if (nat64_output(nh.nh_ifp, m, (struct sockaddr *)&dst, + NULL, stats, logdata) != 0) break; NAT64STAT_INC(stats, opcnt46); } mbufq_drain(&mq); - FREE_ROUTE(&ro); return (NAT64RETURN); } @@ -1406,15 +1388,13 @@ int nat64_do_handle_ip6(struct mbuf *m, uint32_t aaddr, uint16_t aport, nat64_stats_block *stats, void *logdata) { - struct route ro; struct ip ip; - struct ifnet *ifp; + struct nhop4_basic nh; + struct sockaddr_in dst; struct ip6_frag *frag; struct ip6_hdr *ip6; struct icmp6_hdr *icmp6; - struct sockaddr *dst; uint16_t *csum; - uint32_t mtu; int plen, hlen, proto; /* @@ -1501,24 +1481,16 @@ nat64_do_handle_ip6(struct mbuf *m, uint32_t aaddr, ui return (nat64_handle_icmp6(m, hlen, aaddr, aport, stats, logdata)); } - dst = nat64_find_route4(&ro, ip.ip_dst.s_addr, m); - if (dst == NULL) { - FREE_ROUTE(&ro); + dst.sin_addr.s_addr = ip.ip_dst.s_addr; + if (nat64_find_route4(&nh, &dst, m) != 0) { NAT64STAT_INC(stats, noroute4); nat64_icmp6_reflect(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_NOROUTE, 0, stats, logdata); return (NAT64RETURN); } - - ifp = ro.ro_rt->rt_ifp; - if (ro.ro_rt->rt_mtu != 0) - mtu = min(ro.ro_rt->rt_mtu, ifp->if_mtu); - else - mtu = ifp->if_mtu; - if (mtu < plen + sizeof(ip)) { - FREE_ROUTE(&ro); - nat64_icmp6_reflect(m, ICMP6_PACKET_TOO_BIG, 0, mtu, stats, - logdata); + if (nh.nh_mtu < plen + sizeof(ip)) { + nat64_icmp6_reflect(m, ICMP6_PACKET_TOO_BIG, 0, nh.nh_mtu, + stats, logdata); return (NAT64RETURN); } nat64_init_ip4hdr(ip6, frag, plen, proto, &ip); @@ -1548,12 +1520,13 @@ nat64_do_handle_ip6(struct mbuf *m, uint32_t aaddr, ui *csum = cksum_add(*csum, in6_cksum_pseudo(ip6, plen, IPPROTO_ICMPV6, 0)); /* Convert ICMPv6 types to ICMP */ - mtu = *(uint16_t *)icmp6; /* save old word for cksum_adjust */ + proto = *(uint16_t *)icmp6; /* save old word for cksum_adjust */ if (icmp6->icmp6_type == ICMP6_ECHO_REQUEST) icmp6->icmp6_type = ICMP_ECHO; else /* ICMP6_ECHO_REPLY */ icmp6->icmp6_type = ICMP_ECHOREPLY; - *csum = cksum_adjust(*csum, (uint16_t)mtu, *(uint16_t *)icmp6); + *csum = cksum_adjust(*csum, (uint16_t)proto, + *(uint16_t *)icmp6); if (aport != 0) { uint16_t old_id = icmp6->icmp6_id; icmp6->icmp6_id = aport; @@ -1564,9 +1537,9 @@ nat64_do_handle_ip6(struct mbuf *m, uint32_t aaddr, ui m_adj(m, hlen - sizeof(ip)); bcopy(&ip, mtod(m, void *), sizeof(ip)); - if (nat64_output(ifp, m, dst, &ro, stats, logdata) == 0) + if (nat64_output(nh.nh_ifp, m, (struct sockaddr *)&dst, NULL, + stats, logdata) == 0) NAT64STAT_INC(stats, opcnt64); - FREE_ROUTE(&ro); return (NAT64RETURN); } Modified: head/sys/netpfil/ipfw/nat64/nat64_translate.h ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64_translate.h Thu Apr 12 20:48:17 2018 (r332455) +++ head/sys/netpfil/ipfw/nat64/nat64_translate.h Thu Apr 12 21:05:20 2018 (r332456) @@ -30,16 +30,6 @@ #ifndef _IP_FW_NAT64_TRANSLATE_H_ #define _IP_FW_NAT64_TRANSLATE_H_ -#ifdef RTALLOC_NOLOCK -#define IN_LOOKUP_ROUTE(ro, fib) rtalloc_fib_nolock((ro), 0, (fib)) -#define IN6_LOOKUP_ROUTE(ro, fib) in6_rtalloc_nolock((ro), (fib)) -#define FREE_ROUTE(ro) -#else -#define IN_LOOKUP_ROUTE(ro, fib) rtalloc_ign_fib((ro), 0, (fib)) -#define IN6_LOOKUP_ROUTE(ro, fib) in6_rtalloc((ro), (fib)) -#define FREE_ROUTE(ro) RO_RTFREE((ro)) -#endif - static inline int nat64_check_ip6(struct in6_addr *addr) { From owner-svn-src-head@freebsd.org Thu Apr 12 21:13:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DB9FBF91B5E; Thu, 12 Apr 2018 21:13:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6DC8B73FD9; Thu, 12 Apr 2018 21:13:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6597010A86; Thu, 12 Apr 2018 21:13:31 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CLDV1I057020; Thu, 12 Apr 2018 21:13:31 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CLDVuT057017; Thu, 12 Apr 2018 21:13:31 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201804122113.w3CLDVuT057017@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 12 Apr 2018 21:13:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332457 - head/sys/netpfil/ipfw/nat64 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 332457 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 21:13:32 -0000 Author: ae Date: Thu Apr 12 21:13:30 2018 New Revision: 332457 URL: https://svnweb.freebsd.org/changeset/base/332457 Log: Use cfg->nomatch_verdict as return value from NAT64LSN handler when given mbuf is considered as not matched. If mbuf was consumed or freed during handling, we must return IP_FW_DENY, since ipfw's pfil handler ipfw_check_packet() expects IP_FW_DENY when mbuf pointer is NULL. This fixes KASSERT panics when NAT64 is used with INVARIANTS. Also remove unused nomatch_final field from struct nat64lsn_cfg. Reported by: Justin Holcomb Obtained from: Yandex LLC MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.c head/sys/netpfil/ipfw/nat64/nat64lsn.h head/sys/netpfil/ipfw/nat64/nat64lsn_control.c Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn.c Thu Apr 12 21:05:20 2018 (r332456) +++ head/sys/netpfil/ipfw/nat64/nat64lsn.c Thu Apr 12 21:13:30 2018 (r332457) @@ -351,10 +351,11 @@ nat64lsn_translate4(struct nat64lsn_cfg *cfg, const st if (nat_proto == NAT_PROTO_ICMP) { ret = inspect_icmp_mbuf(pm, &nat_proto, &addr, &port); if (ret != 0) { - if (ret == ENOMEM) + if (ret == ENOMEM) { NAT64STAT_INC(&cfg->stats, nomem); - else - NAT64STAT_INC(&cfg->stats, noproto); + return (IP_FW_DENY); + } + NAT64STAT_INC(&cfg->stats, noproto); return (cfg->nomatch_verdict); } /* XXX: Check addr for validity */ @@ -416,7 +417,7 @@ nat64lsn_translate4(struct nat64lsn_cfg *cfg, const st &cfg->stats, logdata); if (ret == NAT64SKIP) - return (IP_FW_PASS); + return (cfg->nomatch_verdict); if (ret == NAT64MFREE) m_freem(*pm); *pm = NULL; @@ -1362,7 +1363,7 @@ nat64lsn_request_host(struct nat64lsn_cfg *cfg, NAT64STAT_INC(&cfg->stats, jhostsreq); } - return (IP_FW_PASS); + return (IP_FW_DENY); } static NAT64NOINLINE int @@ -1391,7 +1392,7 @@ nat64lsn_request_portgroup(struct nat64lsn_cfg *cfg, NAT64STAT_INC(&cfg->stats, jportreq); } - return (IP_FW_PASS); + return (IP_FW_DENY); } static NAT64NOINLINE struct nat64lsn_state * @@ -1595,7 +1596,7 @@ nat64lsn_translate6(struct nat64lsn_cfg *cfg, struct i action = nat64_do_handle_ip6(*pm, aaddr, aport, &cfg->stats, logdata); if (action == NAT64SKIP) - return (IP_FW_PASS); + return (cfg->nomatch_verdict); if (action == NAT64MFREE) m_freem(*pm); *pm = NULL; /* mark mbuf as consumed */ @@ -1631,7 +1632,7 @@ ipfw_nat64lsn(struct ip_fw_chain *ch, struct ip_fw_arg ret = nat64lsn_translate6(cfg, &args->f_id, &args->m); break; default: - return (0); + return (cfg->nomatch_verdict); } return (ret); } Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.h ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn.h Thu Apr 12 21:05:20 2018 (r332456) +++ head/sys/netpfil/ipfw/nat64/nat64lsn.h Thu Apr 12 21:13:30 2018 (r332457) @@ -199,7 +199,6 @@ struct nat64lsn_cfg { uint8_t plen4; uint8_t plen6; uint8_t nomatch_verdict;/* What to return to ipfw on no-match */ - uint8_t nomatch_final; /* Exit outer loop? */ struct in6_addr prefix6; /* IPv6 prefix to embed IPv4 hosts */ uint32_t ihcount; /* Number of items in host hash */ Modified: head/sys/netpfil/ipfw/nat64/nat64lsn_control.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn_control.c Thu Apr 12 21:05:20 2018 (r332456) +++ head/sys/netpfil/ipfw/nat64/nat64lsn_control.c Thu Apr 12 21:13:30 2018 (r332457) @@ -190,7 +190,6 @@ nat64lsn_create(struct ip_fw_chain *ch, ip_fw3_opheade cfg->st_icmp_ttl = uc->st_icmp_ttl; cfg->nomatch_verdict = IP_FW_DENY; - cfg->nomatch_final = 1; /* Exit outer loop by default */ IPFW_UH_WLOCK(ch); From owner-svn-src-head@freebsd.org Thu Apr 12 21:16:37 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F2F19F91EB6; Thu, 12 Apr 2018 21:16:36 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.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 4F37974D05; Thu, 12 Apr 2018 21:16:35 +0000 (UTC) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: from pdx.rh.CN85.dnsmgr.net (localhost [127.0.0.1]) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3) with ESMTP id w3CLGXg3034313; Thu, 12 Apr 2018 14:16:33 -0700 (PDT) (envelope-from freebsd@pdx.rh.CN85.dnsmgr.net) Received: (from freebsd@localhost) by pdx.rh.CN85.dnsmgr.net (8.13.3/8.13.3/Submit) id w3CLGXeG034312; Thu, 12 Apr 2018 14:16:33 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201804122116.w3CLGXeG034312@pdx.rh.CN85.dnsmgr.net> Subject: Re: svn commit: r332453 - in head: share/mk sys/conf In-Reply-To: <201804122027.w3CKRwVX032153@repo.freebsd.org> To: Bryan Drewery Date: Thu, 12 Apr 2018 14:16:33 -0700 (PDT) CC: 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-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 21:16:37 -0000 > Author: bdrewery > Date: Thu Apr 12 20:27:57 2018 > New Revision: 332453 > URL: https://svnweb.freebsd.org/changeset/base/332453 > > Log: > Fix using wrong SYSDIR after r331683. > > This was inadvertently overriding the first found SYSDIR with the last > of /usr/src which could result in the wrong headers being used if not > building from /usr/src. > > SYSDIR?= is not used here to avoid evaluating the exists() when unneeded. > > Reported by: rgrimes, sjg, Mark Millard > Pointyhat to: bdrewery > Sponsored by: Dell EMC > Thank you for following through with a fix! > Modified: > head/share/mk/bsd.dtb.mk > head/share/mk/bsd.kmod.mk > head/sys/conf/kmod.mk ... -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Thu Apr 12 21:21:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 43BF0F92384; Thu, 12 Apr 2018 21:21:19 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E9C0876BF8; Thu, 12 Apr 2018 21:21:18 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4C1C10AC8; Thu, 12 Apr 2018 21:21:18 +0000 (UTC) (envelope-from ken@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CLLIB8058789; Thu, 12 Apr 2018 21:21:18 GMT (envelope-from ken@FreeBSD.org) Received: (from ken@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CLLIVl058788; Thu, 12 Apr 2018 21:21:18 GMT (envelope-from ken@FreeBSD.org) Message-Id: <201804122121.w3CLLIVl058788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ken set sender to ken@FreeBSD.org using -f From: "Kenneth D. Merry" Date: Thu, 12 Apr 2018 21:21:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332458 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: ken X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 332458 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 21:21:19 -0000 Author: ken Date: Thu Apr 12 21:21:18 2018 New Revision: 332458 URL: https://svnweb.freebsd.org/changeset/base/332458 Log: Handle Programmable Early Warning for control commands in sa(4). When the tape position is inside the Early Warning area, the tape drive will return a sense key of NO SENSE, and an ASC/ASCQ of 0x00,0x02, which means: End-of-partition/medium detected". If this was in response to a control command like WRITE FILEMARKS, we correctly translate this as informational status and return 0 from saerror(). Programmable Early Warning should be handled the same way, but we weren't handling it that way. As a result, if a PEW status (sense key of NO SENSE, ASC/ASCQ of 0x00,0x07, "Programmable early warning detected") came back in response to a WRITE FILEMARKS, we returned an error. The impact of this was that if an application was writing to a sa(4) device, and a PEW area was set (in the Device Configuration Extension subpage -- mode page 0x10, subpage 1), and a filemark needed to be written on close, we could wind up returning an error to the user on close because of a "failure" to write the filemarks. It actually isn't a failure, but rather just a status report from the drive, and shouldn't be treated as a failure. sys/cam/scsi/scsi_sa.c: For control commands in saerror(), treat asc/ascq 0x00,0x07 the same as 0x00,{0-5} -- not an error. Return 0, since the command actually did succeed. Reported by: Dr. Andreas Haakh Tested by: Dr. Andreas Haakh Sponsored by: Spectra Logic MFC after: 3 days Modified: head/sys/cam/scsi/scsi_sa.c Modified: head/sys/cam/scsi/scsi_sa.c ============================================================================== --- head/sys/cam/scsi/scsi_sa.c Thu Apr 12 21:13:30 2018 (r332457) +++ head/sys/cam/scsi/scsi_sa.c Thu Apr 12 21:21:18 2018 (r332458) @@ -3453,12 +3453,13 @@ saerror(union ccb *ccb, u_int32_t cflgs, u_int32_t sfl break; } /* - * If this was just EOM/EOP, Filemark, Setmark or ILI detected - * on a non read/write command, we assume it's not an error - * and propagate the residule and return. + * If this was just EOM/EOP, Filemark, Setmark, ILI or + * PEW detected on a non read/write command, we assume + * it's not an error and propagate the residual and return. */ - if ((aqvalid && asc == 0 && ascq > 0 && ascq <= 5) || - (aqvalid == 0 && sense_key == SSD_KEY_NO_SENSE)) { + if ((aqvalid && asc == 0 && ((ascq > 0 && ascq <= 5) + || (ascq == 0x07))) + || (aqvalid == 0 && sense_key == SSD_KEY_NO_SENSE)) { csio->resid = resid; QFRLS(ccb); return (0); From owner-svn-src-head@freebsd.org Thu Apr 12 21:29:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BF6C0F92B1F; Thu, 12 Apr 2018 21:29:41 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 6E74079745; Thu, 12 Apr 2018 21:29:41 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 64D4610C31; Thu, 12 Apr 2018 21:29:41 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3CLTfva061963; Thu, 12 Apr 2018 21:29:41 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3CLTfVM061961; Thu, 12 Apr 2018 21:29:41 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201804122129.w3CLTfVM061961@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Thu, 12 Apr 2018 21:29:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332459 - head/sys/netpfil/ipfw/nat64 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 332459 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 12 Apr 2018 21:29:41 -0000 Author: ae Date: Thu Apr 12 21:29:40 2018 New Revision: 332459 URL: https://svnweb.freebsd.org/changeset/base/332459 Log: Fix integer types mismatch for flags field in nat64stl_cfg structure. Also preserve internal flags on NAT64STL reconfiguration. Obtained from: Yandex LLC MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sys/netpfil/ipfw/nat64/nat64stl.h head/sys/netpfil/ipfw/nat64/nat64stl_control.c Modified: head/sys/netpfil/ipfw/nat64/nat64stl.h ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64stl.h Thu Apr 12 21:21:18 2018 (r332458) +++ head/sys/netpfil/ipfw/nat64/nat64stl.h Thu Apr 12 21:29:40 2018 (r332459) @@ -38,7 +38,7 @@ struct nat64stl_cfg { struct in6_addr prefix6;/* IPv6 prefix */ uint8_t plen6; /* prefix length */ - uint8_t flags; /* flags for internal use */ + uint32_t flags; /* flags for internal use */ #define NAT64STL_KIDX 0x0100 #define NAT64STL_46T 0x0200 #define NAT64STL_64T 0x0400 Modified: head/sys/netpfil/ipfw/nat64/nat64stl_control.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64stl_control.c Thu Apr 12 21:21:18 2018 (r332458) +++ head/sys/netpfil/ipfw/nat64/nat64stl_control.c Thu Apr 12 21:29:40 2018 (r332459) @@ -289,8 +289,8 @@ nat64stl_config(struct ip_fw_chain *ch, ip_fw3_opheade * For now allow to change only following values: * flags. */ - - cfg->flags = uc->flags & NAT64STL_FLAGSMASK; + cfg->flags &= ~NAT64STL_FLAGSMASK; + cfg->flags |= uc->flags & NAT64STL_FLAGSMASK; IPFW_UH_WUNLOCK(ch); return (0); } From owner-svn-src-head@freebsd.org Fri Apr 13 09:04:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 02976F9C986; Fri, 13 Apr 2018 09:04:32 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A7AA481C46; Fri, 13 Apr 2018 09:04:31 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A1FBA17B92; Fri, 13 Apr 2018 09:04:31 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3D94VdR008907; Fri, 13 Apr 2018 09:04:31 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3D94V1p008905; Fri, 13 Apr 2018 09:04:31 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201804130904.w3D94V1p008905@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 13 Apr 2018 09:04:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332466 - in head: . usr.bin/mandoc X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: in head: . usr.bin/mandoc X-SVN-Commit-Revision: 332466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 09:04:32 -0000 Author: bapt Date: Fri Apr 13 09:04:31 2018 New Revision: 332466 URL: https://svnweb.freebsd.org/changeset/base/332466 Log: reinstall the roff(7) manpage When we had both groff and mandoc in base, we decided to keep the roff(7) manpage from groff. when remoing groff, we forgot to install the mandoc version instead. This fixes it. Reported by: trasz MFC after: 1 week Modified: head/ObsoleteFiles.inc head/usr.bin/mandoc/Makefile Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Fri Apr 13 03:47:41 2018 (r332465) +++ head/ObsoleteFiles.inc Fri Apr 13 09:04:31 2018 (r332466) @@ -1070,7 +1070,6 @@ OLD_FILES+=usr/share/man/man7/mm.7.gz OLD_FILES+=usr/share/man/man7/mmse.7.gz OLD_FILES+=usr/share/man/man7/ms.7.gz OLD_FILES+=usr/share/man/man7/orig_me.7.gz -OLD_FILES+=usr/share/man/man7/roff.7.gz OLD_FILES+=usr/share/me/acm.me OLD_FILES+=usr/share/me/chars.me OLD_FILES+=usr/share/me/deltext.me Modified: head/usr.bin/mandoc/Makefile ============================================================================== --- head/usr.bin/mandoc/Makefile Fri Apr 13 03:47:41 2018 (r332465) +++ head/usr.bin/mandoc/Makefile Fri Apr 13 09:04:31 2018 (r332466) @@ -6,7 +6,7 @@ MDOCMLDIR= ${SRCTOP}/contrib/mdocml .PATH: ${MDOCMLDIR} PROG= mandoc -MAN= mandoc.1 eqn.7 mandoc_char.7 tbl.7 man.7 mdoc.7 # roff.7 +MAN= mandoc.1 eqn.7 mandoc_char.7 tbl.7 man.7 mdoc.7 roff.7 MLINKS= mandoc.1 mdocml.1 .if ${MK_MAN_UTILS} != no MAN+= apropos.1 makewhatis.8 From owner-svn-src-head@freebsd.org Fri Apr 13 10:03:30 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id CD48FFA0EA6; Fri, 13 Apr 2018 10:03:30 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7FBBA6FA1E; Fri, 13 Apr 2018 10:03:30 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AAC31853D; Fri, 13 Apr 2018 10:03:30 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3DA3UCD040395; Fri, 13 Apr 2018 10:03:30 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DA3ULq040394; Fri, 13 Apr 2018 10:03:30 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201804131003.w3DA3ULq040394@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 13 Apr 2018 10:03:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332467 - head/sys/netpfil/ipfw/nat64 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netpfil/ipfw/nat64 X-SVN-Commit-Revision: 332467 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 10:03:31 -0000 Author: ae Date: Fri Apr 13 10:03:30 2018 New Revision: 332467 URL: https://svnweb.freebsd.org/changeset/base/332467 Log: To avoid possible deadlock do not acquire JQUEUE_LOCK before callout_drain. Obtained from: Yandex LLC MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.c Modified: head/sys/netpfil/ipfw/nat64/nat64lsn.c ============================================================================== --- head/sys/netpfil/ipfw/nat64/nat64lsn.c Fri Apr 13 09:04:31 2018 (r332466) +++ head/sys/netpfil/ipfw/nat64/nat64lsn.c Fri Apr 13 10:03:30 2018 (r332467) @@ -1755,10 +1755,7 @@ nat64lsn_destroy_instance(struct nat64lsn_cfg *cfg) { struct nat64lsn_host *nh, *tmp; - JQUEUE_LOCK(); callout_drain(&cfg->jcallout); - JQUEUE_UNLOCK(); - callout_drain(&cfg->periodic); I6HASH_FOREACH_SAFE(cfg, nh, tmp, nat64lsn_destroy_host, cfg); DPRINTF(DP_OBJ, "instance %s: hosts %d", cfg->name, cfg->ihcount); From owner-svn-src-head@freebsd.org Fri Apr 13 12:41:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 2C0EAF85B52; Fri, 13 Apr 2018 12:41:52 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D10F375A43; Fri, 13 Apr 2018 12:41:51 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC13919E5A; Fri, 13 Apr 2018 12:41:51 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3DCfpEc019615; Fri, 13 Apr 2018 12:41:51 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DCfpa0019612; Fri, 13 Apr 2018 12:41:51 GMT (envelope-from br@FreeBSD.org) Message-Id: <201804131241.w3DCfpa0019612@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 13 Apr 2018 12:41:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332468 - head/sys/dev/xdma X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/dev/xdma X-SVN-Commit-Revision: 332468 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 12:41:52 -0000 Author: br Date: Fri Apr 13 12:41:51 2018 New Revision: 332468 URL: https://svnweb.freebsd.org/changeset/base/332468 Log: Don't include sys/bus_dma.h directly, use machine/bus.h instead. Sponsored by: DARPA, AFRL Modified: head/sys/dev/xdma/xdma_queue.c head/sys/dev/xdma/xdma_sg.c head/sys/dev/xdma/xdma_sglist.c Modified: head/sys/dev/xdma/xdma_queue.c ============================================================================== --- head/sys/dev/xdma/xdma_queue.c Fri Apr 13 10:03:30 2018 (r332467) +++ head/sys/dev/xdma/xdma_queue.c Fri Apr 13 12:41:51 2018 (r332468) @@ -37,8 +37,9 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include + +#include #include Modified: head/sys/dev/xdma/xdma_sg.c ============================================================================== --- head/sys/dev/xdma/xdma_sg.c Fri Apr 13 10:03:30 2018 (r332467) +++ head/sys/dev/xdma/xdma_sg.c Fri Apr 13 12:41:51 2018 (r332468) @@ -38,7 +38,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #include #include Modified: head/sys/dev/xdma/xdma_sglist.c ============================================================================== --- head/sys/dev/xdma/xdma_sglist.c Fri Apr 13 10:03:30 2018 (r332467) +++ head/sys/dev/xdma/xdma_sglist.c Fri Apr 13 12:41:51 2018 (r332468) @@ -37,7 +37,8 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include + +#include #include From owner-svn-src-head@freebsd.org Fri Apr 13 12:43:55 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 1851EF85DBF; Fri, 13 Apr 2018 12:43:55 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id C1A9375C94; Fri, 13 Apr 2018 12:43:54 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC5E919E8F; Fri, 13 Apr 2018 12:43:54 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3DChso6019722; Fri, 13 Apr 2018 12:43:54 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DChsQU019719; Fri, 13 Apr 2018 12:43:54 GMT (envelope-from br@FreeBSD.org) Message-Id: <201804131243.w3DChsQU019719@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 13 Apr 2018 12:43:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332469 - in head/sys: conf dev/xdma/controller X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: conf dev/xdma/controller X-SVN-Commit-Revision: 332469 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 12:43:55 -0000 Author: br Date: Fri Apr 13 12:43:54 2018 New Revision: 332469 URL: https://svnweb.freebsd.org/changeset/base/332469 Log: Add driver for ARM PrimeCell PL330 DMA engine. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D10201 Added: head/sys/dev/xdma/controller/ head/sys/dev/xdma/controller/pl330.c (contents, props changed) head/sys/dev/xdma/controller/pl330.h (contents, props changed) Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Apr 13 12:41:51 2018 (r332468) +++ head/sys/conf/files Fri Apr 13 12:43:54 2018 (r332469) @@ -3510,6 +3510,7 @@ wpi.fw optional wpifw \ compile-with "${NORMAL_FW}" \ no-obj no-implicit-rule \ clean "wpi.fw" +dev/xdma/controller/pl330.c optional xdma pl330 dev/xdma/xdma.c optional xdma dev/xdma/xdma_bank.c optional xdma dev/xdma/xdma_bio.c optional xdma Added: head/sys/dev/xdma/controller/pl330.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/xdma/controller/pl330.c Fri Apr 13 12:43:54 2018 (r332469) @@ -0,0 +1,663 @@ +/*- + * Copyright (c) 2017-2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* ARM PrimeCell DMA Controller (PL330) driver. */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#ifdef FDT +#include +#include +#include +#endif + +#include +#include + +#include "xdma_if.h" + +#define PL330_DEBUG +#undef PL330_DEBUG + +#ifdef PL330_DEBUG +#define dprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) +#else +#define dprintf(fmt, ...) +#endif + +#define READ4(_sc, _reg) \ + bus_read_4(_sc->res[0], _reg) +#define WRITE4(_sc, _reg, _val) \ + bus_write_4(_sc->res[0], _reg, _val) + +#define PL330_NCHANNELS 32 +#define PL330_MAXLOAD 2048 + +struct pl330_channel { + struct pl330_softc *sc; + xdma_channel_t *xchan; + int used; + int index; + uint8_t *ibuf; + bus_addr_t ibuf_phys; + uint32_t enqueued; + uint32_t capacity; +}; + +struct pl330_fdt_data { + uint32_t periph_id; +}; + +struct pl330_softc { + device_t dev; + struct resource *res[PL330_NCHANNELS + 1]; + void *ih[PL330_NCHANNELS]; + struct pl330_channel channels[PL330_NCHANNELS]; +}; + +static struct resource_spec pl330_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 1, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 2, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 3, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 4, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 5, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 6, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 7, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 8, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 9, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 10, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 11, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 12, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 13, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 14, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 15, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 16, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 17, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 18, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 19, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 20, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 21, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 22, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 23, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 24, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 25, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 26, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 27, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 28, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 29, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 30, RF_ACTIVE | RF_OPTIONAL }, + { SYS_RES_IRQ, 31, RF_ACTIVE | RF_OPTIONAL }, + { -1, 0 } +}; + +#define HWTYPE_NONE 0 +#define HWTYPE_STD 1 + +static struct ofw_compat_data compat_data[] = { + { "arm,pl330", HWTYPE_STD }, + { NULL, HWTYPE_NONE }, +}; + +static void +pl330_intr(void *arg) +{ + xdma_transfer_status_t status; + struct xdma_transfer_status st; + struct pl330_channel *chan; + struct xdma_channel *xchan; + struct pl330_softc *sc; + uint32_t pending; + int i; + int c; + + sc = arg; + + pending = READ4(sc, INTMIS); + + dprintf("%s: 0x%x, LC0 %x, SAR %x DAR %x\n", + __func__, pending, READ4(sc, LC0(0)), + READ4(sc, SAR(0)), READ4(sc, DAR(0))); + + WRITE4(sc, INTCLR, pending); + + for (c = 0; c < PL330_NCHANNELS; c++) { + if ((pending & (1 << c)) == 0) { + continue; + } + chan = &sc->channels[c]; + xchan = chan->xchan; + st.error = 0; + st.transferred = 0; + for (i = 0; i < chan->enqueued; i++) { + xchan_seg_done(xchan, &st); + } + + /* Accept new requests. */ + chan->capacity = PL330_MAXLOAD; + + /* Finish operation */ + status.error = 0; + status.transferred = 0; + xdma_callback(chan->xchan, &status); + } +} + +static uint32_t +emit_mov(uint8_t *buf, uint32_t reg, uint32_t val) +{ + + buf[0] = DMAMOV; + buf[1] = reg; + buf[2] = val; + buf[3] = val >> 8; + buf[4] = val >> 16; + buf[5] = val >> 24; + + return (6); +} + +static uint32_t +emit_lp(uint8_t *buf, uint8_t idx, uint32_t iter) +{ + + if (idx > 1) + return (0); /* We have two loops only. */ + + buf[0] = DMALP; + buf[0] |= (idx << 1); + buf[1] = (iter - 1) & 0xff; + + return (2); +} + +static uint32_t +emit_lpend(uint8_t *buf, uint8_t idx, + uint8_t burst, uint8_t jump_addr_relative) +{ + + buf[0] = DMALPEND; + buf[0] |= DMALPEND_NF; + buf[0] |= (idx << 2); + if (burst) + buf[0] |= (1 << 1) | (1 << 0); + else + buf[0] |= (0 << 1) | (1 << 0); + buf[1] = jump_addr_relative; + + return (2); +} + +static uint32_t +emit_ld(uint8_t *buf, uint8_t burst) +{ + + buf[0] = DMALD; + if (burst) + buf[0] |= (1 << 1) | (1 << 0); + else + buf[0] |= (0 << 1) | (1 << 0); + + return (1); +} + +static uint32_t +emit_st(uint8_t *buf, uint8_t burst) +{ + + buf[0] = DMAST; + if (burst) + buf[0] |= (1 << 1) | (1 << 0); + else + buf[0] |= (0 << 1) | (1 << 0); + + return (1); +} + +static uint32_t +emit_end(uint8_t *buf) +{ + + buf[0] = DMAEND; + + return (1); +} + +static uint32_t +emit_sev(uint8_t *buf, uint32_t ev) +{ + + buf[0] = DMASEV; + buf[1] = (ev << 3); + + return (2); +} + +static uint32_t +emit_wfp(uint8_t *buf, uint32_t p_id) +{ + + buf[0] = DMAWFP; + buf[0] |= (1 << 0); + buf[1] = (p_id << 3); + + return (2); +} + +static uint32_t +emit_go(uint8_t *buf, uint32_t chan_id, + uint32_t addr, uint8_t non_secure) +{ + + buf[0] = DMAGO; + buf[0] |= (non_secure << 1); + + buf[1] = chan_id; + buf[2] = addr; + buf[3] = addr >> 8; + buf[4] = addr >> 16; + buf[5] = addr >> 24; + + return (6); +} + +static int +pl330_probe(device_t dev) +{ + int hwtype; + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + if (hwtype == HWTYPE_NONE) + return (ENXIO); + + device_set_desc(dev, "ARM PrimeCell DMA Controller (PL330)"); + + return (BUS_PROBE_DEFAULT); +} + +static int +pl330_attach(device_t dev) +{ + struct pl330_softc *sc; + phandle_t xref, node; + int err; + int i; + + sc = device_get_softc(dev); + sc->dev = dev; + + if (bus_alloc_resources(dev, pl330_spec, sc->res)) { + device_printf(dev, "could not allocate resources for device\n"); + return (ENXIO); + } + + /* Setup interrupt handler */ + for (i = 0; i < PL330_NCHANNELS; i++) { + if (sc->res[i + 1] == NULL) + break; + err = bus_setup_intr(dev, sc->res[i + 1], INTR_TYPE_MISC | INTR_MPSAFE, + NULL, pl330_intr, sc, sc->ih[i]); + if (err) { + device_printf(dev, "Unable to alloc interrupt resource.\n"); + return (ENXIO); + } + } + + node = ofw_bus_get_node(dev); + xref = OF_xref_from_node(node); + OF_device_register_xref(xref, dev); + + return (0); +} + +static int +pl330_detach(device_t dev) +{ + struct pl330_softc *sc; + + sc = device_get_softc(dev); + + return (0); +} + +static int +pl330_channel_alloc(device_t dev, struct xdma_channel *xchan) +{ + struct pl330_channel *chan; + struct pl330_softc *sc; + int i; + + sc = device_get_softc(dev); + + for (i = 0; i < PL330_NCHANNELS; i++) { + chan = &sc->channels[i]; + if (chan->used == 0) { + chan->xchan = xchan; + xchan->chan = (void *)chan; + xchan->caps |= XCHAN_CAP_BUSDMA; + chan->index = i; + chan->sc = sc; + chan->used = 1; + + chan->ibuf = (void *)kmem_alloc_contig(kernel_arena, + PAGE_SIZE*8, M_ZERO, 0, ~0, PAGE_SIZE, 0, + VM_MEMATTR_UNCACHEABLE); + chan->ibuf_phys = vtophys(chan->ibuf); + + return (0); + } + } + + return (-1); +} + +static int +pl330_channel_free(device_t dev, struct xdma_channel *xchan) +{ + struct pl330_channel *chan; + struct pl330_softc *sc; + + sc = device_get_softc(dev); + + chan = (struct pl330_channel *)xchan->chan; + chan->used = 0; + + return (0); +} + +static int +pl330_channel_capacity(device_t dev, xdma_channel_t *xchan, + uint32_t *capacity) +{ + struct pl330_channel *chan; + + chan = (struct pl330_channel *)xchan->chan; + + *capacity = chan->capacity; + + return (0); +} + +static int +pl330_ccr_port_width(struct xdma_sglist *sg, uint32_t *addr) +{ + uint32_t reg; + + reg = 0; + + switch (sg->src_width) { + case 1: + reg |= CCR_SRC_BURST_SIZE_1; + break; + case 2: + reg |= CCR_SRC_BURST_SIZE_2; + break; + case 4: + reg |= CCR_SRC_BURST_SIZE_4; + break; + default: + return (-1); + } + + switch (sg->dst_width) { + case 1: + reg |= CCR_DST_BURST_SIZE_1; + break; + case 2: + reg |= CCR_DST_BURST_SIZE_2; + break; + case 4: + reg |= CCR_DST_BURST_SIZE_4; + break; + default: + return (-1); + } + + *addr |= reg; + + return (0); +} + +static int +pl330_channel_submit_sg(device_t dev, struct xdma_channel *xchan, + struct xdma_sglist *sg, uint32_t sg_n) +{ + struct pl330_fdt_data *data; + xdma_controller_t *xdma; + struct pl330_channel *chan; + struct pl330_softc *sc; + uint32_t src_addr_lo; + uint32_t dst_addr_lo; + uint32_t len; + uint32_t reg; + uint32_t offs; + uint32_t cnt; + uint8_t *ibuf; + uint8_t dbuf[6]; + uint8_t offs0, offs1; + int err; + int i; + + sc = device_get_softc(dev); + + xdma = xchan->xdma; + data = (struct pl330_fdt_data *)xdma->data; + + chan = (struct pl330_channel *)xchan->chan; + ibuf = chan->ibuf; + + dprintf("%s: chan->index %d\n", __func__, chan->index); + + offs = 0; + + for (i = 0; i < sg_n; i++) { + if (sg[i].direction == XDMA_DEV_TO_MEM) + reg = CCR_DST_INC; + else { + reg = CCR_SRC_INC; + reg |= (CCR_DST_PROT_PRIV); + } + + err = pl330_ccr_port_width(&sg[i], ®); + if (err != 0) + return (err); + + offs += emit_mov(&chan->ibuf[offs], R_CCR, reg); + + src_addr_lo = (uint32_t)sg[i].src_addr; + dst_addr_lo = (uint32_t)sg[i].dst_addr; + len = (uint32_t)sg[i].len; + + dprintf("%s: src %x dst %x len %d periph_id %d\n", __func__, + src_addr_lo, dst_addr_lo, len, data->periph_id); + + offs += emit_mov(&ibuf[offs], R_SAR, src_addr_lo); + offs += emit_mov(&ibuf[offs], R_DAR, dst_addr_lo); + + if (sg[i].src_width != sg[i].dst_width) + return (-1); /* Not supported. */ + + cnt = (len / sg[i].src_width); + if (cnt > 128) { + offs += emit_lp(&ibuf[offs], 0, cnt / 128); + offs0 = offs; + offs += emit_lp(&ibuf[offs], 1, 128); + offs1 = offs; + } else { + offs += emit_lp(&ibuf[offs], 0, cnt); + offs0 = offs; + } + offs += emit_wfp(&ibuf[offs], data->periph_id); + offs += emit_ld(&ibuf[offs], 1); + offs += emit_st(&ibuf[offs], 1); + + if (cnt > 128) + offs += emit_lpend(&ibuf[offs], 1, 1, (offs - offs1)); + + offs += emit_lpend(&ibuf[offs], 0, 1, (offs - offs0)); + } + + offs += emit_sev(&ibuf[offs], chan->index); + offs += emit_end(&ibuf[offs]); + + emit_go(dbuf, chan->index, chan->ibuf_phys, 0); + + reg = (dbuf[1] << 24) | (dbuf[0] << 16); + WRITE4(sc, DBGINST0, reg); + reg = (dbuf[5] << 24) | (dbuf[4] << 16) | (dbuf[3] << 8) | dbuf[2]; + WRITE4(sc, DBGINST1, reg); + + WRITE4(sc, INTCLR, 0xffffffff); + WRITE4(sc, INTEN, (1 << chan->index)); + + chan->enqueued = sg_n; + chan->capacity = 0; + + /* Start operation */ + WRITE4(sc, DBGCMD, 0); + + return (0); +} + +static int +pl330_channel_prep_sg(device_t dev, struct xdma_channel *xchan) +{ + struct pl330_channel *chan; + struct pl330_softc *sc; + + sc = device_get_softc(dev); + + dprintf("%s(%d)\n", __func__, device_get_unit(dev)); + + chan = (struct pl330_channel *)xchan->chan; + chan->capacity = PL330_MAXLOAD; + + return (0); +} + +static int +pl330_channel_control(device_t dev, xdma_channel_t *xchan, int cmd) +{ + struct pl330_channel *chan; + struct pl330_softc *sc; + + sc = device_get_softc(dev); + + chan = (struct pl330_channel *)xchan->chan; + + switch (cmd) { + case XDMA_CMD_BEGIN: + case XDMA_CMD_TERMINATE: + case XDMA_CMD_PAUSE: + /* TODO: implement me */ + return (-1); + } + + return (0); +} + +#ifdef FDT +static int +pl330_ofw_md_data(device_t dev, pcell_t *cells, int ncells, void **ptr) +{ + struct pl330_fdt_data *data; + + if (ncells != 1) + return (-1); + + data = malloc(sizeof(struct pl330_fdt_data), + M_DEVBUF, (M_WAITOK | M_ZERO)); + data->periph_id = cells[0]; + + *ptr = data; + + return (0); +} +#endif + +static device_method_t pl330_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, pl330_probe), + DEVMETHOD(device_attach, pl330_attach), + DEVMETHOD(device_detach, pl330_detach), + + /* xDMA Interface */ + DEVMETHOD(xdma_channel_alloc, pl330_channel_alloc), + DEVMETHOD(xdma_channel_free, pl330_channel_free), + DEVMETHOD(xdma_channel_control, pl330_channel_control), + + /* xDMA SG Interface */ + DEVMETHOD(xdma_channel_capacity, pl330_channel_capacity), + DEVMETHOD(xdma_channel_prep_sg, pl330_channel_prep_sg), + DEVMETHOD(xdma_channel_submit_sg, pl330_channel_submit_sg), + +#ifdef FDT + DEVMETHOD(xdma_ofw_md_data, pl330_ofw_md_data), +#endif + + DEVMETHOD_END +}; + +static driver_t pl330_driver = { + "pl330", + pl330_methods, + sizeof(struct pl330_softc), +}; + +static devclass_t pl330_devclass; + +EARLY_DRIVER_MODULE(pl330, simplebus, pl330_driver, pl330_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); Added: head/sys/dev/xdma/controller/pl330.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/xdma/controller/pl330.h Fri Apr 13 12:43:54 2018 (r332469) @@ -0,0 +1,115 @@ +/*- + * Copyright (c) 2017-2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _DEV_XDMA_CONTROLLER_PL330_H_ +#define _DEV_XDMA_CONTROLLER_PL330_H_ + +/* pl330 registers */ +#define DSR 0x000 /* DMA Manager Status */ +#define DPC 0x004 /* DMA Program Counter */ +#define INTEN 0x020 /* Interrupt Enable */ +#define INT_EVENT_RIS 0x024 /* Event-Interrupt Raw Status */ +#define INTMIS 0x028 /* Interrupt Status */ +#define INTCLR 0x02C /* Interrupt Clear */ +#define FSRD 0x030 /* Fault Status DMA Manager */ +#define FSRC 0x034 /* Fault Status DMA Channel */ +#define FTRD 0x038 /* Fault Type DMA Manager */ +#define FTR(n) (0x040 + 0x04 * (n)) /* Fault type for DMA channel n */ +#define CSR(n) (0x100 + 0x08 * (n)) /* Channel status for DMA channel n */ +#define CPC(n) (0x104 + 0x08 * (n)) /* Channel PC for DMA channel n */ +#define SAR(n) (0x400 + 0x20 * (n)) /* Source address for DMA channel n */ +#define DAR(n) (0x404 + 0x20 * (n)) /* Destination address for DMA channel n */ +#define CCR(n) (0x408 + 0x20 * (n)) /* Channel control for DMA channel n */ +#define CCR_DST_BURST_SIZE_S 15 +#define CCR_DST_BURST_SIZE_1 (0 << CCR_DST_BURST_SIZE_S) +#define CCR_DST_BURST_SIZE_2 (1 << CCR_DST_BURST_SIZE_S) +#define CCR_DST_BURST_SIZE_4 (2 << CCR_DST_BURST_SIZE_S) +#define CCR_SRC_BURST_SIZE_S 1 +#define CCR_SRC_BURST_SIZE_1 (0 << CCR_SRC_BURST_SIZE_S) +#define CCR_SRC_BURST_SIZE_2 (1 << CCR_SRC_BURST_SIZE_S) +#define CCR_SRC_BURST_SIZE_4 (2 << CCR_SRC_BURST_SIZE_S) +#define CCR_DST_INC (1 << 14) +#define CCR_SRC_INC (1 << 0) +#define CCR_DST_PROT_CTRL_S 22 +#define CCR_DST_PROT_PRIV (1 << CCR_DST_PROT_CTRL_S) +#define LC0(n) (0x40C + 0x20 * (n)) /* Loop counter 0 for DMA channel n */ +#define LC1(n) (0x410 + 0x20 * (n)) /* Loop counter 1 for DMA channel n */ + +#define DBGSTATUS 0xD00 /* Debug Status */ +#define DBGCMD 0xD04 /* Debug Command */ +#define DBGINST0 0xD08 /* Debug Instruction-0 */ +#define DBGINST1 0xD0C /* Debug Instruction-1 */ +#define CR0 0xE00 /* Configuration Register 0 */ +#define CR1 0xE04 /* Configuration Register 1 */ +#define CR2 0xE08 /* Configuration Register 2 */ +#define CR3 0xE0C /* Configuration Register 3 */ +#define CR4 0xE10 /* Configuration Register 4 */ +#define CRD 0xE14 /* DMA Configuration */ +#define WD 0xE80 /* Watchdog Register */ + +#define R_SAR 0 +#define R_CCR 1 +#define R_DAR 2 + +/* + * 0xFE0- 0xFEC periph_id_n RO Configuration-dependent Peripheral Identification Registers + * 0xFF0- 0xFFC pcell_id_n RO Configuration-dependent Component Identification Registers + */ + +/* pl330 ISA */ +#define DMAADDH 0x54 +#define DMAADNH 0x5c +#define DMAEND 0x00 +#define DMAFLUSHP 0x35 +#define DMAGO 0xa0 +#define DMAKILL 0x01 +#define DMALD 0x04 +#define DMALDP 0x25 +#define DMALP 0x20 +#define DMALPEND 0x28 +#define DMALPEND_NF (1 << 4) /* DMALP started the loop */ +/* + * TODO: documentation miss opcode for infinite loop + * #define DMALPFE 0 + */ +#define DMAMOV 0xbc +#define DMANOP 0x18 +#define DMARMB 0x12 +#define DMASEV 0x34 +#define DMAST 0x08 +#define DMASTP 0x29 +#define DMASTZ 0x0c +#define DMAWFE 0x36 +#define DMAWFP 0x30 +#define DMAWMB 0x13 + +#endif /* !_DEV_XDMA_CONTROLLER_PL330_H_ */ From owner-svn-src-head@freebsd.org Fri Apr 13 13:23:32 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 154CBF88AE3; Fri, 13 Apr 2018 13:23:32 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B7BEC7FCD4; Fri, 13 Apr 2018 13:23:31 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B29B61A4E8; Fri, 13 Apr 2018 13:23:31 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3DDNVOf040000; Fri, 13 Apr 2018 13:23:31 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DDNVlB039997; Fri, 13 Apr 2018 13:23:31 GMT (envelope-from br@FreeBSD.org) Message-Id: <201804131323.w3DDNVlB039997@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 13 Apr 2018 13:23:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332470 - in head/sys: conf dev/altera/msgdma X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: conf dev/altera/msgdma X-SVN-Commit-Revision: 332470 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 13:23:32 -0000 Author: br Date: Fri Apr 13 13:23:31 2018 New Revision: 332470 URL: https://svnweb.freebsd.org/changeset/base/332470 Log: Add driver for Altera modular Scatter-Gather DMA engine (mSGDMA). Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9619 Added: head/sys/dev/altera/msgdma/ head/sys/dev/altera/msgdma/msgdma.c (contents, props changed) head/sys/dev/altera/msgdma/msgdma.h (contents, props changed) Modified: head/sys/conf/files Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Apr 13 12:43:54 2018 (r332469) +++ head/sys/conf/files Fri Apr 13 13:23:31 2018 (r332470) @@ -831,6 +831,7 @@ dev/alpm/alpm.c optional alpm pci dev/altera/avgen/altera_avgen.c optional altera_avgen dev/altera/avgen/altera_avgen_fdt.c optional altera_avgen fdt dev/altera/avgen/altera_avgen_nexus.c optional altera_avgen +dev/altera/msgdma/msgdma.c optional altera_msgdma xdma dev/altera/sdcard/altera_sdcard.c optional altera_sdcard dev/altera/sdcard/altera_sdcard_disk.c optional altera_sdcard dev/altera/sdcard/altera_sdcard_io.c optional altera_sdcard Added: head/sys/dev/altera/msgdma/msgdma.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/altera/msgdma/msgdma.c Fri Apr 13 13:23:31 2018 (r332470) @@ -0,0 +1,641 @@ +/*- + * Copyright (c) 2016-2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* Altera mSGDMA driver. */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#ifdef FDT +#include +#include +#include +#endif + +#include +#include "xdma_if.h" + +#include + +#define MSGDMA_DEBUG +#undef MSGDMA_DEBUG + +#ifdef MSGDMA_DEBUG +#define dprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) +#else +#define dprintf(fmt, ...) +#endif + +#define MSGDMA_NCHANNELS 1 + +struct msgdma_channel { + struct msgdma_softc *sc; + struct mtx mtx; + xdma_channel_t *xchan; + struct proc *p; + int used; + int index; + int idx_head; + int idx_tail; + + struct msgdma_desc **descs; + bus_dma_segment_t *descs_phys; + uint32_t descs_num; + bus_dma_tag_t dma_tag; + bus_dmamap_t *dma_map; + uint32_t map_descr; + uint8_t map_err; + uint32_t descs_used_count; +}; + +struct msgdma_softc { + device_t dev; + struct resource *res[3]; + bus_space_tag_t bst; + bus_space_handle_t bsh; + bus_space_tag_t bst_d; + bus_space_handle_t bsh_d; + void *ih; + struct msgdma_desc desc; + struct msgdma_channel channels[MSGDMA_NCHANNELS]; +}; + +static struct resource_spec msgdma_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_MEMORY, 1, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { -1, 0 } +}; + +#define HWTYPE_NONE 0 +#define HWTYPE_STD 1 + +static struct ofw_compat_data compat_data[] = { + { "altr,msgdma-16.0", HWTYPE_STD }, + { "altr,msgdma-1.0", HWTYPE_STD }, + { NULL, HWTYPE_NONE }, +}; + +static int msgdma_probe(device_t dev); +static int msgdma_attach(device_t dev); +static int msgdma_detach(device_t dev); + +static inline uint32_t +msgdma_next_desc(struct msgdma_channel *chan, uint32_t curidx) +{ + + return ((curidx + 1) % chan->descs_num); +} + +static void +msgdma_intr(void *arg) +{ + xdma_transfer_status_t status; + struct xdma_transfer_status st; + struct msgdma_desc *desc; + struct msgdma_channel *chan; + struct xdma_channel *xchan; + struct msgdma_softc *sc; + uint32_t tot_copied; + + sc = arg; + chan = &sc->channels[0]; + xchan = chan->xchan; + + dprintf("%s(%d): status 0x%08x next_descr 0x%08x, control 0x%08x\n", + __func__, device_get_unit(sc->dev), + READ4_DESC(sc, PF_STATUS), + READ4_DESC(sc, PF_NEXT_LO), + READ4_DESC(sc, PF_CONTROL)); + + tot_copied = 0; + + while (chan->idx_tail != chan->idx_head) { + dprintf("%s: idx_tail %d idx_head %d\n", __func__, + chan->idx_tail, chan->idx_head); + bus_dmamap_sync(chan->dma_tag, chan->dma_map[chan->idx_tail], + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); + + desc = chan->descs[chan->idx_tail]; + if ((le32toh(desc->control) & CONTROL_OWN) != 0) { + break; + } + + tot_copied += le32toh(desc->transferred); + st.error = 0; + st.transferred = le32toh(desc->transferred); + xchan_seg_done(xchan, &st); + + chan->idx_tail = msgdma_next_desc(chan, chan->idx_tail); + atomic_subtract_int(&chan->descs_used_count, 1); + } + + WRITE4_DESC(sc, PF_STATUS, PF_STATUS_IRQ); + + /* Finish operation */ + status.error = 0; + status.transferred = tot_copied; + xdma_callback(chan->xchan, &status); +} + +static int +msgdma_reset(struct msgdma_softc *sc) +{ + int timeout; + + dprintf("%s: read status: %x\n", __func__, READ4(sc, 0x00)); + dprintf("%s: read control: %x\n", __func__, READ4(sc, 0x04)); + dprintf("%s: read 1: %x\n", __func__, READ4(sc, 0x08)); + dprintf("%s: read 2: %x\n", __func__, READ4(sc, 0x0C)); + + WRITE4(sc, DMA_CONTROL, CONTROL_RESET); + + timeout = 100; + do { + if ((READ4(sc, DMA_STATUS) & STATUS_RESETTING) == 0) + break; + } while (timeout--); + + dprintf("timeout %d\n", timeout); + + if (timeout == 0) + return (-1); + + dprintf("%s: read control after reset: %x\n", + __func__, READ4(sc, DMA_CONTROL)); + + return (0); +} + +static int +msgdma_probe(device_t dev) +{ + int hwtype; + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + hwtype = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + if (hwtype == HWTYPE_NONE) + return (ENXIO); + + device_set_desc(dev, "Altera mSGDMA"); + + return (BUS_PROBE_DEFAULT); +} + +static int +msgdma_attach(device_t dev) +{ + struct msgdma_softc *sc; + phandle_t xref, node; + int err; + + sc = device_get_softc(dev); + sc->dev = dev; + + if (bus_alloc_resources(dev, msgdma_spec, sc->res)) { + device_printf(dev, "could not allocate resources for device\n"); + return (ENXIO); + } + + /* CSR memory interface */ + sc->bst = rman_get_bustag(sc->res[0]); + sc->bsh = rman_get_bushandle(sc->res[0]); + + /* Descriptor memory interface */ + sc->bst_d = rman_get_bustag(sc->res[1]); + sc->bsh_d = rman_get_bushandle(sc->res[1]); + + /* Setup interrupt handler */ + err = bus_setup_intr(dev, sc->res[2], INTR_TYPE_MISC | INTR_MPSAFE, + NULL, msgdma_intr, sc, &sc->ih); + if (err) { + device_printf(dev, "Unable to alloc interrupt resource.\n"); + return (ENXIO); + } + + node = ofw_bus_get_node(dev); + xref = OF_xref_from_node(node); + OF_device_register_xref(xref, dev); + + if (msgdma_reset(sc) != 0) + return (-1); + + WRITE4(sc, DMA_CONTROL, CONTROL_GIEM); + + return (0); +} + +static int +msgdma_detach(device_t dev) +{ + struct msgdma_softc *sc; + + sc = device_get_softc(dev); + + return (0); +} + +static void +msgdma_dmamap_cb(void *arg, bus_dma_segment_t *segs, int nseg, int err) +{ + struct msgdma_channel *chan; + + chan = (struct msgdma_channel *)arg; + KASSERT(chan != NULL, ("xchan is NULL")); + + if (err) { + chan->map_err = 1; + return; + } + + chan->descs_phys[chan->map_descr].ds_addr = segs[0].ds_addr; + chan->descs_phys[chan->map_descr].ds_len = segs[0].ds_len; + + dprintf("map desc %d: descs phys %lx len %ld\n", + chan->map_descr, segs[0].ds_addr, segs[0].ds_len); +} + +static int +msgdma_desc_free(struct msgdma_softc *sc, struct msgdma_channel *chan) +{ + struct msgdma_desc *desc; + int nsegments; + int i; + + nsegments = chan->descs_num; + + for (i = 0; i < nsegments; i++) { + desc = chan->descs[i]; + bus_dmamap_unload(chan->dma_tag, chan->dma_map[i]); + bus_dmamem_free(chan->dma_tag, desc, chan->dma_map[i]); + } + + bus_dma_tag_destroy(chan->dma_tag); + free(chan->descs, M_DEVBUF); + free(chan->dma_map, M_DEVBUF); + free(chan->descs_phys, M_DEVBUF); + + return (0); +} + +static int +msgdma_desc_alloc(struct msgdma_softc *sc, struct msgdma_channel *chan, + uint32_t desc_size, uint32_t align) +{ + int nsegments; + int err; + int i; + + nsegments = chan->descs_num; + + dprintf("%s: nseg %d\n", __func__, nsegments); + + err = bus_dma_tag_create( + bus_get_dma_tag(sc->dev), + align, 0, /* alignment, boundary */ + BUS_SPACE_MAXADDR_32BIT, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + desc_size, 1, /* maxsize, nsegments*/ + desc_size, 0, /* maxsegsize, flags */ + NULL, NULL, /* lockfunc, lockarg */ + &chan->dma_tag); + if (err) { + device_printf(sc->dev, + "%s: Can't create bus_dma tag.\n", __func__); + return (-1); + } + + /* Descriptors. */ + chan->descs = malloc(nsegments * sizeof(struct msgdma_desc *), + M_DEVBUF, (M_WAITOK | M_ZERO)); + if (chan->descs == NULL) { + device_printf(sc->dev, + "%s: Can't allocate memory.\n", __func__); + return (-1); + } + chan->dma_map = malloc(nsegments * sizeof(bus_dmamap_t), + M_DEVBUF, (M_WAITOK | M_ZERO)); + chan->descs_phys = malloc(nsegments * sizeof(bus_dma_segment_t), + M_DEVBUF, (M_WAITOK | M_ZERO)); + + /* Allocate bus_dma memory for each descriptor. */ + for (i = 0; i < nsegments; i++) { + err = bus_dmamem_alloc(chan->dma_tag, (void **)&chan->descs[i], + BUS_DMA_WAITOK | BUS_DMA_ZERO, &chan->dma_map[i]); + if (err) { + device_printf(sc->dev, + "%s: Can't allocate memory for descriptors.\n", + __func__); + return (-1); + } + + chan->map_err = 0; + chan->map_descr = i; + err = bus_dmamap_load(chan->dma_tag, chan->dma_map[i], chan->descs[i], + desc_size, msgdma_dmamap_cb, chan, BUS_DMA_WAITOK); + if (err) { + device_printf(sc->dev, + "%s: Can't load DMA map.\n", __func__); + return (-1); + } + + if (chan->map_err != 0) { + device_printf(sc->dev, + "%s: Can't load DMA map.\n", __func__); + return (-1); + } + } + + return (0); +} + + +static int +msgdma_channel_alloc(device_t dev, struct xdma_channel *xchan) +{ + struct msgdma_channel *chan; + struct msgdma_softc *sc; + int i; + + sc = device_get_softc(dev); + + for (i = 0; i < MSGDMA_NCHANNELS; i++) { + chan = &sc->channels[i]; + if (chan->used == 0) { + chan->xchan = xchan; + xchan->chan = (void *)chan; + xchan->caps |= XCHAN_CAP_BUSDMA; + chan->index = i; + chan->sc = sc; + chan->used = 1; + chan->idx_head = 0; + chan->idx_tail = 0; + chan->descs_used_count = 0; + chan->descs_num = 1024; + + return (0); + } + } + + return (-1); +} + +static int +msgdma_channel_free(device_t dev, struct xdma_channel *xchan) +{ + struct msgdma_channel *chan; + struct msgdma_softc *sc; + + sc = device_get_softc(dev); + + chan = (struct msgdma_channel *)xchan->chan; + + msgdma_desc_free(sc, chan); + + chan->used = 0; + + return (0); +} + +static int +msgdma_channel_capacity(device_t dev, xdma_channel_t *xchan, + uint32_t *capacity) +{ + struct msgdma_channel *chan; + uint32_t c; + + chan = (struct msgdma_channel *)xchan->chan; + + /* At least one descriptor must be left empty. */ + c = (chan->descs_num - chan->descs_used_count - 1); + + *capacity = c; + + return (0); +} + +static int +msgdma_channel_submit_sg(device_t dev, struct xdma_channel *xchan, + struct xdma_sglist *sg, uint32_t sg_n) +{ + struct msgdma_channel *chan; + struct msgdma_desc *desc; + struct msgdma_softc *sc; + uint32_t src_addr_lo; + uint32_t dst_addr_lo; + uint32_t len; + uint32_t tmp; + int i; + + sc = device_get_softc(dev); + + chan = (struct msgdma_channel *)xchan->chan; + + for (i = 0; i < sg_n; i++) { + src_addr_lo = (uint32_t)sg[i].src_addr; + dst_addr_lo = (uint32_t)sg[i].dst_addr; + len = (uint32_t)sg[i].len; + + dprintf("%s: src %x dst %x len %d\n", __func__, + src_addr_lo, dst_addr_lo, len); + + desc = chan->descs[chan->idx_head]; + desc->read_lo = htole32(src_addr_lo); + desc->write_lo = htole32(dst_addr_lo); + desc->length = htole32(len); + desc->transferred = 0; + desc->status = 0; + desc->reserved = 0; + desc->control = 0; + + if (sg[i].direction == XDMA_MEM_TO_DEV) { + if (sg[i].first == 1) { + desc->control |= htole32(CONTROL_GEN_SOP); + } + + if (sg[i].last == 1) { + desc->control |= htole32(CONTROL_GEN_EOP); + desc->control |= htole32(CONTROL_TC_IRQ_EN | + CONTROL_ET_IRQ_EN | CONTROL_ERR_M); + } + } else { + desc->control |= htole32(CONTROL_END_ON_EOP | (1 << 13)); + desc->control |= htole32(CONTROL_TC_IRQ_EN | + CONTROL_ET_IRQ_EN | CONTROL_ERR_M); + } + + tmp = chan->idx_head; + + atomic_add_int(&chan->descs_used_count, 1); + chan->idx_head = msgdma_next_desc(chan, chan->idx_head); + + desc->control |= htole32(CONTROL_OWN | CONTROL_GO); + + bus_dmamap_sync(chan->dma_tag, chan->dma_map[tmp], + BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); + } + + return (0); +} + +static int +msgdma_channel_prep_sg(device_t dev, struct xdma_channel *xchan) +{ + struct msgdma_channel *chan; + struct msgdma_desc *desc; + struct msgdma_softc *sc; + uint32_t addr; + uint32_t reg; + int ret; + int i; + + sc = device_get_softc(dev); + + dprintf("%s(%d)\n", __func__, device_get_unit(dev)); + + chan = (struct msgdma_channel *)xchan->chan; + + ret = msgdma_desc_alloc(sc, chan, sizeof(struct msgdma_desc), 16); + if (ret != 0) { + device_printf(sc->dev, + "%s: Can't allocate descriptors.\n", __func__); + return (-1); + } + + for (i = 0; i < chan->descs_num; i++) { + desc = chan->descs[i]; + + if (i == (chan->descs_num - 1)) { + desc->next = htole32(chan->descs_phys[0].ds_addr); + } else { + desc->next = htole32(chan->descs_phys[i+1].ds_addr); + } + + dprintf("%s(%d): desc %d vaddr %lx next paddr %x\n", __func__, + device_get_unit(dev), i, (uint64_t)desc, le32toh(desc->next)); + } + + addr = chan->descs_phys[0].ds_addr; + WRITE4_DESC(sc, PF_NEXT_LO, addr); + WRITE4_DESC(sc, PF_NEXT_HI, 0); + WRITE4_DESC(sc, PF_POLL_FREQ, 1000); + + reg = (PF_CONTROL_GIEM | PF_CONTROL_DESC_POLL_EN); + reg |= PF_CONTROL_RUN; + WRITE4_DESC(sc, PF_CONTROL, reg); + + return (0); +} + +static int +msgdma_channel_control(device_t dev, xdma_channel_t *xchan, int cmd) +{ + struct msgdma_channel *chan; + struct msgdma_softc *sc; + + sc = device_get_softc(dev); + + chan = (struct msgdma_channel *)xchan->chan; + + switch (cmd) { + case XDMA_CMD_BEGIN: + case XDMA_CMD_TERMINATE: + case XDMA_CMD_PAUSE: + /* TODO: implement me */ + return (-1); + } + + return (0); +} + +#ifdef FDT +static int +msgdma_ofw_md_data(device_t dev, pcell_t *cells, int ncells, void **ptr) +{ + + return (0); +} +#endif + +static device_method_t msgdma_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, msgdma_probe), + DEVMETHOD(device_attach, msgdma_attach), + DEVMETHOD(device_detach, msgdma_detach), + + /* xDMA Interface */ + DEVMETHOD(xdma_channel_alloc, msgdma_channel_alloc), + DEVMETHOD(xdma_channel_free, msgdma_channel_free), + DEVMETHOD(xdma_channel_control, msgdma_channel_control), + + /* xDMA SG Interface */ + DEVMETHOD(xdma_channel_capacity, msgdma_channel_capacity), + DEVMETHOD(xdma_channel_prep_sg, msgdma_channel_prep_sg), + DEVMETHOD(xdma_channel_submit_sg, msgdma_channel_submit_sg), + +#ifdef FDT + DEVMETHOD(xdma_ofw_md_data, msgdma_ofw_md_data), +#endif + + DEVMETHOD_END +}; + +static driver_t msgdma_driver = { + "msgdma", + msgdma_methods, + sizeof(struct msgdma_softc), +}; + +static devclass_t msgdma_devclass; + +EARLY_DRIVER_MODULE(msgdma, simplebus, msgdma_driver, msgdma_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); Added: head/sys/dev/altera/msgdma/msgdma.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/altera/msgdma/msgdma.h Fri Apr 13 13:23:31 2018 (r332470) @@ -0,0 +1,96 @@ +/*- + * Copyright (c) 2017-2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +/* Altera mSGDMA registers. */ +#define DMA_STATUS 0x00 +#define STATUS_RESETTING (1 << 6) +#define DMA_CONTROL 0x04 +#define CONTROL_GIEM (1 << 4) /* Global Interrupt Enable Mask */ +#define CONTROL_RESET (1 << 1) /* Reset Dispatcher */ + +/* Descriptor fields. */ +#define CONTROL_GO (1 << 31) /* Commit all the descriptor info */ +#define CONTROL_OWN (1 << 30) /* Owned by hardware (prefetcher-enabled only) */ +#define CONTROL_EDE (1 << 24) /* Early done enable */ +#define CONTROL_ERR_S 16 /* Transmit Error, Error IRQ Enable */ +#define CONTROL_ERR_M (0xff << CONTROL_ERR_S) +#define CONTROL_ET_IRQ_EN (1 << 15) /* Early Termination IRQ Enable */ +#define CONTROL_TC_IRQ_EN (1 << 14) /* Transfer Complete IRQ Enable */ +#define CONTROL_END_ON_EOP (1 << 12) /* End on EOP */ +#define CONTROL_PARK_WR (1 << 11) /* Park Writes */ +#define CONTROL_PARK_RD (1 << 10) /* Park Reads */ +#define CONTROL_GEN_EOP (1 << 9) /* Generate EOP */ +#define CONTROL_GEN_SOP (1 << 8) /* Generate SOP */ +#define CONTROL_TX_CHANNEL_S 0 /* Transmit Channel */ +#define CONTROL_TX_CHANNEL_M (0xff << CONTROL_TRANSMIT_CH_S) + +/* Prefetcher */ +#define PF_CONTROL 0x00 +#define PF_CONTROL_GIEM (1 << 3) +#define PF_CONTROL_RESET (1 << 2) +#define PF_CONTROL_DESC_POLL_EN (1 << 1) +#define PF_CONTROL_RUN (1 << 0) +#define PF_NEXT_LO 0x04 +#define PF_NEXT_HI 0x08 +#define PF_POLL_FREQ 0x0C +#define PF_STATUS 0x10 +#define PF_STATUS_IRQ (1 << 0) + +#define READ4(_sc, _reg) \ + le32toh(bus_space_read_4(_sc->bst, _sc->bsh, _reg)) +#define WRITE4(_sc, _reg, _val) \ + bus_space_write_4(_sc->bst, _sc->bsh, _reg, htole32(_val)) + +#define READ4_DESC(_sc, _reg) \ + le32toh(bus_space_read_4(_sc->bst_d, _sc->bsh_d, _reg)) +#define WRITE4_DESC(_sc, _reg, _val) \ + bus_space_write_4(_sc->bst_d, _sc->bsh_d, _reg, htole32(_val)) + +/* Prefetcher-disabled descriptor format. */ +struct msgdma_desc_nonpf { + uint32_t src_addr; + uint32_t dst_addr; + uint32_t length; + uint32_t control; +}; + +/* Prefetcher-enabled descriptor format. */ +struct msgdma_desc { + uint32_t read_lo; + uint32_t write_lo; + uint32_t length; + uint32_t next; + uint32_t transferred; + uint32_t status; + uint32_t reserved; + uint32_t control; +}; From owner-svn-src-head@freebsd.org Fri Apr 13 13:31:22 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 66373F89512; Fri, 13 Apr 2018 13:31:22 +0000 (UTC) (envelope-from ram@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 27737806AE; Fri, 13 Apr 2018 13:31:21 +0000 (UTC) (envelope-from ram@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 124091A52A; Fri, 13 Apr 2018 13:31:21 +0000 (UTC) (envelope-from ram@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3DDVK3X044087; Fri, 13 Apr 2018 13:31:20 GMT (envelope-from ram@FreeBSD.org) Received: (from ram@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DDVKod044086; Fri, 13 Apr 2018 13:31:20 GMT (envelope-from ram@FreeBSD.org) Message-Id: <201804131331.w3DDVKod044086@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ram set sender to ram@FreeBSD.org using -f From: Ram Kishore Vegesna Date: Fri, 13 Apr 2018 13:31:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332471 - head/sys/dev/ocs_fc X-SVN-Group: head X-SVN-Commit-Author: ram X-SVN-Commit-Paths: head/sys/dev/ocs_fc X-SVN-Commit-Revision: 332471 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 13:31:22 -0000 Author: ram Date: Fri Apr 13 13:31:20 2018 New Revision: 332471 URL: https://svnweb.freebsd.org/changeset/base/332471 Log: Check if STACK is defined before using the stack(9). PR: 227446 Reported by: emaste Approved by: ken Modified: head/sys/dev/ocs_fc/ocs_os.c Modified: head/sys/dev/ocs_fc/ocs_os.c ============================================================================== --- head/sys/dev/ocs_fc/ocs_os.c Fri Apr 13 13:23:31 2018 (r332470) +++ head/sys/dev/ocs_fc/ocs_os.c Fri Apr 13 13:31:20 2018 (r332471) @@ -37,6 +37,7 @@ */ #include "ocs.h" +#include "opt_stack.h" #include #include #include /* for debug of memory allocations */ @@ -855,11 +856,13 @@ void ocs_intr_enable(ocs_os_handle_t os) void ocs_print_stack(void) { +#if defined(STACK) struct stack st; stack_zero(&st); stack_save(&st); stack_print(&st); +#endif } void ocs_abort(void) From owner-svn-src-head@freebsd.org Fri Apr 13 14:18:05 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 5AE27F8C623; Fri, 13 Apr 2018 14:18:05 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 081F86BAF7; Fri, 13 Apr 2018 14:18:05 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E51D91AD49; Fri, 13 Apr 2018 14:18:04 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3DEI4p8064837; Fri, 13 Apr 2018 14:18:04 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DEI4Cm064833; Fri, 13 Apr 2018 14:18:04 GMT (envelope-from br@FreeBSD.org) Message-Id: <201804131418.w3DEI4Cm064833@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 13 Apr 2018 14:18:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332472 - in head/sys: conf dev/altera/atse dev/altera/softdma X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: conf dev/altera/atse dev/altera/softdma X-SVN-Commit-Revision: 332472 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 14:18:05 -0000 Author: br Date: Fri Apr 13 14:18:04 2018 New Revision: 332472 URL: https://svnweb.freebsd.org/changeset/base/332472 Log: Add driver for Altera SoftDMA® device. SoftDMA is a software implementation of DMA engine built using Altera FIFO component. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9620 Added: head/sys/dev/altera/softdma/ head/sys/dev/altera/softdma/a_api.h - copied unchanged from r332471, head/sys/dev/altera/atse/a_api.h head/sys/dev/altera/softdma/softdma.c (contents, props changed) Deleted: head/sys/dev/altera/atse/a_api.h Modified: head/sys/conf/files head/sys/dev/altera/atse/if_atse.c Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Apr 13 13:31:20 2018 (r332471) +++ head/sys/conf/files Fri Apr 13 14:18:04 2018 (r332472) @@ -837,6 +837,7 @@ dev/altera/sdcard/altera_sdcard_disk.c optional altera dev/altera/sdcard/altera_sdcard_io.c optional altera_sdcard dev/altera/sdcard/altera_sdcard_fdt.c optional altera_sdcard fdt dev/altera/sdcard/altera_sdcard_nexus.c optional altera_sdcard +dev/altera/softdma/softdma.c optional altera_softdma xdma fdt dev/altera/pio/pio.c optional altera_pio dev/altera/pio/pio_if.m optional altera_pio dev/amdpm/amdpm.c optional amdpm pci | nfpm pci Modified: head/sys/dev/altera/atse/if_atse.c ============================================================================== --- head/sys/dev/altera/atse/if_atse.c Fri Apr 13 13:31:20 2018 (r332471) +++ head/sys/dev/altera/atse/if_atse.c Fri Apr 13 14:18:04 2018 (r332472) @@ -88,7 +88,7 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include MODULE_DEPEND(atse, ether, 1, 1, 1); MODULE_DEPEND(atse, miibus, 1, 1, 1); Copied: head/sys/dev/altera/softdma/a_api.h (from r332471, head/sys/dev/altera/atse/a_api.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/altera/softdma/a_api.h Fri Apr 13 14:18:04 2018 (r332472, copy of r332471, head/sys/dev/altera/atse/a_api.h) @@ -0,0 +1,100 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2012 Bjoern A. Zeeb + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract (FA8750-11-C-0249) + * ("MRC2"), as part of the DARPA MRC research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ +/* + * Altera, Embedded Peripherals IP, User Guide, v. 11.0, June 2011. + * UG-01085-11.0. + */ + +#ifndef _A_API_H +#define _A_API_H + +/* Table 16-1. Memory Map. */ +#define A_ONCHIP_FIFO_MEM_CORE_DATA 0x00 +#define A_ONCHIP_FIFO_MEM_CORE_METADATA 0x04 + +#define A_ONCHIP_FIFO_MEM_CORE_SOP (1<<0) +#define A_ONCHIP_FIFO_MEM_CORE_EOP (1<<1) +#define A_ONCHIP_FIFO_MEM_CORE_EMPTY_MASK 0x000000f7 +#define A_ONCHIP_FIFO_MEM_CORE_EMPTY_SHIFT 2 + /* Reserved (1<<7) */ +#define A_ONCHIP_FIFO_MEM_CORE_CHANNEL_MASK 0x0000ff00 +#define A_ONCHIP_FIFO_MEM_CORE_CHANNEL_SHIFT 8 +#define A_ONCHIP_FIFO_MEM_CORE_ERROR_MASK 0x00ff0000 +#define A_ONCHIP_FIFO_MEM_CORE_ERROR_SHIFT 16 + /* Reserved 0xff000000 */ + +/* Table 16-3. FIFO Status Register Memory Map. */ +#define A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_FILL_LEVEL 0x00 +#define A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_I_STATUS 0x04 +#define A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_EVENT 0x08 +#define A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_INT_ENABLE 0x0c +#define A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_ALMOSTFULL 0x10 +#define A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_ALMOSTEMPTY 0x14 + +/* Table 16-5. Status Bit Field Descriptions. */ +#define A_ONCHIP_FIFO_MEM_CORE_STATUS_FULL (1<<0) +#define A_ONCHIP_FIFO_MEM_CORE_STATUS_EMPTY (1<<1) +#define A_ONCHIP_FIFO_MEM_CORE_STATUS_ALMOSTFULL (1<<2) +#define A_ONCHIP_FIFO_MEM_CORE_STATUS_ALMOSTEMPTY (1<<3) +#define A_ONCHIP_FIFO_MEM_CORE_STATUS_OVERFLOW (1<<4) +#define A_ONCHIP_FIFO_MEM_CORE_STATUS_UNDERFLOW (1<<5) + +/* Table 16-6. Event Bit Field Descriptions. */ +/* XXX Datasheet has incorrect bit fields. Validate. */ +#define A_ONCHIP_FIFO_MEM_CORE_EVENT_FULL (1<<0) +#define A_ONCHIP_FIFO_MEM_CORE_EVENT_EMPTY (1<<1) +#define A_ONCHIP_FIFO_MEM_CORE_EVENT_ALMOSTFULL (1<<2) +#define A_ONCHIP_FIFO_MEM_CORE_EVENT_ALMOSTEMPTY (1<<3) +#define A_ONCHIP_FIFO_MEM_CORE_EVENT_OVERFLOW (1<<4) +#define A_ONCHIP_FIFO_MEM_CORE_EVENT_UNDERFLOW (1<<5) + +/* Table 16-7. InterruptEnable Bit Field Descriptions. */ +/* XXX Datasheet has incorrect bit fields. Validate. */ +#define A_ONCHIP_FIFO_MEM_CORE_INTR_FULL (1<<0) +#define A_ONCHIP_FIFO_MEM_CORE_INTR_EMPTY (1<<1) +#define A_ONCHIP_FIFO_MEM_CORE_INTR_ALMOSTFULL (1<<2) +#define A_ONCHIP_FIFO_MEM_CORE_INTR_ALMOSTEMPTY (1<<3) +#define A_ONCHIP_FIFO_MEM_CORE_INTR_OVERFLOW (1<<4) +#define A_ONCHIP_FIFO_MEM_CORE_INTR_UNDERFLOW (1<<5) +#define A_ONCHIP_FIFO_MEM_CORE_INTR_ALL \ + (A_ONCHIP_FIFO_MEM_CORE_INTR_EMPTY| \ + A_ONCHIP_FIFO_MEM_CORE_INTR_FULL| \ + A_ONCHIP_FIFO_MEM_CORE_INTR_ALMOSTEMPTY| \ + A_ONCHIP_FIFO_MEM_CORE_INTR_ALMOSTFULL| \ + A_ONCHIP_FIFO_MEM_CORE_INTR_OVERFLOW| \ + A_ONCHIP_FIFO_MEM_CORE_INTR_UNDERFLOW) + +#endif /* _A_API_H */ + +/* end */ Added: head/sys/dev/altera/softdma/softdma.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/altera/softdma/softdma.c Fri Apr 13 14:18:04 2018 (r332472) @@ -0,0 +1,864 @@ +/*- + * Copyright (c) 2017-2018 Ruslan Bukin + * All rights reserved. + * + * This software was developed by SRI International and the University of + * Cambridge Computer Laboratory under DARPA/AFRL contract FA8750-10-C-0237 + * ("CTSRD"), as part of the DARPA CRASH research programme. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* This is driver for SoftDMA device built using Altera FIFO component. */ + +#include +__FBSDID("$FreeBSD$"); + +#include "opt_platform.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#ifdef FDT +#include +#include +#include +#endif + +#include + +#include +#include "xdma_if.h" + +#define SOFTDMA_DEBUG +#undef SOFTDMA_DEBUG + +#ifdef SOFTDMA_DEBUG +#define dprintf(fmt, ...) printf(fmt, ##__VA_ARGS__) +#else +#define dprintf(fmt, ...) +#endif + +#define AVALON_FIFO_TX_BASIC_OPTS_DEPTH 16 +#define SOFTDMA_NCHANNELS 1 +#define CONTROL_GEN_SOP (1 << 0) +#define CONTROL_GEN_EOP (1 << 1) +#define CONTROL_OWN (1 << 31) + +#define SOFTDMA_RX_EVENTS \ + (A_ONCHIP_FIFO_MEM_CORE_INTR_FULL | \ + A_ONCHIP_FIFO_MEM_CORE_INTR_OVERFLOW | \ + A_ONCHIP_FIFO_MEM_CORE_INTR_UNDERFLOW) +#define SOFTDMA_TX_EVENTS \ + (A_ONCHIP_FIFO_MEM_CORE_INTR_EMPTY | \ + A_ONCHIP_FIFO_MEM_CORE_INTR_OVERFLOW | \ + A_ONCHIP_FIFO_MEM_CORE_INTR_UNDERFLOW) + +struct softdma_channel { + struct softdma_softc *sc; + struct mtx mtx; + xdma_channel_t *xchan; + struct proc *p; + int used; + int index; + int run; + uint32_t idx_tail; + uint32_t idx_head; + struct softdma_desc *descs; + + uint32_t descs_num; + uint32_t descs_used_count; +}; + +struct softdma_desc { + uint64_t src_addr; + uint64_t dst_addr; + uint32_t len; + uint32_t access_width; + uint32_t count; + uint16_t src_incr; + uint16_t dst_incr; + uint32_t direction; + struct softdma_desc *next; + uint32_t transfered; + uint32_t status; + uint32_t reserved; + uint32_t control; +}; + +struct softdma_softc { + device_t dev; + struct resource *res[3]; + bus_space_tag_t bst; + bus_space_handle_t bsh; + bus_space_tag_t bst_c; + bus_space_handle_t bsh_c; + void *ih; + struct softdma_channel channels[SOFTDMA_NCHANNELS]; +}; + +static struct resource_spec softdma_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, /* fifo */ + { SYS_RES_MEMORY, 1, RF_ACTIVE }, /* core */ + { SYS_RES_IRQ, 0, RF_ACTIVE }, + { -1, 0 } +}; + +static int softdma_probe(device_t dev); +static int softdma_attach(device_t dev); +static int softdma_detach(device_t dev); + +static inline uint32_t +softdma_next_desc(struct softdma_channel *chan, uint32_t curidx) +{ + + return ((curidx + 1) % chan->descs_num); +} + +static void +softdma_mem_write(struct softdma_softc *sc, uint32_t reg, uint32_t val) +{ + + bus_write_4(sc->res[0], reg, htole32(val)); +} + +static uint32_t +softdma_mem_read(struct softdma_softc *sc, uint32_t reg) +{ + uint32_t val; + + val = bus_read_4(sc->res[0], reg); + + return (le32toh(val)); +} + +static void +softdma_memc_write(struct softdma_softc *sc, uint32_t reg, uint32_t val) +{ + + bus_write_4(sc->res[1], reg, htole32(val)); +} + +static uint32_t +softdma_memc_read(struct softdma_softc *sc, uint32_t reg) +{ + uint32_t val; + + val = bus_read_4(sc->res[1], reg); + + return (le32toh(val)); +} + +static uint32_t +softdma_fill_level(struct softdma_softc *sc) +{ + uint32_t val; + + val = softdma_memc_read(sc, + A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_FILL_LEVEL); + + return (val); +} + +static void +softdma_intr(void *arg) +{ + struct softdma_channel *chan; + struct softdma_softc *sc; + int reg; + int err; + + sc = arg; + + chan = &sc->channels[0]; + + reg = softdma_memc_read(sc, A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_EVENT); + + if (reg & (A_ONCHIP_FIFO_MEM_CORE_EVENT_OVERFLOW | + A_ONCHIP_FIFO_MEM_CORE_EVENT_UNDERFLOW)) { + /* Errors */ + err = (((reg & A_ONCHIP_FIFO_MEM_CORE_ERROR_MASK) >> \ + A_ONCHIP_FIFO_MEM_CORE_ERROR_SHIFT) & 0xff); + } + + if (reg != 0) { + softdma_memc_write(sc, + A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_EVENT, reg); + chan->run = 1; + wakeup(chan); + } +} + +static int +softdma_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_is_compatible(dev, "altr,softdma")) + return (ENXIO); + + device_set_desc(dev, "SoftDMA"); + + return (BUS_PROBE_DEFAULT); +} + +static int +softdma_attach(device_t dev) +{ + struct softdma_softc *sc; + phandle_t xref, node; + int err; + + sc = device_get_softc(dev); + sc->dev = dev; + + if (bus_alloc_resources(dev, softdma_spec, sc->res)) { + device_printf(dev, + "could not allocate resources for device\n"); + return (ENXIO); + } + + /* FIFO memory interface */ + sc->bst = rman_get_bustag(sc->res[0]); + sc->bsh = rman_get_bushandle(sc->res[0]); + + /* FIFO control memory interface */ + sc->bst_c = rman_get_bustag(sc->res[1]); + sc->bsh_c = rman_get_bushandle(sc->res[1]); + + /* Setup interrupt handler */ + err = bus_setup_intr(dev, sc->res[2], INTR_TYPE_MISC | INTR_MPSAFE, + NULL, softdma_intr, sc, &sc->ih); + if (err) { + device_printf(dev, "Unable to alloc interrupt resource.\n"); + return (ENXIO); + } + + node = ofw_bus_get_node(dev); + xref = OF_xref_from_node(node); + OF_device_register_xref(xref, dev); + + return (0); +} + +static int +softdma_detach(device_t dev) +{ + struct softdma_softc *sc; + + sc = device_get_softc(dev); + + return (0); +} + +static int +softdma_process_tx(struct softdma_channel *chan, struct softdma_desc *desc) +{ + struct softdma_softc *sc; + uint32_t src_offs, dst_offs; + uint32_t reg; + uint32_t fill_level; + uint32_t leftm; + uint32_t tmp; + uint32_t val; + uint32_t c; + + sc = chan->sc; + + fill_level = softdma_fill_level(sc); + while (fill_level == AVALON_FIFO_TX_BASIC_OPTS_DEPTH) + fill_level = softdma_fill_level(sc); + + /* Set start of packet. */ + if (desc->control & CONTROL_GEN_SOP) { + reg = 0; + reg |= A_ONCHIP_FIFO_MEM_CORE_SOP; + softdma_mem_write(sc, A_ONCHIP_FIFO_MEM_CORE_METADATA, reg); + } + + src_offs = dst_offs = 0; + c = 0; + while ((desc->len - c) >= 4) { + val = *(uint32_t *)(desc->src_addr + src_offs); + bus_write_4(sc->res[0], A_ONCHIP_FIFO_MEM_CORE_DATA, val); + if (desc->src_incr) + src_offs += 4; + if (desc->dst_incr) + dst_offs += 4; + fill_level += 1; + + while (fill_level == AVALON_FIFO_TX_BASIC_OPTS_DEPTH) { + fill_level = softdma_fill_level(sc); + } + c += 4; + } + + val = 0; + leftm = (desc->len - c); + + switch (leftm) { + case 1: + val = *(uint8_t *)(desc->src_addr + src_offs); + val <<= 24; + src_offs += 1; + break; + case 2: + case 3: + val = *(uint16_t *)(desc->src_addr + src_offs); + val <<= 16; + src_offs += 2; + + if (leftm == 3) { + tmp = *(uint8_t *)(desc->src_addr + src_offs); + val |= (tmp << 8); + src_offs += 1; + } + break; + case 0: + default: + break; + } + + /* Set end of packet. */ + reg = 0; + if (desc->control & CONTROL_GEN_EOP) + reg |= A_ONCHIP_FIFO_MEM_CORE_EOP; + reg |= ((4 - leftm) << A_ONCHIP_FIFO_MEM_CORE_EMPTY_SHIFT); + softdma_mem_write(sc, A_ONCHIP_FIFO_MEM_CORE_METADATA, reg); + + /* Ensure there is a FIFO entry available. */ + fill_level = softdma_fill_level(sc); + while (fill_level == AVALON_FIFO_TX_BASIC_OPTS_DEPTH) + fill_level = softdma_fill_level(sc); + + /* Final write */ + bus_write_4(sc->res[0], A_ONCHIP_FIFO_MEM_CORE_DATA, val); + + return (dst_offs); +} + +static int +softdma_process_rx(struct softdma_channel *chan, struct softdma_desc *desc) +{ + uint32_t src_offs, dst_offs; + struct softdma_softc *sc; + uint32_t fill_level; + uint32_t empty; + uint32_t meta; + uint32_t data; + int sop_rcvd; + int timeout; + size_t len; + int error; + + sc = chan->sc; + empty = 0; + src_offs = dst_offs = 0; + error = 0; + + fill_level = softdma_fill_level(sc); + if (fill_level == 0) { + /* Nothing to receive. */ + return (0); + } + + len = desc->len; + + sop_rcvd = 0; + while (fill_level) { + empty = 0; + data = bus_read_4(sc->res[0], A_ONCHIP_FIFO_MEM_CORE_DATA); + meta = softdma_mem_read(sc, A_ONCHIP_FIFO_MEM_CORE_METADATA); + + if (meta & A_ONCHIP_FIFO_MEM_CORE_ERROR_MASK) { + error = 1; + break; + } + + if ((meta & A_ONCHIP_FIFO_MEM_CORE_CHANNEL_MASK) != 0) { + error = 1; + break; + } + + if (meta & A_ONCHIP_FIFO_MEM_CORE_SOP) { + sop_rcvd = 1; + } + + if (meta & A_ONCHIP_FIFO_MEM_CORE_EOP) { + empty = (meta & A_ONCHIP_FIFO_MEM_CORE_EMPTY_MASK) >> + A_ONCHIP_FIFO_MEM_CORE_EMPTY_SHIFT; + } + + if (sop_rcvd == 0) { + error = 1; + break; + } + + if (empty == 0) { + *(uint32_t *)(desc->dst_addr + dst_offs) = data; + dst_offs += 4; + } else if (empty == 1) { + *(uint16_t *)(desc->dst_addr + dst_offs) = + ((data >> 16) & 0xffff); + dst_offs += 2; + + *(uint8_t *)(desc->dst_addr + dst_offs) = + ((data >> 8) & 0xff); + dst_offs += 1; + } else { + panic("empty %d\n", empty); + } + + if (meta & A_ONCHIP_FIFO_MEM_CORE_EOP) + break; + + fill_level = softdma_fill_level(sc); + timeout = 100; + while (fill_level == 0 && timeout--) + fill_level = softdma_fill_level(sc); + if (timeout == 0) { + /* No EOP received. Broken packet. */ + error = 1; + break; + } + } + + if (error) { + return (-1); + } + + return (dst_offs); +} + +static uint32_t +softdma_process_descriptors(struct softdma_channel *chan, + xdma_transfer_status_t *status) +{ + struct xdma_channel *xchan; + struct softdma_desc *desc; + struct softdma_softc *sc; + xdma_transfer_status_t st; + int ret; + + sc = chan->sc; + + xchan = chan->xchan; + + desc = &chan->descs[chan->idx_tail]; + + while (desc != NULL) { + + if ((desc->control & CONTROL_OWN) == 0) { + break; + } + + if (desc->direction == XDMA_MEM_TO_DEV) { + ret = softdma_process_tx(chan, desc); + } else { + ret = softdma_process_rx(chan, desc); + if (ret == 0) { + /* No new data available. */ + break; + } + } + + /* Descriptor processed. */ + desc->control = 0; + + if (ret >= 0) { + st.error = 0; + st.transferred = ret; + } else { + st.error = ret; + st.transferred = 0; + } + + xchan_seg_done(xchan, &st); + atomic_subtract_int(&chan->descs_used_count, 1); + + if (ret >= 0) { + status->transferred += ret; + } else { + status->error = 1; + break; + } + + chan->idx_tail = softdma_next_desc(chan, chan->idx_tail); + + /* Process next descriptor, if any. */ + desc = desc->next; + } + + return (0); +} + +static void +softdma_worker(void *arg) +{ + xdma_transfer_status_t status; + struct softdma_channel *chan; + struct softdma_softc *sc; + + chan = arg; + + sc = chan->sc; + + while (1) { + mtx_lock(&chan->mtx); + + do { + mtx_sleep(chan, &chan->mtx, 0, "softdma_wait", hz / 2); + } while (chan->run == 0); + + status.error = 0; + status.transferred = 0; + + softdma_process_descriptors(chan, &status); + + /* Finish operation */ + chan->run = 0; + xdma_callback(chan->xchan, &status); + + mtx_unlock(&chan->mtx); + } + +} + +static int +softdma_proc_create(struct softdma_channel *chan) +{ + struct softdma_softc *sc; + + sc = chan->sc; + + if (chan->p != NULL) { + /* Already created */ + return (0); + } + + mtx_init(&chan->mtx, "SoftDMA", NULL, MTX_DEF); + + if (kproc_create(softdma_worker, (void *)chan, &chan->p, 0, 0, + "softdma_worker") != 0) { + device_printf(sc->dev, + "%s: Failed to create worker thread.\n", __func__); + return (-1); + } + + return (0); +} + +static int +softdma_channel_alloc(device_t dev, struct xdma_channel *xchan) +{ + struct softdma_channel *chan; + struct softdma_softc *sc; + int i; + + sc = device_get_softc(dev); + + for (i = 0; i < SOFTDMA_NCHANNELS; i++) { + chan = &sc->channels[i]; + if (chan->used == 0) { + chan->xchan = xchan; + xchan->chan = (void *)chan; + chan->index = i; + chan->idx_head = 0; + chan->idx_tail = 0; + chan->descs_used_count = 0; + chan->descs_num = 1024; + chan->sc = sc; + + if (softdma_proc_create(chan) != 0) { + return (-1); + } + + chan->used = 1; + + return (0); + } + } + + return (-1); +} + +static int +softdma_channel_free(device_t dev, struct xdma_channel *xchan) +{ + struct softdma_channel *chan; + struct softdma_softc *sc; + + sc = device_get_softc(dev); + + chan = (struct softdma_channel *)xchan->chan; + + if (chan->descs != NULL) { + free(chan->descs, M_DEVBUF); + } + + chan->used = 0; + + return (0); +} + +static int +softdma_desc_alloc(struct xdma_channel *xchan) +{ + struct softdma_channel *chan; + uint32_t nsegments; + + chan = (struct softdma_channel *)xchan->chan; + + nsegments = chan->descs_num; + + chan->descs = malloc(nsegments * sizeof(struct softdma_desc), + M_DEVBUF, (M_WAITOK | M_ZERO)); + + return (0); +} + +static int +softdma_channel_prep_sg(device_t dev, struct xdma_channel *xchan) +{ + struct softdma_channel *chan; + struct softdma_desc *desc; + struct softdma_softc *sc; + int ret; + int i; + + sc = device_get_softc(dev); + + chan = (struct softdma_channel *)xchan->chan; + + ret = softdma_desc_alloc(xchan); + if (ret != 0) { + device_printf(sc->dev, + "%s: Can't allocate descriptors.\n", __func__); + return (-1); + } + + for (i = 0; i < chan->descs_num; i++) { + desc = &chan->descs[i]; + + if (i == (chan->descs_num - 1)) { + desc->next = &chan->descs[0]; + } else { + desc->next = &chan->descs[i+1]; + } + } + + return (0); +} + +static int +softdma_channel_capacity(device_t dev, xdma_channel_t *xchan, + uint32_t *capacity) +{ + struct softdma_channel *chan; + uint32_t c; + + chan = (struct softdma_channel *)xchan->chan; + + /* At least one descriptor must be left empty. */ + c = (chan->descs_num - chan->descs_used_count - 1); + + *capacity = c; + + return (0); +} + +static int +softdma_channel_submit_sg(device_t dev, struct xdma_channel *xchan, + struct xdma_sglist *sg, uint32_t sg_n) +{ + struct softdma_channel *chan; + struct softdma_desc *desc; + struct softdma_softc *sc; + uint32_t enqueued; + uint32_t saved_dir; + uint32_t tmp; + uint32_t len; + int i; + + sc = device_get_softc(dev); + + chan = (struct softdma_channel *)xchan->chan; + + enqueued = 0; + + for (i = 0; i < sg_n; i++) { + len = (uint32_t)sg[i].len; + + desc = &chan->descs[chan->idx_head]; + desc->src_addr = sg[i].src_addr; + desc->dst_addr = sg[i].dst_addr; + if (sg[i].direction == XDMA_MEM_TO_DEV) { + desc->src_incr = 1; + desc->dst_incr = 0; + } else { + desc->src_incr = 0; + desc->dst_incr = 1; + } + desc->direction = sg[i].direction; + saved_dir = sg[i].direction; + desc->len = len; + desc->transfered = 0; + desc->status = 0; + desc->reserved = 0; + desc->control = 0; + + if (sg[i].first == 1) + desc->control |= CONTROL_GEN_SOP; + if (sg[i].last == 1) + desc->control |= CONTROL_GEN_EOP; + + tmp = chan->idx_head; + chan->idx_head = softdma_next_desc(chan, chan->idx_head); + atomic_add_int(&chan->descs_used_count, 1); + desc->control |= CONTROL_OWN; + enqueued += 1; + } + + if (enqueued == 0) + return (0); + + if (saved_dir == XDMA_MEM_TO_DEV) { + chan->run = 1; + wakeup(chan); + } else + softdma_memc_write(sc, + A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_INT_ENABLE, + SOFTDMA_RX_EVENTS); + + return (0); +} + +static int +softdma_channel_request(device_t dev, struct xdma_channel *xchan, + struct xdma_request *req) +{ + struct softdma_channel *chan; + struct softdma_desc *desc; + struct softdma_softc *sc; + int ret; + + sc = device_get_softc(dev); + + chan = (struct softdma_channel *)xchan->chan; + + ret = softdma_desc_alloc(xchan); + if (ret != 0) { + device_printf(sc->dev, + "%s: Can't allocate descriptors.\n", __func__); + return (-1); + } + + desc = &chan->descs[0]; + + desc->src_addr = req->src_addr; + desc->dst_addr = req->dst_addr; + desc->len = req->block_len; + desc->src_incr = 1; + desc->dst_incr = 1; + desc->next = NULL; + + return (0); +} + +static int +softdma_channel_control(device_t dev, xdma_channel_t *xchan, int cmd) +{ + struct softdma_channel *chan; + struct softdma_softc *sc; + + sc = device_get_softc(dev); + + chan = (struct softdma_channel *)xchan->chan; + + switch (cmd) { + case XDMA_CMD_BEGIN: + case XDMA_CMD_TERMINATE: + case XDMA_CMD_PAUSE: + /* TODO: implement me */ + return (-1); + } + + return (0); +} + +#ifdef FDT +static int +softdma_ofw_md_data(device_t dev, pcell_t *cells, + int ncells, void **ptr) +{ + + return (0); +} +#endif + +static device_method_t softdma_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, softdma_probe), + DEVMETHOD(device_attach, softdma_attach), + DEVMETHOD(device_detach, softdma_detach), + + /* xDMA Interface */ + DEVMETHOD(xdma_channel_alloc, softdma_channel_alloc), + DEVMETHOD(xdma_channel_free, softdma_channel_free), + DEVMETHOD(xdma_channel_request, softdma_channel_request), + DEVMETHOD(xdma_channel_control, softdma_channel_control), + + /* xDMA SG Interface */ + DEVMETHOD(xdma_channel_prep_sg, softdma_channel_prep_sg), + DEVMETHOD(xdma_channel_submit_sg, softdma_channel_submit_sg), + DEVMETHOD(xdma_channel_capacity, softdma_channel_capacity), + +#ifdef FDT + DEVMETHOD(xdma_ofw_md_data, softdma_ofw_md_data), +#endif + + DEVMETHOD_END +}; + +static driver_t softdma_driver = { + "softdma", + softdma_methods, + sizeof(struct softdma_softc), +}; + +static devclass_t softdma_devclass; + +EARLY_DRIVER_MODULE(softdma, simplebus, softdma_driver, softdma_devclass, 0, 0, + BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LATE); From owner-svn-src-head@freebsd.org Fri Apr 13 15:18:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 820D9F90755; Fri, 13 Apr 2018 15:18:07 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 33A7D79F17; Fri, 13 Apr 2018 15:18:07 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2E9B61B6AC; Fri, 13 Apr 2018 15:18:07 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3DFI7GL094675; Fri, 13 Apr 2018 15:18:07 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DFI7XC094674; Fri, 13 Apr 2018 15:18:07 GMT (envelope-from br@FreeBSD.org) Message-Id: <201804131518.w3DFI7XC094674@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 13 Apr 2018 15:18:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332473 - head/sys/dts/mips X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: head/sys/dts/mips X-SVN-Commit-Revision: 332473 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 15:18:07 -0000 Author: br Date: Fri Apr 13 15:18:06 2018 New Revision: 332473 URL: https://svnweb.freebsd.org/changeset/base/332473 Log: Add beripic1, msgdma and softdma instances. Sponsored by: DARPA, AFRL Modified: head/sys/dts/mips/beripad-de4.dts Modified: head/sys/dts/mips/beripad-de4.dts ============================================================================== --- head/sys/dts/mips/beripad-de4.dts Fri Apr 13 14:18:04 2018 (r332472) +++ head/sys/dts/mips/beripad-de4.dts Fri Apr 13 15:18:06 2018 (r332473) @@ -107,6 +107,23 @@ interrupt-parent = <&cpuintc>; }; +/* + beripic1: beripic@7f808000 { + compatible = "sri-cambridge,beri-pic"; + interrupt-controller; + #address-cells = <0>; + #interrupt-cells = <1>; + reg = <0x7f808000 0x400 + 0x7f80a000 0x10 + 0x7f80a080 0x10 + 0x7f80a100 0x10>; + interrupts = < 2 3 4 5 6 >; + hard-interrupt-sources = <64>; + soft-interrupt-sources = <64>; + interrupt-parent = <&cpuintc>; + }; +*/ + soc { #address-cells = <1>; #size-cells = <1>; @@ -190,6 +207,62 @@ reg = <0x3fe0000 0x20000>; label = "boot"; }; + }; + + msgdma0: msgdma@80004080 { + compatible = "altr,msgdma-16.0", "altr,msgdma-1.0"; + reg = <0x80004080 0x00000020>, + <0x800040a0 0x00000020>; + reg-names = "csr", "descriptor_slave"; + interrupts = <14>; + interrupt-parent = <&beripic0>; + #dma-cells = <3>; + }; + + msgdma1: msgdma@80004000 { + compatible = "altr,msgdma-16.0", "altr,msgdma-1.0"; + reg = <0x80004000 0x00000020>, + <0x80004020 0x00000020>; + reg-names = "csr", "descriptor_slave"; + interrupts = <13>; + interrupt-parent = <&beripic0>; + #dma-cells = <3>; + }; + + softdma0: softdma@7f007400 { + compatible = "altr,softdma"; + reg = < 0x7f007400 0x8 /* tx */ + 0x7f007420 0x20 >; /* txc */ + interrupts = <2>; + interrupt-parent = <&beripic0>; + #dma-cells = <3>; + }; + + softdma1: softdma@7f007500 { + compatible = "altr,softdma"; + reg = < 0x7f007500 0x8 /* rx */ + 0x7f007520 0x20 >; /* rxc */ + interrupts = <1>; + interrupt-parent = <&beripic0>; + #dma-cells = <3>; + }; + + softdma2: softdma@7f005400 { + compatible = "altr,softdma"; + reg = < 0x7f005400 0x8 /* tx */ + 0x7f005420 0x20 >; /* txc */ + interrupts = <12>; + interrupt-parent = <&beripic0>; + #dma-cells = <3>; + }; + + softdma3: softdma@7f005500 { + compatible = "altr,softdma"; + reg = < 0x7f005500 0x8 /* rx */ + 0x7f005520 0x20 >; /* rxc */ + interrupts = <11>; + interrupt-parent = <&beripic0>; + #dma-cells = <3>; }; ethernet@7f007000 { From owner-svn-src-head@freebsd.org Fri Apr 13 15:59:26 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0BA3F93096; Fri, 13 Apr 2018 15:59:25 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4E52A8371C; Fri, 13 Apr 2018 15:59:25 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4678F1BCF5; Fri, 13 Apr 2018 15:59:25 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3DFxPGv014743; Fri, 13 Apr 2018 15:59:25 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DFxPFl014741; Fri, 13 Apr 2018 15:59:25 GMT (envelope-from br@FreeBSD.org) Message-Id: <201804131559.w3DFxPFl014741@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin Date: Fri, 13 Apr 2018 15:59:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332474 - in head/sys: dev/altera/atse dts/mips mips/conf X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: dev/altera/atse dts/mips mips/conf X-SVN-Commit-Revision: 332474 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 15:59:26 -0000 Author: br Date: Fri Apr 13 15:59:24 2018 New Revision: 332474 URL: https://svnweb.freebsd.org/changeset/base/332474 Log: Convert atse(4) driver for Altera Triple-Speed Ethernet MegaCore to use xdma(4) interface. This allows us to switch between Altera mSGDMA or SoftDMA engines used by atse(4) device. This also makes atse(4) driver become 25% smaller. Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D9618 Modified: head/sys/dev/altera/atse/if_atse.c head/sys/dev/altera/atse/if_atse_fdt.c head/sys/dev/altera/atse/if_atse_nexus.c head/sys/dev/altera/atse/if_atsereg.h head/sys/dts/mips/beripad-de4.dts head/sys/mips/conf/BERI_DE4_BASE Modified: head/sys/dev/altera/atse/if_atse.c ============================================================================== --- head/sys/dev/altera/atse/if_atse.c Fri Apr 13 15:18:06 2018 (r332473) +++ head/sys/dev/altera/atse/if_atse.c Fri Apr 13 15:59:24 2018 (r332474) @@ -3,6 +3,7 @@ * * Copyright (c) 2012, 2013 Bjoern A. Zeeb * Copyright (c) 2014 Robert N. M. Watson + * Copyright (c) 2016-2017 Ruslan Bukin * All rights reserved. * * This software was developed by SRI International and the University of @@ -88,29 +89,21 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include -MODULE_DEPEND(atse, ether, 1, 1, 1); -MODULE_DEPEND(atse, miibus, 1, 1, 1); +#define RX_QUEUE_SIZE 4096 +#define TX_QUEUE_SIZE 4096 +#define NUM_RX_MBUF 512 +#define BUFRING_SIZE 8192 +#include -#define ATSE_WATCHDOG_TIME 5 - -#ifdef DEVICE_POLLING -static poll_handler_t atse_poll; -#endif - /* XXX once we'd do parallel attach, we need a global lock for this. */ #define ATSE_ETHERNET_OPTION_BITS_UNDEF 0 #define ATSE_ETHERNET_OPTION_BITS_READ 1 static int atse_ethernet_option_bits_flag = ATSE_ETHERNET_OPTION_BITS_UNDEF; static uint8_t atse_ethernet_option_bits[ALTERA_ETHERNET_OPTION_BITS_LEN]; -static int atse_intr_debug_enable = 0; -SYSCTL_INT(_debug, OID_AUTO, atse_intr_debug_enable, CTLFLAG_RW, - &atse_intr_debug_enable, 0, - "Extra debugging output for atse interrupts"); - /* * Softc and critical resource locking. */ @@ -118,155 +111,15 @@ SYSCTL_INT(_debug, OID_AUTO, atse_intr_debug_enable, C #define ATSE_UNLOCK(_sc) mtx_unlock(&(_sc)->atse_mtx) #define ATSE_LOCK_ASSERT(_sc) mtx_assert(&(_sc)->atse_mtx, MA_OWNED) -#define ATSE_TX_PENDING(sc) (sc->atse_tx_m != NULL || \ - !IFQ_DRV_IS_EMPTY(&ifp->if_snd)) +#define ATSE_DEBUG +#undef ATSE_DEBUG -#ifdef DEBUG +#ifdef ATSE_DEBUG #define DPRINTF(format, ...) printf(format, __VA_ARGS__) #else #define DPRINTF(format, ...) #endif -/* a_api.c functions; factor out? */ -static inline void -a_onchip_fifo_mem_core_write(struct resource *res, uint32_t off, - uint32_t val4, const char *desc, const char *f, const int l) -{ - - val4 = htole32(val4); - DPRINTF("[%s:%d] FIFOW %s 0x%08x = 0x%08x\n", f, l, desc, off, val4); - bus_write_4(res, off, val4); -} - -static inline uint32_t -a_onchip_fifo_mem_core_read(struct resource *res, uint32_t off, - const char *desc, const char *f, const int l) -{ - uint32_t val4; - - val4 = le32toh(bus_read_4(res, off)); - DPRINTF("[%s:%d] FIFOR %s 0x%08x = 0x%08x\n", f, l, desc, off, val4); - - return (val4); -} - -/* The FIFO does an endian conversion, so we must not do it as well. */ -/* XXX-BZ in fact we should do a htobe32 so le would be fine as well? */ -#define ATSE_TX_DATA_WRITE(sc, val4) \ - bus_write_4((sc)->atse_tx_mem_res, A_ONCHIP_FIFO_MEM_CORE_DATA, val4) - -#define ATSE_TX_META_WRITE(sc, val4) \ - a_onchip_fifo_mem_core_write((sc)->atse_tx_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_METADATA, \ - (val4), "TXM", __func__, __LINE__) -#define ATSE_TX_META_READ(sc) \ - a_onchip_fifo_mem_core_read((sc)->atse_tx_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_METADATA, \ - "TXM", __func__, __LINE__) - -#define ATSE_TX_READ_FILL_LEVEL(sc) \ - a_onchip_fifo_mem_core_read((sc)->atse_txc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_FILL_LEVEL, \ - "TX_FILL", __func__, __LINE__) -#define ATSE_RX_READ_FILL_LEVEL(sc) \ - a_onchip_fifo_mem_core_read((sc)->atse_rxc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_FILL_LEVEL, \ - "RX_FILL", __func__, __LINE__) - -/* The FIFO does an endian conversion, so we must not do it as well. */ -/* XXX-BZ in fact we should do a htobe32 so le would be fine as well? */ -#define ATSE_RX_DATA_READ(sc) \ - bus_read_4((sc)->atse_rx_mem_res, A_ONCHIP_FIFO_MEM_CORE_DATA) -#define ATSE_RX_META_READ(sc) \ - a_onchip_fifo_mem_core_read((sc)->atse_rx_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_METADATA, \ - "RXM", __func__, __LINE__) - -#define ATSE_RX_STATUS_READ(sc) \ - a_onchip_fifo_mem_core_read((sc)->atse_rxc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_I_STATUS, \ - "RX_EVENT", __func__, __LINE__) - -#define ATSE_TX_STATUS_READ(sc) \ - a_onchip_fifo_mem_core_read((sc)->atse_txc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_I_STATUS, \ - "TX_EVENT", __func__, __LINE__) - -#define ATSE_RX_EVENT_READ(sc) \ - a_onchip_fifo_mem_core_read((sc)->atse_rxc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_EVENT, \ - "RX_EVENT", __func__, __LINE__) - -#define ATSE_TX_EVENT_READ(sc) \ - a_onchip_fifo_mem_core_read((sc)->atse_txc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_EVENT, \ - "TX_EVENT", __func__, __LINE__) - -#define ATSE_RX_EVENT_CLEAR(sc) \ - do { \ - uint32_t val4; \ - \ - val4 = a_onchip_fifo_mem_core_read( \ - (sc)->atse_rxc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_EVENT, \ - "RX_EVENT", __func__, __LINE__); \ - if (val4 != 0x00) \ - a_onchip_fifo_mem_core_write( \ - (sc)->atse_rxc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_EVENT, \ - val4, "RX_EVENT", __func__, __LINE__); \ - } while(0) -#define ATSE_TX_EVENT_CLEAR(sc) \ - do { \ - uint32_t val4; \ - \ - val4 = a_onchip_fifo_mem_core_read( \ - (sc)->atse_txc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_EVENT, \ - "TX_EVENT", __func__, __LINE__); \ - if (val4 != 0x00) \ - a_onchip_fifo_mem_core_write( \ - (sc)->atse_txc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_EVENT, \ - val4, "TX_EVENT", __func__, __LINE__); \ - } while(0) - -#define ATSE_RX_EVENTS (A_ONCHIP_FIFO_MEM_CORE_INTR_FULL | \ - A_ONCHIP_FIFO_MEM_CORE_INTR_OVERFLOW | \ - A_ONCHIP_FIFO_MEM_CORE_INTR_UNDERFLOW) -#define ATSE_RX_INTR_ENABLE(sc) \ - a_onchip_fifo_mem_core_write((sc)->atse_rxc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_INT_ENABLE, \ - ATSE_RX_EVENTS, \ - "RX_INTR", __func__, __LINE__) /* XXX-BZ review later. */ -#define ATSE_RX_INTR_DISABLE(sc) \ - a_onchip_fifo_mem_core_write((sc)->atse_rxc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_INT_ENABLE, 0, \ - "RX_INTR", __func__, __LINE__) -#define ATSE_RX_INTR_READ(sc) \ - a_onchip_fifo_mem_core_read((sc)->atse_rxc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_INT_ENABLE, \ - "RX_INTR", __func__, __LINE__) - -#define ATSE_TX_EVENTS (A_ONCHIP_FIFO_MEM_CORE_INTR_EMPTY | \ - A_ONCHIP_FIFO_MEM_CORE_INTR_OVERFLOW | \ - A_ONCHIP_FIFO_MEM_CORE_INTR_UNDERFLOW) -#define ATSE_TX_INTR_ENABLE(sc) \ - a_onchip_fifo_mem_core_write((sc)->atse_txc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_INT_ENABLE, \ - ATSE_TX_EVENTS, \ - "TX_INTR", __func__, __LINE__) /* XXX-BZ review later. */ -#define ATSE_TX_INTR_DISABLE(sc) \ - a_onchip_fifo_mem_core_write((sc)->atse_txc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_INT_ENABLE, 0, \ - "TX_INTR", __func__, __LINE__) -#define ATSE_TX_INTR_READ(sc) \ - a_onchip_fifo_mem_core_read((sc)->atse_txc_mem_res, \ - A_ONCHIP_FIFO_MEM_CORE_STATUS_REG_INT_ENABLE, \ - "TX_INTR", __func__, __LINE__) - -static int atse_rx_locked(struct atse_softc *sc); - /* * Register space access macros. */ @@ -345,146 +198,194 @@ static int atse_detach(device_t); devclass_t atse_devclass; static int -atse_tx_locked(struct atse_softc *sc, int *sent) +atse_rx_enqueue(struct atse_softc *sc, uint32_t n) { struct mbuf *m; - uint32_t val4, fill_level; - int leftm; - int c; + int i; - ATSE_LOCK_ASSERT(sc); + for (i = 0; i < n; i++) { + m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); + if (m == NULL) { + device_printf(sc->dev, + "%s: Can't alloc rx mbuf\n", __func__); + return (-1); + } - m = sc->atse_tx_m; - KASSERT(m != NULL, ("%s: m is null: sc=%p", __func__, sc)); - KASSERT(m->m_flags & M_PKTHDR, ("%s: not a pkthdr: m=%p", __func__, m)); - - /* - * Copy to buffer to minimize our pain as we can only store - * double words which, after the first mbuf gets out of alignment - * quite quickly. - */ - if (sc->atse_tx_m_offset == 0) { - m_copydata(m, 0, m->m_pkthdr.len, sc->atse_tx_buf); - sc->atse_tx_buf_len = m->m_pkthdr.len; + m->m_pkthdr.len = m->m_len = m->m_ext.ext_size; + xdma_enqueue_mbuf(sc->xchan_rx, &m, 0, 4, 4, XDMA_DEV_TO_MEM); } - fill_level = ATSE_TX_READ_FILL_LEVEL(sc); -#if 0 /* Returns 0xdeadc0de. */ - val4 = ATSE_TX_META_READ(sc); -#endif - if (sc->atse_tx_m_offset == 0) { - /* Write start of packet. */ - val4 = A_ONCHIP_FIFO_MEM_CORE_SOP; - val4 &= ~A_ONCHIP_FIFO_MEM_CORE_EOP; - ATSE_TX_META_WRITE(sc, val4); + return (0); +} + +static int +atse_xdma_tx_intr(void *arg, xdma_transfer_status_t *status) +{ + xdma_transfer_status_t st; + struct atse_softc *sc; + struct ifnet *ifp; + struct mbuf *m; + int err; + + sc = arg; + + ATSE_LOCK(sc); + + ifp = sc->atse_ifp; + + for (;;) { + err = xdma_dequeue_mbuf(sc->xchan_tx, &m, &st); + if (err != 0) { + break; + } + + if (st.error != 0) { + if_inc_counter(ifp, IFCOUNTER_OERRORS, 1); + } + + m_freem(m); + sc->txcount--; } - /* TX FIFO is single clock mode, so we have the full FIFO. */ - c = 0; - while ((sc->atse_tx_buf_len - sc->atse_tx_m_offset) > 4 && - fill_level < AVALON_FIFO_TX_BASIC_OPTS_DEPTH) { + ifp->if_drv_flags &= ~IFF_DRV_OACTIVE; - bcopy(&sc->atse_tx_buf[sc->atse_tx_m_offset], &val4, - sizeof(val4)); - ATSE_TX_DATA_WRITE(sc, val4); - sc->atse_tx_m_offset += sizeof(val4); - c += sizeof(val4); + ATSE_UNLOCK(sc); - fill_level++; - if (fill_level == AVALON_FIFO_TX_BASIC_OPTS_DEPTH) - fill_level = ATSE_TX_READ_FILL_LEVEL(sc); + return (0); +} + +static int +atse_xdma_rx_intr(void *arg, xdma_transfer_status_t *status) +{ + xdma_transfer_status_t st; + struct atse_softc *sc; + struct ifnet *ifp; + struct mbuf *m; + int err; + uint32_t cnt_processed; + + sc = arg; + + ATSE_LOCK(sc); + + ifp = sc->atse_ifp; + + cnt_processed = 0; + for (;;) { + err = xdma_dequeue_mbuf(sc->xchan_rx, &m, &st); + if (err != 0) { + break; + } + cnt_processed++; + + if (st.error != 0) { + if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); + m_freem(m); + continue; + } + + m->m_pkthdr.len = m->m_len = st.transferred; + m->m_pkthdr.rcvif = ifp; + m_adj(m, ETHER_ALIGN); + ATSE_UNLOCK(sc); + (*ifp->if_input)(ifp, m); + ATSE_LOCK(sc); } - if (sent != NULL) - *sent += c; - /* Set EOP *before* writing the last symbol. */ - if (sc->atse_tx_m_offset >= (sc->atse_tx_buf_len - 4) && - fill_level < AVALON_FIFO_TX_BASIC_OPTS_DEPTH) { + atse_rx_enqueue(sc, cnt_processed); - /* Set EndOfPacket. */ - val4 = A_ONCHIP_FIFO_MEM_CORE_EOP; + ATSE_UNLOCK(sc); - /* Set EMPTY. */ - leftm = sc->atse_tx_buf_len - sc->atse_tx_m_offset; - val4 |= ((4 - leftm) << A_ONCHIP_FIFO_MEM_CORE_EMPTY_SHIFT); - ATSE_TX_META_WRITE(sc, val4); + return (0); +} - /* Write last symbol. */ - val4 = 0; - bcopy(sc->atse_tx_buf + sc->atse_tx_m_offset, &val4, leftm); - ATSE_TX_DATA_WRITE(sc, val4); +static int +atse_transmit_locked(struct ifnet *ifp) +{ + struct atse_softc *sc; + struct mbuf *m; + struct buf_ring *br; + int error; + int enq; - if (sent != NULL) - *sent += leftm; + sc = ifp->if_softc; + br = sc->br; - /* OK, the packet is gone. */ - sc->atse_tx_m = NULL; - sc->atse_tx_m_offset = 0; + enq = 0; + while ((m = drbr_peek(ifp, br)) != NULL) { + error = xdma_enqueue_mbuf(sc->xchan_tx, &m, 0, 4, 4, XDMA_MEM_TO_DEV); + if (error != 0) { + /* No space in request queue available yet. */ + drbr_putback(ifp, br, m); + break; + } + + drbr_advance(ifp, br); + + sc->txcount++; + enq++; + /* If anyone is interested give them a copy. */ - BPF_MTAP(sc->atse_ifp, m); + ETHER_BPF_MTAP(ifp, m); + } - m_freem(m); - return (0); - } + if (enq > 0) + xdma_queue_submit(sc->xchan_tx); - return (EBUSY); + return (0); } -static void -atse_start_locked(struct ifnet *ifp) +static int +atse_transmit(struct ifnet *ifp, struct mbuf *m) { struct atse_softc *sc; - int error, sent; + struct buf_ring *br; + int error; sc = ifp->if_softc; - ATSE_LOCK_ASSERT(sc); + br = sc->br; - if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != - IFF_DRV_RUNNING || (sc->atse_flags & ATSE_FLAGS_LINK) == 0) - return; + ATSE_LOCK(sc); -#if 1 - /* - * Disable the watchdog while sending, we are batching packets. - * Though we should never reach 5 seconds, and are holding the lock, - * but who knows. - */ - sc->atse_watchdog_timer = 0; -#endif + mtx_lock(&sc->br_mtx); - if (sc->atse_tx_m != NULL) { - error = atse_tx_locked(sc, &sent); - if (error != 0) - goto done; + if ((ifp->if_drv_flags & (IFF_DRV_RUNNING | IFF_DRV_OACTIVE)) != IFF_DRV_RUNNING) { + error = drbr_enqueue(ifp, sc->br, m); + mtx_unlock(&sc->br_mtx); + ATSE_UNLOCK(sc); + return (error); } - /* We have more space to send so continue ... */ - for (; !IFQ_DRV_IS_EMPTY(&ifp->if_snd); ) { - IFQ_DRV_DEQUEUE(&ifp->if_snd, sc->atse_tx_m); - sc->atse_tx_m_offset = 0; - if (sc->atse_tx_m == NULL) - break; - error = atse_tx_locked(sc, &sent); - if (error != 0) - goto done; + if ((sc->atse_flags & ATSE_FLAGS_LINK) == 0) { + error = drbr_enqueue(ifp, sc->br, m); + mtx_unlock(&sc->br_mtx); + ATSE_UNLOCK(sc); + return (error); } -done: - /* If the IP core walks into Nekromanteion try to bail out. */ - if (sent > 0) - sc->atse_watchdog_timer = ATSE_WATCHDOG_TIME; + error = drbr_enqueue(ifp, br, m); + if (error) { + mtx_unlock(&sc->br_mtx); + ATSE_UNLOCK(sc); + return (error); + } + error = atse_transmit_locked(ifp); + + mtx_unlock(&sc->br_mtx); + ATSE_UNLOCK(sc); + + return (error); } static void -atse_start(struct ifnet *ifp) +atse_qflush(struct ifnet *ifp) { struct atse_softc *sc; sc = ifp->if_softc; - ATSE_LOCK(sc); - atse_start_locked(ifp); - ATSE_UNLOCK(sc); + + printf("%s\n", __func__); } static int @@ -496,36 +397,33 @@ atse_stop_locked(struct atse_softc *sc) ATSE_LOCK_ASSERT(sc); - sc->atse_watchdog_timer = 0; callout_stop(&sc->atse_tick); ifp = sc->atse_ifp; ifp->if_drv_flags &= ~(IFF_DRV_RUNNING | IFF_DRV_OACTIVE); - ATSE_RX_INTR_DISABLE(sc); - ATSE_TX_INTR_DISABLE(sc); - ATSE_RX_EVENT_CLEAR(sc); - ATSE_TX_EVENT_CLEAR(sc); /* Disable MAC transmit and receive datapath. */ mask = BASE_CFG_COMMAND_CONFIG_TX_ENA|BASE_CFG_COMMAND_CONFIG_RX_ENA; val4 = CSR_READ_4(sc, BASE_CFG_COMMAND_CONFIG); val4 &= ~mask; CSR_WRITE_4(sc, BASE_CFG_COMMAND_CONFIG, val4); + /* Wait for bits to be cleared; i=100 is excessive. */ for (i = 0; i < 100; i++) { val4 = CSR_READ_4(sc, BASE_CFG_COMMAND_CONFIG); - if ((val4 & mask) == 0) + if ((val4 & mask) == 0) { break; + } DELAY(10); } - if ((val4 & mask) != 0) + + if ((val4 & mask) != 0) { device_printf(sc->atse_dev, "Disabling MAC TX/RX timed out.\n"); /* Punt. */ + } sc->atse_flags &= ~ATSE_FLAGS_LINK; - /* XXX-BZ free the RX/TX rings. */ - return (0); } @@ -561,10 +459,11 @@ atse_rxfilter_locked(struct atse_softc *sc) val4 &= ~BASE_CFG_COMMAND_CONFIG_MHASH_SEL; ifp = sc->atse_ifp; - if (ifp->if_flags & IFF_PROMISC) + if (ifp->if_flags & IFF_PROMISC) { val4 |= BASE_CFG_COMMAND_CONFIG_PROMIS_EN; - else + } else { val4 &= ~BASE_CFG_COMMAND_CONFIG_PROMIS_EN; + } CSR_WRITE_4(sc, BASE_CFG_COMMAND_CONFIG, val4); @@ -587,16 +486,18 @@ atse_rxfilter_locked(struct atse_softc *sc) */ if_maddr_rlock(ifp); TAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_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); - for (i = 0; i <= MHASH_LEN; i++) + for (i = 0; i <= MHASH_LEN; i++) { CSR_WRITE_4(sc, MHASH_START + i, (h & (1 << i)) ? 0x01 : 0x00); + } } return (0); @@ -609,22 +510,26 @@ atse_ethernet_option_bits_read_fdt(device_t dev) device_t fdev; int i, rid; - if (atse_ethernet_option_bits_flag & ATSE_ETHERNET_OPTION_BITS_READ) + if (atse_ethernet_option_bits_flag & ATSE_ETHERNET_OPTION_BITS_READ) { return (0); + } fdev = device_find_child(device_get_parent(dev), "cfi", 0); - if (fdev == NULL) + if (fdev == NULL) { return (ENOENT); + } rid = 0; res = bus_alloc_resource_any(fdev, SYS_RES_MEMORY, &rid, RF_ACTIVE | RF_SHAREABLE); - if (res == NULL) + if (res == NULL) { return (ENXIO); + } - for (i = 0; i < ALTERA_ETHERNET_OPTION_BITS_LEN; i++) + for (i = 0; i < ALTERA_ETHERNET_OPTION_BITS_LEN; i++) { atse_ethernet_option_bits[i] = bus_read_1(res, ALTERA_ETHERNET_OPTION_BITS_OFF + i); + } bus_release_resource(fdev, SYS_RES_MEMORY, rid, res); atse_ethernet_option_bits_flag |= ATSE_ETHERNET_OPTION_BITS_READ; @@ -658,12 +563,14 @@ atse_get_eth_address(struct atse_softc *sc) * possibly change our ethernet address, which is not good at all. */ if (sc->atse_eth_addr[0] != 0x00 || sc->atse_eth_addr[1] != 0x00 || - sc->atse_eth_addr[2] != 0x00) + sc->atse_eth_addr[2] != 0x00) { return (0); + } if ((atse_ethernet_option_bits_flag & - ATSE_ETHERNET_OPTION_BITS_READ) == 0) + ATSE_ETHERNET_OPTION_BITS_READ) == 0) { goto get_random; + } val4 = atse_ethernet_option_bits[0] << 24; val4 |= atse_ethernet_option_bits[1] << 16; @@ -718,8 +625,9 @@ atse_get_eth_address(struct atse_softc *sc) * Ethernet, go to random. */ unit = device_get_unit(sc->atse_dev); - if (unit == 0x00) + if (unit == 0x00) { return (0); + } if (unit > 0x0f) { device_printf(sc->atse_dev, "We do not support Ethernet " @@ -831,8 +739,9 @@ atse_reset(struct atse_softc *sc) /* Wait for reset bit to clear; i=100 is excessive. */ for (i = 0; i < 100; i++) { val = PCS_READ_2(sc, PCS_CONTROL); - if ((val & PCS_CONTROL_RESET) == 0) + if ((val & PCS_CONTROL_RESET) == 0) { break; + } DELAY(10); } @@ -851,8 +760,9 @@ atse_reset(struct atse_softc *sc) /* Wait for bits to be cleared; i=100 is excessive. */ for (i = 0; i < 100; i++) { val4 = CSR_READ_4(sc, BASE_CFG_COMMAND_CONFIG); - if ((val4 & mask) == 0) + if ((val4 & mask) == 0) { break; + } DELAY(10); } if ((val4 & mask) != 0) { @@ -926,8 +836,10 @@ atse_reset(struct atse_softc *sc) val4 = CSR_READ_4(sc, TX_CMD_STAT); val4 &= ~(TX_CMD_STAT_OMIT_CRC|TX_CMD_STAT_TX_SHIFT16); CSR_WRITE_4(sc, TX_CMD_STAT, val4); + val4 = CSR_READ_4(sc, RX_CMD_STAT); val4 &= ~RX_CMD_STAT_RX_SHIFT16; + val4 |= RX_CMD_STAT_RX_SHIFT16; CSR_WRITE_4(sc, RX_CMD_STAT, val4); /* e. Reset MAC. */ @@ -937,8 +849,9 @@ atse_reset(struct atse_softc *sc) /* Wait for bits to be cleared; i=100 is excessive. */ for (i = 0; i < 100; i++) { val4 = CSR_READ_4(sc, BASE_CFG_COMMAND_CONFIG); - if ((val4 & BASE_CFG_COMMAND_CONFIG_SW_RESET) == 0) + if ((val4 & BASE_CFG_COMMAND_CONFIG_SW_RESET) == 0) { break; + } DELAY(10); } if ((val4 & BASE_CFG_COMMAND_CONFIG_SW_RESET) != 0) { @@ -954,8 +867,9 @@ atse_reset(struct atse_softc *sc) /* Wait for bits to be cleared; i=100 is excessive. */ for (i = 0; i < 100; i++) { val4 = CSR_READ_4(sc, BASE_CFG_COMMAND_CONFIG); - if ((val4 & mask) == mask) + if ((val4 & mask) == mask) { break; + } DELAY(10); } if ((val4 & mask) != mask) { @@ -976,8 +890,9 @@ atse_init_locked(struct atse_softc *sc) ATSE_LOCK_ASSERT(sc); ifp = sc->atse_ifp; - if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) + if ((ifp->if_drv_flags & IFF_DRV_RUNNING) != 0) { return; + } /* * Must update the ether address if changed. Given we do not handle @@ -989,31 +904,14 @@ atse_init_locked(struct atse_softc *sc) /* Make things frind to halt, cleanup, ... */ atse_stop_locked(sc); - /* ... reset, ... */ + atse_reset(sc); /* ... and fire up the engine again. */ atse_rxfilter_locked(sc); - /* Memory rings? DMA engine? */ - - sc->atse_rx_buf_len = 0; sc->atse_flags &= ATSE_FLAGS_LINK; /* Preserve. */ -#ifdef DEVICE_POLLING - /* Only enable interrupts if we are not polling. */ - if (ifp->if_capenable & IFCAP_POLLING) { - ATSE_RX_INTR_DISABLE(sc); - ATSE_TX_INTR_DISABLE(sc); - ATSE_RX_EVENT_CLEAR(sc); - ATSE_TX_EVENT_CLEAR(sc); - } else -#endif - { - ATSE_RX_INTR_ENABLE(sc); - ATSE_TX_INTR_ENABLE(sc); - } - mii = device_get_softc(sc->atse_miibus); sc->atse_flags &= ~ATSE_FLAGS_LINK; @@ -1070,39 +968,6 @@ atse_ioctl(struct ifnet *ifp, u_long command, caddr_t case SIOCSIFCAP: ATSE_LOCK(sc); mask = ifr->ifr_reqcap ^ ifp->if_capenable; -#ifdef DEVICE_POLLING - if ((mask & IFCAP_POLLING) != 0 && - (IFCAP_POLLING & ifp->if_capabilities) != 0) { - ifp->if_capenable ^= IFCAP_POLLING; - if ((IFCAP_POLLING & ifp->if_capenable) != 0) { - - error = ether_poll_register(atse_poll, ifp); - if (error != 0) { - ATSE_UNLOCK(sc); - break; - } - /* Disable interrupts. */ - ATSE_RX_INTR_DISABLE(sc); - ATSE_TX_INTR_DISABLE(sc); - ATSE_RX_EVENT_CLEAR(sc); - ATSE_TX_EVENT_CLEAR(sc); - - /* - * Do not allow disabling of polling if we do - * not have interrupts. - */ - } else if (sc->atse_rx_irq_res != NULL || - sc->atse_tx_irq_res != NULL) { - error = ether_poll_deregister(ifp); - /* Enable interrupts. */ - ATSE_RX_INTR_ENABLE(sc); - ATSE_TX_INTR_ENABLE(sc); - } else { - ifp->if_capenable ^= IFCAP_POLLING; - error = EINVAL; - } - } -#endif /* DEVICE_POLLING */ ATSE_UNLOCK(sc); break; case SIOCADDMULTI: @@ -1131,55 +996,6 @@ atse_ioctl(struct ifnet *ifp, u_long command, caddr_t } static void -atse_intr_debug(struct atse_softc *sc, const char *intrname) -{ - uint32_t rxs, rxe, rxi, rxf, txs, txe, txi, txf; - - if (!atse_intr_debug_enable) - return; - - rxs = ATSE_RX_STATUS_READ(sc); - rxe = ATSE_RX_EVENT_READ(sc); - rxi = ATSE_RX_INTR_READ(sc); - rxf = ATSE_RX_READ_FILL_LEVEL(sc); - - txs = ATSE_TX_STATUS_READ(sc); - txe = ATSE_TX_EVENT_READ(sc); - txi = ATSE_TX_INTR_READ(sc); - txf = ATSE_TX_READ_FILL_LEVEL(sc); - - printf( - "%s - %s: " - "rxs 0x%x rxe 0x%x rxi 0x%x rxf 0x%x " - "txs 0x%x txe 0x%x txi 0x%x txf 0x%x\n", - __func__, intrname, - rxs, rxe, rxi, rxf, - txs, txe, txi, txf); -} - -static void -atse_watchdog(struct atse_softc *sc) -{ - - ATSE_LOCK_ASSERT(sc); - - if (sc->atse_watchdog_timer == 0 || --sc->atse_watchdog_timer > 0) - return; - - device_printf(sc->atse_dev, "watchdog timeout\n"); - if_inc_counter(sc->atse_ifp, IFCOUNTER_OERRORS, 1); - - atse_intr_debug(sc, "poll"); - - sc->atse_ifp->if_drv_flags &= ~IFF_DRV_RUNNING; - atse_init_locked(sc); - - atse_rx_locked(sc); - if (!IFQ_DRV_IS_EMPTY(&sc->atse_ifp->if_snd)) - atse_start_locked(sc->atse_ifp); -} - -static void atse_tick(void *xsc) { struct atse_softc *sc; @@ -1192,9 +1008,10 @@ atse_tick(void *xsc) mii = device_get_softc(sc->atse_miibus); mii_tick(mii); - atse_watchdog(sc); - if ((sc->atse_flags & ATSE_FLAGS_LINK) == 0) + if ((sc->atse_flags & ATSE_FLAGS_LINK) == 0) { atse_miibus_statchg(sc->atse_dev); + } + callout_reset(&sc->atse_tick, hz, atse_tick, sc); } @@ -1213,171 +1030,15 @@ atse_ifmedia_upd(struct ifnet *ifp) ATSE_LOCK(sc); mii = device_get_softc(sc->atse_miibus); - LIST_FOREACH(miisc, &mii->mii_phys, mii_list) + LIST_FOREACH(miisc, &mii->mii_phys, mii_list) { PHY_RESET(miisc); + } error = mii_mediachg(mii); ATSE_UNLOCK(sc); return (error); } -static void -atse_update_rx_err(struct atse_softc *sc, uint32_t mask) -{ - int i; - - /* RX error are 6 bits, we only know 4 of them. */ - for (i = 0; i < ATSE_RX_ERR_MAX; i++) - if ((mask & (1 << i)) != 0) - sc->atse_rx_err[i]++; -} - -static int -atse_rx_locked(struct atse_softc *sc) -{ - uint32_t fill, i, j; - uint32_t data, meta; - struct ifnet *ifp; - struct mbuf *m; - int rx_npkts; - - ATSE_LOCK_ASSERT(sc); - - ifp = sc->atse_ifp; - rx_npkts = 0; - j = 0; - meta = 0; - do { -outer: - if (sc->atse_rx_m == NULL) { - m = m_getcl(M_NOWAIT, MT_DATA, M_PKTHDR); - if (m == NULL) - return (rx_npkts); - m->m_len = m->m_pkthdr.len = MCLBYTES; - /* Make sure upper layers will be aligned. */ - m_adj(m, ETHER_ALIGN); - sc->atse_rx_m = m; - } - - fill = ATSE_RX_READ_FILL_LEVEL(sc); - for (i = 0; i < fill; i++) { - /* - * XXX-BZ for whatever reason the FIFO requires the - * the data read before we can access the meta data. - */ - data = ATSE_RX_DATA_READ(sc); - meta = ATSE_RX_META_READ(sc); - if (meta & A_ONCHIP_FIFO_MEM_CORE_ERROR_MASK) { - /* XXX-BZ evaluate error. */ - atse_update_rx_err(sc, ((meta & - A_ONCHIP_FIFO_MEM_CORE_ERROR_MASK) >> - A_ONCHIP_FIFO_MEM_CORE_ERROR_SHIFT) & 0xff); - if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); - sc->atse_rx_buf_len = 0; - /* - * Should still read till EOP or next SOP. - * - * XXX-BZ might also depend on - * BASE_CFG_COMMAND_CONFIG_RX_ERR_DISC - */ - sc->atse_flags |= ATSE_FLAGS_ERROR; - return (rx_npkts); - } - if ((meta & A_ONCHIP_FIFO_MEM_CORE_CHANNEL_MASK) != 0) - device_printf(sc->atse_dev, "%s: unexpected " - "channel %u\n", __func__, (meta & - A_ONCHIP_FIFO_MEM_CORE_CHANNEL_MASK) >> - A_ONCHIP_FIFO_MEM_CORE_CHANNEL_SHIFT); - - if (meta & A_ONCHIP_FIFO_MEM_CORE_SOP) { - /* - * There is no need to clear SOP between 1st - * and subsequent packet data junks. - */ - if (sc->atse_rx_buf_len != 0 && - (sc->atse_flags & ATSE_FLAGS_SOP_SEEN) == 0) - { - device_printf(sc->atse_dev, "%s: SOP " - "without empty buffer: %u\n", - __func__, sc->atse_rx_buf_len); - /* XXX-BZ any better counter? */ - if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); - } - - if ((sc->atse_flags & ATSE_FLAGS_SOP_SEEN) == 0) - { - sc->atse_flags |= ATSE_FLAGS_SOP_SEEN; - sc->atse_rx_buf_len = 0; - } - } -#if 0 /* We had to read the data before we could access meta data. See above. */ - data = ATSE_RX_DATA_READ(sc); -#endif - /* Make sure to not overflow the mbuf data size. */ - if (sc->atse_rx_buf_len >= sc->atse_rx_m->m_len - - sizeof(data)) { - /* - * XXX-BZ Error. We need more mbufs and are - * not setup for this yet. - */ - if_inc_counter(ifp, IFCOUNTER_IERRORS, 1); - sc->atse_flags |= ATSE_FLAGS_ERROR; - } - if ((sc->atse_flags & ATSE_FLAGS_ERROR) == 0) - /* - * MUST keep this bcopy as m_data after m_adj - * for IP header aligment is on half-word - * and not word alignment. - */ - bcopy(&data, (uint8_t *)(sc->atse_rx_m->m_data + - sc->atse_rx_buf_len), sizeof(data)); - if (meta & A_ONCHIP_FIFO_MEM_CORE_EOP) { - uint8_t empty; - - empty = (meta & - A_ONCHIP_FIFO_MEM_CORE_EMPTY_MASK) >> - A_ONCHIP_FIFO_MEM_CORE_EMPTY_SHIFT; - sc->atse_rx_buf_len += (4 - empty); - - if_inc_counter(ifp, IFCOUNTER_IPACKETS, 1); - rx_npkts++; - - m = sc->atse_rx_m; - m->m_pkthdr.len = m->m_len = - sc->atse_rx_buf_len; - sc->atse_rx_m = NULL; - - sc->atse_rx_buf_len = 0; - sc->atse_flags &= ~ATSE_FLAGS_SOP_SEEN; - if (sc->atse_flags & ATSE_FLAGS_ERROR) { - sc->atse_flags &= ~ATSE_FLAGS_ERROR; - m_freem(m); - } else { - m->m_pkthdr.rcvif = ifp; - ATSE_UNLOCK(sc); - (*ifp->if_input)(ifp, m); - ATSE_LOCK(sc); - } -#ifdef DEVICE_POLLING - if (ifp->if_capenable & IFCAP_POLLING) { - if (sc->atse_rx_cycles <= 0) - return (rx_npkts); - sc->atse_rx_cycles--; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Apr 13 16:13:59 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B4531F9411F; Fri, 13 Apr 2018 16:13:59 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5EC7E86E87; Fri, 13 Apr 2018 16:13:59 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 566CE1C025; Fri, 13 Apr 2018 16:13:59 +0000 (UTC) (envelope-from ae@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3DGDxQn024584; Fri, 13 Apr 2018 16:13:59 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DGDxtE024583; Fri, 13 Apr 2018 16:13:59 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201804131613.w3DGDxtE024583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Fri, 13 Apr 2018 16:13:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332475 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: ae X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 332475 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 16:13:59 -0000 Author: ae Date: Fri Apr 13 16:13:59 2018 New Revision: 332475 URL: https://svnweb.freebsd.org/changeset/base/332475 Log: Add check that mbuf had not multicast layer2 address. Such packets should be handled by ip6_mforward(). Obtained from: Yandex LLC MFC after: 1 week Sponsored by: Yandex LLC Modified: head/sys/netinet6/ip6_fastfwd.c Modified: head/sys/netinet6/ip6_fastfwd.c ============================================================================== --- head/sys/netinet6/ip6_fastfwd.c Fri Apr 13 15:59:24 2018 (r332474) +++ head/sys/netinet6/ip6_fastfwd.c Fri Apr 13 16:13:59 2018 (r332475) @@ -97,7 +97,8 @@ ip6_tryforward(struct mbuf *m) * Fallback conditions to ip6_input for slow path processing. */ ip6 = mtod(m, struct ip6_hdr *); - if (ip6->ip6_nxt == IPPROTO_HOPOPTS || + if ((m->m_flags & (M_BCAST | M_MCAST)) != 0 || + ip6->ip6_nxt == IPPROTO_HOPOPTS || IN6_IS_ADDR_MULTICAST(&ip6->ip6_dst) || IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_dst) || IN6_IS_ADDR_LINKLOCAL(&ip6->ip6_src) || From owner-svn-src-head@freebsd.org Fri Apr 13 16:45:36 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A0499F96040; Fri, 13 Apr 2018 16:45:36 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4D74D6E170; Fri, 13 Apr 2018 16:45:36 +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 445821C4C6; Fri, 13 Apr 2018 16:45:36 +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 w3DGjatO039450; Fri, 13 Apr 2018 16:45:36 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DGjawS039449; Fri, 13 Apr 2018 16:45:36 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201804131645.w3DGjawS039449@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 13 Apr 2018 16:45:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332476 - head/sys/cam/scsi X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/cam/scsi X-SVN-Commit-Revision: 332476 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 16:45:36 -0000 Author: imp Date: Fri Apr 13 16:45:35 2018 New Revision: 332476 URL: https://svnweb.freebsd.org/changeset/base/332476 Log: Just assert that the lock is held here, rather than taking it out and dropping it. Sponsored by: Netflix Modified: head/sys/cam/scsi/scsi_da.c Modified: head/sys/cam/scsi/scsi_da.c ============================================================================== --- head/sys/cam/scsi/scsi_da.c Fri Apr 13 16:13:59 2018 (r332475) +++ head/sys/cam/scsi/scsi_da.c Fri Apr 13 16:45:35 2018 (r332476) @@ -4652,9 +4652,8 @@ dadone(struct cam_periph *periph, union ccb *done_ccb) (error_code == SSD_CURRENT_ERROR || error_code == SSD_DESC_CURRENT_ERROR) && (sense_key == SSD_KEY_ILLEGAL_REQUEST)))) { - cam_periph_lock(periph); + cam_periph_assert(periph, MA_OWNED); softc->flags &= ~DA_FLAG_CAN_RC16; - cam_periph_unlock(periph); free(rdcap, M_SCSIDA); xpt_release_ccb(done_ccb); softc->state = DA_STATE_PROBE_RC; From owner-svn-src-head@freebsd.org Fri Apr 13 16:54:50 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 82C24F969AF; Fri, 13 Apr 2018 16:54:50 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 357F770F33; Fri, 13 Apr 2018 16:54:50 +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 3028B1C675; Fri, 13 Apr 2018 16:54:50 +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 w3DGsoVC044780; Fri, 13 Apr 2018 16:54:50 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DGsn6V044778; Fri, 13 Apr 2018 16:54:49 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804131654.w3DGsn6V044778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 13 Apr 2018 16:54:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332478 - head/share/vt/fonts X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/vt/fonts X-SVN-Commit-Revision: 332478 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 16:54:50 -0000 Author: emaste Date: Fri Apr 13 16:54:49 2018 New Revision: 332478 URL: https://svnweb.freebsd.org/changeset/base/332478 Log: Add tom-thumb, a tiny (4x6) vt font Obtained from: https://robey.lag.net/2010/01/23/tiny-monospace-font.html MFC after: 2 weeks Added: head/share/vt/fonts/tom-thumb.hex (contents, props changed) Modified: head/share/vt/fonts/Makefile Modified: head/share/vt/fonts/Makefile ============================================================================== --- head/share/vt/fonts/Makefile Fri Apr 13 16:50:16 2018 (r332477) +++ head/share/vt/fonts/Makefile Fri Apr 13 16:54:49 2018 (r332478) @@ -2,6 +2,7 @@ FILES= gallant.fnt \ terminus-b32.fnt \ + tom-thumb.fnt \ vgarom-8x8.fnt \ vgarom-8x14.fnt \ vgarom-8x16.fnt \ Added: head/share/vt/fonts/tom-thumb.hex ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/vt/fonts/tom-thumb.hex Fri Apr 13 16:54:49 2018 (r332478) @@ -0,0 +1,212 @@ +# $FreeBSD$ +# tom-thumb by Brian Swetland and Robey Pointer +# +# To the extent possible under law, the person who associated CC0 with +# tom-thumb has waived all copyright and related or neighboring rights +# to tom-thumb. +# +# You should have received a copy of the CC0 legalcode along with this +# work. If not, see . +# +# Height: 6 +# Width: 4 +0020:000000000000 +0021:404040004000 +0022:A0A000000000 +0023:A0E0A0E0A000 +0024:60C060C04000 +0025:802040802000 +0026:C0C0E0A06000 +0027:404000000000 +0028:408080804000 +0029:804040408000 +002A:00A040A00000 +002B:0040E0400000 +002C:000000408000 +002D:0000E0000000 +002E:000000004000 +002F:202040808000 +0030:60A0A0A0C000 +0031:40C040404000 +0032:C0204080E000 +0033:C0204020C000 +0034:A0A0E0202000 +0035:E080C020C000 +0036:6080E0A0E000 +0037:E02040808000 +0038:E0A0E0A0E000 +0039:E0A0E020C000 +003A:004000400000 +003B:004000408000 +003C:204080402000 +003D:00E000E00000 +003E:804020408000 +003F:E02040004000 +0040:40A0E0806000 +0041:40A0E0A0A000 +0042:C0A0C0A0C000 +0043:608080806000 +0044:C0A0A0A0C000 +0045:E080E080E000 +0046:E080E0808000 +0047:6080E0A06000 +0048:A0A0E0A0A000 +0049:E0404040E000 +004A:202020A04000 +004B:A0A0C0A0A000 +004C:80808080E000 +004D:A0E0E0A0A000 +004E:A0E0E0E0A000 +004F:40A0A0A04000 +0050:C0A0C0808000 +0051:40A0A0E06000 +0052:C0A0E0C0A000 +0053:60804020C000 +0054:E04040404000 +0055:A0A0A0A06000 +0056:A0A0A0404000 +0057:A0A0E0E0A000 +0058:A0A040A0A000 +0059:A0A040404000 +005A:E0204080E000 +005B:E0808080E000 +005C:008040200000 +005D:E0202020E000 +005E:40A000000000 +005F:00000000E000 +0060:804000000000 +0061:00C060A0E000 +0062:80C0A0A0C000 +0063:006080806000 +0064:2060A0A06000 +0065:0060A0C06000 +0066:2040E0404000 +0067:0060A0E02040 +0068:80C0A0A0A000 +0069:400040404000 +006A:20002020A040 +006B:80A0C0C0A000 +006C:C0404040E000 +006D:00E0E0E0A000 +006E:00C0A0A0A000 +006F:0040A0A04000 +0070:00C0A0A0C080 +0071:0060A0A06020 +0072:006080808000 +0073:0060C060C000 +0074:40E040406000 +0075:00A0A0A06000 +0076:00A0A0E04000 +0077:00A0E0E0E000 +0078:00A04040A000 +0079:00A0A0602040 +007A:00E060C0E000 +007B:604080406000 +007C:404000404000 +007D:C0402040C000 +007E:60C000000000 +00A1:800080808000 +00A2:40E080E04000 +00A3:6040E040E000 +00A4:A040E040A000 +00A5:A0A040E04000 +00A6:808000808000 +00A7:6040A040C000 +00A8:A00000000000 +00A9:608060000000 +00AA:60A0E000E000 +00AB:408040000000 +00AC:E02000000000 +00AD:C00000000000 +00AE:C0C0A0000000 +00AF:E00000000000 +00B0:40A040000000 +00B1:40E04000E000 +00B2:C04060000000 +00B3:E060E0000000 +00B4:408000000000 +00B5:A0A0A0C08000 +00B6:60A060606000 +00B7:E0E0E0000000 +00B8:4020C0000000 +00B9:808080000000 +00BA:40A04000E000 +00BB:804080000000 +00BC:808000602000 +00BD:808000C06000 +00BE:C0C000602000 +00BF:40004080E000 +00C0:402040E0A000 +00C1:408040E0A000 +00C2:E00040E0A000 +00C3:60C040E0A000 +00C4:A040A0E0A000 +00C5:C0C0A0E0A000 +00C6:60C0E0C0E000 +00C7:608080602040 +00C8:4020E0C0E000 +00C9:4080E0C0E000 +00CA:E000E0C0E000 +00CB:A000E0C0E000 +00CC:4020E040E000 +00CD:4080E040E000 +00CE:E000E040E000 +00CF:A000E040E000 +00D0:C0A0E0A0C000 +00D1:C060A0E0A000 +00D2:4020E0A0E000 +00D3:4080E0A0E000 +00D4:E000E0A0E000 +00D5:C060E0A0E000 +00D6:A000E0A0E000 +00D7:A040A0000000 +00D8:60A0E0A0C000 +00D9:8040A0A0E000 +00DA:2040A0A0E000 +00DB:E000A0A0E000 +00DC:A000A0A0E000 +00DD:2040A0E04000 +00DE:80E0A0E08000 +00DF:60A0C0A0C080 +00E0:402060A0E000 +00E1:408060A0E000 +00E2:E00060A0E000 +00E3:60C060A0E000 +00E4:A00060A0E000 +00E5:606060A0E000 +00E6:60E0E0C00000 +00E7:608060204000 +00E8:402060E06000 +00E9:408060E06000 +00EA:E00060E06000 +00EB:A00060E06000 +00EC:804080808000 +00ED:408040404000 +00EE:E00040404000 +00EF:A00040404000 +00F0:60C060A06000 +00F1:C060C0A0A000 +00F2:402040A04000 +00F3:408040A04000 +00F4:E00040A04000 +00F5:C06040A04000 +00F6:A00040A04000 +00F7:4000E0004000 +00F8:60E0A0C00000 +00F9:8040A0A06000 +00FA:2040A0A06000 +00FB:E000A0A06000 +00FC:A000A0A06000 +00FD:2040A0602040 +00FE:80C0A0C08000 +00FF:A000A0602040 +0152:60C0E0C06000 +0153:60E0C0E00000 +0160:A060C060C000 +0161:A060C060C000 +0178:A000A0404000 +017D:A0E060C0E000 +017E:A0E060C0E000 +2022:800000000000 +2026:A00000000000 +20AC:60E0E0C06000 From owner-svn-src-head@freebsd.org Fri Apr 13 17:23:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 15562F98981; Fri, 13 Apr 2018 17:23:06 +0000 (UTC) (envelope-from tychon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id BE08375F65; Fri, 13 Apr 2018 17:23:05 +0000 (UTC) (envelope-from tychon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8ECF1CB40; Fri, 13 Apr 2018 17:23:05 +0000 (UTC) (envelope-from tychon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3DHN5pG059696; Fri, 13 Apr 2018 17:23:05 GMT (envelope-from tychon@FreeBSD.org) Received: (from tychon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DHN5qi059693; Fri, 13 Apr 2018 17:23:05 GMT (envelope-from tychon@FreeBSD.org) Message-Id: <201804131723.w3DHN5qi059693@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tychon set sender to tychon@FreeBSD.org using -f From: Tycho Nightingale Date: Fri, 13 Apr 2018 17:23:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332479 - in head/sys/amd64: include vmm vmm/intel X-SVN-Group: head X-SVN-Commit-Author: tychon X-SVN-Commit-Paths: in head/sys/amd64: include vmm vmm/intel X-SVN-Commit-Revision: 332479 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 17:23:06 -0000 Author: tychon Date: Fri Apr 13 17:23:05 2018 New Revision: 332479 URL: https://svnweb.freebsd.org/changeset/base/332479 Log: Add SDT probes to vmexit on Intel. Submitted by: domagoj.stolfa_gmail.com Reviewed by: grehan, tychon Sponsored by: DARPA/AFRL Differential Revision: https://reviews.freebsd.org/D14656 Modified: head/sys/amd64/include/vmm.h head/sys/amd64/vmm/intel/vmx.c head/sys/amd64/vmm/vmm.c Modified: head/sys/amd64/include/vmm.h ============================================================================== --- head/sys/amd64/include/vmm.h Fri Apr 13 16:54:49 2018 (r332478) +++ head/sys/amd64/include/vmm.h Fri Apr 13 17:23:05 2018 (r332479) @@ -31,7 +31,12 @@ #ifndef _VMM_H_ #define _VMM_H_ +#include #include + +#ifdef _KERNEL +SDT_PROVIDER_DECLARE(vmm); +#endif enum vm_suspend_how { VM_SUSPEND_NONE, Modified: head/sys/amd64/vmm/intel/vmx.c ============================================================================== --- head/sys/amd64/vmm/intel/vmx.c Fri Apr 13 16:54:49 2018 (r332478) +++ head/sys/amd64/vmm/intel/vmx.c Fri Apr 13 17:23:05 2018 (r332479) @@ -188,6 +188,82 @@ SYSCTL_UINT(_hw_vmm_vmx, OID_AUTO, vpid_alloc_failed, &vpid_alloc_failed, 0, NULL); /* + * The definitions of SDT probes for VMX. + */ + +SDT_PROBE_DEFINE3(vmm, vmx, exit, entry, + "struct vmx *", "int", "struct vm_exit *"); + +SDT_PROBE_DEFINE4(vmm, vmx, exit, taskswitch, + "struct vmx *", "int", "struct vm_exit *", "struct vm_task_switch *"); + +SDT_PROBE_DEFINE4(vmm, vmx, exit, craccess, + "struct vmx *", "int", "struct vm_exit *", "uint64_t"); + +SDT_PROBE_DEFINE4(vmm, vmx, exit, rdmsr, + "struct vmx *", "int", "struct vm_exit *", "uint32_t"); + +SDT_PROBE_DEFINE5(vmm, vmx, exit, wrmsr, + "struct vmx *", "int", "struct vm_exit *", "uint32_t", "uint64_t"); + +SDT_PROBE_DEFINE3(vmm, vmx, exit, halt, + "struct vmx *", "int", "struct vm_exit *"); + +SDT_PROBE_DEFINE3(vmm, vmx, exit, mtrap, + "struct vmx *", "int", "struct vm_exit *"); + +SDT_PROBE_DEFINE3(vmm, vmx, exit, pause, + "struct vmx *", "int", "struct vm_exit *"); + +SDT_PROBE_DEFINE3(vmm, vmx, exit, intrwindow, + "struct vmx *", "int", "struct vm_exit *"); + +SDT_PROBE_DEFINE4(vmm, vmx, exit, interrupt, + "struct vmx *", "int", "struct vm_exit *", "uint32_t"); + +SDT_PROBE_DEFINE3(vmm, vmx, exit, nmiwindow, + "struct vmx *", "int", "struct vm_exit *"); + +SDT_PROBE_DEFINE3(vmm, vmx, exit, inout, + "struct vmx *", "int", "struct vm_exit *"); + +SDT_PROBE_DEFINE3(vmm, vmx, exit, cpuid, + "struct vmx *", "int", "struct vm_exit *"); + +SDT_PROBE_DEFINE5(vmm, vmx, exit, exception, + "struct vmx *", "int", "struct vm_exit *", "uint32_t", "int"); + +SDT_PROBE_DEFINE5(vmm, vmx, exit, nestedfault, + "struct vmx *", "int", "struct vm_exit *", "uint64_t", "uint64_t"); + +SDT_PROBE_DEFINE4(vmm, vmx, exit, mmiofault, + "struct vmx *", "int", "struct vm_exit *", "uint64_t"); + +SDT_PROBE_DEFINE3(vmm, vmx, exit, eoi, + "struct vmx *", "int", "struct vm_exit *"); + +SDT_PROBE_DEFINE3(vmm, vmx, exit, apicaccess, + "struct vmx *", "int", "struct vm_exit *"); + +SDT_PROBE_DEFINE4(vmm, vmx, exit, apicwrite, + "struct vmx *", "int", "struct vm_exit *", "struct vlapic *"); + +SDT_PROBE_DEFINE3(vmm, vmx, exit, xsetbv, + "struct vmx *", "int", "struct vm_exit *"); + +SDT_PROBE_DEFINE3(vmm, vmx, exit, monitor, + "struct vmx *", "int", "struct vm_exit *"); + +SDT_PROBE_DEFINE3(vmm, vmx, exit, mwait, + "struct vmx *", "int", "struct vm_exit *"); + +SDT_PROBE_DEFINE4(vmm, vmx, exit, unknown, + "struct vmx *", "int", "struct vm_exit *", "uint32_t"); + +SDT_PROBE_DEFINE4(vmm, vmx, exit, return, + "struct vmx *", "int", "struct vm_exit *", "int"); + +/* * Use the last page below 4GB as the APIC access address. This address is * occupied by the boot firmware so it is guaranteed that it will not conflict * with a page in system memory. @@ -2118,6 +2194,7 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ vmexit->exitcode = VM_EXITCODE_BOGUS; vmm_stat_incr(vmx->vm, vcpu, VMEXIT_COUNT, 1); + SDT_PROBE3(vmm, vmx, exit, entry, vmx, vcpu, vmexit); /* * VM-entry failures during or after loading guest state. @@ -2220,6 +2297,7 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ } } vmexit->exitcode = VM_EXITCODE_TASK_SWITCH; + SDT_PROBE4(vmm, vmx, exit, taskswitch, vmx, vcpu, vmexit, ts); VCPU_CTR4(vmx->vm, vcpu, "task switch reason %d, tss 0x%04x, " "%s errcode 0x%016lx", ts->reason, ts->tsssel, ts->ext ? "external" : "internal", @@ -2227,6 +2305,7 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ break; case EXIT_REASON_CR_ACCESS: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_CR_ACCESS, 1); + SDT_PROBE4(vmm, vmx, exit, craccess, vmx, vcpu, vmexit, qual); switch (qual & 0xf) { case 0: handled = vmx_emulate_cr0_access(vmx, vcpu, qual); @@ -2244,6 +2323,7 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ retu = false; ecx = vmxctx->guest_rcx; VCPU_CTR1(vmx->vm, vcpu, "rdmsr 0x%08x", ecx); + SDT_PROBE4(vmm, vmx, exit, rdmsr, vmx, vcpu, vmexit, ecx); error = emulate_rdmsr(vmx, vcpu, ecx, &retu); if (error) { vmexit->exitcode = VM_EXITCODE_RDMSR; @@ -2264,6 +2344,8 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ edx = vmxctx->guest_rdx; VCPU_CTR2(vmx->vm, vcpu, "wrmsr 0x%08x value 0x%016lx", ecx, (uint64_t)edx << 32 | eax); + SDT_PROBE5(vmm, vmx, exit, wrmsr, vmx, vmexit, vcpu, ecx, + (uint64_t)edx << 32 | eax); error = emulate_wrmsr(vmx, vcpu, ecx, (uint64_t)edx << 32 | eax, &retu); if (error) { @@ -2280,6 +2362,7 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ break; case EXIT_REASON_HLT: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_HLT, 1); + SDT_PROBE3(vmm, vmx, exit, halt, vmx, vcpu, vmexit); vmexit->exitcode = VM_EXITCODE_HLT; vmexit->u.hlt.rflags = vmcs_read(VMCS_GUEST_RFLAGS); if (virtual_interrupt_delivery) @@ -2290,15 +2373,18 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ break; case EXIT_REASON_MTF: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_MTRAP, 1); + SDT_PROBE3(vmm, vmx, exit, mtrap, vmx, vcpu, vmexit); vmexit->exitcode = VM_EXITCODE_MTRAP; vmexit->inst_length = 0; break; case EXIT_REASON_PAUSE: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_PAUSE, 1); + SDT_PROBE3(vmm, vmx, exit, pause, vmx, vcpu, vmexit); vmexit->exitcode = VM_EXITCODE_PAUSE; break; case EXIT_REASON_INTR_WINDOW: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_INTR_WINDOW, 1); + SDT_PROBE3(vmm, vmx, exit, intrwindow, vmx, vcpu, vmexit); vmx_clear_int_window_exiting(vmx, vcpu); return (1); case EXIT_REASON_EXT_INTR: @@ -2312,6 +2398,8 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ * this virtual interrupt during the subsequent VM enter. */ intr_info = vmcs_read(VMCS_EXIT_INTR_INFO); + SDT_PROBE4(vmm, vmx, exit, interrupt, + vmx, vcpu, vmexit, intr_info); /* * XXX: Ignore this exit if VMCS_INTR_VALID is not set. @@ -2331,6 +2419,7 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ vmm_stat_incr(vmx->vm, vcpu, VMEXIT_EXTINT, 1); return (1); case EXIT_REASON_NMI_WINDOW: + SDT_PROBE3(vmm, vmx, exit, nmiwindow, vmx, vcpu, vmexit); /* Exit to allow the pending virtual NMI to be injected */ if (vm_nmi_pending(vmx->vm, vcpu)) vmx_inject_nmi(vmx, vcpu); @@ -2358,9 +2447,11 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ vis->addrsize = inout_str_addrsize(inst_info); inout_str_seginfo(vmx, vcpu, inst_info, in, vis); } + SDT_PROBE3(vmm, vmx, exit, inout, vmx, vcpu, vmexit); break; case EXIT_REASON_CPUID: vmm_stat_incr(vmx->vm, vcpu, VMEXIT_CPUID, 1); + SDT_PROBE3(vmm, vmx, exit, cpuid, vmx, vcpu, vmexit); handled = vmx_handle_cpuid(vmx->vm, vcpu, vmxctx); break; case EXIT_REASON_EXCEPTION: @@ -2425,6 +2516,8 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ } VCPU_CTR2(vmx->vm, vcpu, "Reflecting exception %d/%#x into " "the guest", intr_vec, errcode); + SDT_PROBE5(vmm, vmx, exit, exception, + vmx, vcpu, vmexit, intr_vec, errcode); error = vm_inject_exception(vmx->vm, vcpu, intr_vec, errcode_valid, errcode, 0); KASSERT(error == 0, ("%s: vm_inject_exception error %d", @@ -2445,9 +2538,13 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ vmexit->u.paging.gpa = gpa; vmexit->u.paging.fault_type = ept_fault_type(qual); vmm_stat_incr(vmx->vm, vcpu, VMEXIT_NESTED_FAULT, 1); + SDT_PROBE5(vmm, vmx, exit, nestedfault, + vmx, vcpu, vmexit, gpa, qual); } else if (ept_emulation_fault(qual)) { vmexit_inst_emul(vmexit, gpa, vmcs_gla()); vmm_stat_incr(vmx->vm, vcpu, VMEXIT_INST_EMUL, 1); + SDT_PROBE4(vmm, vmx, exit, mmiofault, + vmx, vcpu, vmexit, gpa); } /* * If Virtual NMIs control is 1 and the VM-exit is due to an @@ -2464,9 +2561,11 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ case EXIT_REASON_VIRTUALIZED_EOI: vmexit->exitcode = VM_EXITCODE_IOAPIC_EOI; vmexit->u.ioapic_eoi.vector = qual & 0xFF; + SDT_PROBE3(vmm, vmx, exit, eoi, vmx, vcpu, vmexit); vmexit->inst_length = 0; /* trap-like */ break; case EXIT_REASON_APIC_ACCESS: + SDT_PROBE3(vmm, vmx, exit, apicaccess, vmx, vcpu, vmexit); handled = vmx_handle_apic_access(vmx, vcpu, vmexit); break; case EXIT_REASON_APIC_WRITE: @@ -2476,18 +2575,25 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ */ vmexit->inst_length = 0; vlapic = vm_lapic(vmx->vm, vcpu); + SDT_PROBE4(vmm, vmx, exit, apicwrite, + vmx, vcpu, vmexit, vlapic); handled = vmx_handle_apic_write(vmx, vcpu, vlapic, qual); break; case EXIT_REASON_XSETBV: + SDT_PROBE3(vmm, vmx, exit, xsetbv, vmx, vcpu, vmexit); handled = vmx_emulate_xsetbv(vmx, vcpu, vmexit); break; case EXIT_REASON_MONITOR: + SDT_PROBE3(vmm, vmx, exit, monitor, vmx, vcpu, vmexit); vmexit->exitcode = VM_EXITCODE_MONITOR; break; case EXIT_REASON_MWAIT: + SDT_PROBE3(vmm, vmx, exit, mwait, vmx, vcpu, vmexit); vmexit->exitcode = VM_EXITCODE_MWAIT; break; default: + SDT_PROBE4(vmm, vmx, exit, unknown, + vmx, vcpu, vmexit, reason); vmm_stat_incr(vmx->vm, vcpu, VMEXIT_UNKNOWN, 1); break; } @@ -2523,6 +2629,9 @@ vmx_exit_process(struct vmx *vmx, int vcpu, struct vm_ */ } } + + SDT_PROBE4(vmm, vmx, exit, return, + vmx, vcpu, vmexit, handled); return (handled); } Modified: head/sys/amd64/vmm/vmm.c ============================================================================== --- head/sys/amd64/vmm/vmm.c Fri Apr 13 16:54:49 2018 (r332478) +++ head/sys/amd64/vmm/vmm.c Fri Apr 13 17:23:05 2018 (r332479) @@ -208,6 +208,8 @@ static struct vmm_ops *ops; #define fpu_start_emulating() load_cr0(rcr0() | CR0_TS) #define fpu_stop_emulating() clts() +SDT_PROVIDER_DEFINE(vmm); + static MALLOC_DEFINE(M_VM, "vm", "vm"); /* statistics */ From owner-svn-src-head@freebsd.org Fri Apr 13 17:36:47 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F01E9F9976A; Fri, 13 Apr 2018 17:36:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from mail.baldwin.cx (bigwig.baldwin.cx [IPv6:2001:470:1f11:75::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 8992079D72; Fri, 13 Apr 2018 17:36:46 +0000 (UTC) (envelope-from jhb@freebsd.org) Received: from ralph.baldwin.cx (ralph.baldwin.cx [66.234.199.215]) by mail.baldwin.cx (Postfix) with ESMTPSA id 7234610AFD2; Fri, 13 Apr 2018 13:36:45 -0400 (EDT) From: John Baldwin To: Konstantin Belousov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332454 - in head/sys: amd64/amd64 amd64/ia32 amd64/linux amd64/linux32 i386/i386 Date: Fri, 13 Apr 2018 10:30:39 -0700 Message-ID: <6635699.GyEHu4i8EZ@ralph.baldwin.cx> User-Agent: KMail/4.14.10 (FreeBSD/11.1-STABLE; KDE/4.14.30; amd64; ; ) In-Reply-To: <201804122043.w3CKhdFF041945@repo.freebsd.org> References: <201804122043.w3CKhdFF041945@repo.freebsd.org> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.4.3 (mail.baldwin.cx); Fri, 13 Apr 2018 13:36:45 -0400 (EDT) X-Virus-Scanned: clamav-milter 0.99.2 at mail.baldwin.cx X-Virus-Status: Clean X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 17:36:47 -0000 On Thursday, April 12, 2018 08:43:39 PM Konstantin Belousov wrote: > Author: kib > Date: Thu Apr 12 20:43:39 2018 > New Revision: 332454 > URL: https://svnweb.freebsd.org/changeset/base/332454 > > Log: > Fix PSL_T inheritance on exec for x86. > > The miscellaneous x86 sysent->sv_setregs() implementations tried to > migrate PSL_T from the previous program to the new executed one, but > they evaluated regs->tf_eflags after the whole regs structure was > bzeroed. Make this functional by saving PSL_T value before zeroing. > > Note that if the debugger is not attached, executing the first > instruction in the new program with PSL_T set results in SIGTRAP, and > since all intercepted signals are reset to default dispostion on > exec(2), this means that non-debugged process gets killed immediately > if PSL_T is inherited. In particular, since suid images drop > P_TRACED, attempt to set PSL_T for execution of such program would > kill the process. > > Another issue with userspace PSL_T handling is that it is reset by > trap(). It is reasonable to clear PSL_T when entering SIGTRAP > handler, to allow the signal to be handled without recursion or > delivery of blocked fault. But it is not reasonable to return back to > the normal flow with PSL_T cleared. This is too late to change, I > think. Hmm, I had wanted to write an explicit test for this in ptrace_test.c so that we could ensure other architectures that support hardware stepping (like aarch64) use matching semantics. It wasn't clear to me if clearing PSL_T on exec() isn't actually more correct. Exec will report a PL_FLAG_EXEC ptrace stop and the debugger can PT_STEP from that stop if it wants to continue stepping post-exec. The trap() case is indeed interesting, but I think the concern you raise is largely mitigated by having the debugger simple re-enable stepping after resuming from the event reported from trapsignal(). OTOH, we explicitly clear PSL_T in sendsig() so that signal handlers don't step. I feel like we probably should not do this for traced processes as this fix single stepping in a debugger to properly report a step for the start of a signal handler. FWIW, Linux single steps into signal handlers instead of over them as we currently do. (I have even some thoughts on how to fix stepping for architectures like MIPS that do software stepping by letting the debugger enable a "report a step for first signal instruction" mode while it is stepping a thread and then reporting an explicit SIGTRAP ptracestop() during sendsig.) -- John Baldwin From owner-svn-src-head@freebsd.org Fri Apr 13 17:37:40 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0F33BF998AD; Fri, 13 Apr 2018 17:37:40 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id B242179EEF; Fri, 13 Apr 2018 17:37:39 +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 AC5F71CD1D; Fri, 13 Apr 2018 17:37:39 +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 w3DHbdNj064572; Fri, 13 Apr 2018 17:37:39 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DHbdNZ064571; Fri, 13 Apr 2018 17:37:39 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201804131737.w3DHbdNZ064571@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Fri, 13 Apr 2018 17:37:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332480 - head/share/vt/fonts X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/share/vt/fonts X-SVN-Commit-Revision: 332480 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 17:37:40 -0000 Author: emaste Date: Fri Apr 13 17:37:39 2018 New Revision: 332480 URL: https://svnweb.freebsd.org/changeset/base/332480 Log: Correct tom-thumb vt font glyphs A few glyphs were converted incorrectly: U+00A6 broken bar - center U+2022 bullet - center U+2026 horizontal ellipsis - move to bottom of character cell Modified: head/share/vt/fonts/tom-thumb.hex Modified: head/share/vt/fonts/tom-thumb.hex ============================================================================== --- head/share/vt/fonts/tom-thumb.hex Fri Apr 13 17:23:05 2018 (r332479) +++ head/share/vt/fonts/tom-thumb.hex Fri Apr 13 17:37:39 2018 (r332480) @@ -110,7 +110,7 @@ 00A3:6040E040E000 00A4:A040E040A000 00A5:A0A040E04000 -00A6:808000808000 +00A6:404000404000 00A7:6040A040C000 00A8:A00000000000 00A9:608060000000 @@ -207,6 +207,6 @@ 0178:A000A0404000 017D:A0E060C0E000 017E:A0E060C0E000 -2022:800000000000 -2026:A00000000000 +2022:000040000000 +2026:00000000A000 20AC:60E0E0C06000 From owner-svn-src-head@freebsd.org Fri Apr 13 17:45:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id DE05FF9A14B; Fri, 13 Apr 2018 17:45:05 +0000 (UTC) (envelope-from kib@freebsd.org) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (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 4B1947A48A; Fri, 13 Apr 2018 17:45:05 +0000 (UTC) (envelope-from kib@freebsd.org) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id w3DHimxw058714 (version=TLSv1.2 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 13 Apr 2018 20:44:51 +0300 (EEST) (envelope-from kib@freebsd.org) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua w3DHimxw058714 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id w3DHimj3058713; Fri, 13 Apr 2018 20:44:48 +0300 (EEST) (envelope-from kib@freebsd.org) X-Authentication-Warning: tom.home: kostik set sender to kib@freebsd.org using -f Date: Fri, 13 Apr 2018 20:44:48 +0300 From: Konstantin Belousov To: John Baldwin Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r332454 - in head/sys: amd64/amd64 amd64/ia32 amd64/linux amd64/linux32 i386/i386 Message-ID: <20180413174448.GA1774@kib.kiev.ua> References: <201804122043.w3CKhdFF041945@repo.freebsd.org> <6635699.GyEHu4i8EZ@ralph.baldwin.cx> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6635699.GyEHu4i8EZ@ralph.baldwin.cx> User-Agent: Mutt/1.9.4 (2018-02-28) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=ham autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 17:45:06 -0000 On Fri, Apr 13, 2018 at 10:30:39AM -0700, John Baldwin wrote: > On Thursday, April 12, 2018 08:43:39 PM Konstantin Belousov wrote: > > Author: kib > > Date: Thu Apr 12 20:43:39 2018 > > New Revision: 332454 > > URL: https://svnweb.freebsd.org/changeset/base/332454 > > > > Log: > > Fix PSL_T inheritance on exec for x86. > > > > The miscellaneous x86 sysent->sv_setregs() implementations tried to > > migrate PSL_T from the previous program to the new executed one, but > > they evaluated regs->tf_eflags after the whole regs structure was > > bzeroed. Make this functional by saving PSL_T value before zeroing. > > > > Note that if the debugger is not attached, executing the first > > instruction in the new program with PSL_T set results in SIGTRAP, and > > since all intercepted signals are reset to default dispostion on > > exec(2), this means that non-debugged process gets killed immediately > > if PSL_T is inherited. In particular, since suid images drop > > P_TRACED, attempt to set PSL_T for execution of such program would > > kill the process. > > > > Another issue with userspace PSL_T handling is that it is reset by > > trap(). It is reasonable to clear PSL_T when entering SIGTRAP > > handler, to allow the signal to be handled without recursion or > > delivery of blocked fault. But it is not reasonable to return back to > > the normal flow with PSL_T cleared. This is too late to change, I > > think. > > Hmm, I had wanted to write an explicit test for this in ptrace_test.c so that > we could ensure other architectures that support hardware stepping (like > aarch64) use matching semantics. It wasn't clear to me if clearing PSL_T on > exec() isn't actually more correct. Exec will report a PL_FLAG_EXEC ptrace > stop and the debugger can PT_STEP from that stop if it wants to continue > stepping post-exec. > > The trap() case is indeed interesting, but I think the concern you raise is > largely mitigated by having the debugger simple re-enable stepping after > resuming from the event reported from trapsignal(). OTOH, we explicitly > clear PSL_T in sendsig() so that signal handlers don't step. I feel like we > probably should not do this for traced processes as this fix single stepping > in a debugger to properly report a step for the start of a signal handler. > FWIW, Linux single steps into signal handlers instead of over them as we > currently do. (I have even some thoughts on how to fix stepping for > architectures like MIPS that do software stepping by letting the debugger > enable a "report a step for first signal instruction" mode while it is > stepping a thread and then reporting an explicit SIGTRAP ptracestop() > during sendsig.) There is https://reviews.freebsd.org/D15054 where I added you as reviewer. If you consider it the right thing to do, I can easily add a quirk to stop clearing PSL_T in sendsig()s. From owner-svn-src-head@freebsd.org Fri Apr 13 18:04:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37D4DF9BB96; Fri, 13 Apr 2018 18:04:52 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E211B80064; Fri, 13 Apr 2018 18:04:51 +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 DD08C1D21E; Fri, 13 Apr 2018 18:04:51 +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 w3DI4pjL079428; Fri, 13 Apr 2018 18:04:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DI4pd6079424; Fri, 13 Apr 2018 18:04:51 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201804131804.w3DI4pd6079424@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 13 Apr 2018 18:04:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332483 - head/usr.bin/dtc X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/usr.bin/dtc X-SVN-Commit-Revision: 332483 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 18:04:52 -0000 Author: kevans Date: Fri Apr 13 18:04:51 2018 New Revision: 332483 URL: https://svnweb.freebsd.org/changeset/base/332483 Log: dtc(1): Update to upstream 006664a Highlights: - Passing "-" to -o will now cause output to go to stdout - Path-based syntactic sugar for overlays is now accepted. This looks like: /dts-v1/; /plugin/; &{/soc} { sid: eeprom@1c14000 { compatible = "allwinner,sun8i-h3-sid"; reg = <0x1c14000 0x400>; status = "okay"; }; }; MFC after: 3 days Modified: head/usr.bin/dtc/dtc.1 head/usr.bin/dtc/dtc.cc head/usr.bin/dtc/fdt.cc head/usr.bin/dtc/fdt.hh Modified: head/usr.bin/dtc/dtc.1 ============================================================================== --- head/usr.bin/dtc/dtc.1 Fri Apr 13 17:57:00 2018 (r332482) +++ head/usr.bin/dtc/dtc.1 Fri Apr 13 18:04:51 2018 (r332483) @@ -30,7 +30,7 @@ .\" .\" $FreeBSD$ .\"/ -.Dd January 17, 2018 +.Dd April 7, 2018 .Dt DTC 1 .Os .Sh NAME @@ -275,7 +275,7 @@ tree when the overlay is applied. .Pp Much simpler syntactic sugar was later invented to simplify generating overlays. Instead of creating targetted fragments manually, one can instead create a root -node that targets a label in the base node using the +node that targets a label in the base FDT using the .Va &label syntax supported in conventional DTS. This will indicate that a fragment should be generated for the node, with the @@ -283,6 +283,19 @@ given .Va label being the target, and the properties and child nodes will be used as the __overlay__. +.Pp +Additionally, a path-based version of this syntactic sugar is supported. +A root node may target a path in the base FDT using a name of the form +.Va &{/path} . +A fragment will be generated for the node as it is in the +.Va &label +case, except the +.Va target-path +property will be set to +.Va /path +and no +.Va target +will be set. .Pp Both conventional overlays and the later-added syntactic sugar are supported. .Pp Modified: head/usr.bin/dtc/dtc.cc ============================================================================== --- head/usr.bin/dtc/dtc.cc Fri Apr 13 17:57:00 2018 (r332482) +++ head/usr.bin/dtc/dtc.cc Fri Apr 13 18:04:51 2018 (r332483) @@ -171,11 +171,14 @@ main(int argc, char **argv) case 'o': { outfile_name = optarg; - outfile = open(optarg, O_CREAT | O_TRUNC | O_WRONLY, 0666); - if (outfile == -1) + if (strcmp(outfile_name, "-") != 0) { - perror("Unable to open output file"); - return EXIT_FAILURE; + outfile = open(optarg, O_CREAT | O_TRUNC | O_WRONLY, 0666); + if (outfile == -1) + { + perror("Unable to open output file"); + return EXIT_FAILURE; + } } break; } Modified: head/usr.bin/dtc/fdt.cc ============================================================================== --- head/usr.bin/dtc/fdt.cc Fri Apr 13 17:57:00 2018 (r332482) +++ head/usr.bin/dtc/fdt.cc Fri Apr 13 18:04:51 2018 (r332483) @@ -727,14 +727,32 @@ node::parse_name(text_input_buffer &input, bool &is_pr return n; } -void -node::visit(std::function fn) +node::visit_behavior +node::visit(std::function fn, node *parent) { - fn(*this); - for (auto &&c : children) + visit_behavior behavior; + behavior = fn(*this, parent); + if (behavior == VISIT_BREAK) { - c->visit(fn); + return VISIT_BREAK; } + else if (behavior != VISIT_CONTINUE) + { + for (auto &&c : children) + { + behavior = c->visit(fn, this); + // Any status other than VISIT_RECURSE stops our execution and + // bubbles up to our caller. The caller may then either continue + // visiting nodes that are siblings to this one or completely halt + // visiting. + if (behavior != VISIT_RECURSE) + { + return behavior; + } + } + } + // Continue recursion by default + return VISIT_RECURSE; } node::node(input_buffer &structs, input_buffer &strings) : valid(true) @@ -1319,7 +1337,7 @@ device_tree::resolve_cross_references(uint32_t &phandl phandle_set.insert({&i.val, i}); } std::vector> sorted_phandles; - root->visit([&](node &n) { + root->visit([&](node &n, node *parent) { for (auto &p : n.properties()) { for (auto &v : *p) @@ -1331,7 +1349,9 @@ device_tree::resolve_cross_references(uint32_t &phandl } } } - }); + // Allow recursion + return node::VISIT_RECURSE; + }, nullptr); assert(sorted_phandles.size() == fixups.size()); for (auto &i : sorted_phandles) @@ -1471,9 +1491,24 @@ device_tree::parse_file(text_input_buffer &input, else if (input.consume('&')) { input.next_token(); - string name = input.parse_node_name(); + string name; + bool name_is_path_reference = false; + // This is to deal with names intended as path references, e.g. &{/path}. + // While it may make sense in a non-plugin context, we don't support such + // usage at this time. + if (input.consume('{') && is_plugin) + { + name = input.parse_to('}'); + input.consume('}'); + name_is_path_reference = true; + } + else + { + name = input.parse_node_name(); + } input.next_token(); n = node::parse(input, std::move(name), string_set(), string(), &defines); + n->name_is_path_reference = name_is_path_reference; } else { @@ -1702,11 +1737,21 @@ device_tree::create_fragment_wrapper(node_ptr &node, i node_ptr newroot = node::create_special_node("", symbols); node_ptr wrapper = node::create_special_node("__overlay__", symbols); - // Generate the fragment with target = <&name> + // Generate the fragment with $propname = <&name> property_value v; + std::string propname; v.string_data = node->name; - v.type = property_value::PHANDLE; - auto prop = std::make_shared(std::string("target")); + if (!node->name_is_path_reference) + { + propname = "target"; + v.type = property_value::PHANDLE; + } + else + { + propname = "target-path"; + v.type = property_value::STRING; + } + auto prop = std::make_shared(std::string(propname)); prop->add_value(v); symbols.push_back(prop); Modified: head/usr.bin/dtc/fdt.hh ============================================================================== --- head/usr.bin/dtc/fdt.hh Fri Apr 13 17:57:00 2018 (r332482) +++ head/usr.bin/dtc/fdt.hh Fri Apr 13 18:04:51 2018 (r332483) @@ -409,6 +409,10 @@ class node */ std::string name; /** + * The name of the node is a path reference. + */ + bool name_is_path_reference = false; + /** * The unit address of the node, which is optionally written after the * name followed by an at symbol. */ @@ -421,6 +425,25 @@ class node * Iterator type for child nodes. */ typedef std::vector::iterator child_iterator; + /** + * Recursion behavior to be observed for visiting + */ + enum visit_behavior + { + /** + * Recurse as normal through the rest of the tree. + */ + VISIT_RECURSE, + /** + * Continue recursing through the device tree, but do not + * recurse through this branch of the tree any further. + */ + VISIT_CONTINUE, + /** + * Immediately halt the visit. No further nodes will be visited. + */ + VISIT_BREAK + }; private: /** * Adaptor to use children in range-based for loops. @@ -635,9 +658,13 @@ class node */ void write_dts(FILE *file, int indent); /** - * Recursively visit this node and then its children. + * Recursively visit this node and then its children based on the + * callable's return value. The callable may return VISIT_BREAK + * immediately halt all recursion and end the visit, VISIT_CONTINUE to + * not recurse into the current node's children, or VISIT_RECURSE to recurse + * through children as expected. parent will be passed to the callable. */ - void visit(std::function); + visit_behavior visit(std::function, node *parent); }; /** From owner-svn-src-head@freebsd.org Fri Apr 13 18:25:01 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 4F38AF9CFF2; Fri, 13 Apr 2018 18:25:01 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E8E9883554; Fri, 13 Apr 2018 18:25:00 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DB49A1D55A; Fri, 13 Apr 2018 18:25:00 +0000 (UTC) (envelope-from bapt@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3DIP01o089010; Fri, 13 Apr 2018 18:25:00 GMT (envelope-from bapt@FreeBSD.org) Received: (from bapt@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DIP07v089009; Fri, 13 Apr 2018 18:25:00 GMT (envelope-from bapt@FreeBSD.org) Message-Id: <201804131825.w3DIP07v089009@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bapt set sender to bapt@FreeBSD.org using -f From: Baptiste Daroussin Date: Fri, 13 Apr 2018 18:25:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332484 - head/usr.sbin/pkg X-SVN-Group: head X-SVN-Commit-Author: bapt X-SVN-Commit-Paths: head/usr.sbin/pkg X-SVN-Commit-Revision: 332484 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 18:25:01 -0000 Author: bapt Date: Fri Apr 13 18:25:00 2018 New Revision: 332484 URL: https://svnweb.freebsd.org/changeset/base/332484 Log: pkg: accept -y and --yes from arguments By popular demand, pkg now walks thought the arguments passed and if it finds -y or --yes it does accept those as equivalent of ASSUME_ALWAYS_YES env var. Requested by: many MFC after: 1 week Modified: head/usr.sbin/pkg/pkg.c Modified: head/usr.sbin/pkg/pkg.c ============================================================================== --- head/usr.sbin/pkg/pkg.c Fri Apr 13 18:04:51 2018 (r332483) +++ head/usr.sbin/pkg/pkg.c Fri Apr 13 18:25:00 2018 (r332484) @@ -1032,6 +1032,7 @@ main(int argc, char *argv[]) { char pkgpath[MAXPATHLEN]; const char *pkgarg; + int i; bool bootstrap_only, force, yes; bootstrap_only = false; @@ -1083,6 +1084,15 @@ main(int argc, char *argv[]) * tucked in there already. */ config_bool(ASSUME_ALWAYS_YES, &yes); + if (!yes) { + for (i = 1; i < argc; i++) { + if (strcmp(argv[i], "-y") == 0 || + strcmp(argv[i], "--yes") == 0) { + yes = true; + break; + } + } + } if (!yes) { if (!isatty(fileno(stdin))) { fprintf(stderr, non_interactive_message); From owner-svn-src-head@freebsd.org Fri Apr 13 19:43:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id ED3ECFA247E; Fri, 13 Apr 2018 19:43:23 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id A10CF767AD; Fri, 13 Apr 2018 19:43:23 +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 9BA321E227; Fri, 13 Apr 2018 19:43:23 +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 w3DJhN8s028883; Fri, 13 Apr 2018 19:43:23 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DJhNOb028882; Fri, 13 Apr 2018 19:43:23 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201804131943.w3DJhNOb028882@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 13 Apr 2018 19:43:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332488 - head/sys/dev/netmap X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/dev/netmap X-SVN-Commit-Revision: 332488 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 19:43:24 -0000 Author: brooks Date: Fri Apr 13 19:43:23 2018 New Revision: 332488 URL: https://svnweb.freebsd.org/changeset/base/332488 Log: Fix build on 32-bit systems. Modified: head/sys/dev/netmap/netmap_freebsd.c Modified: head/sys/dev/netmap/netmap_freebsd.c ============================================================================== --- head/sys/dev/netmap/netmap_freebsd.c Fri Apr 13 19:23:06 2018 (r332487) +++ head/sys/dev/netmap/netmap_freebsd.c Fri Apr 13 19:43:23 2018 (r332488) @@ -632,7 +632,7 @@ struct nm_os_extmem { void nm_os_extmem_delete(struct nm_os_extmem *e) { - D("freeing %lx bytes", e->size); + D("freeing %zx bytes", (size_t)e->size); vm_map_remove(kernel_map, e->kva, e->kva + e->size); nm_os_free(e); } @@ -701,7 +701,7 @@ nm_os_extmem_create(unsigned long p, struct nmreq_pool VMFS_OPTIMAL_SPACE, VM_PROT_READ | VM_PROT_WRITE, VM_PROT_READ | VM_PROT_WRITE, 0); if (rv != KERN_SUCCESS) { - D("vm_map_find(%lx) failed", e->size); + D("vm_map_find(%zx) failed", (size_t)e->size); goto out_rel; } rv = vm_map_wire(kernel_map, e->kva, e->kva + e->size, From owner-svn-src-head@freebsd.org Fri Apr 13 20:30:52 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 96823FA4FC4; Fri, 13 Apr 2018 20:30:51 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 45A4D7F491; Fri, 13 Apr 2018 20:30:51 +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 405221E8B9; Fri, 13 Apr 2018 20:30:51 +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 w3DKUpbV050168; Fri, 13 Apr 2018 20:30:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DKUnFn050153; Fri, 13 Apr 2018 20:30:49 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201804132030.w3DKUnFn050153@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 13 Apr 2018 20:30:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332489 - in head: gnu/usr.bin/gdb/kgdb sys/conf sys/dev/dcons sys/dev/hyperv/vmbus/i386 sys/dev/ppc sys/dev/syscons sys/i386/conf sys/i386/i386 sys/i386/include sys/i386/include/pc sys... X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: gnu/usr.bin/gdb/kgdb sys/conf sys/dev/dcons sys/dev/hyperv/vmbus/i386 sys/dev/ppc sys/dev/syscons sys/i386/conf sys/i386/i386 sys/i386/include sys/i386/include/pc sys/kern sys/x86/acpica sys/... X-SVN-Commit-Revision: 332489 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 20:30:52 -0000 Author: kib Date: Fri Apr 13 20:30:49 2018 New Revision: 332489 URL: https://svnweb.freebsd.org/changeset/base/332489 Log: i386 4/4G split. The change makes the user and kernel address spaces on i386 independent, giving each almost the full 4G of usable virtual addresses except for one PDE at top used for trampoline and per-CPU trampoline stacks, and system structures that must be always mapped, namely IDT, GDT, common TSS and LDT, and process-private TSS and LDT if allocated. By using 1:1 mapping for the kernel text and data, it appeared possible to eliminate assembler part of the locore.S which bootstraps initial page table and KPTmap. The code is rewritten in C and moved into the pmap_cold(). The comment in vmparam.h explains the KVA layout. There is no PCID mechanism available in protected mode, so each kernel/user switch forth and back completely flushes the TLB, except for the trampoline PTD region. The TLB invalidations for userspace becomes trivial, because IPI handlers switch page tables. On the other hand, context switches no longer need to reload %cr3. copyout(9) was rewritten to use vm_fault_quick_hold(). An issue for new copyout(9) is compatibility with wiring user buffers around sysctl handlers. This explains two kind of locks for copyout ptes and accounting of the vslock() calls. The vm_fault_quick_hold() AKA slow path, is only tried after the 'fast path' failed, which temporary changes mapping to the userspace and copies the data to/from small per-cpu buffer in the trampoline. If a page fault occurs during the copy, it is short-circuit by exception.s to not even reach C code. The change was motivated by the need to implement the Meltdown mitigation, but instead of KPTI the full split is done. The i386 architecture already shows the sizing problems, in particular, it is impossible to link clang and lld with debugging. I expect that the issues due to the virtual address space limits would only exaggerate and the split gives more liveness to the platform. Tested by: pho Discussed with: bde Sponsored by: The FreeBSD Foundation MFC after: 1 month Differential revision: https://reviews.freebsd.org/D14633 Added: head/sys/i386/i386/copyout.c (contents, props changed) head/sys/i386/i386/copyout_fast.s - copied, changed from r332488, head/sys/i386/i386/support.s Modified: head/gnu/usr.bin/gdb/kgdb/trgt_i386.c head/sys/conf/files.i386 head/sys/conf/ldscript.i386 head/sys/dev/dcons/dcons_crom.c head/sys/dev/dcons/dcons_os.c head/sys/dev/hyperv/vmbus/i386/vmbus_vector.S head/sys/dev/ppc/ppc.c head/sys/dev/syscons/syscons.c head/sys/i386/conf/NOTES head/sys/i386/i386/apic_vector.s head/sys/i386/i386/atpic_vector.s head/sys/i386/i386/bios.c head/sys/i386/i386/db_interface.c head/sys/i386/i386/db_trace.c head/sys/i386/i386/elf_machdep.c head/sys/i386/i386/exception.s head/sys/i386/i386/genassym.c head/sys/i386/i386/locore.s head/sys/i386/i386/machdep.c head/sys/i386/i386/mem.c head/sys/i386/i386/minidump_machdep.c head/sys/i386/i386/mp_machdep.c head/sys/i386/i386/mpboot.s head/sys/i386/i386/pmap.c head/sys/i386/i386/sigtramp.s head/sys/i386/i386/support.s head/sys/i386/i386/swtch.s head/sys/i386/i386/sys_machdep.c head/sys/i386/i386/trap.c head/sys/i386/i386/vm86.c head/sys/i386/i386/vm86bios.s head/sys/i386/i386/vm_machdep.c head/sys/i386/include/asmacros.h head/sys/i386/include/frame.h head/sys/i386/include/md_var.h head/sys/i386/include/param.h head/sys/i386/include/pc/bios.h head/sys/i386/include/pcpu.h head/sys/i386/include/pmap.h head/sys/i386/include/segments.h head/sys/i386/include/vmparam.h head/sys/kern/imgact_aout.c head/sys/kern/subr_witness.c head/sys/x86/acpica/acpi_wakeup.c head/sys/x86/x86/local_apic.c head/sys/x86/x86/mp_x86.c head/sys/x86/x86/mptable.c Modified: head/gnu/usr.bin/gdb/kgdb/trgt_i386.c ============================================================================== --- head/gnu/usr.bin/gdb/kgdb/trgt_i386.c Fri Apr 13 19:43:23 2018 (r332488) +++ head/gnu/usr.bin/gdb/kgdb/trgt_i386.c Fri Apr 13 20:30:49 2018 (r332489) @@ -29,6 +29,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include @@ -279,12 +281,26 @@ kgdb_trgt_frame_cache(struct frame_info *next_frame, v char buf[MAX_REGISTER_SIZE]; struct kgdb_frame_cache *cache; char *pname; + CORE_ADDR pcx; + uintptr_t addr, setidt_disp; cache = *this_cache; if (cache == NULL) { cache = FRAME_OBSTACK_ZALLOC(struct kgdb_frame_cache); *this_cache = cache; - cache->pc = frame_func_unwind(next_frame); + pcx = frame_pc_unwind(next_frame); + if (pcx >= PMAP_TRM_MIN_ADDRESS) { + addr = kgdb_lookup("setidt_disp"); + if (addr != 0) { + if (kvm_read(kvm, addr, &setidt_disp, + sizeof(setidt_disp)) != + sizeof(setidt_disp)) + warnx("kvm_read: %s", kvm_geterr(kvm)); + else + pcx -= setidt_disp; + } + } + cache->pc = pcx; find_pc_partial_function(cache->pc, &pname, NULL, NULL); if (pname[0] != 'X') cache->frame_type = FT_NORMAL; @@ -373,6 +389,8 @@ kgdb_trgt_trapframe_sniffer(struct frame_info *next_fr CORE_ADDR pc; pc = frame_pc_unwind(next_frame); + if (pc >= PMAP_TRM_MIN_ADDRESS) + return (&kgdb_trgt_trapframe_unwind); pname = NULL; find_pc_partial_function(pc, &pname, NULL, NULL); if (pname == NULL) Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Fri Apr 13 19:43:23 2018 (r332488) +++ head/sys/conf/files.i386 Fri Apr 13 20:30:49 2018 (r332489) @@ -483,6 +483,7 @@ i386/i386/atomic.c standard \ i386/i386/bios.c standard i386/i386/bioscall.s standard i386/i386/bpf_jit_machdep.c optional bpf_jitter +i386/i386/copyout.c standard i386/i386/db_disasm.c optional ddb i386/i386/db_interface.c optional ddb i386/i386/db_trace.c optional ddb Modified: head/sys/conf/ldscript.i386 ============================================================================== --- head/sys/conf/ldscript.i386 Fri Apr 13 19:43:23 2018 (r332488) +++ head/sys/conf/ldscript.i386 Fri Apr 13 20:30:49 2018 (r332489) @@ -6,7 +6,7 @@ SEARCH_DIR(/usr/lib); SECTIONS { /* Read-only sections, merged into text segment: */ - . = kernbase + kernload + SIZEOF_HEADERS; + . = kernbase + SIZEOF_HEADERS; .interp : { *(.interp) } .hash : { *(.hash) } .gnu.hash : { *(.gnu.hash) } Modified: head/sys/dev/dcons/dcons_crom.c ============================================================================== --- head/sys/dev/dcons/dcons_crom.c Fri Apr 13 19:43:23 2018 (r332488) +++ head/sys/dev/dcons/dcons_crom.c Fri Apr 13 20:30:49 2018 (r332489) @@ -109,7 +109,11 @@ dcons_crom_expose_idt(struct dcons_crom_softc *sc) static off_t idt_paddr; /* XXX */ +#ifdef __amd64__ idt_paddr = (char *)idt - (char *)KERNBASE; +#else /* __i386__ */ + idt_paddr = (off_t)pmap_kextract((vm_offset_t)idt); +#endif crom_add_entry(&sc->unit, DCONS_CSR_KEY_RESET_HI, ADDR_HI(idt_paddr)); crom_add_entry(&sc->unit, DCONS_CSR_KEY_RESET_LO, ADDR_LO(idt_paddr)); Modified: head/sys/dev/dcons/dcons_os.c ============================================================================== --- head/sys/dev/dcons/dcons_os.c Fri Apr 13 19:43:23 2018 (r332488) +++ head/sys/dev/dcons/dcons_os.c Fri Apr 13 20:30:49 2018 (r332489) @@ -309,11 +309,16 @@ dcons_drv_init(int stage) * Allow read/write access to dcons buffer. */ for (pa = trunc_page(addr); pa < addr + size; pa += PAGE_SIZE) - *vtopte(KERNBASE + pa) |= PG_RW; + *vtopte(PMAP_MAP_LOW + pa) |= PG_RW; invltlb(); #endif /* XXX P to V */ +#ifdef __amd64__ dg.buf = (struct dcons_buf *)(vm_offset_t)(KERNBASE + addr); +#else /* __i386__ */ + dg.buf = (struct dcons_buf *)((vm_offset_t)PMAP_MAP_LOW + + addr); +#endif dg.size = size; if (dcons_load_buffer(dg.buf, dg.size, sc) < 0) dg.buf = NULL; Modified: head/sys/dev/hyperv/vmbus/i386/vmbus_vector.S ============================================================================== --- head/sys/dev/hyperv/vmbus/i386/vmbus_vector.S Fri Apr 13 19:43:23 2018 (r332488) +++ head/sys/dev/hyperv/vmbus/i386/vmbus_vector.S Fri Apr 13 20:30:49 2018 (r332489) @@ -26,11 +26,12 @@ * $FreeBSD$ */ +#include "assym.inc" + +#include #include #include -#include "assym.inc" - /* * This is the Hyper-V vmbus channel direct callback interrupt. * Only used when it is running on Hyper-V. @@ -42,6 +43,7 @@ IDTVEC(vmbus_isr) PUSH_FRAME SET_KERNEL_SREGS cld + KENTER FAKE_MCOUNT(TF_EIP(%esp)) pushl %esp call vmbus_handle_intr Modified: head/sys/dev/ppc/ppc.c ============================================================================== --- head/sys/dev/ppc/ppc.c Fri Apr 13 19:43:23 2018 (r332488) +++ head/sys/dev/ppc/ppc.c Fri Apr 13 20:30:49 2018 (r332489) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #endif #include @@ -121,7 +122,7 @@ static char *ppc_epp_protocol[] = { " (EPP 1.9)", " (E * BIOS printer list - used by BIOS probe. */ #define BIOS_PPC_PORTS 0x408 -#define BIOS_PORTS (short *)(KERNBASE+BIOS_PPC_PORTS) +#define BIOS_PORTS ((short *)BIOS_PADDRTOVADDR(BIOS_PPC_PORTS)) #define BIOS_MAX_PPC 4 #endif Modified: head/sys/dev/syscons/syscons.c ============================================================================== --- head/sys/dev/syscons/syscons.c Fri Apr 13 19:43:23 2018 (r332488) +++ head/sys/dev/syscons/syscons.c Fri Apr 13 20:30:49 2018 (r332489) @@ -288,7 +288,11 @@ ec_putc(int c) * This is enough for ec_putc() to work very early on x86 * if the kernel starts in normal color text mode. */ +#ifdef __amd64__ fb = KERNBASE + 0xb8000; +#else /* __i386__ */ + fb = PMAP_MAP_LOW + 0xb8000; +#endif xsize = 80; ysize = 25; #endif Modified: head/sys/i386/conf/NOTES ============================================================================== --- head/sys/i386/conf/NOTES Fri Apr 13 19:43:23 2018 (r332488) +++ head/sys/i386/conf/NOTES Fri Apr 13 20:30:49 2018 (r332489) @@ -895,19 +895,6 @@ options ENABLE_ALART # Control alarm on Intel intpm options PMAP_SHPGPERPROC=201 # -# Change the size of the kernel virtual address space. Due to -# constraints in loader(8) on i386, this must be a multiple of 4. -# 256 = 1 GB of kernel address space. Increasing this also causes -# a reduction of the address space in user processes. 512 splits -# the 4GB cpu address space in half (2GB user, 2GB kernel). For PAE -# kernels, the value will need to be double non-PAE. A value of 1024 -# for PAE kernels is necessary to split the address space in half. -# This will likely need to be increased to handle memory sizes >4GB. -# PAE kernels default to a value of 512. -# -options KVA_PAGES=260 - -# # Number of initial kernel page table pages used for early bootstrap. # This number should include enough pages to map the kernel, any # modules or other data loaded with the kernel by the loader, and data @@ -950,22 +937,6 @@ device ndis ##################################################################### # VM OPTIONS - -# Disable the 4 MByte page PSE CPU feature. The PSE feature allows the -# kernel to use 4 MByte pages to map the kernel instead of 4k pages. -# This saves on the amount of memory needed for page tables needed to -# map the kernel. You should only disable this feature as a temporary -# workaround if you are having problems with it enabled. -# -#options DISABLE_PSE - -# Disable the global pages PGE CPU feature. The PGE feature allows pages -# to be marked with the PG_G bit. TLB entries for these pages are not -# flushed from the cache when %cr3 is reloaded. This can make context -# switches less expensive. You should only disable this feature as a -# temporary workaround if you are having problems with it enabled. -# -#options DISABLE_PG_G # KSTACK_PAGES is the number of memory pages to assign to the kernel # stack of each thread. Modified: head/sys/i386/i386/apic_vector.s ============================================================================== --- head/sys/i386/i386/apic_vector.s Fri Apr 13 19:43:23 2018 (r332488) +++ head/sys/i386/i386/apic_vector.s Fri Apr 13 20:30:49 2018 (r332489) @@ -39,6 +39,7 @@ #include "opt_smp.h" #include +#include #include #include @@ -67,34 +68,39 @@ as_lapic_eoi: * translates that into a vector, and passes the vector to the * lapic_handle_intr() function. */ -#define ISR_VEC(index, vec_name) \ - .text ; \ - SUPERALIGN_TEXT ; \ -IDTVEC(vec_name ## _pti) ; \ -IDTVEC(vec_name) ; \ - PUSH_FRAME ; \ - SET_KERNEL_SREGS ; \ - cld ; \ - FAKE_MCOUNT(TF_EIP(%esp)) ; \ - cmpl $0,x2apic_mode ; \ - je 1f ; \ - movl $(MSR_APIC_ISR0 + index),%ecx ; \ - rdmsr ; \ - jmp 2f ; \ -1: ; \ - movl lapic_map, %edx ;/* pointer to local APIC */ \ - movl LA_ISR + 16 * (index)(%edx), %eax ; /* load ISR */ \ -2: ; \ - bsrl %eax, %eax ; /* index of highest set bit in ISR */ \ - jz 3f ; \ - addl $(32 * index),%eax ; \ - pushl %esp ; \ - pushl %eax ; /* pass the IRQ */ \ - call lapic_handle_intr ; \ - addl $8, %esp ; /* discard parameter */ \ -3: ; \ - MEXITCOUNT ; \ + .macro ISR_VEC index, vec_name + .text + SUPERALIGN_TEXT + .globl X\()\vec_name\()_pti, X\()\vec_name + +X\()\vec_name\()_pti: +X\()\vec_name: + PUSH_FRAME + SET_KERNEL_SREGS + cld + KENTER + FAKE_MCOUNT(TF_EIP(%esp)) + cmpl $0,x2apic_mode + je 2f + movl $(MSR_APIC_ISR0 + \index),%ecx + rdmsr + jmp 3f +2: + movl lapic_map, %edx /* pointer to local APIC */ + movl LA_ISR + 16 * \index(%edx), %eax /* load ISR */ +3: + bsrl %eax, %eax /* index of highest set bit in ISR */ + jz 4f + addl $(32 * \index),%eax + pushl %esp + pushl %eax /* pass the IRQ */ + movl $lapic_handle_intr, %eax + call *%eax + addl $8, %esp /* discard parameter */ +4: + MEXITCOUNT jmp doreti + .endm /* * Handle "spurious INTerrupts". @@ -111,13 +117,13 @@ IDTVEC(spuriousint) iret - ISR_VEC(1, apic_isr1) - ISR_VEC(2, apic_isr2) - ISR_VEC(3, apic_isr3) - ISR_VEC(4, apic_isr4) - ISR_VEC(5, apic_isr5) - ISR_VEC(6, apic_isr6) - ISR_VEC(7, apic_isr7) + ISR_VEC 1, apic_isr1 + ISR_VEC 2, apic_isr2 + ISR_VEC 3, apic_isr3 + ISR_VEC 4, apic_isr4 + ISR_VEC 5, apic_isr5 + ISR_VEC 6, apic_isr6 + ISR_VEC 7, apic_isr7 /* * Local APIC periodic timer handler. @@ -129,9 +135,11 @@ IDTVEC(timerint) PUSH_FRAME SET_KERNEL_SREGS cld + KENTER FAKE_MCOUNT(TF_EIP(%esp)) pushl %esp - call lapic_handle_timer + movl $lapic_handle_timer, %eax + call *%eax add $4, %esp MEXITCOUNT jmp doreti @@ -146,8 +154,10 @@ IDTVEC(cmcint) PUSH_FRAME SET_KERNEL_SREGS cld + KENTER FAKE_MCOUNT(TF_EIP(%esp)) - call lapic_handle_cmc + movl $lapic_handle_cmc, %eax + call *%eax MEXITCOUNT jmp doreti @@ -161,8 +171,10 @@ IDTVEC(errorint) PUSH_FRAME SET_KERNEL_SREGS cld + KENTER FAKE_MCOUNT(TF_EIP(%esp)) - call lapic_handle_error + movl $lapic_handle_error, %eax + call *%eax MEXITCOUNT jmp doreti @@ -177,9 +189,11 @@ IDTVEC(xen_intr_upcall) PUSH_FRAME SET_KERNEL_SREGS cld + KENTER FAKE_MCOUNT(TF_EIP(%esp)) pushl %esp - call xen_intr_handle_upcall + movl $xen_intr_handle_upcall, %eax + call *%eax add $4, %esp MEXITCOUNT jmp doreti @@ -200,9 +214,9 @@ IDTVEC(invltlb) PUSH_FRAME SET_KERNEL_SREGS cld - - call invltlb_handler - + KENTER + movl $invltlb_handler, %eax + call *%eax jmp invltlb_ret /* @@ -214,9 +228,9 @@ IDTVEC(invlpg) PUSH_FRAME SET_KERNEL_SREGS cld - - call invlpg_handler - + KENTER + movl $invlpg_handler, %eax + call *%eax jmp invltlb_ret /* @@ -228,9 +242,9 @@ IDTVEC(invlrng) PUSH_FRAME SET_KERNEL_SREGS cld - - call invlrng_handler - + KENTER + movl $invlrng_handler, %eax + call *%eax jmp invltlb_ret /* @@ -242,9 +256,9 @@ IDTVEC(invlcache) PUSH_FRAME SET_KERNEL_SREGS cld - - call invlcache_handler - + KENTER + movl $invlcache_handler, %eax + call *%eax jmp invltlb_ret /* @@ -256,12 +270,11 @@ IDTVEC(ipi_intr_bitmap_handler) PUSH_FRAME SET_KERNEL_SREGS cld - + KENTER call as_lapic_eoi - FAKE_MCOUNT(TF_EIP(%esp)) - - call ipi_bitmap_handler + movl $ipi_bitmap_handler, %eax + call *%eax MEXITCOUNT jmp doreti @@ -274,9 +287,10 @@ IDTVEC(cpustop) PUSH_FRAME SET_KERNEL_SREGS cld - + KENTER call as_lapic_eoi - call cpustop_handler + movl $cpustop_handler, %eax + call *%eax jmp doreti /* @@ -288,9 +302,10 @@ IDTVEC(cpususpend) PUSH_FRAME SET_KERNEL_SREGS cld - + KENTER call as_lapic_eoi - call cpususpend_handler + movl $cpususpend_handler, %eax + call *%eax jmp doreti /* @@ -304,14 +319,14 @@ IDTVEC(rendezvous) PUSH_FRAME SET_KERNEL_SREGS cld - + KENTER #ifdef COUNT_IPIS movl PCPU(CPUID), %eax movl ipi_rendezvous_counts(,%eax,4), %eax incl (%eax) #endif - call smp_rendezvous_action - + movl $smp_rendezvous_action, %eax + call *%eax call as_lapic_eoi jmp doreti Modified: head/sys/i386/i386/atpic_vector.s ============================================================================== --- head/sys/i386/i386/atpic_vector.s Fri Apr 13 19:43:23 2018 (r332488) +++ head/sys/i386/i386/atpic_vector.s Fri Apr 13 20:30:49 2018 (r332489) @@ -36,6 +36,7 @@ * master and slave interrupt controllers. */ +#include #include #include "assym.inc" @@ -43,37 +44,41 @@ /* * Macros for interrupt entry, call to handler, and exit. */ -#define INTR(irq_num, vec_name) \ - .text ; \ - SUPERALIGN_TEXT ; \ -IDTVEC(vec_name ##_pti) ; \ -IDTVEC(vec_name) ; \ - PUSH_FRAME ; \ - SET_KERNEL_SREGS ; \ - cld ; \ -; \ - FAKE_MCOUNT(TF_EIP(%esp)) ; \ - pushl %esp ; \ - pushl $irq_num; /* pass the IRQ */ \ - call atpic_handle_intr ; \ - addl $8, %esp ; /* discard the parameters */ \ -; \ - MEXITCOUNT ; \ + .macro INTR irq_num, vec_name + .text + SUPERALIGN_TEXT + .globl X\()\vec_name\()_pti, X\()\vec_name + +X\()\vec_name\()_pti: +X\()\vec_name: + PUSH_FRAME + SET_KERNEL_SREGS + cld + KENTER + FAKE_MCOUNT(TF_EIP(%esp)) + pushl %esp + pushl $\irq_num /* pass the IRQ */ + movl $atpic_handle_intr, %eax + call *%eax + addl $8, %esp /* discard the parameters */ + + MEXITCOUNT jmp doreti + .endm - INTR(0, atpic_intr0) - INTR(1, atpic_intr1) - INTR(2, atpic_intr2) - INTR(3, atpic_intr3) - INTR(4, atpic_intr4) - INTR(5, atpic_intr5) - INTR(6, atpic_intr6) - INTR(7, atpic_intr7) - INTR(8, atpic_intr8) - INTR(9, atpic_intr9) - INTR(10, atpic_intr10) - INTR(11, atpic_intr11) - INTR(12, atpic_intr12) - INTR(13, atpic_intr13) - INTR(14, atpic_intr14) - INTR(15, atpic_intr15) + INTR 0, atpic_intr0 + INTR 1, atpic_intr1 + INTR 2, atpic_intr2 + INTR 3, atpic_intr3 + INTR 4, atpic_intr4 + INTR 5, atpic_intr5 + INTR 6, atpic_intr6 + INTR 7, atpic_intr7 + INTR 8, atpic_intr8 + INTR 9, atpic_intr9 + INTR 10, atpic_intr10 + INTR 11, atpic_intr11 + INTR 12, atpic_intr12 + INTR 13, atpic_intr13 + INTR 14, atpic_intr14 + INTR 15, atpic_intr15 Modified: head/sys/i386/i386/bios.c ============================================================================== --- head/sys/i386/i386/bios.c Fri Apr 13 19:43:23 2018 (r332488) +++ head/sys/i386/i386/bios.c Fri Apr 13 20:30:49 2018 (r332489) @@ -305,6 +305,7 @@ set_bios_selectors(struct bios_segments *seg, int flag } extern int vm86pa; +extern u_long vm86phystk; extern void bios16_jmp(void); /* @@ -329,7 +330,7 @@ bios16(struct bios_args *args, char *fmt, ...) int flags = BIOSCODE_FLAG | BIOSDATA_FLAG; u_int i, arg_start, arg_end; pt_entry_t *pte; - pd_entry_t *ptd; + pd_entry_t *ptd, orig_ptd; arg_start = 0xffffffff; arg_end = 0; @@ -390,27 +391,14 @@ bios16(struct bios_args *args, char *fmt, ...) args->seg.code32.base = (u_int)&bios16_jmp & PG_FRAME; args->seg.code32.limit = 0xffff; - ptd = (pd_entry_t *)rcr3(); -#if defined(PAE) || defined(PAE_TABLES) - if (ptd == IdlePDPT) -#else - if (ptd == IdlePTD) -#endif - { - /* - * no page table, so create one and install it. - */ - pte = (pt_entry_t *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK); - ptd = (pd_entry_t *)((u_int)IdlePTD + KERNBASE); - *pte = (vm86pa - PAGE_SIZE) | PG_RW | PG_V; - *ptd = vtophys(pte) | PG_RW | PG_V; - } else { - /* - * this is a user-level page table - */ - pte = PTmap; - *pte = (vm86pa - PAGE_SIZE) | PG_RW | PG_V; - } + /* + * no page table, so create one and install it. + */ + pte = (pt_entry_t *)malloc(PAGE_SIZE, M_TEMP, M_WAITOK); + ptd = IdlePTD; + *pte = vm86phystk | PG_RW | PG_V; + orig_ptd = *ptd; + *ptd = vtophys(pte) | PG_RW | PG_V; pmap_invalidate_all(kernel_pmap); /* XXX insurance for now */ stack_top = stack; @@ -464,20 +452,12 @@ bios16(struct bios_args *args, char *fmt, ...) i = bios16_call(&args->r, stack_top); - if (pte == PTmap) { - *pte = 0; /* remove entry */ - /* - * XXX only needs to be invlpg(0) but that doesn't work on the 386 - */ - pmap_invalidate_all(kernel_pmap); - } else { - *ptd = 0; /* remove page table */ - /* - * XXX only needs to be invlpg(0) but that doesn't work on the 386 - */ - pmap_invalidate_all(kernel_pmap); - free(pte, M_TEMP); /* ... and free it */ - } + *ptd = orig_ptd; /* remove page table */ + /* + * XXX only needs to be invlpg(0) but that doesn't work on the 386 + */ + pmap_invalidate_all(kernel_pmap); + free(pte, M_TEMP); /* ... and free it */ return (i); } Added: head/sys/i386/i386/copyout.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/i386/i386/copyout.c Fri Apr 13 20:30:49 2018 (r332489) @@ -0,0 +1,489 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Konstantin Belousov + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#if defined(PAE) || defined(PAE_TABLES) +#define KCR3 ((u_int)IdlePDPT) +#else +#define KCR3 ((u_int)IdlePTD) +#endif + +int copyin_fast(const void *udaddr, void *kaddr, size_t len, u_int); +static int (*copyin_fast_tramp)(const void *, void *, size_t, u_int); +int copyout_fast(const void *kaddr, void *udaddr, size_t len, u_int); +static int (*copyout_fast_tramp)(const void *, void *, size_t, u_int); +int fubyte_fast(volatile const void *base, u_int kcr3); +static int (*fubyte_fast_tramp)(volatile const void *, u_int); +int fuword16_fast(volatile const void *base, u_int kcr3); +static int (*fuword16_fast_tramp)(volatile const void *, u_int); +int fueword_fast(volatile const void *base, long *val, u_int kcr3); +static int (*fueword_fast_tramp)(volatile const void *, long *, u_int); +int subyte_fast(volatile void *base, int val, u_int kcr3); +static int (*subyte_fast_tramp)(volatile void *, int, u_int); +int suword16_fast(volatile void *base, int val, u_int kcr3); +static int (*suword16_fast_tramp)(volatile void *, int, u_int); +int suword_fast(volatile void *base, long val, u_int kcr3); +static int (*suword_fast_tramp)(volatile void *, long, u_int); + +static int fast_copyout = 1; +SYSCTL_INT(_machdep, OID_AUTO, fast_copyout, CTLFLAG_RWTUN, + &fast_copyout, 0, + ""); + +void +copyout_init_tramp(void) +{ + + copyin_fast_tramp = (int (*)(const void *, void *, size_t, u_int))( + (uintptr_t)copyin_fast + setidt_disp); + copyout_fast_tramp = (int (*)(const void *, void *, size_t, u_int))( + (uintptr_t)copyout_fast + setidt_disp); + fubyte_fast_tramp = (int (*)(volatile const void *, u_int))( + (uintptr_t)fubyte_fast + setidt_disp); + fuword16_fast_tramp = (int (*)(volatile const void *, u_int))( + (uintptr_t)fuword16_fast + setidt_disp); + fueword_fast_tramp = (int (*)(volatile const void *, long *, u_int))( + (uintptr_t)fueword_fast + setidt_disp); + subyte_fast_tramp = (int (*)(volatile void *, int, u_int))( + (uintptr_t)subyte_fast + setidt_disp); + suword16_fast_tramp = (int (*)(volatile void *, int, u_int))( + (uintptr_t)suword16_fast + setidt_disp); + suword_fast_tramp = (int (*)(volatile void *, long, u_int))( + (uintptr_t)suword_fast + setidt_disp); +} + +static int +cp_slow0(vm_offset_t uva, size_t len, bool write, + void (*f)(vm_offset_t, void *), void *arg) +{ + struct pcpu *pc; + vm_page_t m[2]; + pt_entry_t *pte; + vm_offset_t kaddr; + int error, i, plen; + bool sleepable; + + plen = howmany(uva - trunc_page(uva) + len, PAGE_SIZE); + MPASS(plen <= nitems(m)); + error = 0; + i = vm_fault_quick_hold_pages(&curproc->p_vmspace->vm_map, uva, len, + (write ? VM_PROT_WRITE : VM_PROT_READ) | VM_PROT_QUICK_NOFAULT, + m, nitems(m)); + if (i != plen) + return (EFAULT); + sched_pin(); + pc = get_pcpu(); + if (!THREAD_CAN_SLEEP() || curthread->td_vslock_sz > 0 || + (curthread->td_pflags & TDP_NOFAULTING) != 0) { + sleepable = false; + mtx_lock(&pc->pc_copyout_mlock); + kaddr = pc->pc_copyout_maddr; + } else { + sleepable = true; + sx_xlock(&pc->pc_copyout_slock); + kaddr = pc->pc_copyout_saddr; + } + for (i = 0, pte = vtopte(kaddr); i < plen; i++, pte++) { + *pte = PG_V | PG_RW | PG_A | PG_M | VM_PAGE_TO_PHYS(m[i]) | + pmap_cache_bits(pmap_page_get_memattr(m[i]), FALSE); + invlpg(kaddr + ptoa(i)); + } + kaddr += uva - trunc_page(uva); + f(kaddr, arg); + sched_unpin(); + if (sleepable) + sx_xunlock(&pc->pc_copyout_slock); + else + mtx_unlock(&pc->pc_copyout_mlock); + for (i = 0; i < plen; i++) { + vm_page_lock(m[i]); + vm_page_unhold(m[i]); + vm_page_unlock(m[i]); + } + return (error); +} + +struct copyinstr_arg0 { + vm_offset_t kc; + size_t len; + size_t alen; + bool end; +}; + +static void +copyinstr_slow0(vm_offset_t kva, void *arg) +{ + struct copyinstr_arg0 *ca; + char c; + + ca = arg; + MPASS(ca->alen == 0 && ca->len > 0 && !ca->end); + while (ca->alen < ca->len && !ca->end) { + c = *(char *)(kva + ca->alen); + *(char *)ca->kc = c; + ca->alen++; + ca->kc++; + if (c == '\0') + ca->end = true; + } +} + +int +copyinstr(const void *udaddr, void *kaddr, size_t maxlen, size_t *lencopied) +{ + struct copyinstr_arg0 ca; + vm_offset_t uc; + size_t plen; + int error; + + error = 0; + ca.end = false; + for (plen = 0, uc = (vm_offset_t)udaddr, ca.kc = (vm_offset_t)kaddr; + plen < maxlen && !ca.end; uc += ca.alen, plen += ca.alen) { + ca.len = round_page(uc) - uc; + if (ca.len == 0) + ca.len = PAGE_SIZE; + if (plen + ca.len > maxlen) + ca.len = maxlen - plen; + ca.alen = 0; + if (cp_slow0(uc, ca.len, false, copyinstr_slow0, &ca) != 0) { + error = EFAULT; + break; + } + } + if (!ca.end && plen == maxlen && error == 0) + error = ENAMETOOLONG; + if (lencopied != NULL) + *lencopied = plen; + return (error); +} + +struct copyin_arg0 { + vm_offset_t kc; + size_t len; +}; + +static void +copyin_slow0(vm_offset_t kva, void *arg) +{ + struct copyin_arg0 *ca; + + ca = arg; + bcopy((void *)kva, (void *)ca->kc, ca->len); +} + +int +copyin(const void *udaddr, void *kaddr, size_t len) +{ + struct copyin_arg0 ca; + vm_offset_t uc; + size_t plen; + + if ((uintptr_t)udaddr + len < (uintptr_t)udaddr || + (uintptr_t)udaddr + len > VM_MAXUSER_ADDRESS) + return (-1); + if (len == 0 || (fast_copyout && len <= TRAMP_COPYOUT_SZ && + copyin_fast_tramp(udaddr, kaddr, len, KCR3) == 0)) + return (0); + for (plen = 0, uc = (vm_offset_t)udaddr, ca.kc = (vm_offset_t)kaddr; + plen < len; uc += ca.len, ca.kc += ca.len, plen += ca.len) { + ca.len = round_page(uc) - uc; + if (ca.len == 0) + ca.len = PAGE_SIZE; + if (plen + ca.len > len) + ca.len = len - plen; + if (cp_slow0(uc, ca.len, false, copyin_slow0, &ca) != 0) + return (EFAULT); + } + return (0); +} + +static void +copyout_slow0(vm_offset_t kva, void *arg) +{ + struct copyin_arg0 *ca; + + ca = arg; + bcopy((void *)ca->kc, (void *)kva, ca->len); +} + +int +copyout(const void *kaddr, void *udaddr, size_t len) +{ + struct copyin_arg0 ca; + vm_offset_t uc; + size_t plen; + + if ((uintptr_t)udaddr + len < (uintptr_t)udaddr || + (uintptr_t)udaddr + len > VM_MAXUSER_ADDRESS) + return (-1); + if (len == 0 || (fast_copyout && len <= TRAMP_COPYOUT_SZ && + copyout_fast_tramp(kaddr, udaddr, len, KCR3) == 0)) + return (0); + for (plen = 0, uc = (vm_offset_t)udaddr, ca.kc = (vm_offset_t)kaddr; + plen < len; uc += ca.len, ca.kc += ca.len, plen += ca.len) { + ca.len = round_page(uc) - uc; + if (ca.len == 0) + ca.len = PAGE_SIZE; + if (plen + ca.len > len) + ca.len = len - plen; + if (cp_slow0(uc, ca.len, true, copyout_slow0, &ca) != 0) + return (EFAULT); + } + return (0); +} + +/* + * Fetch (load) a 32-bit word, a 16-bit word, or an 8-bit byte from user + * memory. + */ + +static void +fubyte_slow0(vm_offset_t kva, void *arg) +{ + + *(int *)arg = *(u_char *)kva; +} + +int +fubyte(volatile const void *base) +{ + int res; + + if ((uintptr_t)base + sizeof(uint8_t) < (uintptr_t)base || + (uintptr_t)base + sizeof(uint8_t) > VM_MAXUSER_ADDRESS) + return (-1); + if (fast_copyout) { + res = fubyte_fast_tramp(base, KCR3); + if (res != -1) + return (res); + } + if (cp_slow0((vm_offset_t)base, sizeof(char), false, fubyte_slow0, + &res) != 0) + return (-1); + return (res); +} + +static void +fuword16_slow0(vm_offset_t kva, void *arg) +{ + + *(int *)arg = *(uint16_t *)kva; +} + +int +fuword16(volatile const void *base) +{ + int res; + + if ((uintptr_t)base + sizeof(uint16_t) < (uintptr_t)base || + (uintptr_t)base + sizeof(uint16_t) > VM_MAXUSER_ADDRESS) + return (-1); + if (fast_copyout) { + res = fuword16_fast_tramp(base, KCR3); + if (res != -1) + return (res); + } + if (cp_slow0((vm_offset_t)base, sizeof(uint16_t), false, + fuword16_slow0, &res) != 0) + return (-1); + return (res); +} + +static void +fueword_slow0(vm_offset_t kva, void *arg) +{ + + *(uint32_t *)arg = *(uint32_t *)kva; +} + +int +fueword(volatile const void *base, long *val) +{ + uint32_t res; + + if ((uintptr_t)base + sizeof(*val) < (uintptr_t)base || + (uintptr_t)base + sizeof(*val) > VM_MAXUSER_ADDRESS) + return (-1); + if (fast_copyout) { + if (fueword_fast_tramp(base, val, KCR3) == 0) + return (0); + } + if (cp_slow0((vm_offset_t)base, sizeof(long), false, fueword_slow0, + &res) != 0) + return (-1); + *val = res; + return (0); +} + +int +fueword32(volatile const void *base, int32_t *val) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Apr 13 20:42:24 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 20F86FA5B7E; Fri, 13 Apr 2018 20:42:24 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7A3A3822D5; Fri, 13 Apr 2018 20:42:23 +0000 (UTC) (envelope-from chmeeedalf@gmail.com) Received: by mail-lf0-x241.google.com with SMTP id m200-v6so14319752lfm.4; Fri, 13 Apr 2018 13:42:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=PumMV9+NU4/r2PfosSqZudAzRik9KDLWdHTSA47JWjQ=; b=ttItOq+r8s3GpIA/SnuKhTq5KTuuxcPy9HYGOmgEswilmbP7ckndenjzCwihG+b54g KEn1Aw6AgMge/4d1bl6B0cOhU6b1Wl4cjyZSmQ3Aa8SJ/sBhTQqEt2uu6QXW8wmSr603 6sowjE+ch0bulwkFMznusO7S9nA1AyAZydjkMSCpfNQXqnyiFAZkrnLOt+RLAo5KS+yQ n0d+a4UxRR4tF3N/DWcD0FX5aiLuT8ut2H1N1m6NPEKOiWPEdQM03ISPSCS1Cqhq9wA3 /lf86kw69ygTa6h0vVWC1RLNFTYqcKAOorASpWsZHYKXL0YRzeg+2iJN3EKaOBkYtN5c Wt7Q== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=alumni-cwru-edu.20150623.gappssmtp.com; s=20150623; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=PumMV9+NU4/r2PfosSqZudAzRik9KDLWdHTSA47JWjQ=; b=xB/PYZqHcSEYn1eCThuwgoO6jT7sFTLgXJ2MVDJGp5q7mlBk3XubHgoot1zqdjGXdS t2t2B3jXnd8C6AxN2H1cZH32+ubCPeEWvUXvLvZWHdnwVPxO/LAHIdJ+oF2/e2Gji+wb N5sQ8aHKOQc4mcNc04zeRY45jH/MECsOZqXRy1fKS8Ep0ABEnIMEI9Au70iATrLAw6Gf rHat9ePFOSvxz5LGeLyI+P1k/P2TyDum0SBVSgFocj+e0ocsrEzEFJaFthT8DA0Sp4oI gHUT0gDZSAZh6iU1r2VXsBAagarQzfwPtWfSbApg4OYE1107BZAXMcJ0wWUZAKdGULwF WLWQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=PumMV9+NU4/r2PfosSqZudAzRik9KDLWdHTSA47JWjQ=; b=R71tTxzyQrnQ5P6wkLltguP8S6V3Luw/AoSocP/EAnOSpxLoNPrakoLWpK/r0bbk6i q9hOWXct2evxqQAh/SAYzlZe/e0l9X//iVizdpUir0pJhSclq3dHLNUTTaI+X5ZjsZL1 U2FXdJgDAOV0NiempmhT4KU1Vo/NpkszcWN+pd6AwUF7D/mzn6tEGOOMw18vUoa1EcmY wYeSXWRR/1lj7jfxRuo+i58s9s68XoD4bwEqk1VShb6zK2ynfBAQBX0UvvkEDt60IHmZ xNcCFme1H9Unj0+LRsTMiuqn6AAEgm8pMtv3ULNKHrEiIAnqqZOsPiRqqc2MjwOz0pBd CvaA== X-Gm-Message-State: ALQs6tBi6K/BKncTX3qF8SU7LfcKoB0Khnh8lKWlsvOjOGTdh6mcZX99 1t6V87IDofHf2BcpoOieaEH+7l9O8mL4vNlnD67hug== X-Google-Smtp-Source: AIpwx49AwjJIDvfqmbooi+yj+IRqjT+705Choq3k0x9JyDjvIiJd7RWWhB0gsqkVgzvTQAhI26G+95nm45MP6S8ujeE= X-Received: by 10.46.17.23 with SMTP id f23mr4117227lje.43.1523652141365; Fri, 13 Apr 2018 13:42:21 -0700 (PDT) MIME-Version: 1.0 Sender: chmeeedalf@gmail.com Received: by 10.46.104.15 with HTTP; Fri, 13 Apr 2018 13:42:20 -0700 (PDT) In-Reply-To: <201804120720.w3C7Koe4032111@repo.freebsd.org> References: <201804120720.w3C7Koe4032111@repo.freebsd.org> From: Justin Hibbits Date: Fri, 13 Apr 2018 15:42:20 -0500 X-Google-Sender-Auth: B3hTYHI3BfyWrWj2mYwshD-cx04 Message-ID: Subject: Re: svn commit: r332423 - in head/sys: conf dev/cxgbe dev/ixgbe dev/ixl dev/netmap dev/re modules/netmap net sys To: Vincenzo Maffione Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 20:42:24 -0000 On Thu, Apr 12, 2018 at 2:20 AM, Vincenzo Maffione wrote: > Author: vmaffione > Date: Thu Apr 12 07:20:50 2018 > New Revision: 332423 > URL: https://svnweb.freebsd.org/changeset/base/332423 > > Log: > netmap: align codebase to the current upstream (commit id 3fb001303718146) > > Changelist: > - Turn tx_rings and rx_rings arrays into arrays of pointers to kring > structs. This patch includes fixes for ixv, ixl, ix, re, cxgbe, iflib, > vtnet and ptnet drivers to cope with the change. > - Generalize the nm_config() callback to accept a struct containing many > parameters. > - Introduce NKR_FAKERING to support buffers sharing (used for netmap > pipes) > - Improved API for external VALE modules. > - Various bug fixes and improvements to the netmap memory allocator, > including support for externally (userspace) allocated memory. > - Refactoring of netmap pipes: now linked rings share the same netmap > buffers, with a separate set of kring pointers (rhead, rcur, rtail). > Buffer swapping does not need to happen anymore. > - Large refactoring of the control API towards an extensible solution; > the goal is to allow the addition of more commands and extension of > existing ones (with new options) without the need of hacks or the > risk of running out of configuration space. > A new NIOCCTRL ioctl has been added to handle all the requests of the > new control API, which cover all the functionalities so far supported. > The netmap API bumps from 11 to 12 with this patch. Full backward > compatibility is provided for the old control command (NIOCREGIF), by > means of a new netmap_legacy module. Many parts of the old netmap.h > header has now been moved to netmap_legacy.h (included by netmap.h). > > Approved by: hrs (mentor) > > Added: > head/sys/dev/netmap/netmap_legacy.c (contents, props changed) > head/sys/net/netmap_legacy.h (contents, props changed) > Modified: > head/sys/conf/files > head/sys/dev/cxgbe/t4_netmap.c > head/sys/dev/ixgbe/if_ixv.c > head/sys/dev/ixl/ixl_pf_main.c > head/sys/dev/ixl/ixl_txrx.c > head/sys/dev/netmap/if_ptnet.c > head/sys/dev/netmap/if_re_netmap.h > head/sys/dev/netmap/if_vtnet_netmap.h > head/sys/dev/netmap/netmap.c > head/sys/dev/netmap/netmap_freebsd.c > head/sys/dev/netmap/netmap_generic.c > head/sys/dev/netmap/netmap_kern.h > head/sys/dev/netmap/netmap_mem2.c > head/sys/dev/netmap/netmap_mem2.h > head/sys/dev/netmap/netmap_monitor.c > head/sys/dev/netmap/netmap_pipe.c > head/sys/dev/netmap/netmap_pt.c > head/sys/dev/netmap/netmap_vale.c > head/sys/dev/re/if_re.c > head/sys/modules/netmap/Makefile > head/sys/net/iflib.c > head/sys/net/netmap.h > head/sys/net/netmap_user.h > head/sys/net/netmap_virt.h > head/sys/sys/param.h This breaks 32-bit powerpc LINT, with errors of: /usr/src/sys/dev/netmap/netmap.c: In function 'netmap_get_na': /usr/src/sys/dev/netmap/netmap.c:1479: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] /usr/src/sys/dev/netmap/netmap.c: In function 'netmap_ioctl': /usr/src/sys/dev/netmap/netmap.c:2329: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] /usr/src/sys/dev/netmap/netmap.c:2344: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] /usr/src/sys/dev/netmap/netmap.c:2447: warning: cast to pointer from integer of different size [-Wint-to-pointer-cast] /usr/src/sys/dev/netmap/netmap.c:2466: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast] among others. struct nmreq_header->nr_body is a uint64_t, casting to 32-bit pointers needs to go through uintptr_t. - Justin From owner-svn-src-head@freebsd.org Fri Apr 13 20:48:31 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id F1445F80163; Fri, 13 Apr 2018 20:48:30 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: from mail-qk0-x233.google.com (mail-qk0-x233.google.com [IPv6:2607:f8b0:400d:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id DAEE482AD9; Fri, 13 Apr 2018 20:48:29 +0000 (UTC) (envelope-from v.maffione@gmail.com) Received: by mail-qk0-x233.google.com with SMTP id f9so2569401qkm.12; Fri, 13 Apr 2018 13:48:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nA0b5mXSxOgmDf72BK8ehqXhjQ/Ov34qEPtp6zw85gk=; b=LIlS475Aoja6TTUh4v6u8OgMOOCRghAZds4yNFgziPAIl+AXV+zcrS2LYa1Cup73tD OhxdlMFl1rnUyGlBvLJeKAS7XU+Ix0tFZbEHr3DxRz0HjvtwGQFbW6zARG912U/f04D9 F5sEcYvWohSNiXwZ40hZh3z5XxTI294qxpGa3rqGq/YkeskZXBZN6oQ8l8+U9+15fkjN gGlq8WuUCCOn/blREq6p4MGfYj9pyTjv45k6pB+WLYL1WWQ7H9JQNSzSrsHdzyTIdgyN mFicc9fHfjiV0IIEwAxSDVZfVWh/J0vjzDaXVIbrxabsfnLq3jTF2TE7/lAkOLxRFiY4 9eKw== 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=nA0b5mXSxOgmDf72BK8ehqXhjQ/Ov34qEPtp6zw85gk=; b=R2uSJMbqaEm9KEIfuJ6krordG7lx9CwdhR0wNSMkzj3SdiFL9iQOTaQo0gWCCpB92F UhdHydFcwPClo/lnjWYiXaUV/trFWIBrPsr5EW0OcE2Sn8MzGzYPaHRyyvny6TWSIa0B 5LrIH5SE0BBYvrxcqdqOokgpzUuCWLZAZA6jbnE4aM8H6fM2a13PtnC3em/75hv8k+b7 CL+qshGis161RkNTx0McfY8a3nrWhHl1yWvTe3d1pUTkpP6l5F92eLpy5Oz1TeXBiTYy oh4zgWk8HJwJdXaXWn546I8qDT4kK1b3a1osIfRxotC3uqWErJ7L/M7EQkADVeO2je3k tYDg== X-Gm-Message-State: ALQs6tCSASGqXLrE3WQLVdk0RLrxLmp2ELQA9bHmdEKg/UYuGF0XMmt2 QOXjkyKN1m3CwjbZS2OJHJ2gTv6pA3/Wc5qnChg= X-Google-Smtp-Source: AIpwx4+OqN6v+SXATa5S8cU7yNwpdWYRikZT5ClamirP94ZxkV2cm4u68d/UQBOmo4wZKF+ErFSD/fMx2ObodOKycsE= X-Received: by 10.233.235.2 with SMTP id b2mr6148541qkg.27.1523652508366; Fri, 13 Apr 2018 13:48:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.190.132 with HTTP; Fri, 13 Apr 2018 13:48:27 -0700 (PDT) In-Reply-To: References: <201804120720.w3C7Koe4032111@repo.freebsd.org> From: Vincenzo Maffione Date: Fri, 13 Apr 2018 22:48:27 +0200 Message-ID: Subject: Re: svn commit: r332423 - in head/sys: conf dev/cxgbe dev/ixgbe dev/ixl dev/netmap dev/re modules/netmap net sys To: Justin Hibbits Cc: Vincenzo Maffione , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 20:48:31 -0000 Right, sorry for that. The fix is actually already in the upstream github, I'm preparing a commit to import that. Cheers, Vincenzo 2018-04-13 22:42 GMT+02:00 Justin Hibbits : > On Thu, Apr 12, 2018 at 2:20 AM, Vincenzo Maffione > wrote: > > Author: vmaffione > > Date: Thu Apr 12 07:20:50 2018 > > New Revision: 332423 > > URL: https://svnweb.freebsd.org/changeset/base/332423 > > > > Log: > > netmap: align codebase to the current upstream (commit id > 3fb001303718146) > > > > Changelist: > > - Turn tx_rings and rx_rings arrays into arrays of pointers to > kring > > structs. This patch includes fixes for ixv, ixl, ix, re, cxgbe, > iflib, > > vtnet and ptnet drivers to cope with the change. > > - Generalize the nm_config() callback to accept a struct > containing many > > parameters. > > - Introduce NKR_FAKERING to support buffers sharing (used for > netmap > > pipes) > > - Improved API for external VALE modules. > > - Various bug fixes and improvements to the netmap memory > allocator, > > including support for externally (userspace) allocated memory. > > - Refactoring of netmap pipes: now linked rings share the same > netmap > > buffers, with a separate set of kring pointers (rhead, rcur, > rtail). > > Buffer swapping does not need to happen anymore. > > - Large refactoring of the control API towards an extensible > solution; > > the goal is to allow the addition of more commands and extension > of > > existing ones (with new options) without the need of hacks or the > > risk of running out of configuration space. > > A new NIOCCTRL ioctl has been added to handle all the requests > of the > > new control API, which cover all the functionalities so far > supported. > > The netmap API bumps from 11 to 12 with this patch. Full backward > > compatibility is provided for the old control command > (NIOCREGIF), by > > means of a new netmap_legacy module. Many parts of the old > netmap.h > > header has now been moved to netmap_legacy.h (included by > netmap.h). > > > > Approved by: hrs (mentor) > > > > Added: > > head/sys/dev/netmap/netmap_legacy.c (contents, props changed) > > head/sys/net/netmap_legacy.h (contents, props changed) > > Modified: > > head/sys/conf/files > > head/sys/dev/cxgbe/t4_netmap.c > > head/sys/dev/ixgbe/if_ixv.c > > head/sys/dev/ixl/ixl_pf_main.c > > head/sys/dev/ixl/ixl_txrx.c > > head/sys/dev/netmap/if_ptnet.c > > head/sys/dev/netmap/if_re_netmap.h > > head/sys/dev/netmap/if_vtnet_netmap.h > > head/sys/dev/netmap/netmap.c > > head/sys/dev/netmap/netmap_freebsd.c > > head/sys/dev/netmap/netmap_generic.c > > head/sys/dev/netmap/netmap_kern.h > > head/sys/dev/netmap/netmap_mem2.c > > head/sys/dev/netmap/netmap_mem2.h > > head/sys/dev/netmap/netmap_monitor.c > > head/sys/dev/netmap/netmap_pipe.c > > head/sys/dev/netmap/netmap_pt.c > > head/sys/dev/netmap/netmap_vale.c > > head/sys/dev/re/if_re.c > > head/sys/modules/netmap/Makefile > > head/sys/net/iflib.c > > head/sys/net/netmap.h > > head/sys/net/netmap_user.h > > head/sys/net/netmap_virt.h > > head/sys/sys/param.h > > This breaks 32-bit powerpc LINT, with errors of: > > /usr/src/sys/dev/netmap/netmap.c: In function 'netmap_get_na': > /usr/src/sys/dev/netmap/netmap.c:1479: warning: cast to pointer from > integer of different size [-Wint-to-pointer-cast] > /usr/src/sys/dev/netmap/netmap.c: In function 'netmap_ioctl': > /usr/src/sys/dev/netmap/netmap.c:2329: warning: cast to pointer from > integer of different size [-Wint-to-pointer-cast] > /usr/src/sys/dev/netmap/netmap.c:2344: warning: cast to pointer from > integer of different size [-Wint-to-pointer-cast] > /usr/src/sys/dev/netmap/netmap.c:2447: warning: cast to pointer from > integer of different size [-Wint-to-pointer-cast] > /usr/src/sys/dev/netmap/netmap.c:2466: warning: cast from pointer to > integer of different size [-Wpointer-to-int-cast] > > among others. > > struct nmreq_header->nr_body is a uint64_t, casting to 32-bit pointers > needs to go through uintptr_t. > > - Justin > -- Vincenzo Maffione From owner-svn-src-head@freebsd.org Fri Apr 13 21:18:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 6063CF82541; Fri, 13 Apr 2018 21:18:07 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 105D86ACCB; Fri, 13 Apr 2018 21:18:07 +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 096121F0B3; Fri, 13 Apr 2018 21:18:07 +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 w3DLI6hl079128; Fri, 13 Apr 2018 21:18:06 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3DLI5YW079110; Fri, 13 Apr 2018 21:18:05 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201804132118.w3DLI5YW079110@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Fri, 13 Apr 2018 21:18:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332490 - in head: . contrib/bsnmp/snmp_mibII lib/libc/net share/man/man4 stand/i386/libi386 sys/conf sys/dev/cm sys/modules sys/modules/arcnet sys/modules/cm sys/net sys/netinet sys/ne... X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head: . contrib/bsnmp/snmp_mibII lib/libc/net share/man/man4 stand/i386/libi386 sys/conf sys/dev/cm sys/modules sys/modules/arcnet sys/modules/cm sys/net sys/netinet sys/netinet6 X-SVN-Commit-Revision: 332490 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 21:18:07 -0000 Author: brooks Date: Fri Apr 13 21:18:04 2018 New Revision: 332490 URL: https://svnweb.freebsd.org/changeset/base/332490 Log: Remove support for the Arcnet protocol. While Arcnet has some continued deployment in industrial controls, the lack of drivers for any of the PCI, USB, or PCIe NICs on the market suggests such users aren't running FreeBSD. Evidence in the PR database suggests that the cm(4) driver (our sole Arcnet NIC) was broken in 5.0 and has not worked since. PR: 182297 Reviewed by: jhibbits, vangyzen Relnotes: yes Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D15057 Deleted: head/share/man/man4/cm.4 head/sys/dev/cm/if_cm_isa.c head/sys/dev/cm/smc90cx6.c head/sys/dev/cm/smc90cx6reg.h head/sys/dev/cm/smc90cx6var.h head/sys/modules/arcnet/Makefile head/sys/modules/cm/Makefile head/sys/net/if_arc.h head/sys/net/if_arcsubr.c Modified: head/ObsoleteFiles.inc head/UPDATING head/contrib/bsnmp/snmp_mibII/mibII.c head/lib/libc/net/getnameinfo.c head/share/man/man4/Makefile head/stand/i386/libi386/pxe.h head/sys/conf/NOTES head/sys/conf/files head/sys/conf/files.i386 head/sys/modules/Makefile head/sys/net/if.c head/sys/net/if_arp.h head/sys/netinet/if_ether.c head/sys/netinet6/in6.c head/sys/netinet6/in6_ifattach.c head/sys/netinet6/nd6.c head/sys/netinet6/nd6_nbr.c Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Fri Apr 13 20:30:49 2018 (r332489) +++ head/ObsoleteFiles.inc Fri Apr 13 21:18:04 2018 (r332490) @@ -38,6 +38,9 @@ # xargs -n1 | sort | uniq -d; # done +# 20180413: remove Arcnet support +OLD_FILES+=usr/include/net/if_arc.h +OLD_FILES+=usr/share/man/man4/cm.4 # 20180409: remove FDDI support OLD_FILES+=usr/include/net/fddi.h OLD_FILES+=usr/share/man/man4/fpa.4.gz Modified: head/UPDATING ============================================================================== --- head/UPDATING Fri Apr 13 20:30:49 2018 (r332489) +++ head/UPDATING Fri Apr 13 21:18:04 2018 (r332490) @@ -51,6 +51,11 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 12.x IS SLOW: ****************************** SPECIAL WARNING: ****************************** +20180413: + Support for Arcnet networks has been removed. If you have device + arcnet or device cm in your kernel config file they must be + removed. + 20180411: Support for FDDI networks has been removed. If you have device fddi or device fpa in your kernel config file they must be Modified: head/contrib/bsnmp/snmp_mibII/mibII.c ============================================================================== --- head/contrib/bsnmp/snmp_mibII/mibII.c Fri Apr 13 20:30:49 2018 (r332489) +++ head/contrib/bsnmp/snmp_mibII/mibII.c Fri Apr 13 21:18:04 2018 (r332490) @@ -846,7 +846,6 @@ static void check_llbcast(struct mibif *ifp) { static u_char ether_bcast[6] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - static u_char arcnet_bcast = 0; struct mibrcvaddr *rcv; if (!(ifp->mib.ifmd_flags & IFF_BROADCAST)) @@ -860,12 +859,6 @@ check_llbcast(struct mibif *ifp) case IFT_L2VLAN: if (mib_find_rcvaddr(ifp->index, ether_bcast, 6) == NULL && (rcv = mib_rcvaddr_create(ifp, ether_bcast, 6)) != NULL) - rcv->flags |= MIBRCVADDR_BCAST; - break; - - case IFT_ARCNET: - if (mib_find_rcvaddr(ifp->index, &arcnet_bcast, 1) == NULL && - (rcv = mib_rcvaddr_create(ifp, &arcnet_bcast, 1)) != NULL) rcv->flags |= MIBRCVADDR_BCAST; break; } Modified: head/lib/libc/net/getnameinfo.c ============================================================================== --- head/lib/libc/net/getnameinfo.c Fri Apr 13 20:30:49 2018 (r332489) +++ head/lib/libc/net/getnameinfo.c Fri Apr 13 21:18:04 2018 (r332490) @@ -481,7 +481,6 @@ getnameinfo_link(const struct afd *afd, * IFT_OTHER (netinet/ip_ipip.c) */ /* default below is believed correct for all these. */ - case IFT_ARCNET: case IFT_ETHER: case IFT_FDDI: case IFT_HIPPI: Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Fri Apr 13 20:30:49 2018 (r332489) +++ head/share/man/man4/Makefile Fri Apr 13 21:18:04 2018 (r332490) @@ -120,7 +120,6 @@ MAN= aac.4 \ chromebook_platform.4 \ ciss.4 \ cloudabi.4 \ - cm.4 \ cmx.4 \ ${_coretemp.4} \ ${_cpuctl.4} \ Modified: head/stand/i386/libi386/pxe.h ============================================================================== --- head/stand/i386/libi386/pxe.h Fri Apr 13 20:30:49 2018 (r332489) +++ head/stand/i386/libi386/pxe.h Fri Apr 13 21:18:04 2018 (r332490) @@ -245,7 +245,6 @@ typedef struct { # define ETHER_TYPE 1 # define EXP_ETHER_TYPE 2 # define IEEE_TYPE 6 -# define ARCNET_TYPE 7 uint16_t HwAddrLen; /* Length of hardware address */ MAC_ADDR CurrentNodeAddress; /* Current hardware address */ Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Fri Apr 13 20:30:49 2018 (r332489) +++ head/sys/conf/NOTES Fri Apr 13 21:18:04 2018 (r332490) @@ -845,9 +845,6 @@ device wlan_xauth device wlan_acl device wlan_amrr -# The `arcnet' device provides generic code to support Arcnet. -device arcnet - # The `sppp' device serves a similar role for certain types # of synchronous PPP links (like `cx', `ar'). device sppp Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Apr 13 20:30:49 2018 (r332489) +++ head/sys/conf/files Fri Apr 13 21:18:04 2018 (r332490) @@ -1362,7 +1362,6 @@ dev/cfi/cfi_dev.c optional cfi dev/cfi/cfi_disk.c optional cfid dev/chromebook_platform/chromebook_platform.c optional chromebook_platform dev/ciss/ciss.c optional ciss -dev/cm/smc90cx6.c optional cm dev/cmx/cmx.c optional cmx dev/cmx/cmx_pccard.c optional cmx pccard dev/cpufreq/ichss.c optional cpufreq pci @@ -4127,7 +4126,6 @@ net/bridgestp.c optional bridge | if_bridge net/flowtable.c optional flowtable inet | flowtable inet6 net/ieee8023ad_lacp.c optional lagg net/if.c standard -net/if_arcsubr.c optional arcnet net/if_bridge.c optional bridge inet | if_bridge inet net/if_clone.c standard net/if_dead.c standard Modified: head/sys/conf/files.i386 ============================================================================== --- head/sys/conf/files.i386 Fri Apr 13 20:30:49 2018 (r332489) +++ head/sys/conf/files.i386 Fri Apr 13 21:18:04 2018 (r332490) @@ -185,7 +185,6 @@ dev/ce/ceddk.c optional ce dev/ce/if_ce.c optional ce dev/ce/tau32-ddk.c optional ce \ compile-with "${NORMAL_C} ${NO_WCONSTANT_CONVERSION}" -dev/cm/if_cm_isa.c optional cm isa dev/coretemp/coretemp.c optional coretemp dev/cp/cpddk.c optional cp dev/cp/if_cp.c optional cp Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Fri Apr 13 20:30:49 2018 (r332489) +++ head/sys/modules/Makefile Fri Apr 13 21:18:04 2018 (r332490) @@ -42,7 +42,6 @@ SUBDIR= \ ${_aout} \ ${_apm} \ ${_arcmsr} \ - ${_arcnet} \ ${_armv8crypto} \ ${_asmc} \ ata \ @@ -92,7 +91,6 @@ SUBDIR= \ cloudabi \ ${_cloudabi32} \ ${_cloudabi64} \ - ${_cm} \ ${_cmx} \ ${_coff} \ ${_coretemp} \ @@ -744,7 +742,6 @@ _3dfx= 3dfx _3dfx_linux= 3dfx_linux _aic= aic _apm= apm -_arcnet= arcnet .if ${MK_SOURCELESS_UCODE} != "no" _ce= ce .endif @@ -763,7 +760,6 @@ _pcfclock= pcfclock _pst= pst _sbni= sbni _stg= stg -_cm= cm .if ${MK_SOURCELESS_UCODE} != "no" _ctau= ctau .endif Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Fri Apr 13 20:30:49 2018 (r332489) +++ head/sys/net/if.c Fri Apr 13 21:18:04 2018 (r332490) @@ -3695,7 +3695,6 @@ if_setlladdr(struct ifnet *ifp, const u_char *lladdr, case IFT_XETHER: case IFT_L2VLAN: case IFT_BRIDGE: - case IFT_ARCNET: case IFT_IEEE8023ADLAG: bcopy(lladdr, LLADDR(sdl), len); ifa_free(ifa); Modified: head/sys/net/if_arp.h ============================================================================== --- head/sys/net/if_arp.h Fri Apr 13 20:30:49 2018 (r332489) +++ head/sys/net/if_arp.h Fri Apr 13 21:18:04 2018 (r332490) @@ -49,7 +49,6 @@ struct arphdr { u_short ar_hrd; /* format of hardware address */ #define ARPHRD_ETHER 1 /* ethernet hardware format */ #define ARPHRD_IEEE802 6 /* token-ring hardware format */ -#define ARPHRD_ARCNET 7 /* arcnet hardware format */ #define ARPHRD_FRELAY 15 /* frame relay hardware format */ #define ARPHRD_IEEE1394 24 /* firewire hardware format */ #define ARPHRD_INFINIBAND 32 /* infiniband hardware format */ Modified: head/sys/netinet/if_ether.c ============================================================================== --- head/sys/netinet/if_ether.c Fri Apr 13 20:30:49 2018 (r332489) +++ head/sys/netinet/if_ether.c Fri Apr 13 21:18:04 2018 (r332490) @@ -694,10 +694,6 @@ arpintr(struct mbuf *m) hlen = ETHER_ADDR_LEN; /* RFC 826 */ layer = "ethernet"; break; - case ARPHRD_ARCNET: - hlen = 1; /* RFC 1201, ARC_ADDR_LEN */ - layer = "arcnet"; - break; case ARPHRD_INFINIBAND: hlen = 20; /* RFC 4391, INFINIBAND_ALEN */ layer = "infiniband"; Modified: head/sys/netinet6/in6.c ============================================================================== --- head/sys/netinet6/in6.c Fri Apr 13 20:30:49 2018 (r332489) +++ head/sys/netinet6/in6.c Fri Apr 13 21:18:04 2018 (r332490) @@ -1974,8 +1974,6 @@ in6_if2idlen(struct ifnet *ifp) return (64); case IFT_PPP: /* RFC2472 */ return (64); - case IFT_ARCNET: /* RFC2497 */ - return (64); case IFT_FRELAY: /* RFC2590 */ return (64); case IFT_IEEE1394: /* RFC3146 */ Modified: head/sys/netinet6/in6_ifattach.c ============================================================================== --- head/sys/netinet6/in6_ifattach.c Fri Apr 13 20:30:49 2018 (r332489) +++ head/sys/netinet6/in6_ifattach.c Fri Apr 13 21:18:04 2018 (r332490) @@ -316,26 +316,6 @@ found: } break; - case IFT_ARCNET: - if (addrlen != 1) { - IF_ADDR_RUNLOCK(ifp); - return -1; - } - if (!addr[0]) { - IF_ADDR_RUNLOCK(ifp); - return -1; - } - - bzero(&in6->s6_addr[8], 8); - in6->s6_addr[15] = addr[0]; - - /* - * due to insufficient bitwidth, we mark it local. - */ - in6->s6_addr[8] &= ~EUI64_GBIT; /* g bit to "individual" */ - in6->s6_addr[8] |= EUI64_UBIT; /* u bit to "local" */ - break; - case IFT_GIF: case IFT_STF: /* Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Fri Apr 13 20:30:49 2018 (r332489) +++ head/sys/netinet6/nd6.c Fri Apr 13 21:18:04 2018 (r332490) @@ -58,7 +58,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include @@ -334,16 +333,8 @@ nd6_setmtu0(struct ifnet *ifp, struct nd_ifinfo *ndi) u_int32_t omaxmtu; omaxmtu = ndi->maxmtu; + ndi->maxmtu = ifp->if_mtu; - switch (ifp->if_type) { - case IFT_ARCNET: - ndi->maxmtu = MIN(ARC_PHDS_MAXMTU, ifp->if_mtu); /* RFC2497 */ - break; - default: - ndi->maxmtu = ifp->if_mtu; - break; - } - /* * Decreasing the interface MTU under IPV6 minimum MTU may cause * undesirable situation. We thus notify the operator of the change @@ -2519,13 +2510,12 @@ nd6_need_cache(struct ifnet *ifp) { /* * XXX: we currently do not make neighbor cache on any interface - * other than ARCnet, Ethernet and GIF. + * other than Ethernet and GIF. * * RFC2893 says: * - unidirectional tunnels needs no ND */ switch (ifp->if_type) { - case IFT_ARCNET: case IFT_ETHER: case IFT_IEEE1394: case IFT_L2VLAN: Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Fri Apr 13 20:30:49 2018 (r332489) +++ head/sys/netinet6/nd6_nbr.c Fri Apr 13 21:18:04 2018 (r332490) @@ -1090,7 +1090,6 @@ caddr_t nd6_ifptomac(struct ifnet *ifp) { switch (ifp->if_type) { - case IFT_ARCNET: case IFT_ETHER: case IFT_IEEE1394: case IFT_L2VLAN: From owner-svn-src-head@freebsd.org Fri Apr 13 22:02:23 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9DDBCF85AC0 for ; Fri, 13 Apr 2018 22:02:23 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yb0-x22f.google.com (mail-yb0-x22f.google.com [IPv6:2607:f8b0:4002:c09::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 3027974E5D for ; Fri, 13 Apr 2018 22:02:23 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yb0-x22f.google.com with SMTP id y5-v6so366133ybg.0 for ; Fri, 13 Apr 2018 15:02:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd-org.20150623.gappssmtp.com; s=20150623; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=cwGbEJpYwaKCDfQxhqw542eLJ0q4oImNPiPyEcP20iI=; b=eJQ7sCmH36qdSpSPzDz1Ds/9iC6MxWZH4AbiZbK60aUHtXN+QJyb6uQpHu8cOlyUpf UlqFnvT3+kWvi+V53gCzXnQW14PCAuQruzKOL29PKpHUqZQojyq/cLCNHC2wbpOC5wyY KuRzpRDFVHZLrCoTtFR727sgV6ZyHWO9oLL0LqTwoIcE7rVqwIJvdbeTmLy40LtWgmGd ELrqAlyW+wBcp/wo/gMAOrbdgk89wbPsBzvbp6ctdBvxNL/jSW6hMRhay5YiSaTueJ3F WPN5khj1JKLqkt0x0qTpmQNBvVFCLsiH+FVfOT9dYxQie7LJDXvmrPSdsyBYglpHUpuD CYMw== 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=cwGbEJpYwaKCDfQxhqw542eLJ0q4oImNPiPyEcP20iI=; b=eQVQQIUNJBw46Lr3pQ046etanolaanxvAwnn1tf0xwzrxhWJanzVKdVQP/660F0oOY uwtWrrDLujlHkbb/tAZQojVKrujyW9sz9C4y6lUsDeP20ayokCQjyTLsEJR1aFeAV+Mv 55SyCQ/0Gk5/hj8vqZsPsKNAreePoz2g86gaf60xJxDcyCjTxU7MOaHOrBtrOvTVUn1O sRGTAdPlu5juTPxbc6ZaBjN7ShlOLspFJKYilTo4nPXPdfcEiaD6wIf1GFw1U8z7P9fE EsrND/ytN4LuxJpshiZZixFq0eBOcpZivNep02/qU/VkpEvDku+YC6YfVnWKh1VPsjb+ bM9w== X-Gm-Message-State: ALQs6tAezlmb6DmKc7AuZrPjDp8K9aAkio/il1qXhktyv2DZIpE9YX/a uG/PeHk5iuGhQn4C3/DGyHYLWoum1VqJcdaq5ytlHA== X-Google-Smtp-Source: AIpwx4/hrptT2lpnLZKvWTXjNUMrlg2/k12cB8CfW9aD1T8Mlj9qclyPO7vB7xfkTZlafSG5oM6aQS0qiHzkStH4an0= X-Received: by 2002:a25:dc53:: with SMTP id y80-v6mr6233123ybe.331.1523656942694; Fri, 13 Apr 2018 15:02:22 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:ae64:0:0:0:0:0 with HTTP; Fri, 13 Apr 2018 15:02:22 -0700 (PDT) In-Reply-To: <201804131331.w3DDVKod044086@repo.freebsd.org> References: <201804131331.w3DDVKod044086@repo.freebsd.org> From: Oliver Pinter Date: Sat, 14 Apr 2018 00:02:22 +0200 Message-ID: Subject: Re: svn commit: r332471 - head/sys/dev/ocs_fc To: Ram Kishore Vegesna Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" , Bruce Evans Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 13 Apr 2018 22:02:23 -0000 On Friday, April 13, 2018, Ram Kishore Vegesna wrote: > Author: ram > Date: Fri Apr 13 13:31:20 2018 > New Revision: 332471 > URL: https://svnweb.freebsd.org/changeset/base/332471 > > Log: > Check if STACK is defined before using the stack(9). > > PR: 227446 > Reported by: emaste > Approved by: ken > > Modified: > head/sys/dev/ocs_fc/ocs_os.c > > Modified: head/sys/dev/ocs_fc/ocs_os.c > ============================================================ > ================== > --- head/sys/dev/ocs_fc/ocs_os.c Fri Apr 13 13:23:31 2018 > (r332470) > +++ head/sys/dev/ocs_fc/ocs_os.c Fri Apr 13 13:31:20 2018 > (r332471) > @@ -37,6 +37,7 @@ > */ > > #include "ocs.h" > +#include "opt_stack.h" These types of includes - where you includes opts - should go before any other includes. > #include > #include > #include /* for debug of memory allocations > */ > @@ -855,11 +856,13 @@ void ocs_intr_enable(ocs_os_handle_t os) > > void ocs_print_stack(void) > { > +#if defined(STACK) > struct stack st; > > stack_zero(&st); > stack_save(&st); > stack_print(&st); > +#endif > } > > void ocs_abort(void) > _______________________________________________ > 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 Sat Apr 14 03:15:06 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 534DFF9B7DB; Sat, 14 Apr 2018 03:15:06 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EA2957810E; Sat, 14 Apr 2018 03:15:05 +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 E1CCC22BAC; Sat, 14 Apr 2018 03:15:05 +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 w3E3F5TY058803; Sat, 14 Apr 2018 03:15:05 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3E3F5Id058802; Sat, 14 Apr 2018 03:15:05 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201804140315.w3E3F5Id058802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 14 Apr 2018 03:15:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332498 - head/sys/x86/cpufreq X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/x86/cpufreq X-SVN-Commit-Revision: 332498 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 14 Apr 2018 03:15:06 -0000 Author: cem Date: Sat Apr 14 03:15:05 2018 New Revision: 332498 URL: https://svnweb.freebsd.org/changeset/base/332498 Log: cpufreq: Remove error-prone table terminators in favor of automatic sizing PR: 227388 Reported by: Vladimir Machulsky Sponsored by: Dell EMC Isilon Modified: head/sys/x86/cpufreq/est.c Modified: head/sys/x86/cpufreq/est.c ============================================================================== --- head/sys/x86/cpufreq/est.c Sat Apr 14 00:20:47 2018 (r332497) +++ head/sys/x86/cpufreq/est.c Sat Apr 14 03:15:05 2018 (r332498) @@ -71,6 +71,7 @@ typedef struct { const u_int vendor_id; uint32_t id32; freq_info *freqtab; + size_t tablen; } cpu_info; struct est_softc { @@ -78,6 +79,7 @@ struct est_softc { int acpi_settings; int msr_settings; freq_info *freq_list; + size_t flist_len; }; /* Convert MHz and mV into IDs for passing to the MSR. */ @@ -92,9 +94,9 @@ struct est_softc { #define FREQ_INFO(MHz, mV, bus_clk) \ FREQ_INFO_PWR(MHz, mV, bus_clk, CPUFREQ_VAL_UNKNOWN) #define INTEL(tab, zhi, vhi, zlo, vlo, bus_clk) \ - { CPU_VENDOR_INTEL, ID32(zhi, vhi, zlo, vlo, bus_clk), tab } + { CPU_VENDOR_INTEL, ID32(zhi, vhi, zlo, vlo, bus_clk), tab, nitems(tab) } #define CENTAUR(tab, zhi, vhi, zlo, vlo, bus_clk) \ - { CPU_VENDOR_CENTAUR, ID32(zhi, vhi, zlo, vlo, bus_clk), tab } + { CPU_VENDOR_CENTAUR, ID32(zhi, vhi, zlo, vlo, bus_clk), tab, nitems(tab) } static int msr_info_enabled = 0; TUNABLE_INT("hw.est.msr_info", &msr_info_enabled); @@ -131,7 +133,6 @@ static freq_info PM17_130[] = { FREQ_INFO(1000, 1116, INTEL_BUS_CLK), FREQ_INFO( 800, 1004, INTEL_BUS_CLK), FREQ_INFO( 600, 956, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM16_130[] = { /* 130nm 1.60GHz Pentium M */ @@ -141,7 +142,6 @@ static freq_info PM16_130[] = { FREQ_INFO(1000, 1164, INTEL_BUS_CLK), FREQ_INFO( 800, 1036, INTEL_BUS_CLK), FREQ_INFO( 600, 956, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM15_130[] = { /* 130nm 1.50GHz Pentium M */ @@ -151,7 +151,6 @@ static freq_info PM15_130[] = { FREQ_INFO(1000, 1228, INTEL_BUS_CLK), FREQ_INFO( 800, 1116, INTEL_BUS_CLK), FREQ_INFO( 600, 956, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM14_130[] = { /* 130nm 1.40GHz Pentium M */ @@ -160,7 +159,6 @@ static freq_info PM14_130[] = { FREQ_INFO(1000, 1308, INTEL_BUS_CLK), FREQ_INFO( 800, 1180, INTEL_BUS_CLK), FREQ_INFO( 600, 956, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM13_130[] = { /* 130nm 1.30GHz Pentium M */ @@ -169,7 +167,6 @@ static freq_info PM13_130[] = { FREQ_INFO(1000, 1292, INTEL_BUS_CLK), FREQ_INFO( 800, 1260, INTEL_BUS_CLK), FREQ_INFO( 600, 956, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM13_LV_130[] = { /* 130nm 1.30GHz Low Voltage Pentium M */ @@ -180,7 +177,6 @@ static freq_info PM13_LV_130[] = { FREQ_INFO( 900, 1004, INTEL_BUS_CLK), FREQ_INFO( 800, 988, INTEL_BUS_CLK), FREQ_INFO( 600, 956, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM12_LV_130[] = { /* 130 nm 1.20GHz Low Voltage Pentium M */ @@ -190,7 +186,6 @@ static freq_info PM12_LV_130[] = { FREQ_INFO( 900, 1020, INTEL_BUS_CLK), FREQ_INFO( 800, 1004, INTEL_BUS_CLK), FREQ_INFO( 600, 956, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM11_LV_130[] = { /* 130 nm 1.10GHz Low Voltage Pentium M */ @@ -199,7 +194,6 @@ static freq_info PM11_LV_130[] = { FREQ_INFO( 900, 1100, INTEL_BUS_CLK), FREQ_INFO( 800, 1020, INTEL_BUS_CLK), FREQ_INFO( 600, 956, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM11_ULV_130[] = { /* 130 nm 1.10GHz Ultra Low Voltage Pentium M */ @@ -208,7 +202,6 @@ static freq_info PM11_ULV_130[] = { FREQ_INFO( 900, 972, INTEL_BUS_CLK), FREQ_INFO( 800, 956, INTEL_BUS_CLK), FREQ_INFO( 600, 844, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM10_ULV_130[] = { /* 130 nm 1.00GHz Ultra Low Voltage Pentium M */ @@ -216,7 +209,6 @@ static freq_info PM10_ULV_130[] = { FREQ_INFO( 900, 988, INTEL_BUS_CLK), FREQ_INFO( 800, 972, INTEL_BUS_CLK), FREQ_INFO( 600, 844, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; /* @@ -233,7 +225,6 @@ static freq_info PM_765A_90[] = { FREQ_INFO(1000, 1084, INTEL_BUS_CLK), FREQ_INFO( 800, 1036, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_765B_90[] = { /* 90 nm 2.10GHz Pentium M, VID #B */ @@ -245,7 +236,6 @@ static freq_info PM_765B_90[] = { FREQ_INFO(1000, 1084, INTEL_BUS_CLK), FREQ_INFO( 800, 1036, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_765C_90[] = { /* 90 nm 2.10GHz Pentium M, VID #C */ @@ -257,7 +247,6 @@ static freq_info PM_765C_90[] = { FREQ_INFO(1000, 1084, INTEL_BUS_CLK), FREQ_INFO( 800, 1036, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_765E_90[] = { /* 90 nm 2.10GHz Pentium M, VID #E */ @@ -269,7 +258,6 @@ static freq_info PM_765E_90[] = { FREQ_INFO(1000, 1100, INTEL_BUS_CLK), FREQ_INFO( 800, 1052, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_755A_90[] = { /* 90 nm 2.00GHz Pentium M, VID #A */ @@ -281,7 +269,6 @@ static freq_info PM_755A_90[] = { FREQ_INFO(1000, 1100, INTEL_BUS_CLK), FREQ_INFO( 800, 1052, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_755B_90[] = { /* 90 nm 2.00GHz Pentium M, VID #B */ @@ -293,7 +280,6 @@ static freq_info PM_755B_90[] = { FREQ_INFO(1000, 1084, INTEL_BUS_CLK), FREQ_INFO( 800, 1036, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_755C_90[] = { /* 90 nm 2.00GHz Pentium M, VID #C */ @@ -305,7 +291,6 @@ static freq_info PM_755C_90[] = { FREQ_INFO(1000, 1084, INTEL_BUS_CLK), FREQ_INFO( 800, 1036, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_755D_90[] = { /* 90 nm 2.00GHz Pentium M, VID #D */ @@ -317,7 +302,6 @@ static freq_info PM_755D_90[] = { FREQ_INFO(1000, 1084, INTEL_BUS_CLK), FREQ_INFO( 800, 1036, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_745A_90[] = { /* 90 nm 1.80GHz Pentium M, VID #A */ @@ -328,7 +312,6 @@ static freq_info PM_745A_90[] = { FREQ_INFO(1000, 1116, INTEL_BUS_CLK), FREQ_INFO( 800, 1052, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_745B_90[] = { /* 90 nm 1.80GHz Pentium M, VID #B */ @@ -339,7 +322,6 @@ static freq_info PM_745B_90[] = { FREQ_INFO(1000, 1116, INTEL_BUS_CLK), FREQ_INFO( 800, 1052, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_745C_90[] = { /* 90 nm 1.80GHz Pentium M, VID #C */ @@ -350,7 +332,6 @@ static freq_info PM_745C_90[] = { FREQ_INFO(1000, 1100, INTEL_BUS_CLK), FREQ_INFO( 800, 1052, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_745D_90[] = { /* 90 nm 1.80GHz Pentium M, VID #D */ @@ -361,7 +342,6 @@ static freq_info PM_745D_90[] = { FREQ_INFO(1000, 1084, INTEL_BUS_CLK), FREQ_INFO( 800, 1036, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_735A_90[] = { /* 90 nm 1.70GHz Pentium M, VID #A */ @@ -371,7 +351,6 @@ static freq_info PM_735A_90[] = { FREQ_INFO(1000, 1116, INTEL_BUS_CLK), FREQ_INFO( 800, 1052, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_735B_90[] = { /* 90 nm 1.70GHz Pentium M, VID #B */ @@ -381,7 +360,6 @@ static freq_info PM_735B_90[] = { FREQ_INFO(1000, 1116, INTEL_BUS_CLK), FREQ_INFO( 800, 1052, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_735C_90[] = { /* 90 nm 1.70GHz Pentium M, VID #C */ @@ -391,7 +369,6 @@ static freq_info PM_735C_90[] = { FREQ_INFO(1000, 1116, INTEL_BUS_CLK), FREQ_INFO( 800, 1052, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_735D_90[] = { /* 90 nm 1.70GHz Pentium M, VID #D */ @@ -401,7 +378,6 @@ static freq_info PM_735D_90[] = { FREQ_INFO(1000, 1100, INTEL_BUS_CLK), FREQ_INFO( 800, 1052, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_725A_90[] = { /* 90 nm 1.60GHz Pentium M, VID #A */ @@ -411,7 +387,6 @@ static freq_info PM_725A_90[] = { FREQ_INFO(1000, 1132, INTEL_BUS_CLK), FREQ_INFO( 800, 1068, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_725B_90[] = { /* 90 nm 1.60GHz Pentium M, VID #B */ @@ -421,7 +396,6 @@ static freq_info PM_725B_90[] = { FREQ_INFO(1000, 1132, INTEL_BUS_CLK), FREQ_INFO( 800, 1068, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_725C_90[] = { /* 90 nm 1.60GHz Pentium M, VID #C */ @@ -431,7 +405,6 @@ static freq_info PM_725C_90[] = { FREQ_INFO(1000, 1116, INTEL_BUS_CLK), FREQ_INFO( 800, 1052, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_725D_90[] = { /* 90 nm 1.60GHz Pentium M, VID #D */ @@ -441,7 +414,6 @@ static freq_info PM_725D_90[] = { FREQ_INFO(1000, 1116, INTEL_BUS_CLK), FREQ_INFO( 800, 1052, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_715A_90[] = { /* 90 nm 1.50GHz Pentium M, VID #A */ @@ -450,7 +422,6 @@ static freq_info PM_715A_90[] = { FREQ_INFO(1000, 1148, INTEL_BUS_CLK), FREQ_INFO( 800, 1068, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_715B_90[] = { /* 90 nm 1.50GHz Pentium M, VID #B */ @@ -459,7 +430,6 @@ static freq_info PM_715B_90[] = { FREQ_INFO(1000, 1148, INTEL_BUS_CLK), FREQ_INFO( 800, 1068, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_715C_90[] = { /* 90 nm 1.50GHz Pentium M, VID #C */ @@ -468,7 +438,6 @@ static freq_info PM_715C_90[] = { FREQ_INFO(1000, 1132, INTEL_BUS_CLK), FREQ_INFO( 800, 1068, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_715D_90[] = { /* 90 nm 1.50GHz Pentium M, VID #D */ @@ -477,7 +446,6 @@ static freq_info PM_715D_90[] = { FREQ_INFO(1000, 1116, INTEL_BUS_CLK), FREQ_INFO( 800, 1052, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_778_90[] = { /* 90 nm 1.60GHz Low Voltage Pentium M */ @@ -491,7 +459,6 @@ static freq_info PM_778_90[] = { FREQ_INFO( 900, 1036, INTEL_BUS_CLK), FREQ_INFO( 800, 1020, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_758_90[] = { /* 90 nm 1.50GHz Low Voltage Pentium M */ @@ -504,7 +471,6 @@ static freq_info PM_758_90[] = { FREQ_INFO( 900, 1036, INTEL_BUS_CLK), FREQ_INFO( 800, 1020, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_738_90[] = { /* 90 nm 1.40GHz Low Voltage Pentium M */ @@ -516,7 +482,6 @@ static freq_info PM_738_90[] = { FREQ_INFO( 900, 1036, INTEL_BUS_CLK), FREQ_INFO( 800, 1020, INTEL_BUS_CLK), FREQ_INFO( 600, 988, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_773G_90[] = { /* 90 nm 1.30GHz Ultra Low Voltage Pentium M, VID #G */ @@ -688,7 +653,6 @@ static freq_info PM_733_90[] = { FREQ_INFO( 900, 892, INTEL_BUS_CLK), FREQ_INFO( 800, 876, INTEL_BUS_CLK), FREQ_INFO( 600, 812, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; static freq_info PM_723_90[] = { /* 90 nm 1.00GHz Ultra Low Voltage Pentium M */ @@ -696,7 +660,6 @@ static freq_info PM_723_90[] = { FREQ_INFO( 900, 908, INTEL_BUS_CLK), FREQ_INFO( 800, 876, INTEL_BUS_CLK), FREQ_INFO( 600, 812, INTEL_BUS_CLK), - FREQ_INFO( 0, 0, 1), }; /* @@ -713,7 +676,6 @@ static freq_info C7M_795[] = { FREQ_INFO_PWR( 800, 844, 133, 7000), FREQ_INFO_PWR( 667, 844, 133, 6000), FREQ_INFO_PWR( 533, 844, 133, 5000), - FREQ_INFO(0, 0, 1), }; static freq_info C7M_785[] = { /* 1.80GHz Centaur C7-M 533 Mhz FSB */ @@ -724,7 +686,6 @@ static freq_info C7M_785[] = { FREQ_INFO_PWR( 800, 844, 133, 7000), FREQ_INFO_PWR( 667, 844, 133, 6000), FREQ_INFO_PWR( 533, 844, 133, 5000), - FREQ_INFO(0, 0, 1), }; static freq_info C7M_765[] = { /* 1.60GHz Centaur C7-M 533 Mhz FSB */ @@ -734,7 +695,6 @@ static freq_info C7M_765[] = { FREQ_INFO_PWR( 800, 844, 133, 7000), FREQ_INFO_PWR( 667, 844, 133, 6000), FREQ_INFO_PWR( 533, 844, 133, 5000), - FREQ_INFO(0, 0, 1), }; static freq_info C7M_794[] = { @@ -747,7 +707,6 @@ static freq_info C7M_794[] = { FREQ_INFO_PWR( 800, 844, 100, 7000), FREQ_INFO_PWR( 600, 844, 100, 6000), FREQ_INFO_PWR( 400, 844, 100, 5000), - FREQ_INFO(0, 0, 1), }; static freq_info C7M_784[] = { /* 1.80GHz Centaur C7-M 400 Mhz FSB */ @@ -758,7 +717,6 @@ static freq_info C7M_784[] = { FREQ_INFO_PWR( 800, 844, 100, 7000), FREQ_INFO_PWR( 600, 844, 100, 6000), FREQ_INFO_PWR( 400, 844, 100, 5000), - FREQ_INFO(0, 0, 1), }; static freq_info C7M_764[] = { /* 1.60GHz Centaur C7-M 400 Mhz FSB */ @@ -768,7 +726,6 @@ static freq_info C7M_764[] = { FREQ_INFO_PWR( 800, 844, 100, 7000), FREQ_INFO_PWR( 600, 844, 100, 6000), FREQ_INFO_PWR( 400, 844, 100, 5000), - FREQ_INFO(0, 0, 1), }; static freq_info C7M_754[] = { /* 1.50GHz Centaur C7-M 400 Mhz FSB */ @@ -778,7 +735,6 @@ static freq_info C7M_754[] = { FREQ_INFO_PWR( 800, 844, 100, 7000), FREQ_INFO_PWR( 600, 844, 100, 6000), FREQ_INFO_PWR( 400, 844, 100, 5000), - FREQ_INFO(0, 0, 1), }; static freq_info C7M_771[] = { /* 1.20GHz Centaur C7-M 400 Mhz FSB */ @@ -787,7 +743,6 @@ static freq_info C7M_771[] = { FREQ_INFO_PWR( 800, 844, 100, 5500), FREQ_INFO_PWR( 600, 844, 100, 5000), FREQ_INFO_PWR( 400, 844, 100, 4000), - FREQ_INFO(0, 0, 1), }; static freq_info C7M_775_ULV[] = { @@ -798,7 +753,6 @@ static freq_info C7M_775_ULV[] = { FREQ_INFO_PWR( 800, 828, 100, 2800), FREQ_INFO_PWR( 600, 796, 100, 2500), FREQ_INFO_PWR( 400, 796, 100, 2000), - FREQ_INFO(0, 0, 1), }; static freq_info C7M_772_ULV[] = { /* 1.20GHz Centaur C7-M ULV */ @@ -807,7 +761,6 @@ static freq_info C7M_772_ULV[] = { FREQ_INFO_PWR( 800, 828, 100, 2800), FREQ_INFO_PWR( 600, 796, 100, 2500), FREQ_INFO_PWR( 400, 796, 100, 2000), - FREQ_INFO(0, 0, 1), }; static freq_info C7M_779_ULV[] = { /* 1.00GHz Centaur C7-M ULV */ @@ -815,7 +768,6 @@ static freq_info C7M_779_ULV[] = { FREQ_INFO_PWR( 800, 796, 100, 2800), FREQ_INFO_PWR( 600, 796, 100, 2500), FREQ_INFO_PWR( 400, 796, 100, 2000), - FREQ_INFO(0, 0, 1), }; static freq_info C7M_770_ULV[] = { /* 1.00GHz Centaur C7-M ULV */ @@ -823,7 +775,6 @@ static freq_info C7M_770_ULV[] = { FREQ_INFO_PWR( 800, 796, 100, 2800), FREQ_INFO_PWR( 600, 796, 100, 2500), FREQ_INFO_PWR( 400, 796, 100, 2000), - FREQ_INFO(0, 0, 1), }; static cpu_info ESTprocs[] = { @@ -906,10 +857,13 @@ static int est_probe(device_t parent); static int est_attach(device_t parent); static int est_detach(device_t parent); static int est_get_info(device_t dev); -static int est_acpi_info(device_t dev, freq_info **freqs); -static int est_table_info(device_t dev, uint64_t msr, freq_info **freqs); -static int est_msr_info(device_t dev, uint64_t msr, freq_info **freqs); -static freq_info *est_get_current(freq_info *freq_list); +static int est_acpi_info(device_t dev, freq_info **freqs, + size_t *freqslen); +static int est_table_info(device_t dev, uint64_t msr, freq_info **freqs, + size_t *freqslen); +static int est_msr_info(device_t dev, uint64_t msr, freq_info **freqs, + size_t *freqslen); +static freq_info *est_get_current(freq_info *freq_list, size_t tablen); static int est_settings(device_t dev, struct cf_setting *sets, int *count); static int est_set(device_t dev, const struct cf_setting *set); static int est_get(device_t dev, struct cf_setting *set); @@ -1077,11 +1031,11 @@ est_get_info(device_t dev) sc = device_get_softc(dev); msr = rdmsr(MSR_PERF_STATUS); - error = est_table_info(dev, msr, &sc->freq_list); + error = est_table_info(dev, msr, &sc->freq_list, &sc->flist_len); if (error) - error = est_acpi_info(dev, &sc->freq_list); + error = est_acpi_info(dev, &sc->freq_list, &sc->flist_len); if (error) - error = est_msr_info(dev, msr, &sc->freq_list); + error = est_msr_info(dev, msr, &sc->freq_list, &sc->flist_len); if (error) { printf( @@ -1094,7 +1048,7 @@ est_get_info(device_t dev) } static int -est_acpi_info(device_t dev, freq_info **freqs) +est_acpi_info(device_t dev, freq_info **freqs, size_t *freqslen) { struct est_softc *sc; struct cf_setting *sets; @@ -1119,7 +1073,7 @@ est_acpi_info(device_t dev, freq_info **freqs) goto out; /* Parse settings into our local table format. */ - table = malloc((count + 1) * sizeof(freq_info), M_DEVBUF, M_NOWAIT); + table = malloc(count * sizeof(*table), M_DEVBUF, M_NOWAIT); if (table == NULL) { error = ENOMEM; goto out; @@ -1147,11 +1101,9 @@ est_acpi_info(device_t dev, freq_info **freqs) /* restore saved setting */ est_set_id16(dev, saved_id16, 0); - /* Mark end of table with a terminator. */ - bzero(&table[j], sizeof(freq_info)); - sc->acpi_settings = TRUE; *freqs = table; + *freqslen = j; error = 0; out: @@ -1163,7 +1115,7 @@ out: } static int -est_table_info(device_t dev, uint64_t msr, freq_info **freqs) +est_table_info(device_t dev, uint64_t msr, freq_info **freqs, size_t *freqslen) { cpu_info *p; uint32_t id; @@ -1178,12 +1130,13 @@ est_table_info(device_t dev, uint64_t msr, freq_info * return (EOPNOTSUPP); /* Make sure the current setpoint is valid. */ - if (est_get_current(p->freqtab) == NULL) { + if (est_get_current(p->freqtab, p->tablen) == NULL) { device_printf(dev, "current setting not found in table\n"); return (EOPNOTSUPP); } *freqs = p->freqtab; + *freqslen = p->tablen; return (0); } @@ -1206,7 +1159,7 @@ bus_speed_ok(int bus) * based on the current clock speed and the upper 32 bits of the MSR. */ static int -est_msr_info(device_t dev, uint64_t msr, freq_info **freqs) +est_msr_info(device_t dev, uint64_t msr, freq_info **freqs, size_t *freqslen) { struct est_softc *sc; freq_info *fp; @@ -1236,7 +1189,7 @@ est_msr_info(device_t dev, uint64_t msr, freq_info **f /* Fill out a new freq table containing just the high and low freqs. */ sc = device_get_softc(dev); - fp = malloc(sizeof(freq_info) * 3, M_DEVBUF, M_WAITOK | M_ZERO); + fp = malloc(sizeof(freq_info) * 2, M_DEVBUF, M_WAITOK | M_ZERO); /* First, the high frequency. */ volts = id & 0xff; @@ -1269,6 +1222,7 @@ est_msr_info(device_t dev, uint64_t msr, freq_info **f /* Table is already terminated due to M_ZERO. */ sc->msr_settings = TRUE; *freqs = fp; + *freqslen = 2; return (0); } @@ -1305,7 +1259,7 @@ est_set_id16(device_t dev, uint16_t id16, int need_che } static freq_info * -est_get_current(freq_info *freq_list) +est_get_current(freq_info *freq_list, size_t tablen) { freq_info *f; int i; @@ -1318,7 +1272,7 @@ est_get_current(freq_info *freq_list) */ for (i = 0; i < 5; i++) { est_get_id16(&id16); - for (f = freq_list; f->id16 != 0; f++) { + for (f = freq_list; f < freq_list + tablen; f++) { if (f->id16 == id16) return (f); } @@ -1339,7 +1293,7 @@ est_settings(device_t dev, struct cf_setting *sets, in return (E2BIG); i = 0; - for (f = sc->freq_list; f->freq != 0; f++, i++) { + for (f = sc->freq_list; f < sc->freq_list + sc->flist_len; f++, i++) { sets[i].freq = f->freq; sets[i].volts = f->volts; sets[i].power = f->power; @@ -1359,7 +1313,7 @@ est_set(device_t dev, const struct cf_setting *set) /* Find the setting matching the requested one. */ sc = device_get_softc(dev); - for (f = sc->freq_list; f->freq != 0; f++) { + for (f = sc->freq_list; f < sc->freq_list + sc->flist_len; f++) { if (f->freq == set->freq) break; } @@ -1379,7 +1333,7 @@ est_get(device_t dev, struct cf_setting *set) freq_info *f; sc = device_get_softc(dev); - f = est_get_current(sc->freq_list); + f = est_get_current(sc->freq_list, sc->flist_len); if (f == NULL) return (ENXIO); From owner-svn-src-head@freebsd.org Sat Apr 14 04:35:11 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 438AFFA2411; Sat, 14 Apr 2018 04:35:11 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id EAC658785F; Sat, 14 Apr 2018 04:35:10 +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 E5D1A238F7; Sat, 14 Apr 2018 04:35:10 +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 w3E4ZApx098698; Sat, 14 Apr 2018 04:35:10 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3E4ZAiI098697; Sat, 14 Apr 2018 04:35:10 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201804140435.w3E4ZAiI098697@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 14 Apr 2018 04:35:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332499 - head/bin/expr X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/bin/expr X-SVN-Commit-Revision: 332499 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 14 Apr 2018 04:35:11 -0000 Author: cem Date: Sat Apr 14 04:35:10 2018 New Revision: 332499 URL: https://svnweb.freebsd.org/changeset/base/332499 Log: expr(1): Fix overflow detection when operand is INTMAX_MIN PR: 227329 Submitted by: Tobias Stoeckmann Modified: head/bin/expr/expr.y Modified: head/bin/expr/expr.y ============================================================================== --- head/bin/expr/expr.y Sat Apr 14 03:15:05 2018 (r332498) +++ head/bin/expr/expr.y Sat Apr 14 04:35:10 2018 (r332499) @@ -422,11 +422,9 @@ op_plus(struct val *a, struct val *b) void assert_minus(intmax_t a, intmax_t b, intmax_t r) { - /* special case subtraction of INTMAX_MIN */ - if (b == INTMAX_MIN && a < 0) + if ((a >= 0 && b < 0 && r <= 0) || + (a < 0 && b > 0 && r >= 0)) errx(ERR_EXIT, "overflow"); - /* check addition of negative subtrahend */ - assert_plus(a, -b, r); } struct val * From owner-svn-src-head@freebsd.org Sat Apr 14 08:05:42 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B296AF896E1; Sat, 14 Apr 2018 08:05:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 642CF73433; Sat, 14 Apr 2018 08:05:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D48B25A4F; Sat, 14 Apr 2018 08:05:42 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3E85gkO002967; Sat, 14 Apr 2018 08:05:42 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3E85gYT002966; Sat, 14 Apr 2018 08:05:42 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201804140805.w3E85gYT002966@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 14 Apr 2018 08:05:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332500 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 332500 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 14 Apr 2018 08:05:42 -0000 Author: eadler Date: Sat Apr 14 08:05:42 2018 New Revision: 332500 URL: https://svnweb.freebsd.org/changeset/base/332500 Log: sys: remove 'cm' from notes Followup to r332490 MFC After: never PR: 182297 Modified: head/sys/conf/NOTES Modified: head/sys/conf/NOTES ============================================================================== --- head/sys/conf/NOTES Sat Apr 14 04:35:10 2018 (r332499) +++ head/sys/conf/NOTES Sat Apr 14 08:05:42 2018 (r332500) @@ -1942,8 +1942,6 @@ device xmphy # XaQti XMAC II # bwi: Broadcom BCM430* and BCM431* family of wireless adapters. # bwn: Broadcom BCM43xx family of wireless adapters. # cas: Sun Cassini/Cassini+ and National Semiconductor DP83065 Saturn -# cm: Arcnet SMC COM90c26 / SMC COM90c56 -# (and SMC COM90c66 in '56 compatibility mode) adapters. # cxgb: Chelsio T3 based 1GbE/10GbE PCIe Ethernet adapters. # cxgbe:Chelsio T4, T5, and T6-based 1/10/25/40/100GbE PCIe Ethernet # adapters. From owner-svn-src-head@freebsd.org Sat Apr 14 12:07:07 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 61BF9F9A5F0; Sat, 14 Apr 2018 12:07:07 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 0E4426A12C; Sat, 14 Apr 2018 12:07:07 +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 08A1328065; Sat, 14 Apr 2018 12:07:07 +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 w3EC76dQ023630; Sat, 14 Apr 2018 12:07:06 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3EC75cj023620; Sat, 14 Apr 2018 12:07:05 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201804141207.w3EC75cj023620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 14 Apr 2018 12:07:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332501 - in head: contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/CodeGen contrib/llvm/lib/Target/X86 contrib/llvm/lib/Target/X86/Disassembler contrib/llvm/tools/clang/include/clang... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/CodeGen contrib/llvm/lib/Target/X86 contrib/llvm/lib/Target/X86/Disassembler contrib/llvm/tools/clang/include/clang/Driver contrib/llvm/tool... X-SVN-Commit-Revision: 332501 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 14 Apr 2018 12:07:07 -0000 Author: dim Date: Sat Apr 14 12:07:05 2018 New Revision: 332501 URL: https://svnweb.freebsd.org/changeset/base/332501 Log: Pull in r325446 from upstream clang trunk (by me): [X86] Add 'sahf' CPU feature to frontend Summary: Make clang accept `-msahf` (and `-mno-sahf`) flags to activate the `+sahf` feature for the backend, for bug 36028 (Incorrect use of pushf/popf enables/disables interrupts on amd64 kernels). This was originally submitted in bug 36037 by Jonathan Looney . As described there, GCC also uses `-msahf` for this feature, and the backend already recognizes the `+sahf` feature. All that is needed is to teach clang to pass this on to the backend. The mapping of feature support onto CPUs may not be complete; rather, it was chosen to match LLVM's idea of which CPUs support this feature (see lib/Target/X86/X86.td). I also updated the affected test case (CodeGen/attr-target-x86.c) to match the emitted output. Reviewers: craig.topper, coby, efriedma, rsmith Reviewed By: craig.topper Subscribers: emaste, cfe-commits Differential Revision: https://reviews.llvm.org/D43394 Pull in r328944 from upstream llvm trunk (by Chandler Carruth): [x86] Expose more of the condition conversion routines in the public API for X86's instruction information. I've now got a second patch under review that needs these same APIs. This bit is nicely orthogonal and obvious, so landing it. NFC. Pull in r329414 from upstream llvm trunk (by Craig Topper): [X86] Merge itineraries for CLC, CMC, and STC. These are very simple flag setting instructions that appear to only be a single uop. They're unlikely to need this separation. Pull in r329657 from upstream llvm trunk (by Chandler Carruth): [x86] Introduce a pass to begin more systematically fixing PR36028 and similar issues. The key idea is to lower COPY nodes populating EFLAGS by scanning the uses of EFLAGS and introducing dedicated code to preserve the necessary state in a GPR. In the vast majority of cases, these uses are cmovCC and jCC instructions. For such cases, we can very easily save and restore the necessary information by simply inserting a setCC into a GPR where the original flags are live, and then testing that GPR directly to feed the cmov or conditional branch. However, things are a bit more tricky if arithmetic is using the flags. This patch handles the vast majority of cases that seem to come up in practice: adc, adcx, adox, rcl, and rcr; all without taking advantage of partially preserved EFLAGS as LLVM doesn't currently model that at all. There are a large number of operations that techinaclly observe EFLAGS currently but shouldn't in this case -- they typically are using DF. Currently, they will not be handled by this approach. However, I have never seen this issue come up in practice. It is already pretty rare to have these patterns come up in practical code with LLVM. I had to resort to writing MIR tests to cover most of the logic in this pass already. I suspect even with its current amount of coverage of arithmetic users of EFLAGS it will be a significant improvement over the current use of pushf/popf. It will also produce substantially faster code in most of the common patterns. This patch also removes all of the old lowering for EFLAGS copies, and the hack that forced us to use a frame pointer when EFLAGS copies were found anywhere in a function so that the dynamic stack adjustment wasn't a problem. None of this is needed as we now lower all of these copies directly in MI and without require stack adjustments. Lots of thanks to Reid who came up with several aspects of this approach, and Craig who helped me work out a couple of things tripping me up while working on this. Differential Revision: https://reviews.llvm.org/D45146 Pull in r329673 from upstream llvm trunk (by Chandler Carruth): [x86] Model the direction flag (DF) separately from the rest of EFLAGS. This cleans up a number of operations that only claimed te use EFLAGS due to using DF. But no instructions which we think of us setting EFLAGS actually modify DF (other than things like popf) and so this needlessly creates uses of EFLAGS that aren't really there. In fact, DF is so restrictive it is pretty easy to model. Only STD, CLD, and the whole-flags writes (WRFLAGS and POPF) need to model this. I've also somewhat cleaned up some of the flag management instruction definitions to be in the correct .td file. Adding this extra register also uncovered a failure to use the correct datatype to hold X86 registers, and I've corrected that as necessary here. Differential Revision: https://reviews.llvm.org/D45154 Together, these should ensure clang does not use pushf/popf sequences to save and restore flags, avoiding problems with unrelated flags (such as the interrupt flag) being restored unexpectedly. Requested by: jtl PR: 225330 MFC after: 1 week Added: head/contrib/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp (contents, props changed) Modified: head/contrib/llvm/include/llvm/CodeGen/MachineBasicBlock.h head/contrib/llvm/lib/CodeGen/MachineBasicBlock.cpp head/contrib/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp head/contrib/llvm/lib/Target/X86/X86.h head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp head/contrib/llvm/lib/Target/X86/X86ISelLowering.h head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td head/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp head/contrib/llvm/lib/Target/X86/X86InstrInfo.h head/contrib/llvm/lib/Target/X86/X86InstrInfo.td head/contrib/llvm/lib/Target/X86/X86InstrSystem.td head/contrib/llvm/lib/Target/X86/X86RegisterInfo.td head/contrib/llvm/lib/Target/X86/X86Schedule.td head/contrib/llvm/lib/Target/X86/X86ScheduleAtom.td head/contrib/llvm/lib/Target/X86/X86TargetMachine.cpp head/contrib/llvm/tools/clang/include/clang/Driver/Options.td head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.cpp head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.h head/lib/clang/freebsd_cc_version.h head/lib/clang/libllvm/Makefile Modified: head/contrib/llvm/include/llvm/CodeGen/MachineBasicBlock.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/MachineBasicBlock.h Sat Apr 14 08:05:42 2018 (r332500) +++ head/contrib/llvm/include/llvm/CodeGen/MachineBasicBlock.h Sat Apr 14 12:07:05 2018 (r332501) @@ -449,6 +449,13 @@ class MachineBasicBlock (public) /// Replace successor OLD with NEW and update probability info. void replaceSuccessor(MachineBasicBlock *Old, MachineBasicBlock *New); + /// Copy a successor (and any probability info) from original block to this + /// block's. Uses an iterator into the original blocks successors. + /// + /// This is useful when doing a partial clone of successors. Afterward, the + /// probabilities may need to be normalized. + void copySuccessor(MachineBasicBlock *Orig, succ_iterator I); + /// Transfers all the successors from MBB to this machine basic block (i.e., /// copies all the successors FromMBB and remove all the successors from /// FromMBB). Modified: head/contrib/llvm/lib/CodeGen/MachineBasicBlock.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/MachineBasicBlock.cpp Sat Apr 14 08:05:42 2018 (r332500) +++ head/contrib/llvm/lib/CodeGen/MachineBasicBlock.cpp Sat Apr 14 12:07:05 2018 (r332501) @@ -646,6 +646,14 @@ void MachineBasicBlock::replaceSuccessor(MachineBasicB removeSuccessor(OldI); } +void MachineBasicBlock::copySuccessor(MachineBasicBlock *Orig, + succ_iterator I) { + if (Orig->Probs.empty()) + addSuccessor(*I, Orig->getSuccProbability(I)); + else + addSuccessorWithoutProb(*I); +} + void MachineBasicBlock::addPredecessor(MachineBasicBlock *Pred) { Predecessors.push_back(Pred); } Modified: head/contrib/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp Sat Apr 14 08:05:42 2018 (r332500) +++ head/contrib/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp Sat Apr 14 12:07:05 2018 (r332501) @@ -265,13 +265,10 @@ MCDisassembler::DecodeStatus X86GenericDisassembler::g /// @param reg - The Reg to append. static void translateRegister(MCInst &mcInst, Reg reg) { #define ENTRY(x) X86::x, - uint8_t llvmRegnums[] = { - ALL_REGS - 0 - }; + static constexpr MCPhysReg llvmRegnums[] = {ALL_REGS}; #undef ENTRY - uint8_t llvmRegnum = llvmRegnums[reg]; + MCPhysReg llvmRegnum = llvmRegnums[reg]; mcInst.addOperand(MCOperand::createReg(llvmRegnum)); } Modified: head/contrib/llvm/lib/Target/X86/X86.h ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86.h Sat Apr 14 08:05:42 2018 (r332500) +++ head/contrib/llvm/lib/Target/X86/X86.h Sat Apr 14 12:07:05 2018 (r332501) @@ -66,6 +66,9 @@ FunctionPass *createX86OptimizeLEAs(); /// Return a pass that transforms setcc + movzx pairs into xor + setcc. FunctionPass *createX86FixupSetCC(); +/// Return a pass that lowers EFLAGS copy pseudo instructions. +FunctionPass *createX86FlagsCopyLoweringPass(); + /// Return a pass that expands WinAlloca pseudo-instructions. FunctionPass *createX86WinAllocaExpander(); Added: head/contrib/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp Sat Apr 14 12:07:05 2018 (r332501) @@ -0,0 +1,734 @@ +//====- X86FlagsCopyLowering.cpp - Lowers COPY nodes of EFLAGS ------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// +/// \file +/// +/// Lowers COPY nodes of EFLAGS by directly extracting and preserving individual +/// flag bits. +/// +/// We have to do this by carefully analyzing and rewriting the usage of the +/// copied EFLAGS register because there is no general way to rematerialize the +/// entire EFLAGS register safely and efficiently. Using `popf` both forces +/// dynamic stack adjustment and can create correctness issues due to IF, TF, +/// and other non-status flags being overwritten. Using sequences involving +/// SAHF don't work on all x86 processors and are often quite slow compared to +/// directly testing a single status preserved in its own GPR. +/// +//===----------------------------------------------------------------------===// + +#include "X86.h" +#include "X86InstrBuilder.h" +#include "X86InstrInfo.h" +#include "X86Subtarget.h" +#include "llvm/ADT/ArrayRef.h" +#include "llvm/ADT/DenseMap.h" +#include "llvm/ADT/STLExtras.h" +#include "llvm/ADT/ScopeExit.h" +#include "llvm/ADT/SmallPtrSet.h" +#include "llvm/ADT/SmallSet.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/ADT/SparseBitVector.h" +#include "llvm/ADT/Statistic.h" +#include "llvm/CodeGen/MachineBasicBlock.h" +#include "llvm/CodeGen/MachineConstantPool.h" +#include "llvm/CodeGen/MachineFunction.h" +#include "llvm/CodeGen/MachineFunctionPass.h" +#include "llvm/CodeGen/MachineInstr.h" +#include "llvm/CodeGen/MachineInstrBuilder.h" +#include "llvm/CodeGen/MachineModuleInfo.h" +#include "llvm/CodeGen/MachineOperand.h" +#include "llvm/CodeGen/MachineRegisterInfo.h" +#include "llvm/CodeGen/MachineSSAUpdater.h" +#include "llvm/CodeGen/TargetInstrInfo.h" +#include "llvm/CodeGen/TargetRegisterInfo.h" +#include "llvm/CodeGen/TargetSchedule.h" +#include "llvm/CodeGen/TargetSubtargetInfo.h" +#include "llvm/IR/DebugLoc.h" +#include "llvm/MC/MCSchedule.h" +#include "llvm/Pass.h" +#include "llvm/Support/CommandLine.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h" +#include +#include +#include +#include + +using namespace llvm; + +#define PASS_KEY "x86-flags-copy-lowering" +#define DEBUG_TYPE PASS_KEY + +STATISTIC(NumCopiesEliminated, "Number of copies of EFLAGS eliminated"); +STATISTIC(NumSetCCsInserted, "Number of setCC instructions inserted"); +STATISTIC(NumTestsInserted, "Number of test instructions inserted"); +STATISTIC(NumAddsInserted, "Number of adds instructions inserted"); + +namespace llvm { + +void initializeX86FlagsCopyLoweringPassPass(PassRegistry &); + +} // end namespace llvm + +namespace { + +// Convenient array type for storing registers associated with each condition. +using CondRegArray = std::array; + +class X86FlagsCopyLoweringPass : public MachineFunctionPass { +public: + X86FlagsCopyLoweringPass() : MachineFunctionPass(ID) { + initializeX86FlagsCopyLoweringPassPass(*PassRegistry::getPassRegistry()); + } + + StringRef getPassName() const override { return "X86 EFLAGS copy lowering"; } + bool runOnMachineFunction(MachineFunction &MF) override; + void getAnalysisUsage(AnalysisUsage &AU) const override; + + /// Pass identification, replacement for typeid. + static char ID; + +private: + MachineRegisterInfo *MRI; + const X86InstrInfo *TII; + const TargetRegisterInfo *TRI; + const TargetRegisterClass *PromoteRC; + + CondRegArray collectCondsInRegs(MachineBasicBlock &MBB, + MachineInstr &CopyDefI); + + unsigned promoteCondToReg(MachineBasicBlock &MBB, + MachineBasicBlock::iterator TestPos, + DebugLoc TestLoc, X86::CondCode Cond); + std::pair + getCondOrInverseInReg(MachineBasicBlock &TestMBB, + MachineBasicBlock::iterator TestPos, DebugLoc TestLoc, + X86::CondCode Cond, CondRegArray &CondRegs); + void insertTest(MachineBasicBlock &MBB, MachineBasicBlock::iterator Pos, + DebugLoc Loc, unsigned Reg); + + void rewriteArithmetic(MachineBasicBlock &TestMBB, + MachineBasicBlock::iterator TestPos, DebugLoc TestLoc, + MachineInstr &MI, MachineOperand &FlagUse, + CondRegArray &CondRegs); + void rewriteCMov(MachineBasicBlock &TestMBB, + MachineBasicBlock::iterator TestPos, DebugLoc TestLoc, + MachineInstr &CMovI, MachineOperand &FlagUse, + CondRegArray &CondRegs); + void rewriteCondJmp(MachineBasicBlock &TestMBB, + MachineBasicBlock::iterator TestPos, DebugLoc TestLoc, + MachineInstr &JmpI, CondRegArray &CondRegs); + void rewriteCopy(MachineInstr &MI, MachineOperand &FlagUse, + MachineInstr &CopyDefI); + void rewriteSetCC(MachineBasicBlock &TestMBB, + MachineBasicBlock::iterator TestPos, DebugLoc TestLoc, + MachineInstr &SetCCI, MachineOperand &FlagUse, + CondRegArray &CondRegs); +}; + +} // end anonymous namespace + +INITIALIZE_PASS_BEGIN(X86FlagsCopyLoweringPass, DEBUG_TYPE, + "X86 EFLAGS copy lowering", false, false) +INITIALIZE_PASS_END(X86FlagsCopyLoweringPass, DEBUG_TYPE, + "X86 EFLAGS copy lowering", false, false) + +FunctionPass *llvm::createX86FlagsCopyLoweringPass() { + return new X86FlagsCopyLoweringPass(); +} + +char X86FlagsCopyLoweringPass::ID = 0; + +void X86FlagsCopyLoweringPass::getAnalysisUsage(AnalysisUsage &AU) const { + MachineFunctionPass::getAnalysisUsage(AU); +} + +namespace { +/// An enumeration of the arithmetic instruction mnemonics which have +/// interesting flag semantics. +/// +/// We can map instruction opcodes into these mnemonics to make it easy to +/// dispatch with specific functionality. +enum class FlagArithMnemonic { + ADC, + ADCX, + ADOX, + RCL, + RCR, + SBB, +}; +} // namespace + +static FlagArithMnemonic getMnemonicFromOpcode(unsigned Opcode) { + switch (Opcode) { + default: + report_fatal_error("No support for lowering a copy into EFLAGS when used " + "by this instruction!"); + +#define LLVM_EXPAND_INSTR_SIZES(MNEMONIC, SUFFIX) \ + case X86::MNEMONIC##8##SUFFIX: \ + case X86::MNEMONIC##16##SUFFIX: \ + case X86::MNEMONIC##32##SUFFIX: \ + case X86::MNEMONIC##64##SUFFIX: + +#define LLVM_EXPAND_ADC_SBB_INSTR(MNEMONIC) \ + LLVM_EXPAND_INSTR_SIZES(MNEMONIC, rr) \ + LLVM_EXPAND_INSTR_SIZES(MNEMONIC, rr_REV) \ + LLVM_EXPAND_INSTR_SIZES(MNEMONIC, rm) \ + LLVM_EXPAND_INSTR_SIZES(MNEMONIC, mr) \ + case X86::MNEMONIC##8ri: \ + case X86::MNEMONIC##16ri8: \ + case X86::MNEMONIC##32ri8: \ + case X86::MNEMONIC##64ri8: \ + case X86::MNEMONIC##16ri: \ + case X86::MNEMONIC##32ri: \ + case X86::MNEMONIC##64ri32: \ + case X86::MNEMONIC##8mi: \ + case X86::MNEMONIC##16mi8: \ + case X86::MNEMONIC##32mi8: \ + case X86::MNEMONIC##64mi8: \ + case X86::MNEMONIC##16mi: \ + case X86::MNEMONIC##32mi: \ + case X86::MNEMONIC##64mi32: \ + case X86::MNEMONIC##8i8: \ + case X86::MNEMONIC##16i16: \ + case X86::MNEMONIC##32i32: \ + case X86::MNEMONIC##64i32: + + LLVM_EXPAND_ADC_SBB_INSTR(ADC) + return FlagArithMnemonic::ADC; + + LLVM_EXPAND_ADC_SBB_INSTR(SBB) + return FlagArithMnemonic::SBB; + +#undef LLVM_EXPAND_ADC_SBB_INSTR + + LLVM_EXPAND_INSTR_SIZES(RCL, rCL) + LLVM_EXPAND_INSTR_SIZES(RCL, r1) + LLVM_EXPAND_INSTR_SIZES(RCL, ri) + return FlagArithMnemonic::RCL; + + LLVM_EXPAND_INSTR_SIZES(RCR, rCL) + LLVM_EXPAND_INSTR_SIZES(RCR, r1) + LLVM_EXPAND_INSTR_SIZES(RCR, ri) + return FlagArithMnemonic::RCR; + +#undef LLVM_EXPAND_INSTR_SIZES + + case X86::ADCX32rr: + case X86::ADCX64rr: + case X86::ADCX32rm: + case X86::ADCX64rm: + return FlagArithMnemonic::ADCX; + + case X86::ADOX32rr: + case X86::ADOX64rr: + case X86::ADOX32rm: + case X86::ADOX64rm: + return FlagArithMnemonic::ADOX; + } +} + +static MachineBasicBlock &splitBlock(MachineBasicBlock &MBB, + MachineInstr &SplitI, + const X86InstrInfo &TII) { + MachineFunction &MF = *MBB.getParent(); + + assert(SplitI.getParent() == &MBB && + "Split instruction must be in the split block!"); + assert(SplitI.isBranch() && + "Only designed to split a tail of branch instructions!"); + assert(X86::getCondFromBranchOpc(SplitI.getOpcode()) != X86::COND_INVALID && + "Must split on an actual jCC instruction!"); + + // Dig out the previous instruction to the split point. + MachineInstr &PrevI = *std::prev(SplitI.getIterator()); + assert(PrevI.isBranch() && "Must split after a branch!"); + assert(X86::getCondFromBranchOpc(PrevI.getOpcode()) != X86::COND_INVALID && + "Must split after an actual jCC instruction!"); + assert(!std::prev(PrevI.getIterator())->isTerminator() && + "Must only have this one terminator prior to the split!"); + + // Grab the one successor edge that will stay in `MBB`. + MachineBasicBlock &UnsplitSucc = *PrevI.getOperand(0).getMBB(); + + // Analyze the original block to see if we are actually splitting an edge + // into two edges. This can happen when we have multiple conditional jumps to + // the same successor. + bool IsEdgeSplit = + std::any_of(SplitI.getIterator(), MBB.instr_end(), + [&](MachineInstr &MI) { + assert(MI.isTerminator() && + "Should only have spliced terminators!"); + return llvm::any_of( + MI.operands(), [&](MachineOperand &MOp) { + return MOp.isMBB() && MOp.getMBB() == &UnsplitSucc; + }); + }) || + MBB.getFallThrough() == &UnsplitSucc; + + MachineBasicBlock &NewMBB = *MF.CreateMachineBasicBlock(); + + // Insert the new block immediately after the current one. Any existing + // fallthrough will be sunk into this new block anyways. + MF.insert(std::next(MachineFunction::iterator(&MBB)), &NewMBB); + + // Splice the tail of instructions into the new block. + NewMBB.splice(NewMBB.end(), &MBB, SplitI.getIterator(), MBB.end()); + + // Copy the necessary succesors (and their probability info) into the new + // block. + for (auto SI = MBB.succ_begin(), SE = MBB.succ_end(); SI != SE; ++SI) + if (IsEdgeSplit || *SI != &UnsplitSucc) + NewMBB.copySuccessor(&MBB, SI); + // Normalize the probabilities if we didn't end up splitting the edge. + if (!IsEdgeSplit) + NewMBB.normalizeSuccProbs(); + + // Now replace all of the moved successors in the original block with the new + // block. This will merge their probabilities. + for (MachineBasicBlock *Succ : NewMBB.successors()) + if (Succ != &UnsplitSucc) + MBB.replaceSuccessor(Succ, &NewMBB); + + // We should always end up replacing at least one successor. + assert(MBB.isSuccessor(&NewMBB) && + "Failed to make the new block a successor!"); + + // Now update all the PHIs. + for (MachineBasicBlock *Succ : NewMBB.successors()) { + for (MachineInstr &MI : *Succ) { + if (!MI.isPHI()) + break; + + for (int OpIdx = 1, NumOps = MI.getNumOperands(); OpIdx < NumOps; + OpIdx += 2) { + MachineOperand &OpV = MI.getOperand(OpIdx); + MachineOperand &OpMBB = MI.getOperand(OpIdx + 1); + assert(OpMBB.isMBB() && "Block operand to a PHI is not a block!"); + if (OpMBB.getMBB() != &MBB) + continue; + + // Replace the operand for unsplit successors + if (!IsEdgeSplit || Succ != &UnsplitSucc) { + OpMBB.setMBB(&NewMBB); + + // We have to continue scanning as there may be multiple entries in + // the PHI. + continue; + } + + // When we have split the edge append a new successor. + MI.addOperand(MF, OpV); + MI.addOperand(MF, MachineOperand::CreateMBB(&NewMBB)); + break; + } + } + } + + return NewMBB; +} + +bool X86FlagsCopyLoweringPass::runOnMachineFunction(MachineFunction &MF) { + DEBUG(dbgs() << "********** " << getPassName() << " : " << MF.getName() + << " **********\n"); + + auto &Subtarget = MF.getSubtarget(); + MRI = &MF.getRegInfo(); + TII = Subtarget.getInstrInfo(); + TRI = Subtarget.getRegisterInfo(); + PromoteRC = &X86::GR8RegClass; + + if (MF.begin() == MF.end()) + // Nothing to do for a degenerate empty function... + return false; + + SmallVector Copies; + for (MachineBasicBlock &MBB : MF) + for (MachineInstr &MI : MBB) + if (MI.getOpcode() == TargetOpcode::COPY && + MI.getOperand(0).getReg() == X86::EFLAGS) + Copies.push_back(&MI); + + for (MachineInstr *CopyI : Copies) { + MachineBasicBlock &MBB = *CopyI->getParent(); + + MachineOperand &VOp = CopyI->getOperand(1); + assert(VOp.isReg() && + "The input to the copy for EFLAGS should always be a register!"); + MachineInstr &CopyDefI = *MRI->getVRegDef(VOp.getReg()); + if (CopyDefI.getOpcode() != TargetOpcode::COPY) { + // FIXME: The big likely candidate here are PHI nodes. We could in theory + // handle PHI nodes, but it gets really, really hard. Insanely hard. Hard + // enough that it is probably better to change every other part of LLVM + // to avoid creating them. The issue is that once we have PHIs we won't + // know which original EFLAGS value we need to capture with our setCCs + // below. The end result will be computing a complete set of setCCs that + // we *might* want, computing them in every place where we copy *out* of + // EFLAGS and then doing SSA formation on all of them to insert necessary + // PHI nodes and consume those here. Then hoping that somehow we DCE the + // unnecessary ones. This DCE seems very unlikely to be successful and so + // we will almost certainly end up with a glut of dead setCC + // instructions. Until we have a motivating test case and fail to avoid + // it by changing other parts of LLVM's lowering, we refuse to handle + // this complex case here. + DEBUG(dbgs() << "ERROR: Encountered unexpected def of an eflags copy: "; + CopyDefI.dump()); + report_fatal_error( + "Cannot lower EFLAGS copy unless it is defined in turn by a copy!"); + } + + auto Cleanup = make_scope_exit([&] { + // All uses of the EFLAGS copy are now rewritten, kill the copy into + // eflags and if dead the copy from. + CopyI->eraseFromParent(); + if (MRI->use_empty(CopyDefI.getOperand(0).getReg())) + CopyDefI.eraseFromParent(); + ++NumCopiesEliminated; + }); + + MachineOperand &DOp = CopyI->getOperand(0); + assert(DOp.isDef() && "Expected register def!"); + assert(DOp.getReg() == X86::EFLAGS && "Unexpected copy def register!"); + if (DOp.isDead()) + continue; + + MachineBasicBlock &TestMBB = *CopyDefI.getParent(); + auto TestPos = CopyDefI.getIterator(); + DebugLoc TestLoc = CopyDefI.getDebugLoc(); + + DEBUG(dbgs() << "Rewriting copy: "; CopyI->dump()); + + // Scan for usage of newly set EFLAGS so we can rewrite them. We just buffer + // jumps because their usage is very constrained. + bool FlagsKilled = false; + SmallVector JmpIs; + + // Gather the condition flags that have already been preserved in + // registers. We do this from scratch each time as we expect there to be + // very few of them and we expect to not revisit the same copy definition + // many times. If either of those change sufficiently we could build a map + // of these up front instead. + CondRegArray CondRegs = collectCondsInRegs(TestMBB, CopyDefI); + + for (auto MII = std::next(CopyI->getIterator()), MIE = MBB.instr_end(); + MII != MIE;) { + MachineInstr &MI = *MII++; + MachineOperand *FlagUse = MI.findRegisterUseOperand(X86::EFLAGS); + if (!FlagUse) { + if (MI.findRegisterDefOperand(X86::EFLAGS)) { + // If EFLAGS are defined, it's as-if they were killed. We can stop + // scanning here. + // + // NB!!! Many instructions only modify some flags. LLVM currently + // models this as clobbering all flags, but if that ever changes this + // will need to be carefully updated to handle that more complex + // logic. + FlagsKilled = true; + break; + } + continue; + } + + DEBUG(dbgs() << " Rewriting use: "; MI.dump()); + + // Check the kill flag before we rewrite as that may change it. + if (FlagUse->isKill()) + FlagsKilled = true; + + // Once we encounter a branch, the rest of the instructions must also be + // branches. We can't rewrite in place here, so we handle them below. + // + // Note that we don't have to handle tail calls here, even conditional + // tail calls, as those are not introduced into the X86 MI until post-RA + // branch folding or black placement. As a consequence, we get to deal + // with the simpler formulation of conditional branches followed by tail + // calls. + if (X86::getCondFromBranchOpc(MI.getOpcode()) != X86::COND_INVALID) { + auto JmpIt = MI.getIterator(); + do { + JmpIs.push_back(&*JmpIt); + ++JmpIt; + } while (JmpIt != MBB.instr_end() && + X86::getCondFromBranchOpc(JmpIt->getOpcode()) != + X86::COND_INVALID); + break; + } + + // Otherwise we can just rewrite in-place. + if (X86::getCondFromCMovOpc(MI.getOpcode()) != X86::COND_INVALID) { + rewriteCMov(TestMBB, TestPos, TestLoc, MI, *FlagUse, CondRegs); + } else if (X86::getCondFromSETOpc(MI.getOpcode()) != X86::COND_INVALID) { + rewriteSetCC(TestMBB, TestPos, TestLoc, MI, *FlagUse, CondRegs); + } else if (MI.getOpcode() == TargetOpcode::COPY) { + rewriteCopy(MI, *FlagUse, CopyDefI); + } else { + // We assume that arithmetic instructions that use flags also def them. + assert(MI.findRegisterDefOperand(X86::EFLAGS) && + "Expected a def of EFLAGS for this instruction!"); + + // NB!!! Several arithmetic instructions only *partially* update + // flags. Theoretically, we could generate MI code sequences that + // would rely on this fact and observe different flags independently. + // But currently LLVM models all of these instructions as clobbering + // all the flags in an undef way. We rely on that to simplify the + // logic. + FlagsKilled = true; + + rewriteArithmetic(TestMBB, TestPos, TestLoc, MI, *FlagUse, CondRegs); + break; + } + + // If this was the last use of the flags, we're done. + if (FlagsKilled) + break; + } + + // If we didn't find a kill (or equivalent) check that the flags don't + // live-out of the basic block. Currently we don't support lowering copies + // of flags that live out in this fashion. + if (!FlagsKilled && + llvm::any_of(MBB.successors(), [](MachineBasicBlock *SuccMBB) { + return SuccMBB->isLiveIn(X86::EFLAGS); + })) { + DEBUG({ + dbgs() << "ERROR: Found a copied EFLAGS live-out from basic block:\n" + << "----\n"; + MBB.dump(); + dbgs() << "----\n" + << "ERROR: Cannot lower this EFLAGS copy!\n"; + }); + report_fatal_error( + "Cannot lower EFLAGS copy that lives out of a basic block!"); + } + + // Now rewrite the jumps that use the flags. These we handle specially + // because if there are multiple jumps we'll have to do surgery on the CFG. + for (MachineInstr *JmpI : JmpIs) { + // Past the first jump we need to split the blocks apart. + if (JmpI != JmpIs.front()) + splitBlock(*JmpI->getParent(), *JmpI, *TII); + + rewriteCondJmp(TestMBB, TestPos, TestLoc, *JmpI, CondRegs); + } + + // FIXME: Mark the last use of EFLAGS before the copy's def as a kill if + // the copy's def operand is itself a kill. + } + +#ifndef NDEBUG + for (MachineBasicBlock &MBB : MF) + for (MachineInstr &MI : MBB) + if (MI.getOpcode() == TargetOpcode::COPY && + (MI.getOperand(0).getReg() == X86::EFLAGS || + MI.getOperand(1).getReg() == X86::EFLAGS)) { + DEBUG(dbgs() << "ERROR: Found a COPY involving EFLAGS: "; MI.dump()); + llvm_unreachable("Unlowered EFLAGS copy!"); + } +#endif + + return true; +} + +/// Collect any conditions that have already been set in registers so that we +/// can re-use them rather than adding duplicates. +CondRegArray +X86FlagsCopyLoweringPass::collectCondsInRegs(MachineBasicBlock &MBB, + MachineInstr &CopyDefI) { + CondRegArray CondRegs = {}; + + // Scan backwards across the range of instructions with live EFLAGS. + for (MachineInstr &MI : llvm::reverse( + llvm::make_range(MBB.instr_begin(), CopyDefI.getIterator()))) { + X86::CondCode Cond = X86::getCondFromSETOpc(MI.getOpcode()); + if (Cond != X86::COND_INVALID && MI.getOperand(0).isReg() && + TRI->isVirtualRegister(MI.getOperand(0).getReg())) + CondRegs[Cond] = MI.getOperand(0).getReg(); + + // Stop scanning when we see the first definition of the EFLAGS as prior to + // this we would potentially capture the wrong flag state. + if (MI.findRegisterDefOperand(X86::EFLAGS)) + break; + } + return CondRegs; +} + +unsigned X86FlagsCopyLoweringPass::promoteCondToReg( + MachineBasicBlock &TestMBB, MachineBasicBlock::iterator TestPos, + DebugLoc TestLoc, X86::CondCode Cond) { + unsigned Reg = MRI->createVirtualRegister(PromoteRC); + auto SetI = BuildMI(TestMBB, TestPos, TestLoc, + TII->get(X86::getSETFromCond(Cond)), Reg); + (void)SetI; + DEBUG(dbgs() << " save cond: "; SetI->dump()); + ++NumSetCCsInserted; + return Reg; +} + +std::pair X86FlagsCopyLoweringPass::getCondOrInverseInReg( + MachineBasicBlock &TestMBB, MachineBasicBlock::iterator TestPos, + DebugLoc TestLoc, X86::CondCode Cond, CondRegArray &CondRegs) { + unsigned &CondReg = CondRegs[Cond]; + unsigned &InvCondReg = CondRegs[X86::GetOppositeBranchCondition(Cond)]; + if (!CondReg && !InvCondReg) + CondReg = promoteCondToReg(TestMBB, TestPos, TestLoc, Cond); + + if (CondReg) + return {CondReg, false}; + else + return {InvCondReg, true}; +} + +void X86FlagsCopyLoweringPass::insertTest(MachineBasicBlock &MBB, + MachineBasicBlock::iterator Pos, + DebugLoc Loc, unsigned Reg) { + // We emit test instructions as register/immediate test against -1. This + // allows register allocation to fold a memory operand if needed (that will + // happen often due to the places this code is emitted). But hopefully will + // also allow us to select a shorter encoding of `testb %reg, %reg` when that + // would be equivalent. + auto TestI = + BuildMI(MBB, Pos, Loc, TII->get(X86::TEST8ri)).addReg(Reg).addImm(-1); + (void)TestI; + DEBUG(dbgs() << " test cond: "; TestI->dump()); + ++NumTestsInserted; +} + +void X86FlagsCopyLoweringPass::rewriteArithmetic( + MachineBasicBlock &TestMBB, MachineBasicBlock::iterator TestPos, + DebugLoc TestLoc, MachineInstr &MI, MachineOperand &FlagUse, + CondRegArray &CondRegs) { + // Arithmetic is either reading CF or OF. Figure out which condition we need + // to preserve in a register. + X86::CondCode Cond; + + // The addend to use to reset CF or OF when added to the flag value. + int Addend; + + switch (getMnemonicFromOpcode(MI.getOpcode())) { + case FlagArithMnemonic::ADC: + case FlagArithMnemonic::ADCX: + case FlagArithMnemonic::RCL: + case FlagArithMnemonic::RCR: + case FlagArithMnemonic::SBB: + Cond = X86::COND_B; // CF == 1 + // Set up an addend that when one is added will need a carry due to not + // having a higher bit available. + Addend = 255; + break; + + case FlagArithMnemonic::ADOX: + Cond = X86::COND_O; // OF == 1 + // Set up an addend that when one is added will turn from positive to + // negative and thus overflow in the signed domain. + Addend = 127; + break; + } + + // Now get a register that contains the value of the flag input to the + // arithmetic. We require exactly this flag to simplify the arithmetic + // required to materialize it back into the flag. + unsigned &CondReg = CondRegs[Cond]; + if (!CondReg) + CondReg = promoteCondToReg(TestMBB, TestPos, TestLoc, Cond); + + MachineBasicBlock &MBB = *MI.getParent(); + + // Insert an instruction that will set the flag back to the desired value. + unsigned TmpReg = MRI->createVirtualRegister(PromoteRC); + auto AddI = + BuildMI(MBB, MI.getIterator(), MI.getDebugLoc(), TII->get(X86::ADD8ri)) + .addDef(TmpReg, RegState::Dead) + .addReg(CondReg) + .addImm(Addend); + (void)AddI; + DEBUG(dbgs() << " add cond: "; AddI->dump()); + ++NumAddsInserted; + FlagUse.setIsKill(true); +} + +void X86FlagsCopyLoweringPass::rewriteCMov(MachineBasicBlock &TestMBB, + MachineBasicBlock::iterator TestPos, + DebugLoc TestLoc, + MachineInstr &CMovI, + MachineOperand &FlagUse, + CondRegArray &CondRegs) { + // First get the register containing this specific condition. + X86::CondCode Cond = X86::getCondFromCMovOpc(CMovI.getOpcode()); + unsigned CondReg; + bool Inverted; + std::tie(CondReg, Inverted) = + getCondOrInverseInReg(TestMBB, TestPos, TestLoc, Cond, CondRegs); + + MachineBasicBlock &MBB = *CMovI.getParent(); + + // Insert a direct test of the saved register. + insertTest(MBB, CMovI.getIterator(), CMovI.getDebugLoc(), CondReg); + + // Rewrite the CMov to use the !ZF flag from the test (but match register + // size and memory operand), and then kill its use of the flags afterward. + auto &CMovRC = *MRI->getRegClass(CMovI.getOperand(0).getReg()); + CMovI.setDesc(TII->get(X86::getCMovFromCond( + Inverted ? X86::COND_E : X86::COND_NE, TRI->getRegSizeInBits(CMovRC) / 8, + !CMovI.memoperands_empty()))); + FlagUse.setIsKill(true); + DEBUG(dbgs() << " fixed cmov: "; CMovI.dump()); +} + +void X86FlagsCopyLoweringPass::rewriteCondJmp( + MachineBasicBlock &TestMBB, MachineBasicBlock::iterator TestPos, + DebugLoc TestLoc, MachineInstr &JmpI, CondRegArray &CondRegs) { + // First get the register containing this specific condition. + X86::CondCode Cond = X86::getCondFromBranchOpc(JmpI.getOpcode()); + unsigned CondReg; + bool Inverted; + std::tie(CondReg, Inverted) = + getCondOrInverseInReg(TestMBB, TestPos, TestLoc, Cond, CondRegs); + + MachineBasicBlock &JmpMBB = *JmpI.getParent(); + + // Insert a direct test of the saved register. + insertTest(JmpMBB, JmpI.getIterator(), JmpI.getDebugLoc(), CondReg); + + // Rewrite the jump to use the !ZF flag from the test, and kill its use of + // flags afterward. + JmpI.setDesc(TII->get( + X86::GetCondBranchFromCond(Inverted ? X86::COND_E : X86::COND_NE))); + const int ImplicitEFLAGSOpIdx = 1; + JmpI.getOperand(ImplicitEFLAGSOpIdx).setIsKill(true); + DEBUG(dbgs() << " fixed jCC: "; JmpI.dump()); +} + +void X86FlagsCopyLoweringPass::rewriteCopy(MachineInstr &MI, + MachineOperand &FlagUse, + MachineInstr &CopyDefI) { + // Just replace this copy with the the original copy def. + MRI->replaceRegWith(MI.getOperand(0).getReg(), + CopyDefI.getOperand(0).getReg()); + MI.eraseFromParent(); +} + +void X86FlagsCopyLoweringPass::rewriteSetCC(MachineBasicBlock &TestMBB, + MachineBasicBlock::iterator TestPos, + DebugLoc TestLoc, + MachineInstr &SetCCI, + MachineOperand &FlagUse, + CondRegArray &CondRegs) { + X86::CondCode Cond = X86::getCondFromSETOpc(SetCCI.getOpcode()); + // Note that we can't usefully rewrite this to the inverse without complex + // analysis of the users of the setCC. Largely we rely on duplicates which + // could have been avoided already being avoided here. + unsigned &CondReg = CondRegs[Cond]; + if (!CondReg) + CondReg = promoteCondToReg(TestMBB, TestPos, TestLoc, Cond); + + // Rewriting this is trivial: we just replace the register and remove the + // setcc. + MRI->replaceRegWith(SetCCI.getOperand(0).getReg(), CondReg); + SetCCI.eraseFromParent(); +} Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Sat Apr 14 08:05:42 2018 (r332500) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Sat Apr 14 12:07:05 2018 (r332501) @@ -27781,11 +27781,16 @@ X86TargetLowering::EmitInstrWithCustomInserter(Machine MI.getOpcode() == X86::RDFLAGS32 ? X86::PUSHF32 : X86::PUSHF64; unsigned Pop = MI.getOpcode() == X86::RDFLAGS32 ? X86::POP32r : X86::POP64r; MachineInstr *Push = BuildMI(*BB, MI, DL, TII->get(PushF)); - // Permit reads of the FLAGS register without it being defined. + // Permit reads of the EFLAGS and DF registers without them being defined. // This intrinsic exists to read external processor state in flags, such as // the trap flag, interrupt flag, and direction flag, none of which are // modeled by the backend. + assert(Push->getOperand(2).getReg() == X86::EFLAGS && + "Unexpected register in operand!"); Push->getOperand(2).setIsUndef(); + assert(Push->getOperand(3).getReg() == X86::DF && + "Unexpected register in operand!"); + Push->getOperand(3).setIsUndef(); BuildMI(*BB, MI, DL, TII->get(Pop), MI.getOperand(0).getReg()); MI.eraseFromParent(); // The pseudo is gone now. @@ -37827,25 +37832,6 @@ bool X86TargetLowering::isTypeDesirableForOp(unsigned case ISD::XOR: return false; } -} - -/// This function checks if any of the users of EFLAGS copies the EFLAGS. We -/// know that the code that lowers COPY of EFLAGS has to use the stack, and if -/// we don't adjust the stack we clobber the first frame index. -/// See X86InstrInfo::copyPhysReg. -static bool hasCopyImplyingStackAdjustment(const MachineFunction &MF) { - const MachineRegisterInfo &MRI = MF.getRegInfo(); - return any_of(MRI.reg_instructions(X86::EFLAGS), - [](const MachineInstr &RI) { return RI.isCopy(); }); -} - -void X86TargetLowering::finalizeLowering(MachineFunction &MF) const { - if (hasCopyImplyingStackAdjustment(MF)) { - MachineFrameInfo &MFI = MF.getFrameInfo(); - MFI.setHasCopyImplyingStackAdjustment(true); - } - - TargetLoweringBase::finalizeLowering(MF); } /// This method query the target whether it is beneficial for dag combiner to Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.h ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.h Sat Apr 14 08:05:42 2018 (r332500) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.h Sat Apr 14 12:07:05 2018 (r332501) @@ -1100,8 +1100,6 @@ namespace llvm { unsigned Factor) const override; - void finalizeLowering(MachineFunction &MF) const override; - protected: std::pair findRepresentativeClass(const TargetRegisterInfo *TRI, Modified: head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Sat Apr 14 08:05:42 2018 (r332500) +++ head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Sat Apr 14 12:07:05 2018 (r332501) @@ -473,7 +473,7 @@ let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, - XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS], + XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS, DF], usesCustomInserter = 1, Uses = [ESP, SSP] in { def TLS_addr32 : I<0, Pseudo, (outs), (ins i32mem:$sym), "# TLS_addr32", @@ -493,7 +493,7 @@ let Defs = [RAX, RCX, RDX, RSI, RDI, R8, R9, R10, R11, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, - XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS], + XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS, DF], usesCustomInserter = 1, Uses = [RSP, SSP] in { def TLS_addr64 : I<0, Pseudo, (outs), (ins i64mem:$sym), "# TLS_addr64", @@ -509,7 +509,7 @@ def TLS_base_addr64 : I<0, Pseudo, (outs), (ins i64mem // For i386, the address of the thunk is passed on the stack, on return the // address of the variable is in %eax. %ecx is trashed during the function // call. All other registers are preserved. -let Defs = [EAX, ECX, EFLAGS], +let Defs = [EAX, ECX, EFLAGS, DF], Uses = [ESP, SSP], usesCustomInserter = 1 in def TLSCall_32 : I<0, Pseudo, (outs), (ins i32mem:$sym), @@ -522,7 +522,7 @@ def TLSCall_32 : I<0, Pseudo, (outs), (ins i32mem:$sym // %rdi. The lowering will do the right thing with RDI. // On return the address of the variable is in %rax. All other // registers are preserved. -let Defs = [RAX, EFLAGS], +let Defs = [RAX, EFLAGS, DF], Uses = [RSP, SSP], usesCustomInserter = 1 in def TLSCall_64 : I<0, Pseudo, (outs), (ins i64mem:$sym), Modified: head/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp Sat Apr 14 08:05:42 2018 (r332500) +++ head/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp Sat Apr 14 12:07:05 2018 (r332501) @@ -5782,7 +5782,7 @@ bool X86InstrInfo::findCommutedOpIndices(MachineInstr return false; } -static X86::CondCode getCondFromBranchOpc(unsigned BrOpc) { +X86::CondCode X86::getCondFromBranchOpc(unsigned BrOpc) { switch (BrOpc) { default: return X86::COND_INVALID; case X86::JE_1: return X86::COND_E; @@ -5805,7 +5805,7 @@ static X86::CondCode getCondFromBranchOpc(unsigned BrO } /// Return condition code of a SET opcode. -static X86::CondCode getCondFromSETOpc(unsigned Opc) { +X86::CondCode X86::getCondFromSETOpc(unsigned Opc) { switch (Opc) { default: return X86::COND_INVALID; case X86::SETAr: case X86::SETAm: return X86::COND_A; @@ -6130,7 +6130,7 @@ void X86InstrInfo::replaceBranchWithTailCall( if (!I->isBranch()) assert(0 && "Can't find the branch to replace!"); - X86::CondCode CC = getCondFromBranchOpc(I->getOpcode()); + X86::CondCode CC = X86::getCondFromBranchOpc(I->getOpcode()); assert(BranchCond.size() == 1); if (CC != BranchCond[0].getImm()) continue; @@ -6237,7 +6237,7 @@ bool X86InstrInfo::AnalyzeBranchImpl( } // Handle conditional branches. - X86::CondCode BranchCode = getCondFromBranchOpc(I->getOpcode()); + X86::CondCode BranchCode = X86::getCondFromBranchOpc(I->getOpcode()); if (BranchCode == X86::COND_INVALID) return true; // Can't handle indirect branch. @@ -6433,7 +6433,7 @@ unsigned X86InstrInfo::removeBranch(MachineBasicBlock if (I->isDebugValue()) continue; if (I->getOpcode() != X86::JMP_1 && - getCondFromBranchOpc(I->getOpcode()) == X86::COND_INVALID) + X86::getCondFromBranchOpc(I->getOpcode()) == X86::COND_INVALID) break; // Remove the branch. I->eraseFromParent(); @@ -6710,102 +6710,12 @@ void X86InstrInfo::copyPhysReg(MachineBasicBlock &MBB, return; } - bool FromEFLAGS = SrcReg == X86::EFLAGS; - bool ToEFLAGS = DestReg == X86::EFLAGS; - int Reg = FromEFLAGS ? DestReg : SrcReg; - bool is32 = X86::GR32RegClass.contains(Reg); - bool is64 = X86::GR64RegClass.contains(Reg); - - if ((FromEFLAGS || ToEFLAGS) && (is32 || is64)) { - int Mov = is64 ? X86::MOV64rr : X86::MOV32rr; - int Push = is64 ? X86::PUSH64r : X86::PUSH32r; - int PushF = is64 ? X86::PUSHF64 : X86::PUSHF32; - int Pop = is64 ? X86::POP64r : X86::POP32r; - int PopF = is64 ? X86::POPF64 : X86::POPF32; - int AX = is64 ? X86::RAX : X86::EAX; - - if (!Subtarget.hasLAHFSAHF()) { - assert(Subtarget.is64Bit() && - "Not having LAHF/SAHF only happens on 64-bit."); - // Moving EFLAGS to / from another register requires a push and a pop. - // Notice that we have to adjust the stack if we don't want to clobber the - // first frame index. See X86FrameLowering.cpp - usesTheStack. - if (FromEFLAGS) { - BuildMI(MBB, MI, DL, get(PushF)); - BuildMI(MBB, MI, DL, get(Pop), DestReg); - } - if (ToEFLAGS) { - BuildMI(MBB, MI, DL, get(Push)) - .addReg(SrcReg, getKillRegState(KillSrc)); - BuildMI(MBB, MI, DL, get(PopF)); - } - return; - } - - // The flags need to be saved, but saving EFLAGS with PUSHF/POPF is - // inefficient. Instead: - // - Save the overflow flag OF into AL using SETO, and restore it using a - // signed 8-bit addition of AL and INT8_MAX. - // - Save/restore the bottom 8 EFLAGS bits (CF, PF, AF, ZF, SF) to/from AH - // using LAHF/SAHF. - // - When RAX/EAX is live and isn't the destination register, make sure it - // isn't clobbered by PUSH/POP'ing it before and after saving/restoring - // the flags. - // This approach is ~2.25x faster than using PUSHF/POPF. - // - // This is still somewhat inefficient because we don't know which flags are - // actually live inside EFLAGS. Were we able to do a single SETcc instead of - // SETO+LAHF / ADDB+SAHF the code could be 1.02x faster. - // - // PUSHF/POPF is also potentially incorrect because it affects other flags - // such as TF/IF/DF, which LLVM doesn't model. - // - // Notice that we have to adjust the stack if we don't want to clobber the - // first frame index. - // See X86ISelLowering.cpp - X86::hasCopyImplyingStackAdjustment. - *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Apr 14 14:44:45 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9FF97FA5150; Sat, 14 Apr 2018 14:44:45 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: from mail-wr0-f177.google.com (mail-wr0-f177.google.com [209.85.128.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 1EDEB6D8AD; Sat, 14 Apr 2018 14:44:44 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: by mail-wr0-f177.google.com with SMTP id s18so14848823wrg.9; Sat, 14 Apr 2018 07:44:44 -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:in-reply-to:references:from:date :message-id:subject:to:cc; bh=6wB24ARf9KZSam9zpqNrWQr7lf9/vKxb0vxdY+uAa2U=; b=ndDJI0iNqttOwuPPBltXeNgprCBLXDdmzW+GxVfVajxCt6eZJiIAq5QXHoJS0IUQnc 8eZPbpCnwqmYDCWA1iclI7XF0iFtBV51tMjv0StfL1n5JVBUKnjeP+kzJtVFitaqg1En a7O9jnBN3RC0KJ6UbQfpmoa8o1+dKmFbWiM2v0CREsdnRRwaJwqqvnzJ15PR3i77AaY/ lqeXJR2YAdvOpWdayZH37JxfpTN/dN/HzGF+Ba9D+00B9YnvBHzRRNo8ikrQuT237FJ/ fsq43RxXze88XqlARY7onNSjvpCSrkrxAdUC6qaC3QaaXO2Sln17if0AFnC91ZGQ0Ngz H37A== X-Gm-Message-State: ALQs6tAX2mrsyOxRq2YBZVkTbZNz9rzlxzBq1yL+cyG/9TMuRq42/pc0 vX2azCjZ2yY9KrAu6Ky0/w6prWSO X-Google-Smtp-Source: AIpwx4/47aeOXYpZR56yv8XZRZFDP/myKl3vCBLKYIdYr4pacEBZZ8sNZ0LaC54OEYG9uEG4GJ/Dsg== X-Received: by 10.80.143.164 with SMTP id y33mr4991594edy.135.1523717078323; Sat, 14 Apr 2018 07:44:38 -0700 (PDT) Received: from mail-wr0-f180.google.com (mail-wr0-f180.google.com. [209.85.128.180]) by smtp.gmail.com with ESMTPSA id h33sm4781576edh.1.2018.04.14.07.44.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Apr 2018 07:44:37 -0700 (PDT) Received: by mail-wr0-f180.google.com with SMTP id q6so2774884wrd.6; Sat, 14 Apr 2018 07:44:37 -0700 (PDT) X-Received: by 10.28.85.137 with SMTP id j131mr6602154wmb.94.1523717077204; Sat, 14 Apr 2018 07:44:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.199.203 with HTTP; Sat, 14 Apr 2018 07:44:36 -0700 (PDT) In-Reply-To: <201804141207.w3EC75cj023620@repo.freebsd.org> References: <201804141207.w3EC75cj023620@repo.freebsd.org> From: "Jonathan T. Looney" Date: Sat, 14 Apr 2018 10:44:36 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r332501 - in head: contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/CodeGen contrib/llvm/lib/Target/X86 contrib/llvm/lib/Target/X86/Disassembler contrib/llvm/tools/clang/include/clang... To: Dimitry Andric Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 14 Apr 2018 14:44:45 -0000 On Sat, Apr 14, 2018 at 8:07 AM, Dimitry Andric wrote: > Author: dim > Date: Sat Apr 14 12:07:05 2018 > New Revision: 332501 > URL: https://svnweb.freebsd.org/changeset/base/332501 > > Log: > Pull in r325446 from upstream clang trunk (by me): > > [X86] Add 'sahf' CPU feature to frontend > > Pull in r328944 from upstream llvm trunk (by Chandler Carruth): > > [x86] Expose more of the condition conversion routines in the public > API for X86's instruction information. I've now got a second patch > under review that needs these same APIs. This bit is nicely > orthogonal and obvious, so landing it. NFC. > > Pull in r329414 from upstream llvm trunk (by Craig Topper): > > [X86] Merge itineraries for CLC, CMC, and STC. > > Pull in r329673 from upstream llvm trunk (by Chandler Carruth): > > [x86] Model the direction flag (DF) separately from the rest of > EFLAGS. > > Thanks so much for doing this! Jonathan From owner-svn-src-head@freebsd.org Sat Apr 14 14:57:35 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 3A5B8FA5E8C; Sat, 14 Apr 2018 14:57:35 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id D09086EBF8; Sat, 14 Apr 2018 14:57:34 +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 C8D8E29B34; Sat, 14 Apr 2018 14:57:34 +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 w3EEvYrF009716; Sat, 14 Apr 2018 14:57:34 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3EEvWPr009695; Sat, 14 Apr 2018 14:57:32 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201804141457.w3EEvWPr009695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sat, 14 Apr 2018 14:57:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332503 - in head: contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/CodeGen contrib/llvm/lib/Target/X86 contrib/llvm/lib/Target/X86/Disassembler contrib/llvm/tools/clang/include/clang... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/CodeGen contrib/llvm/lib/Target/X86 contrib/llvm/lib/Target/X86/Disassembler contrib/llvm/tools/clang/include/clang/Driver contrib/llvm/tool... X-SVN-Commit-Revision: 332503 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 14 Apr 2018 14:57:35 -0000 Author: dim Date: Sat Apr 14 14:57:32 2018 New Revision: 332503 URL: https://svnweb.freebsd.org/changeset/base/332503 Log: Revert r332501 for now, as it can cause build failures on i386. Reported upstream as . Reported by: emaste, ci.freebsd.org PR: 225330 Deleted: head/contrib/llvm/lib/Target/X86/X86FlagsCopyLowering.cpp Modified: head/contrib/llvm/include/llvm/CodeGen/MachineBasicBlock.h head/contrib/llvm/lib/CodeGen/MachineBasicBlock.cpp head/contrib/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp head/contrib/llvm/lib/Target/X86/X86.h head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp head/contrib/llvm/lib/Target/X86/X86ISelLowering.h head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td head/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp head/contrib/llvm/lib/Target/X86/X86InstrInfo.h head/contrib/llvm/lib/Target/X86/X86InstrInfo.td head/contrib/llvm/lib/Target/X86/X86InstrSystem.td head/contrib/llvm/lib/Target/X86/X86RegisterInfo.td head/contrib/llvm/lib/Target/X86/X86Schedule.td head/contrib/llvm/lib/Target/X86/X86ScheduleAtom.td head/contrib/llvm/lib/Target/X86/X86TargetMachine.cpp head/contrib/llvm/tools/clang/include/clang/Driver/Options.td head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.cpp head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.h head/lib/clang/freebsd_cc_version.h head/lib/clang/libllvm/Makefile Modified: head/contrib/llvm/include/llvm/CodeGen/MachineBasicBlock.h ============================================================================== --- head/contrib/llvm/include/llvm/CodeGen/MachineBasicBlock.h Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/include/llvm/CodeGen/MachineBasicBlock.h Sat Apr 14 14:57:32 2018 (r332503) @@ -449,13 +449,6 @@ class MachineBasicBlock (public) /// Replace successor OLD with NEW and update probability info. void replaceSuccessor(MachineBasicBlock *Old, MachineBasicBlock *New); - /// Copy a successor (and any probability info) from original block to this - /// block's. Uses an iterator into the original blocks successors. - /// - /// This is useful when doing a partial clone of successors. Afterward, the - /// probabilities may need to be normalized. - void copySuccessor(MachineBasicBlock *Orig, succ_iterator I); - /// Transfers all the successors from MBB to this machine basic block (i.e., /// copies all the successors FromMBB and remove all the successors from /// FromMBB). Modified: head/contrib/llvm/lib/CodeGen/MachineBasicBlock.cpp ============================================================================== --- head/contrib/llvm/lib/CodeGen/MachineBasicBlock.cpp Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/CodeGen/MachineBasicBlock.cpp Sat Apr 14 14:57:32 2018 (r332503) @@ -646,14 +646,6 @@ void MachineBasicBlock::replaceSuccessor(MachineBasicB removeSuccessor(OldI); } -void MachineBasicBlock::copySuccessor(MachineBasicBlock *Orig, - succ_iterator I) { - if (Orig->Probs.empty()) - addSuccessor(*I, Orig->getSuccProbability(I)); - else - addSuccessorWithoutProb(*I); -} - void MachineBasicBlock::addPredecessor(MachineBasicBlock *Pred) { Predecessors.push_back(Pred); } Modified: head/contrib/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/Target/X86/Disassembler/X86Disassembler.cpp Sat Apr 14 14:57:32 2018 (r332503) @@ -265,10 +265,13 @@ MCDisassembler::DecodeStatus X86GenericDisassembler::g /// @param reg - The Reg to append. static void translateRegister(MCInst &mcInst, Reg reg) { #define ENTRY(x) X86::x, - static constexpr MCPhysReg llvmRegnums[] = {ALL_REGS}; + uint8_t llvmRegnums[] = { + ALL_REGS + 0 + }; #undef ENTRY - MCPhysReg llvmRegnum = llvmRegnums[reg]; + uint8_t llvmRegnum = llvmRegnums[reg]; mcInst.addOperand(MCOperand::createReg(llvmRegnum)); } Modified: head/contrib/llvm/lib/Target/X86/X86.h ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86.h Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/Target/X86/X86.h Sat Apr 14 14:57:32 2018 (r332503) @@ -66,9 +66,6 @@ FunctionPass *createX86OptimizeLEAs(); /// Return a pass that transforms setcc + movzx pairs into xor + setcc. FunctionPass *createX86FixupSetCC(); -/// Return a pass that lowers EFLAGS copy pseudo instructions. -FunctionPass *createX86FlagsCopyLoweringPass(); - /// Return a pass that expands WinAlloca pseudo-instructions. FunctionPass *createX86WinAllocaExpander(); Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.cpp Sat Apr 14 14:57:32 2018 (r332503) @@ -27781,16 +27781,11 @@ X86TargetLowering::EmitInstrWithCustomInserter(Machine MI.getOpcode() == X86::RDFLAGS32 ? X86::PUSHF32 : X86::PUSHF64; unsigned Pop = MI.getOpcode() == X86::RDFLAGS32 ? X86::POP32r : X86::POP64r; MachineInstr *Push = BuildMI(*BB, MI, DL, TII->get(PushF)); - // Permit reads of the EFLAGS and DF registers without them being defined. + // Permit reads of the FLAGS register without it being defined. // This intrinsic exists to read external processor state in flags, such as // the trap flag, interrupt flag, and direction flag, none of which are // modeled by the backend. - assert(Push->getOperand(2).getReg() == X86::EFLAGS && - "Unexpected register in operand!"); Push->getOperand(2).setIsUndef(); - assert(Push->getOperand(3).getReg() == X86::DF && - "Unexpected register in operand!"); - Push->getOperand(3).setIsUndef(); BuildMI(*BB, MI, DL, TII->get(Pop), MI.getOperand(0).getReg()); MI.eraseFromParent(); // The pseudo is gone now. @@ -37832,6 +37827,25 @@ bool X86TargetLowering::isTypeDesirableForOp(unsigned case ISD::XOR: return false; } +} + +/// This function checks if any of the users of EFLAGS copies the EFLAGS. We +/// know that the code that lowers COPY of EFLAGS has to use the stack, and if +/// we don't adjust the stack we clobber the first frame index. +/// See X86InstrInfo::copyPhysReg. +static bool hasCopyImplyingStackAdjustment(const MachineFunction &MF) { + const MachineRegisterInfo &MRI = MF.getRegInfo(); + return any_of(MRI.reg_instructions(X86::EFLAGS), + [](const MachineInstr &RI) { return RI.isCopy(); }); +} + +void X86TargetLowering::finalizeLowering(MachineFunction &MF) const { + if (hasCopyImplyingStackAdjustment(MF)) { + MachineFrameInfo &MFI = MF.getFrameInfo(); + MFI.setHasCopyImplyingStackAdjustment(true); + } + + TargetLoweringBase::finalizeLowering(MF); } /// This method query the target whether it is beneficial for dag combiner to Modified: head/contrib/llvm/lib/Target/X86/X86ISelLowering.h ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ISelLowering.h Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/Target/X86/X86ISelLowering.h Sat Apr 14 14:57:32 2018 (r332503) @@ -1100,6 +1100,8 @@ namespace llvm { unsigned Factor) const override; + void finalizeLowering(MachineFunction &MF) const override; + protected: std::pair findRepresentativeClass(const TargetRegisterInfo *TRI, Modified: head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/Target/X86/X86InstrCompiler.td Sat Apr 14 14:57:32 2018 (r332503) @@ -473,7 +473,7 @@ let Defs = [EAX, ECX, EDX, FP0, FP1, FP2, FP3, FP4, FP ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, - XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS, DF], + XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS], usesCustomInserter = 1, Uses = [ESP, SSP] in { def TLS_addr32 : I<0, Pseudo, (outs), (ins i32mem:$sym), "# TLS_addr32", @@ -493,7 +493,7 @@ let Defs = [RAX, RCX, RDX, RSI, RDI, R8, R9, R10, R11, ST0, ST1, ST2, ST3, ST4, ST5, ST6, ST7, MM0, MM1, MM2, MM3, MM4, MM5, MM6, MM7, XMM0, XMM1, XMM2, XMM3, XMM4, XMM5, XMM6, XMM7, - XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS, DF], + XMM8, XMM9, XMM10, XMM11, XMM12, XMM13, XMM14, XMM15, EFLAGS], usesCustomInserter = 1, Uses = [RSP, SSP] in { def TLS_addr64 : I<0, Pseudo, (outs), (ins i64mem:$sym), "# TLS_addr64", @@ -509,7 +509,7 @@ def TLS_base_addr64 : I<0, Pseudo, (outs), (ins i64mem // For i386, the address of the thunk is passed on the stack, on return the // address of the variable is in %eax. %ecx is trashed during the function // call. All other registers are preserved. -let Defs = [EAX, ECX, EFLAGS, DF], +let Defs = [EAX, ECX, EFLAGS], Uses = [ESP, SSP], usesCustomInserter = 1 in def TLSCall_32 : I<0, Pseudo, (outs), (ins i32mem:$sym), @@ -522,7 +522,7 @@ def TLSCall_32 : I<0, Pseudo, (outs), (ins i32mem:$sym // %rdi. The lowering will do the right thing with RDI. // On return the address of the variable is in %rax. All other // registers are preserved. -let Defs = [RAX, EFLAGS, DF], +let Defs = [RAX, EFLAGS], Uses = [RSP, SSP], usesCustomInserter = 1 in def TLSCall_64 : I<0, Pseudo, (outs), (ins i64mem:$sym), Modified: head/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/Target/X86/X86InstrInfo.cpp Sat Apr 14 14:57:32 2018 (r332503) @@ -5782,7 +5782,7 @@ bool X86InstrInfo::findCommutedOpIndices(MachineInstr return false; } -X86::CondCode X86::getCondFromBranchOpc(unsigned BrOpc) { +static X86::CondCode getCondFromBranchOpc(unsigned BrOpc) { switch (BrOpc) { default: return X86::COND_INVALID; case X86::JE_1: return X86::COND_E; @@ -5805,7 +5805,7 @@ X86::CondCode X86::getCondFromBranchOpc(unsigned BrOpc } /// Return condition code of a SET opcode. -X86::CondCode X86::getCondFromSETOpc(unsigned Opc) { +static X86::CondCode getCondFromSETOpc(unsigned Opc) { switch (Opc) { default: return X86::COND_INVALID; case X86::SETAr: case X86::SETAm: return X86::COND_A; @@ -6130,7 +6130,7 @@ void X86InstrInfo::replaceBranchWithTailCall( if (!I->isBranch()) assert(0 && "Can't find the branch to replace!"); - X86::CondCode CC = X86::getCondFromBranchOpc(I->getOpcode()); + X86::CondCode CC = getCondFromBranchOpc(I->getOpcode()); assert(BranchCond.size() == 1); if (CC != BranchCond[0].getImm()) continue; @@ -6237,7 +6237,7 @@ bool X86InstrInfo::AnalyzeBranchImpl( } // Handle conditional branches. - X86::CondCode BranchCode = X86::getCondFromBranchOpc(I->getOpcode()); + X86::CondCode BranchCode = getCondFromBranchOpc(I->getOpcode()); if (BranchCode == X86::COND_INVALID) return true; // Can't handle indirect branch. @@ -6433,7 +6433,7 @@ unsigned X86InstrInfo::removeBranch(MachineBasicBlock if (I->isDebugValue()) continue; if (I->getOpcode() != X86::JMP_1 && - X86::getCondFromBranchOpc(I->getOpcode()) == X86::COND_INVALID) + getCondFromBranchOpc(I->getOpcode()) == X86::COND_INVALID) break; // Remove the branch. I->eraseFromParent(); @@ -6710,12 +6710,102 @@ void X86InstrInfo::copyPhysReg(MachineBasicBlock &MBB, return; } - if (SrcReg == X86::EFLAGS || DestReg == X86::EFLAGS) { - // FIXME: We use a fatal error here because historically LLVM has tried - // lower some of these physreg copies and we want to ensure we get - // reasonable bug reports if someone encounters a case no other testing - // found. This path should be removed after the LLVM 7 release. - report_fatal_error("Unable to copy EFLAGS physical register!"); + bool FromEFLAGS = SrcReg == X86::EFLAGS; + bool ToEFLAGS = DestReg == X86::EFLAGS; + int Reg = FromEFLAGS ? DestReg : SrcReg; + bool is32 = X86::GR32RegClass.contains(Reg); + bool is64 = X86::GR64RegClass.contains(Reg); + + if ((FromEFLAGS || ToEFLAGS) && (is32 || is64)) { + int Mov = is64 ? X86::MOV64rr : X86::MOV32rr; + int Push = is64 ? X86::PUSH64r : X86::PUSH32r; + int PushF = is64 ? X86::PUSHF64 : X86::PUSHF32; + int Pop = is64 ? X86::POP64r : X86::POP32r; + int PopF = is64 ? X86::POPF64 : X86::POPF32; + int AX = is64 ? X86::RAX : X86::EAX; + + if (!Subtarget.hasLAHFSAHF()) { + assert(Subtarget.is64Bit() && + "Not having LAHF/SAHF only happens on 64-bit."); + // Moving EFLAGS to / from another register requires a push and a pop. + // Notice that we have to adjust the stack if we don't want to clobber the + // first frame index. See X86FrameLowering.cpp - usesTheStack. + if (FromEFLAGS) { + BuildMI(MBB, MI, DL, get(PushF)); + BuildMI(MBB, MI, DL, get(Pop), DestReg); + } + if (ToEFLAGS) { + BuildMI(MBB, MI, DL, get(Push)) + .addReg(SrcReg, getKillRegState(KillSrc)); + BuildMI(MBB, MI, DL, get(PopF)); + } + return; + } + + // The flags need to be saved, but saving EFLAGS with PUSHF/POPF is + // inefficient. Instead: + // - Save the overflow flag OF into AL using SETO, and restore it using a + // signed 8-bit addition of AL and INT8_MAX. + // - Save/restore the bottom 8 EFLAGS bits (CF, PF, AF, ZF, SF) to/from AH + // using LAHF/SAHF. + // - When RAX/EAX is live and isn't the destination register, make sure it + // isn't clobbered by PUSH/POP'ing it before and after saving/restoring + // the flags. + // This approach is ~2.25x faster than using PUSHF/POPF. + // + // This is still somewhat inefficient because we don't know which flags are + // actually live inside EFLAGS. Were we able to do a single SETcc instead of + // SETO+LAHF / ADDB+SAHF the code could be 1.02x faster. + // + // PUSHF/POPF is also potentially incorrect because it affects other flags + // such as TF/IF/DF, which LLVM doesn't model. + // + // Notice that we have to adjust the stack if we don't want to clobber the + // first frame index. + // See X86ISelLowering.cpp - X86::hasCopyImplyingStackAdjustment. + + const TargetRegisterInfo &TRI = getRegisterInfo(); + MachineBasicBlock::LivenessQueryResult LQR = + MBB.computeRegisterLiveness(&TRI, AX, MI); + // We do not want to save and restore AX if we do not have to. + // Moreover, if we do so whereas AX is dead, we would need to set + // an undef flag on the use of AX, otherwise the verifier will + // complain that we read an undef value. + // We do not want to change the behavior of the machine verifier + // as this is usually wrong to read an undef value. + if (MachineBasicBlock::LQR_Unknown == LQR) { + LivePhysRegs LPR(TRI); + LPR.addLiveOuts(MBB); + MachineBasicBlock::iterator I = MBB.end(); + while (I != MI) { + --I; + LPR.stepBackward(*I); + } + // AX contains the top most register in the aliasing hierarchy. + // It may not be live, but one of its aliases may be. + for (MCRegAliasIterator AI(AX, &TRI, true); + AI.isValid() && LQR != MachineBasicBlock::LQR_Live; ++AI) + LQR = LPR.contains(*AI) ? MachineBasicBlock::LQR_Live + : MachineBasicBlock::LQR_Dead; + } + bool AXDead = (Reg == AX) || (MachineBasicBlock::LQR_Dead == LQR); + if (!AXDead) + BuildMI(MBB, MI, DL, get(Push)).addReg(AX, getKillRegState(true)); + if (FromEFLAGS) { + BuildMI(MBB, MI, DL, get(X86::SETOr), X86::AL); + BuildMI(MBB, MI, DL, get(X86::LAHF)); + BuildMI(MBB, MI, DL, get(Mov), Reg).addReg(AX); + } + if (ToEFLAGS) { + BuildMI(MBB, MI, DL, get(Mov), AX).addReg(Reg, getKillRegState(KillSrc)); + BuildMI(MBB, MI, DL, get(X86::ADD8ri), X86::AL) + .addReg(X86::AL) + .addImm(INT8_MAX); + BuildMI(MBB, MI, DL, get(X86::SAHF)); + } + if (!AXDead) + BuildMI(MBB, MI, DL, get(Pop), AX); + return; } DEBUG(dbgs() << "Cannot copy " << RI.getName(SrcReg) @@ -7375,9 +7465,9 @@ bool X86InstrInfo::optimizeCompareInstr(MachineInstr & if (IsCmpZero || IsSwapped) { // We decode the condition code from opcode. if (Instr.isBranch()) - OldCC = X86::getCondFromBranchOpc(Instr.getOpcode()); + OldCC = getCondFromBranchOpc(Instr.getOpcode()); else { - OldCC = X86::getCondFromSETOpc(Instr.getOpcode()); + OldCC = getCondFromSETOpc(Instr.getOpcode()); if (OldCC != X86::COND_INVALID) OpcIsSET = true; else @@ -9323,9 +9413,8 @@ bool X86InstrInfo:: isSafeToMoveRegClassDefs(const TargetRegisterClass *RC) const { // FIXME: Return false for x87 stack register classes for now. We can't // allow any loads of these registers before FpGet_ST0_80. - return !(RC == &X86::CCRRegClass || RC == &X86::DFCCRRegClass || - RC == &X86::RFP32RegClass || RC == &X86::RFP64RegClass || - RC == &X86::RFP80RegClass); + return !(RC == &X86::CCRRegClass || RC == &X86::RFP32RegClass || + RC == &X86::RFP64RegClass || RC == &X86::RFP80RegClass); } /// Return a virtual register initialized with the Modified: head/contrib/llvm/lib/Target/X86/X86InstrInfo.h ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrInfo.h Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/Target/X86/X86InstrInfo.h Sat Apr 14 14:57:32 2018 (r332503) @@ -77,12 +77,6 @@ unsigned getSETFromCond(CondCode CC, bool HasMemoryOpe unsigned getCMovFromCond(CondCode CC, unsigned RegBytes, bool HasMemoryOperand = false); -// Turn jCC opcode into condition code. -CondCode getCondFromBranchOpc(unsigned Opc); - -// Turn setCC opcode into condition code. -CondCode getCondFromSETOpc(unsigned Opc); - // Turn CMov opcode into condition code. CondCode getCondFromCMovOpc(unsigned Opc); Modified: head/contrib/llvm/lib/Target/X86/X86InstrInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrInfo.td Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/Target/X86/X86InstrInfo.td Sat Apr 14 14:57:32 2018 (r332503) @@ -1235,18 +1235,18 @@ let mayLoad = 1, mayStore = 1, usesCustomInserter = 1, let mayLoad = 1, mayStore = 1, usesCustomInserter = 1, SchedRW = [WriteRMW] in { - let Defs = [ESP, EFLAGS, DF], Uses = [ESP] in + let Defs = [ESP, EFLAGS], Uses = [ESP] in def WRFLAGS32 : PseudoI<(outs), (ins GR32:$src), [(int_x86_flags_write_u32 GR32:$src)]>, Requires<[Not64BitMode]>; - let Defs = [RSP, EFLAGS, DF], Uses = [RSP] in + let Defs = [RSP, EFLAGS], Uses = [RSP] in def WRFLAGS64 : PseudoI<(outs), (ins GR64:$src), [(int_x86_flags_write_u64 GR64:$src)]>, Requires<[In64BitMode]>; } -let Defs = [ESP, EFLAGS, DF], Uses = [ESP], mayLoad = 1, hasSideEffects=0, +let Defs = [ESP, EFLAGS], Uses = [ESP], mayLoad = 1, hasSideEffects=0, SchedRW = [WriteLoad] in { def POPF16 : I<0x9D, RawFrm, (outs), (ins), "popf{w}", [], IIC_POP_F>, OpSize16; @@ -1254,7 +1254,7 @@ def POPF32 : I<0x9D, RawFrm, (outs), (ins), "popf{l| OpSize32, Requires<[Not64BitMode]>; } -let Defs = [ESP], Uses = [ESP, EFLAGS, DF], mayStore = 1, hasSideEffects=0, +let Defs = [ESP], Uses = [ESP, EFLAGS], mayStore = 1, hasSideEffects=0, SchedRW = [WriteStore] in { def PUSHF16 : I<0x9C, RawFrm, (outs), (ins), "pushf{w}", [], IIC_PUSH_F>, OpSize16; @@ -1294,10 +1294,10 @@ def PUSH64i32 : Ii32S<0x68, RawFrm, (outs), (ins i64i Requires<[In64BitMode]>; } -let Defs = [RSP, EFLAGS, DF], Uses = [RSP], mayLoad = 1, hasSideEffects=0 in +let Defs = [RSP, EFLAGS], Uses = [RSP], mayLoad = 1, hasSideEffects=0 in def POPF64 : I<0x9D, RawFrm, (outs), (ins), "popfq", [], IIC_POP_FD>, OpSize32, Requires<[In64BitMode]>, Sched<[WriteLoad]>; -let Defs = [RSP], Uses = [RSP, EFLAGS, DF], mayStore = 1, hasSideEffects=0 in +let Defs = [RSP], Uses = [RSP, EFLAGS], mayStore = 1, hasSideEffects=0 in def PUSHF64 : I<0x9C, RawFrm, (outs), (ins), "pushfq", [], IIC_PUSH_F>, OpSize32, Requires<[In64BitMode]>, Sched<[WriteStore]>; @@ -1382,7 +1382,8 @@ def BSR64rm : RI<0xBD, MRMSrcMem, (outs GR64:$dst), ( } // Defs = [EFLAGS] let SchedRW = [WriteMicrocoded] in { -let Defs = [EDI,ESI], Uses = [EDI,ESI,DF] in { +// These uses the DF flag in the EFLAGS register to inc or dec EDI and ESI +let Defs = [EDI,ESI], Uses = [EDI,ESI,EFLAGS] in { def MOVSB : I<0xA4, RawFrmDstSrc, (outs), (ins dstidx8:$dst, srcidx8:$src), "movsb\t{$src, $dst|$dst, $src}", [], IIC_MOVS>; def MOVSW : I<0xA5, RawFrmDstSrc, (outs), (ins dstidx16:$dst, srcidx16:$src), @@ -1393,33 +1394,36 @@ def MOVSQ : RI<0xA5, RawFrmDstSrc, (outs), (ins dstidx "movsq\t{$src, $dst|$dst, $src}", [], IIC_MOVS>; } -let Defs = [EDI], Uses = [AL,EDI,DF] in +// These uses the DF flag in the EFLAGS register to inc or dec EDI and ESI +let Defs = [EDI], Uses = [AL,EDI,EFLAGS] in def STOSB : I<0xAA, RawFrmDst, (outs), (ins dstidx8:$dst), "stosb\t{%al, $dst|$dst, al}", [], IIC_STOS>; -let Defs = [EDI], Uses = [AX,EDI,DF] in +let Defs = [EDI], Uses = [AX,EDI,EFLAGS] in def STOSW : I<0xAB, RawFrmDst, (outs), (ins dstidx16:$dst), "stosw\t{%ax, $dst|$dst, ax}", [], IIC_STOS>, OpSize16; -let Defs = [EDI], Uses = [EAX,EDI,DF] in +let Defs = [EDI], Uses = [EAX,EDI,EFLAGS] in def STOSL : I<0xAB, RawFrmDst, (outs), (ins dstidx32:$dst), "stos{l|d}\t{%eax, $dst|$dst, eax}", [], IIC_STOS>, OpSize32; -let Defs = [RDI], Uses = [RAX,RDI,DF] in +let Defs = [RDI], Uses = [RAX,RDI,EFLAGS] in def STOSQ : RI<0xAB, RawFrmDst, (outs), (ins dstidx64:$dst), "stosq\t{%rax, $dst|$dst, rax}", [], IIC_STOS>; -let Defs = [EDI,EFLAGS], Uses = [AL,EDI,DF] in +// These uses the DF flag in the EFLAGS register to inc or dec EDI and ESI +let Defs = [EDI,EFLAGS], Uses = [AL,EDI,EFLAGS] in def SCASB : I<0xAE, RawFrmDst, (outs), (ins dstidx8:$dst), "scasb\t{$dst, %al|al, $dst}", [], IIC_SCAS>; -let Defs = [EDI,EFLAGS], Uses = [AX,EDI,DF] in +let Defs = [EDI,EFLAGS], Uses = [AX,EDI,EFLAGS] in def SCASW : I<0xAF, RawFrmDst, (outs), (ins dstidx16:$dst), "scasw\t{$dst, %ax|ax, $dst}", [], IIC_SCAS>, OpSize16; -let Defs = [EDI,EFLAGS], Uses = [EAX,EDI,DF] in +let Defs = [EDI,EFLAGS], Uses = [EAX,EDI,EFLAGS] in def SCASL : I<0xAF, RawFrmDst, (outs), (ins dstidx32:$dst), "scas{l|d}\t{$dst, %eax|eax, $dst}", [], IIC_SCAS>, OpSize32; -let Defs = [EDI,EFLAGS], Uses = [RAX,EDI,DF] in +let Defs = [EDI,EFLAGS], Uses = [RAX,EDI,EFLAGS] in def SCASQ : RI<0xAF, RawFrmDst, (outs), (ins dstidx64:$dst), "scasq\t{$dst, %rax|rax, $dst}", [], IIC_SCAS>; -let Defs = [EDI,ESI,EFLAGS], Uses = [EDI,ESI,DF] in { +// These uses the DF flag in the EFLAGS register to inc or dec EDI and ESI +let Defs = [EDI,ESI,EFLAGS], Uses = [EDI,ESI,EFLAGS] in { def CMPSB : I<0xA6, RawFrmDstSrc, (outs), (ins dstidx8:$dst, srcidx8:$src), "cmpsb\t{$dst, $src|$src, $dst}", [], IIC_CMPS>; def CMPSW : I<0xA7, RawFrmDstSrc, (outs), (ins dstidx16:$dst, srcidx16:$src), @@ -2066,7 +2070,8 @@ def DATA32_PREFIX : I<0x66, RawFrm, (outs), (ins), "d } // SchedRW // Repeat string operation instruction prefixes -let Defs = [ECX], Uses = [ECX,DF], SchedRW = [WriteMicrocoded] in { +// These use the DF flag in the EFLAGS register to inc or dec ECX +let Defs = [ECX], Uses = [ECX,EFLAGS], SchedRW = [WriteMicrocoded] in { // Repeat (used with INS, OUTS, MOVS, LODS and STOS) def REP_PREFIX : I<0xF3, RawFrm, (outs), (ins), "rep", []>; // Repeat while not equal (used with CMPS and SCAS) @@ -2075,22 +2080,24 @@ def REPNE_PREFIX : I<0xF2, RawFrm, (outs), (ins), "re // String manipulation instructions let SchedRW = [WriteMicrocoded] in { -let Defs = [AL,ESI], Uses = [ESI,DF] in +// These uses the DF flag in the EFLAGS register to inc or dec EDI and ESI +let Defs = [AL,ESI], Uses = [ESI,EFLAGS] in def LODSB : I<0xAC, RawFrmSrc, (outs), (ins srcidx8:$src), "lodsb\t{$src, %al|al, $src}", [], IIC_LODS>; -let Defs = [AX,ESI], Uses = [ESI,DF] in +let Defs = [AX,ESI], Uses = [ESI,EFLAGS] in def LODSW : I<0xAD, RawFrmSrc, (outs), (ins srcidx16:$src), "lodsw\t{$src, %ax|ax, $src}", [], IIC_LODS>, OpSize16; -let Defs = [EAX,ESI], Uses = [ESI,DF] in +let Defs = [EAX,ESI], Uses = [ESI,EFLAGS] in def LODSL : I<0xAD, RawFrmSrc, (outs), (ins srcidx32:$src), "lods{l|d}\t{$src, %eax|eax, $src}", [], IIC_LODS>, OpSize32; -let Defs = [RAX,ESI], Uses = [ESI,DF] in +let Defs = [RAX,ESI], Uses = [ESI,EFLAGS] in def LODSQ : RI<0xAD, RawFrmSrc, (outs), (ins srcidx64:$src), "lodsq\t{$src, %rax|rax, $src}", [], IIC_LODS>; } let SchedRW = [WriteSystem] in { -let Defs = [ESI], Uses = [DX,ESI,DF] in { +// These uses the DF flag in the EFLAGS register to inc or dec EDI and ESI +let Defs = [ESI], Uses = [DX,ESI,EFLAGS] in { def OUTSB : I<0x6E, RawFrmSrc, (outs), (ins srcidx8:$src), "outsb\t{$src, %dx|dx, $src}", [], IIC_OUTS>; def OUTSW : I<0x6F, RawFrmSrc, (outs), (ins srcidx16:$src), @@ -2099,7 +2106,8 @@ def OUTSL : I<0x6F, RawFrmSrc, (outs), (ins srcidx32:$ "outs{l|d}\t{$src, %dx|dx, $src}", [], IIC_OUTS>, OpSize32; } -let Defs = [EDI], Uses = [DX,EDI,DF] in { +// These uses the DF flag in the EFLAGS register to inc or dec EDI and ESI +let Defs = [EDI], Uses = [DX,EDI,EFLAGS] in { def INSB : I<0x6C, RawFrmDst, (outs), (ins dstidx8:$dst), "insb\t{%dx, $dst|$dst, dx}", [], IIC_INS>; def INSW : I<0x6D, RawFrmDst, (outs), (ins dstidx16:$dst), @@ -2109,21 +2117,18 @@ def INSL : I<0x6D, RawFrmDst, (outs), (ins dstidx32:$d } } -// EFLAGS management instructions. -let SchedRW = [WriteALU], Defs = [EFLAGS], Uses = [EFLAGS] in { -def CLC : I<0xF8, RawFrm, (outs), (ins), "clc", [], IIC_CLC_CMC_STC>; -def STC : I<0xF9, RawFrm, (outs), (ins), "stc", [], IIC_CLC_CMC_STC>; -def CMC : I<0xF5, RawFrm, (outs), (ins), "cmc", [], IIC_CLC_CMC_STC>; -} - -// DF management instructions. -// FIXME: These are a bit more expensive than CLC and STC. We should consider -// adjusting their schedule bucket. -let SchedRW = [WriteALU], Defs = [DF] in { +// Flag instructions +let SchedRW = [WriteALU] in { +def CLC : I<0xF8, RawFrm, (outs), (ins), "clc", [], IIC_CLC>; +def STC : I<0xF9, RawFrm, (outs), (ins), "stc", [], IIC_STC>; +def CLI : I<0xFA, RawFrm, (outs), (ins), "cli", [], IIC_CLI>; +def STI : I<0xFB, RawFrm, (outs), (ins), "sti", [], IIC_STI>; def CLD : I<0xFC, RawFrm, (outs), (ins), "cld", [], IIC_CLD>; def STD : I<0xFD, RawFrm, (outs), (ins), "std", [], IIC_STD>; -} +def CMC : I<0xF5, RawFrm, (outs), (ins), "cmc", [], IIC_CMC>; +def CLTS : I<0x06, RawFrm, (outs), (ins), "clts", [], IIC_CLTS>, TB; +} // Table lookup instructions let Uses = [AL,EBX], Defs = [AL], hasSideEffects = 0, mayLoad = 1 in Modified: head/contrib/llvm/lib/Target/X86/X86InstrSystem.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86InstrSystem.td Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/Target/X86/X86InstrSystem.td Sat Apr 14 14:57:32 2018 (r332503) @@ -693,19 +693,6 @@ let Uses = [RAX, RBX, RCX, RDX], Defs = [RAX, RBX, RCX } // SchedRW //===----------------------------------------------------------------------===// -// TS flag control instruction. -let SchedRW = [WriteSystem] in { -def CLTS : I<0x06, RawFrm, (outs), (ins), "clts", [], IIC_CLTS>, TB; -} - -//===----------------------------------------------------------------------===// -// IF (inside EFLAGS) management instructions. -let SchedRW = [WriteSystem], Uses = [EFLAGS], Defs = [EFLAGS] in { -def CLI : I<0xFA, RawFrm, (outs), (ins), "cli", [], IIC_CLI>; -def STI : I<0xFB, RawFrm, (outs), (ins), "sti", [], IIC_STI>; -} - -//===----------------------------------------------------------------------===// // RDPID Instruction let SchedRW = [WriteSystem] in { def RDPID32 : I<0xC7, MRM7r, (outs GR32:$src), (ins), Modified: head/contrib/llvm/lib/Target/X86/X86RegisterInfo.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86RegisterInfo.td Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/Target/X86/X86RegisterInfo.td Sat Apr 14 14:57:32 2018 (r332503) @@ -251,19 +251,9 @@ def ST7 : X86Reg<"st(7)", 7>, DwarfRegNum<[40, 19, 18] // Floating-point status word def FPSW : X86Reg<"fpsw", 0>; -// Status flags register. -// -// Note that some flags that are commonly thought of as part of the status -// flags register are modeled separately. Typically this is due to instructions -// reading and updating those flags independently of all the others. We don't -// want to create false dependencies between these instructions and so we use -// a separate register to model them. +// Status flags register def EFLAGS : X86Reg<"flags", 0>; -// The direction flag. -def DF : X86Reg<"DF", 0>; - - // Segment registers def CS : X86Reg<"cs", 1>; def DS : X86Reg<"ds", 3>; @@ -504,10 +494,6 @@ def CCR : RegisterClass<"X86", [i32], 32, (add EFLAGS) let isAllocatable = 0; } def FPCCR : RegisterClass<"X86", [i16], 16, (add FPSW)> { - let CopyCost = -1; // Don't allow copying of status registers. - let isAllocatable = 0; -} -def DFCCR : RegisterClass<"X86", [i32], 32, (add DF)> { let CopyCost = -1; // Don't allow copying of status registers. let isAllocatable = 0; } Modified: head/contrib/llvm/lib/Target/X86/X86Schedule.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86Schedule.td Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/Target/X86/X86Schedule.td Sat Apr 14 14:57:32 2018 (r332503) @@ -608,10 +608,12 @@ def IIC_CMPXCHG_8B : InstrItinClass; def IIC_CMPXCHG_16B : InstrItinClass; def IIC_LODS : InstrItinClass; def IIC_OUTS : InstrItinClass; -def IIC_CLC_CMC_STC : InstrItinClass; +def IIC_CLC : InstrItinClass; def IIC_CLD : InstrItinClass; def IIC_CLI : InstrItinClass; +def IIC_CMC : InstrItinClass; def IIC_CLTS : InstrItinClass; +def IIC_STC : InstrItinClass; def IIC_STI : InstrItinClass; def IIC_STD : InstrItinClass; def IIC_XLAT : InstrItinClass; Modified: head/contrib/llvm/lib/Target/X86/X86ScheduleAtom.td ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86ScheduleAtom.td Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/Target/X86/X86ScheduleAtom.td Sat Apr 14 14:57:32 2018 (r332503) @@ -514,10 +514,12 @@ def AtomItineraries : ProcessorItineraries< InstrItinData] >, InstrItinData] >, InstrItinData] >, - InstrItinData] >, + InstrItinData] >, InstrItinData] >, InstrItinData] >, + InstrItinData] >, InstrItinData] >, + InstrItinData] >, InstrItinData] >, InstrItinData] >, InstrItinData] >, Modified: head/contrib/llvm/lib/Target/X86/X86TargetMachine.cpp ============================================================================== --- head/contrib/llvm/lib/Target/X86/X86TargetMachine.cpp Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/lib/Target/X86/X86TargetMachine.cpp Sat Apr 14 14:57:32 2018 (r332503) @@ -62,7 +62,6 @@ void initializeX86CallFrameOptimizationPass(PassRegist void initializeX86CmovConverterPassPass(PassRegistry &); void initializeX86ExecutionDepsFixPass(PassRegistry &); void initializeX86DomainReassignmentPass(PassRegistry &); -void initializeX86FlagsCopyLoweringPassPass(PassRegistry &); } // end namespace llvm @@ -81,7 +80,6 @@ extern "C" void LLVMInitializeX86Target() { initializeX86CmovConverterPassPass(PR); initializeX86ExecutionDepsFixPass(PR); initializeX86DomainReassignmentPass(PR); - initializeX86FlagsCopyLoweringPassPass(PR); } static std::unique_ptr createTLOF(const Triple &TT) { @@ -417,7 +415,6 @@ void X86PassConfig::addPreRegAlloc() { addPass(createX86CallFrameOptimization()); } - addPass(createX86FlagsCopyLoweringPass()); addPass(createX86WinAllocaExpander()); } void X86PassConfig::addMachineSSAOptimization() { Modified: head/contrib/llvm/tools/clang/include/clang/Driver/Options.td ============================================================================== --- head/contrib/llvm/tools/clang/include/clang/Driver/Options.td Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/tools/clang/include/clang/Driver/Options.td Sat Apr 14 14:57:32 2018 (r332503) @@ -2559,8 +2559,6 @@ def mrtm : Flag<["-"], "mrtm">, Group, Group; def mrdseed : Flag<["-"], "mrdseed">, Group; def mno_rdseed : Flag<["-"], "mno-rdseed">, Group; -def msahf : Flag<["-"], "msahf">, Group; -def mno_sahf : Flag<["-"], "mno-sahf">, Group; def msgx : Flag<["-"], "msgx">, Group; def mno_sgx : Flag<["-"], "mno-sgx">, Group; def msha : Flag<["-"], "msha">, Group; Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.cpp Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.cpp Sat Apr 14 14:57:32 2018 (r332503) @@ -198,7 +198,6 @@ bool X86TargetInfo::initFeatureMap( LLVM_FALLTHROUGH; case CK_Core2: setFeatureEnabledImpl(Features, "ssse3", true); - setFeatureEnabledImpl(Features, "sahf", true); LLVM_FALLTHROUGH; case CK_Yonah: case CK_Prescott: @@ -240,7 +239,6 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabledImpl(Features, "ssse3", true); setFeatureEnabledImpl(Features, "fxsr", true); setFeatureEnabledImpl(Features, "cx16", true); - setFeatureEnabledImpl(Features, "sahf", true); break; case CK_KNM: @@ -271,7 +269,6 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabledImpl(Features, "xsaveopt", true); setFeatureEnabledImpl(Features, "xsave", true); setFeatureEnabledImpl(Features, "movbe", true); - setFeatureEnabledImpl(Features, "sahf", true); break; case CK_K6_2: @@ -285,7 +282,6 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabledImpl(Features, "sse4a", true); setFeatureEnabledImpl(Features, "lzcnt", true); setFeatureEnabledImpl(Features, "popcnt", true); - setFeatureEnabledImpl(Features, "sahf", true); LLVM_FALLTHROUGH; case CK_K8SSE3: setFeatureEnabledImpl(Features, "sse3", true); @@ -319,7 +315,6 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabledImpl(Features, "prfchw", true); setFeatureEnabledImpl(Features, "cx16", true); setFeatureEnabledImpl(Features, "fxsr", true); - setFeatureEnabledImpl(Features, "sahf", true); break; case CK_ZNVER1: @@ -343,7 +338,6 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabledImpl(Features, "prfchw", true); setFeatureEnabledImpl(Features, "rdrnd", true); setFeatureEnabledImpl(Features, "rdseed", true); - setFeatureEnabledImpl(Features, "sahf", true); setFeatureEnabledImpl(Features, "sha", true); setFeatureEnabledImpl(Features, "sse4a", true); setFeatureEnabledImpl(Features, "xsave", true); @@ -378,7 +372,6 @@ bool X86TargetInfo::initFeatureMap( setFeatureEnabledImpl(Features, "cx16", true); setFeatureEnabledImpl(Features, "fxsr", true); setFeatureEnabledImpl(Features, "xsave", true); - setFeatureEnabledImpl(Features, "sahf", true); break; } if (!TargetInfo::initFeatureMap(Features, Diags, CPU, FeaturesVec)) @@ -775,8 +768,6 @@ bool X86TargetInfo::handleTargetFeatures(std::vector(Feature) @@ -1249,7 +1240,6 @@ bool X86TargetInfo::isValidFeatureName(StringRef Name) .Case("rdrnd", true) .Case("rdseed", true) .Case("rtm", true) - .Case("sahf", true) .Case("sgx", true) .Case("sha", true) .Case("shstk", true) @@ -1323,7 +1313,6 @@ bool X86TargetInfo::hasFeature(StringRef Feature) cons .Case("retpoline", HasRetpoline) .Case("retpoline-external-thunk", HasRetpolineExternalThunk) .Case("rtm", HasRTM) - .Case("sahf", HasLAHFSAHF) .Case("sgx", HasSGX) .Case("sha", HasSHA) .Case("shstk", HasSHSTK) Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.h ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.h Sat Apr 14 12:52:34 2018 (r332502) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets/X86.h Sat Apr 14 14:57:32 2018 (r332503) @@ -98,7 +98,6 @@ class LLVM_LIBRARY_VISIBILITY X86TargetInfo : public T bool HasPREFETCHWT1 = false; bool HasRetpoline = false; bool HasRetpolineExternalThunk = false; - bool HasLAHFSAHF = false; /// \brief Enumeration of all of the X86 CPUs supported by Clang. /// Modified: head/lib/clang/freebsd_cc_version.h ============================================================================== --- head/lib/clang/freebsd_cc_version.h Sat Apr 14 12:52:34 2018 (r332502) +++ head/lib/clang/freebsd_cc_version.h Sat Apr 14 14:57:32 2018 (r332503) @@ -1,3 +1,3 @@ /* $FreeBSD$ */ -#define FREEBSD_CC_VERSION 1200012 +#define FREEBSD_CC_VERSION 1200013 Modified: head/lib/clang/libllvm/Makefile ============================================================================== --- head/lib/clang/libllvm/Makefile Sat Apr 14 12:52:34 2018 (r332502) +++ head/lib/clang/libllvm/Makefile Sat Apr 14 14:57:32 2018 (r332503) @@ -1042,7 +1042,6 @@ SRCS_MIN+= Target/X86/X86FastISel.cpp SRCS_MIN+= Target/X86/X86FixupBWInsts.cpp SRCS_MIN+= Target/X86/X86FixupLEAs.cpp SRCS_MIN+= Target/X86/X86FixupSetCC.cpp -SRCS_MIN+= Target/X86/X86FlagsCopyLowering.cpp SRCS_MIN+= Target/X86/X86FloatingPoint.cpp SRCS_MIN+= Target/X86/X86FrameLowering.cpp SRCS_MIN+= Target/X86/X86ISelDAGToDAG.cpp From owner-svn-src-head@freebsd.org Sat Apr 14 15:10:41 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D7DA0F80D04; Sat, 14 Apr 2018 15:10:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [87.251.56.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "COMODO RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7138D71C44; Sat, 14 Apr 2018 15:10:41 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from coleburn.home.andric.com (coleburn.home.andric.com [192.168.0.15]) (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 A6AD551082; Sat, 14 Apr 2018 17:03:15 +0200 (CEST) From: Dimitry Andric Message-Id: <90F6B862-D4D3-41CB-85C3-7FA40D83465C@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_9DCC695B-34DC-4001-9395-BF31D97C775B"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 10.3 \(3273\)) Subject: Re: svn commit: r332501 - in head: contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/CodeGen contrib/llvm/lib/Target/X86 contrib/llvm/lib/Target/X86/Disassembler contrib/llvm/tools/clang/include/clang... Date: Sat, 14 Apr 2018 17:03:14 +0200 In-Reply-To: Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org To: "Jonathan T. Looney" References: <201804141207.w3EC75cj023620@repo.freebsd.org> X-Mailer: Apple Mail (2.3273) X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 14 Apr 2018 15:10:42 -0000 --Apple-Mail=_9DCC695B-34DC-4001-9395-BF31D97C775B Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii On 14 Apr 2018, at 16:44, Jonathan T. Looney wrote: > > On Sat, Apr 14, 2018 at 8:07 AM, Dimitry Andric wrote: > Author: dim > Date: Sat Apr 14 12:07:05 2018 > New Revision: 332501 > URL: https://svnweb.freebsd.org/changeset/base/332501 > > Log: > Pull in r325446 from upstream clang trunk (by me): > > [X86] Add 'sahf' CPU feature to frontend > > Pull in r328944 from upstream llvm trunk (by Chandler Carruth): > > [x86] Expose more of the condition conversion routines in the public > API for X86's instruction information. I've now got a second patch > under review that needs these same APIs. This bit is nicely > orthogonal and obvious, so landing it. NFC. > > Pull in r329414 from upstream llvm trunk (by Craig Topper): > > [X86] Merge itineraries for CLC, CMC, and STC. > > Pull in r329673 from upstream llvm trunk (by Chandler Carruth): > > [x86] Model the direction flag (DF) separately from the rest of > EFLAGS. > > > > > Thanks so much for doing this! Unfortunately I had to revert it, as it caused buildworld failures on i386. :-/ It has been reported upstream for further investigation. -Dimitry --Apple-Mail=_9DCC695B-34DC-4001-9395-BF31D97C775B 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 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCWtIYMgAKCRCwXqMKLiCW o8heAKCk5XrRSoOsqJE40M1wvb4oHxTunwCgnEk5FrWUF4jBupc5sO9ZImMtRZQ= =WGIo -----END PGP SIGNATURE----- --Apple-Mail=_9DCC695B-34DC-4001-9395-BF31D97C775B-- From owner-svn-src-head@freebsd.org Sat Apr 14 17:33:17 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id B480AF8B98C; Sat, 14 Apr 2018 17:33:17 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 657528EF4A; Sat, 14 Apr 2018 17:33:17 +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 5FEF32B46E; Sat, 14 Apr 2018 17:33:17 +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 w3EHXH0D090267; Sat, 14 Apr 2018 17:33:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3EHXHNd090266; Sat, 14 Apr 2018 17:33:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201804141733.w3EHXHNd090266@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 14 Apr 2018 17:33:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332504 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 332504 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 14 Apr 2018 17:33:17 -0000 Author: kib Date: Sat Apr 14 17:33:16 2018 New Revision: 332504 URL: https://svnweb.freebsd.org/changeset/base/332504 Log: Set PG_G global mapping bit on the trampoline ptes. Trampoline mappings are better treated as global since they are valid in all address spaces, even for PTI. pmap_invalidate_range() must work on global mappings for pti since kernel_pmap invalidations are really same as for non-PTI. Reviewed by: alc, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 1 month Differential revision: https://reviews.freebsd.org/D15052 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Sat Apr 14 14:57:32 2018 (r332503) +++ head/sys/amd64/amd64/pmap.c Sat Apr 14 17:33:16 2018 (r332504) @@ -8000,7 +8000,7 @@ pmap_pti_add_kva_locked(vm_offset_t sva, vm_offset_t e for (; sva < eva; sva += PAGE_SIZE) { pte = pmap_pti_pte(sva, &unwire_pde); pa = pmap_kextract(sva); - ptev = pa | X86_PG_RW | X86_PG_V | X86_PG_A | + ptev = pa | X86_PG_RW | X86_PG_V | X86_PG_A | X86_PG_G | (exec ? 0 : pg_nx) | pmap_cache_bits(kernel_pmap, VM_MEMATTR_DEFAULT, FALSE); if (*pte == 0) { From owner-svn-src-head@freebsd.org Sat Apr 14 17:38:51 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id E1A0DF8BF07; Sat, 14 Apr 2018 17:38:50 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: from mail-wr0-f170.google.com (mail-wr0-f170.google.com [209.85.128.170]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 5D4FD690AC; Sat, 14 Apr 2018 17:38:50 +0000 (UTC) (envelope-from jonlooney@gmail.com) Received: by mail-wr0-f170.google.com with SMTP id q6so3418641wrd.6; Sat, 14 Apr 2018 10:38:50 -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:in-reply-to:references:from:date :message-id:subject:to:cc; bh=fGCUmt8PU6f4Yz6zfuAqm0cUhDtBYGD62lB2DzR+j3w=; b=VnB4BBcNPu/BnzQGe7G96UMuS02qs/MgIBlc2jvTgzThh0uy8W9cMaD/FehnB+Fm5w eIwf04EAFdi5ODTKUwGQF7urFCUmLw4Qqdcu5tKyPnI+i6YLHu2vycOboIvibEW5aygF 2W68jjnLye7dP+PSdG46HGTYKs9fvkRGm21lFKqLuCXP5UOzu+chNtpwE8/MaGRZ61eo dK50ecGS/Qou0ZVaFT1OZLY8KMPi8ajGElebdYWc1x52gejxlPT6qABEHjCE02fzUYse q4X4pSbOFDwy3niGdp9Kkm4SNmLIbCe/eRJ7bhzHk9rnB39vYAKa5Cu/LSSYltRpYX0l E1HQ== X-Gm-Message-State: ALQs6tBrs078lZEWhOqmu0M2w3u5rbHQcZ82iwL9cK13LQSZIkD/asKi Jsnsnr6bKl37itNy9f5cBNUiIGbp X-Google-Smtp-Source: AIpwx495ufcLJfTwfM0+YuseptfwtwGKWYiRWX8W1DNHOFEIlH+XcLowUEem3hGNVDfWXsQZqCIIWQ== X-Received: by 10.80.135.68 with SMTP id 4mr25434843edv.11.1523727528872; Sat, 14 Apr 2018 10:38:48 -0700 (PDT) Received: from mail-wr0-f176.google.com (mail-wr0-f176.google.com. [209.85.128.176]) by smtp.gmail.com with ESMTPSA id i8sm4617590edj.3.2018.04.14.10.38.48 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 14 Apr 2018 10:38:48 -0700 (PDT) Received: by mail-wr0-f176.google.com with SMTP id d19so15501771wre.1; Sat, 14 Apr 2018 10:38:48 -0700 (PDT) X-Received: by 10.28.141.138 with SMTP id p132mr6870736wmd.51.1523727528541; Sat, 14 Apr 2018 10:38:48 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.199.203 with HTTP; Sat, 14 Apr 2018 10:38:48 -0700 (PDT) In-Reply-To: <90F6B862-D4D3-41CB-85C3-7FA40D83465C@FreeBSD.org> References: <201804141207.w3EC75cj023620@repo.freebsd.org> <90F6B862-D4D3-41CB-85C3-7FA40D83465C@FreeBSD.org> From: "Jonathan T. Looney" Date: Sat, 14 Apr 2018 13:38:48 -0400 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r332501 - in head: contrib/llvm/include/llvm/CodeGen contrib/llvm/lib/CodeGen contrib/llvm/lib/Target/X86 contrib/llvm/lib/Target/X86/Disassembler contrib/llvm/tools/clang/include/clang... To: Dimitry Andric Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.25 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 14 Apr 2018 17:38:51 -0000 On Sat, Apr 14, 2018 at 11:03 AM, Dimitry Andric wrote: > > Unfortunately I had to revert it, as it caused buildworld failures on > i386. :-/ It has been reported upstream for further investigation. :-( Any chance we can at least get r325446 (-msahf), since that gives us a way to workaround the problem? I'm sorry about the extra work... Jonathan From owner-svn-src-head@freebsd.org Sat Apr 14 19:07:58 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id D0C4FF920AD; Sat, 14 Apr 2018 19:07:57 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 7F9F17CDB1; Sat, 14 Apr 2018 19:07:57 +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 6D42C2C2A8; Sat, 14 Apr 2018 19:07:57 +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 w3EJ7v1V035133; Sat, 14 Apr 2018 19:07:57 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3EJ7uO4035120; Sat, 14 Apr 2018 19:07:56 GMT (envelope-from np@FreeBSD.org) Message-Id: <201804141907.w3EJ7uO4035120@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Sat, 14 Apr 2018 19:07:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332506 - in head: sys/dev/cxgbe sys/dev/cxgbe/tom usr.sbin/cxgbetool X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head: sys/dev/cxgbe sys/dev/cxgbe/tom usr.sbin/cxgbetool X-SVN-Commit-Revision: 332506 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 14 Apr 2018 19:07:58 -0000 Author: np Date: Sat Apr 14 19:07:56 2018 New Revision: 332506 URL: https://svnweb.freebsd.org/changeset/base/332506 Log: cxgbe(4): Add support for Connection Offload Policy (aka COP). COP allows fine-grained control on whether to offload a TCP connection using t4_tom, and what settings to apply to a connection selected for offload. t4_tom must still be loaded and IFCAP_TOE must still be enabled for full TCP offload to take place on an interface. The difference is that IFCAP_TOE used to be the only knob and would enable TOE for all new connections on the inteface, but now the driver will also consult the COP, if any, before offloading to the hardware TOE. A policy is a plain text file with any number of rules, one per line. Each rule has a "match" part consisting of a socket-type (L = listen, A = active open, P = passive open, D = don't care) and a pcap-filter(7) expression, and a "settings" part that specifies whether to offload the connection or not and the parameters to use if so. The general format of a rule is: [socket-type] expr => settings Example. See cxgbetool(8) for more information. [L] ip && port http => offload [L] port 443 => !offload [L] port ssh => offload [P] src net 192.168/16 && dst port ssh => offload !nagle !timestamp cong newreno [P] dst port ssh => offload !nagle ecn cong tahoe [P] dst port http => offload [A] dst port 443 => offload tls [A] dst net 192.168/16 => offload !timestamp cong highspeed The driver processes the rules for each new listen, active open, or passive open and stops at the first match. There is an implicit rule at the end of every policy that prohibits offload when no rule in the policy matches: [D] all => !offload This is a reworked and expanded version of a patch submitted by Krishnamraju Eraparaju @ Chelsio. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/t4_ioctl.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sge.c head/sys/dev/cxgbe/tom/t4_connect.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_listen.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h head/usr.sbin/cxgbetool/Makefile head/usr.sbin/cxgbetool/cxgbetool.8 head/usr.sbin/cxgbetool/cxgbetool.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Sat Apr 14 17:41:54 2018 (r332505) +++ head/sys/dev/cxgbe/adapter.h Sat Apr 14 19:07:56 2018 (r332506) @@ -804,8 +804,11 @@ struct adapter { void *tom_softc; /* (struct tom_data *) */ struct tom_tunables tt; - struct iw_tunables iwt; + struct t4_offload_policy *policy; + struct rwlock policy_lock; + void *iwarp_softc; /* (struct c4iw_dev *) */ + struct iw_tunables iwt; void *iscsi_ulp_softc; /* (struct cxgbei_data *) */ void *ccr_softc; /* (struct ccr_softc *) */ struct l2t_data *l2t; /* L2 table */ Modified: head/sys/dev/cxgbe/offload.h ============================================================================== --- head/sys/dev/cxgbe/offload.h Sat Apr 14 17:41:54 2018 (r332505) +++ head/sys/dev/cxgbe/offload.h Sat Apr 14 19:07:56 2018 (r332506) @@ -156,6 +156,7 @@ struct tom_tunables { int num_tls_rx_ports; int tx_align; int tx_zcopy; + int cop_managed_offloading; }; /* iWARP driver tunables */ struct iw_tunables { Modified: head/sys/dev/cxgbe/t4_ioctl.h ============================================================================== --- head/sys/dev/cxgbe/t4_ioctl.h Sat Apr 14 17:41:54 2018 (r332505) +++ head/sys/dev/cxgbe/t4_ioctl.h Sat Apr 14 19:07:56 2018 (r332506) @@ -35,6 +35,7 @@ #include #include +#include /* * Ioctl commands specific to this driver. @@ -344,6 +345,44 @@ struct t4_cudbg_dump { uint8_t *data; }; +enum { + OPEN_TYPE_LISTEN = 'L', + OPEN_TYPE_ACTIVE = 'A', + OPEN_TYPE_PASSIVE = 'P', + OPEN_TYPE_DONTCARE = 'D', +}; + +struct offload_settings { + int8_t offload; + int8_t rx_coalesce; + int8_t cong_algo; + int8_t sched_class; + int8_t tstamp; + int8_t sack; + int8_t nagle; + int8_t ecn; + int8_t ddp; + int8_t tls; + int16_t txq; + int16_t rxq; + int16_t mss; +}; + +struct offload_rule { + char open_type; + struct offload_settings settings; + struct bpf_program bpf_prog; /* compiled program/filter */ +}; + +/* + * An offload policy consists of a set of rules matched in sequence. The + * settings of the first rule that matches are applied to that connection. + */ +struct t4_offload_policy { + uint32_t nrules; + struct offload_rule *rule; +}; + #define CHELSIO_T4_GETREG _IOWR('f', T4_GETREG, struct t4_reg) #define CHELSIO_T4_SETREG _IOW('f', T4_SETREG, struct t4_reg) #define CHELSIO_T4_REGDUMP _IOWR('f', T4_REGDUMP, struct t4_regdump) @@ -368,4 +407,5 @@ struct t4_cudbg_dump { #define CHELSIO_T4_LOAD_BOOT _IOW('f', T4_LOAD_BOOT, struct t4_bootrom) #define CHELSIO_T4_LOAD_BOOTCFG _IOW('f', T4_LOAD_BOOTCFG, struct t4_data) #define CHELSIO_T4_CUDBG_DUMP _IOWR('f', T4_CUDBG_DUMP, struct t4_cudbg_dump) +#define CHELSIO_T4_SET_OFLD_POLICY _IOW('f', T4_SET_OFLD_POLICY, struct t4_offload_policy) #endif Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Sat Apr 14 17:41:54 2018 (r332505) +++ head/sys/dev/cxgbe/t4_main.c Sat Apr 14 19:07:56 2018 (r332506) @@ -470,6 +470,14 @@ static int pcie_relaxed_ordering = -1; TUNABLE_INT("hw.cxgbe.pcie_relaxed_ordering", &pcie_relaxed_ordering); +#ifdef TCP_OFFLOAD +/* + * TOE tunables. + */ +static int t4_cop_managed_offloading = 0; +TUNABLE_INT("hw.cxgbe.cop_managed_offloading", &t4_cop_managed_offloading); +#endif + /* Functions used by VIs to obtain unique MAC addresses for each VI. */ static int vi_mac_funcs[] = { FW_VI_FUNC_ETH, @@ -617,6 +625,8 @@ static int load_cfg(struct adapter *, struct t4_data * static int load_boot(struct adapter *, struct t4_bootrom *); static int load_bootcfg(struct adapter *, struct t4_data *); static int cudbg_dump(struct adapter *, struct t4_cudbg_dump *); +static void free_offload_policy(struct t4_offload_policy *); +static int set_offload_policy(struct adapter *, struct t4_offload_policy *); static int read_card_mem(struct adapter *, int, struct t4_mem_range *); static int read_i2c(struct adapter *, struct t4_i2c_data *); #ifdef TCP_OFFLOAD @@ -897,6 +907,9 @@ t4_attach(device_t dev) mtx_init(&sc->reg_lock, "indirect register access", 0, MTX_DEF); + sc->policy = NULL; + rw_init(&sc->policy_lock, "connection offload policy"); + rc = t4_map_bars_0_and_4(sc); if (rc != 0) goto done; /* error message displayed already */ @@ -1405,6 +1418,14 @@ t4_detach_common(device_t dev) if (mtx_initialized(&sc->reg_lock)) mtx_destroy(&sc->reg_lock); + if (rw_initialized(&sc->policy_lock)) { + rw_destroy(&sc->policy_lock); +#ifdef TCP_OFFLOAD + if (sc->policy != NULL) + free_offload_policy(sc->policy); +#endif + } + for (i = 0; i < NUM_MEMWIN; i++) { struct memwin *mw = &sc->memwin[i]; @@ -5440,6 +5461,12 @@ t4_sysctls(struct adapter *sc) CTLFLAG_RW, &sc->tt.tx_zcopy, 0, "Enable zero-copy aio_write(2)"); + sc->tt.cop_managed_offloading = !!t4_cop_managed_offloading; + SYSCTL_ADD_INT(ctx, children, OID_AUTO, + "cop_managed_offloading", CTLFLAG_RW, + &sc->tt.cop_managed_offloading, 0, + "COP (Connection Offload Policy) controls all TOE offload"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "timer_tick", CTLTYPE_STRING | CTLFLAG_RD, sc, 0, sysctl_tp_tick, "A", "TP timer tick (us)"); @@ -9385,6 +9412,113 @@ done: return (rc); } +static void +free_offload_policy(struct t4_offload_policy *op) +{ + struct offload_rule *r; + int i; + + if (op == NULL) + return; + + r = &op->rule[0]; + for (i = 0; i < op->nrules; i++, r++) { + free(r->bpf_prog.bf_insns, M_CXGBE); + } + free(op->rule, M_CXGBE); + free(op, M_CXGBE); +} + +static int +set_offload_policy(struct adapter *sc, struct t4_offload_policy *uop) +{ + int i, rc, len; + struct t4_offload_policy *op, *old; + struct bpf_program *bf; + const struct offload_settings *s; + struct offload_rule *r; + void *u; + + if (!is_offload(sc)) + return (ENODEV); + + if (uop->nrules == 0) { + /* Delete installed policies. */ + op = NULL; + goto set_policy; + } if (uop->nrules > 256) { /* arbitrary */ + return (E2BIG); + } + + /* Copy userspace offload policy to kernel */ + op = malloc(sizeof(*op), M_CXGBE, M_ZERO | M_WAITOK); + op->nrules = uop->nrules; + len = op->nrules * sizeof(struct offload_rule); + op->rule = malloc(len, M_CXGBE, M_ZERO | M_WAITOK); + rc = copyin(uop->rule, op->rule, len); + if (rc) { + free(op->rule, M_CXGBE); + free(op, M_CXGBE); + return (rc); + } + + r = &op->rule[0]; + for (i = 0; i < op->nrules; i++, r++) { + + /* Validate open_type */ + if (r->open_type != OPEN_TYPE_LISTEN && + r->open_type != OPEN_TYPE_ACTIVE && + r->open_type != OPEN_TYPE_PASSIVE && + r->open_type != OPEN_TYPE_DONTCARE) { +error: + /* + * Rules 0 to i have malloc'd filters that need to be + * freed. Rules i+1 to nrules have userspace pointers + * and should be left alone. + */ + op->nrules = i; + free_offload_policy(op); + return (rc); + } + + /* Validate settings */ + s = &r->settings; + if ((s->offload != 0 && s->offload != 1) || + s->cong_algo < -1 || s->cong_algo > CONG_ALG_HIGHSPEED || + s->sched_class < -1 || + s->sched_class >= sc->chip_params->nsched_cls) { + rc = EINVAL; + goto error; + } + + bf = &r->bpf_prog; + u = bf->bf_insns; /* userspace ptr */ + bf->bf_insns = NULL; + if (bf->bf_len == 0) { + /* legal, matches everything */ + continue; + } + len = bf->bf_len * sizeof(*bf->bf_insns); + bf->bf_insns = malloc(len, M_CXGBE, M_ZERO | M_WAITOK); + rc = copyin(u, bf->bf_insns, len); + if (rc != 0) + goto error; + + if (!bpf_validate(bf->bf_insns, bf->bf_len)) { + rc = EINVAL; + goto error; + } + } +set_policy: + rw_wlock(&sc->policy_lock); + old = sc->policy; + sc->policy = op; + rw_wunlock(&sc->policy_lock); + free_offload_policy(old); + + return (0); +} + #define MAX_READ_BUF_SIZE (128 * 1024) static int read_card_mem(struct adapter *sc, int win, struct t4_mem_range *mr) @@ -9742,6 +9876,9 @@ t4_ioctl(struct cdev *dev, unsigned long cmd, caddr_t break; case CHELSIO_T4_CUDBG_DUMP: rc = cudbg_dump(sc, (struct t4_cudbg_dump *)data); + break; + case CHELSIO_T4_SET_OFLD_POLICY: + rc = set_offload_policy(sc, (struct t4_offload_policy *)data); break; default: rc = ENOTTY; Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Sat Apr 14 17:41:54 2018 (r332505) +++ head/sys/dev/cxgbe/t4_sge.c Sat Apr 14 19:07:56 2018 (r332506) @@ -963,8 +963,10 @@ mtu_to_max_payload(struct adapter *sc, int mtu, const #ifdef TCP_OFFLOAD if (toe) { - payload = sc->tt.rx_coalesce ? - G_RXCOALESCESIZE(t4_read_reg(sc, A_TP_PARA_REG2)) : mtu; + int rxcs = G_RXCOALESCESIZE(t4_read_reg(sc, A_TP_PARA_REG2)); + + /* Note that COP can set rx_coalesce on/off per connection. */ + payload = max(mtu, rxcs); } else { #endif /* large enough even when hw VLAN extraction is disabled */ Modified: head/sys/dev/cxgbe/tom/t4_connect.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_connect.c Sat Apr 14 17:41:54 2018 (r332505) +++ head/sys/dev/cxgbe/tom/t4_connect.c Sat Apr 14 19:07:56 2018 (r332506) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -55,6 +56,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "common/common.h" #include "common/t4_msg.h" @@ -233,47 +235,85 @@ do_act_open_rpl(struct sge_iq *iq, const struct rss_he * Options2 for active open. */ static uint32_t -calc_opt2a(struct socket *so, struct toepcb *toep) +calc_opt2a(struct socket *so, struct toepcb *toep, + const struct offload_settings *s) { struct tcpcb *tp = so_sototcpcb(so); struct port_info *pi = toep->vi->pi; struct adapter *sc = pi->adapter; - uint32_t opt2; + uint32_t opt2 = 0; - opt2 = V_TX_QUEUE(sc->params.tp.tx_modq[pi->tx_chan]) | - F_RSS_QUEUE_VALID | V_RSS_QUEUE(toep->ofld_rxq->iq.abs_id); + /* + * rx flow control, rx coalesce, congestion control, and tx pace are all + * explicitly set by the driver. On T5+ the ISS is also set by the + * driver to the value picked by the kernel. + */ + if (is_t4(sc)) { + opt2 |= F_RX_FC_VALID | F_RX_COALESCE_VALID; + opt2 |= F_CONG_CNTRL_VALID | F_PACE_VALID; + } else { + opt2 |= F_T5_OPT_2_VALID; /* all 4 valid */ + opt2 |= F_T5_ISS; /* ISS provided in CPL */ + } - if (tp->t_flags & TF_SACK_PERMIT) + if (s->sack > 0 || (s->sack < 0 && (tp->t_flags & TF_SACK_PERMIT))) opt2 |= F_SACK_EN; - if (tp->t_flags & TF_REQ_TSTMP) + if (s->tstamp > 0 || (s->tstamp < 0 && (tp->t_flags & TF_REQ_TSTMP))) opt2 |= F_TSTAMPS_EN; if (tp->t_flags & TF_REQ_SCALE) opt2 |= F_WND_SCALE_EN; - if (V_tcp_do_ecn) + if (s->ecn > 0 || (s->ecn < 0 && V_tcp_do_ecn == 1)) opt2 |= F_CCTRL_ECN; - /* RX_COALESCE is always a valid value (M_RX_COALESCE). */ - if (is_t4(sc)) - opt2 |= F_RX_COALESCE_VALID; + /* XXX: F_RX_CHANNEL for multiple rx c-chan support goes here. */ + + opt2 |= V_TX_QUEUE(sc->params.tp.tx_modq[pi->tx_chan]); + + /* These defaults are subject to ULP specific fixups later. */ + opt2 |= V_RX_FC_DDP(0) | V_RX_FC_DISABLE(0); + + opt2 |= V_PACE(0); + + if (s->cong_algo >= 0) + opt2 |= V_CONG_CNTRL(s->cong_algo); + else if (sc->tt.cong_algorithm >= 0) + opt2 |= V_CONG_CNTRL(sc->tt.cong_algorithm & M_CONG_CNTRL); else { - opt2 |= F_T5_OPT_2_VALID; - opt2 |= F_T5_ISS; + struct cc_algo *cc = CC_ALGO(tp); + + if (strcasecmp(cc->name, "reno") == 0) + opt2 |= V_CONG_CNTRL(CONG_ALG_RENO); + else if (strcasecmp(cc->name, "tahoe") == 0) + opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); + if (strcasecmp(cc->name, "newreno") == 0) + opt2 |= V_CONG_CNTRL(CONG_ALG_NEWRENO); + if (strcasecmp(cc->name, "highspeed") == 0) + opt2 |= V_CONG_CNTRL(CONG_ALG_HIGHSPEED); + else { + /* + * Use newreno in case the algorithm selected by the + * host stack is not supported by the hardware. + */ + opt2 |= V_CONG_CNTRL(CONG_ALG_NEWRENO); + } } - if (sc->tt.rx_coalesce) + + if (s->rx_coalesce > 0 || (s->rx_coalesce < 0 && sc->tt.rx_coalesce)) opt2 |= V_RX_COALESCE(M_RX_COALESCE); - if (sc->tt.cong_algorithm != -1) - opt2 |= V_CONG_CNTRL(sc->tt.cong_algorithm & M_CONG_CNTRL); + /* Note that ofld_rxq is already set according to s->rxq. */ + opt2 |= F_RSS_QUEUE_VALID; + opt2 |= V_RSS_QUEUE(toep->ofld_rxq->iq.abs_id); #ifdef USE_DDP_RX_FLOW_CONTROL if (toep->ulp_mode == ULP_MODE_TCPDDP) - opt2 |= F_RX_FC_VALID | F_RX_FC_DDP; + opt2 |= F_RX_FC_DDP; #endif + if (toep->ulp_mode == ULP_MODE_TLS) { - opt2 |= F_RX_FC_VALID; opt2 &= ~V_RX_COALESCE(M_RX_COALESCE); opt2 |= F_RX_FC_DISABLE; } @@ -348,10 +388,12 @@ t4_connect(struct toedev *tod, struct socket *so, stru struct wrqe *wr = NULL; struct ifnet *rt_ifp = rt->rt_ifp; struct vi_info *vi; - int mtu_idx, rscale, qid_atid, rc, isipv6; + int mtu_idx, rscale, qid_atid, rc, isipv6, txqid, rxqid; struct inpcb *inp = sotoinpcb(so); struct tcpcb *tp = intotcpcb(inp); int reason; + struct offload_settings settings; + uint16_t vid = 0xffff; INP_WLOCK_ASSERT(inp); KASSERT(nam->sa_family == AF_INET || nam->sa_family == AF_INET6, @@ -363,12 +405,30 @@ t4_connect(struct toedev *tod, struct socket *so, stru struct ifnet *ifp = VLAN_COOKIE(rt_ifp); vi = ifp->if_softc; + VLAN_TAG(ifp, &vid); } else if (rt_ifp->if_type == IFT_IEEE8023ADLAG) DONT_OFFLOAD_ACTIVE_OPEN(ENOSYS); /* XXX: implement lagg+TOE */ else DONT_OFFLOAD_ACTIVE_OPEN(ENOTSUP); - toep = alloc_toepcb(vi, -1, -1, M_NOWAIT | M_ZERO); + rw_rlock(&sc->policy_lock); + settings = *lookup_offload_policy(sc, OPEN_TYPE_ACTIVE, NULL, vid, inp); + rw_runlock(&sc->policy_lock); + if (!settings.offload) + DONT_OFFLOAD_ACTIVE_OPEN(EPERM); + + if (settings.txq >= 0 && settings.txq < vi->nofldtxq) + txqid = settings.txq; + else + txqid = arc4random() % vi->nofldtxq; + txqid += vi->first_ofld_txq; + if (settings.rxq >= 0 && settings.rxq < vi->nofldrxq) + rxqid = settings.rxq; + else + rxqid = arc4random() % vi->nofldrxq; + rxqid += vi->first_ofld_rxq; + + toep = alloc_toepcb(vi, txqid, rxqid, M_NOWAIT | M_ZERO); if (toep == NULL) DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM); @@ -387,7 +447,7 @@ t4_connect(struct toedev *tod, struct socket *so, stru DONT_OFFLOAD_ACTIVE_OPEN(ENOMEM); toep->vnet = so->so_vnet; - set_ulp_mode(toep, select_ulp_mode(so, sc)); + set_ulp_mode(toep, select_ulp_mode(so, sc, &settings)); SOCKBUF_LOCK(&so->so_rcv); /* opt0 rcv_bufsiz initially, assumes its normal meaning later */ toep->rx_credits = min(select_rcv_wnd(so) >> 10, M_RCV_BUFSIZ); @@ -402,7 +462,7 @@ t4_connect(struct toedev *tod, struct socket *so, stru rscale = tp->request_r_scale = select_rcv_wscale(); else rscale = 0; - mtu_idx = find_best_mtu_idx(sc, &inp->inp_inc, 0); + mtu_idx = find_best_mtu_idx(sc, &inp->inp_inc, &settings); qid_atid = (toep->ofld_rxq->iq.abs_id << 14) | toep->tid; if (isipv6) { @@ -443,8 +503,8 @@ t4_connect(struct toedev *tod, struct socket *so, stru cpl->peer_ip_hi = *(uint64_t *)&inp->in6p_faddr.s6_addr[0]; cpl->peer_ip_lo = *(uint64_t *)&inp->in6p_faddr.s6_addr[8]; cpl->opt0 = calc_opt0(so, vi, toep->l2te, mtu_idx, rscale, - toep->rx_credits, toep->ulp_mode); - cpl->opt2 = calc_opt2a(so, toep); + toep->rx_credits, toep->ulp_mode, &settings); + cpl->opt2 = calc_opt2a(so, toep, &settings); } else { struct cpl_act_open_req *cpl = wrtod(wr); struct cpl_t5_act_open_req *cpl5 = (void *)cpl; @@ -472,8 +532,8 @@ t4_connect(struct toedev *tod, struct socket *so, stru inp_4tuple_get(inp, &cpl->local_ip, &cpl->local_port, &cpl->peer_ip, &cpl->peer_port); cpl->opt0 = calc_opt0(so, vi, toep->l2te, mtu_idx, rscale, - toep->rx_credits, toep->ulp_mode); - cpl->opt2 = calc_opt2a(so, toep); + toep->rx_credits, toep->ulp_mode, &settings); + cpl->opt2 = calc_opt2a(so, toep, &settings); } CTR5(KTR_CXGBE, "%s: atid %u (%s), toep %p, inp %p", __func__, Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Sat Apr 14 17:41:54 2018 (r332505) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Sat Apr 14 19:07:56 2018 (r332506) @@ -121,6 +121,11 @@ send_flowc_wr(struct toepcb *toep, struct flowc_tx_par nparams++; if (toep->tls.fcplenmax != 0) nparams++; + if (toep->tc_idx != -1) { + MPASS(toep->tc_idx >= 0 && + toep->tc_idx < sc->chip_params->nsched_cls); + nparams++; + } flowclen = sizeof(*flowc) + nparams * sizeof(struct fw_flowc_mnemval); @@ -172,6 +177,8 @@ send_flowc_wr(struct toepcb *toep, struct flowc_tx_par FLOWC_PARAM(ULP_MODE, toep->ulp_mode); if (toep->tls.fcplenmax != 0) FLOWC_PARAM(TXDATAPLEN_MAX, toep->tls.fcplenmax); + if (toep->tc_idx != -1) + FLOWC_PARAM(SCHEDCLASS, toep->tc_idx); #undef FLOWC_PARAM KASSERT(paramidx == nparams, ("nparams mismatch")); @@ -333,18 +340,18 @@ assign_rxopt(struct tcpcb *tp, unsigned int opt) n = sizeof(struct ip6_hdr) + sizeof(struct tcphdr); else n = sizeof(struct ip) + sizeof(struct tcphdr); - if (V_tcp_do_rfc1323) - n += TCPOLEN_TSTAMP_APPA; tp->t_maxseg = sc->params.mtus[G_TCPOPT_MSS(opt)] - n; - CTR4(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u)", __func__, toep->tid, - G_TCPOPT_MSS(opt), sc->params.mtus[G_TCPOPT_MSS(opt)]); - if (G_TCPOPT_TSTAMP(opt)) { tp->t_flags |= TF_RCVD_TSTMP; /* timestamps ok */ tp->ts_recent = 0; /* hmmm */ tp->ts_recent_age = tcp_ts_getticks(); + tp->t_maxseg -= TCPOLEN_TSTAMP_APPA; } + + CTR5(KTR_CXGBE, "%s: tid %d, mtu_idx %u (%u), mss %u", __func__, + toep->tid, G_TCPOPT_MSS(opt), sc->params.mtus[G_TCPOPT_MSS(opt)], + tp->t_maxseg); if (G_TCPOPT_SACK(opt)) tp->t_flags |= TF_SACK_PERMIT; /* should already be set */ Modified: head/sys/dev/cxgbe/tom/t4_listen.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_listen.c Sat Apr 14 17:41:54 2018 (r332505) +++ head/sys/dev/cxgbe/tom/t4_listen.c Sat Apr 14 19:07:56 2018 (r332506) @@ -45,6 +45,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -62,6 +63,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "common/common.h" #include "common/t4_msg.h" @@ -84,7 +86,8 @@ static struct listen_ctx *listen_hash_find(struct adap static struct listen_ctx *listen_hash_del(struct adapter *, struct inpcb *); static struct inpcb *release_lctx(struct adapter *, struct listen_ctx *); -static inline void save_qids_in_mbuf(struct mbuf *, struct vi_info *); +static inline void save_qids_in_mbuf(struct mbuf *, struct vi_info *, + struct offload_settings *); static inline void get_qids_from_mbuf(struct mbuf *m, int *, int *); static void send_reset_synqe(struct toedev *, struct synq_entry *); @@ -513,9 +516,17 @@ t4_listen_start(struct toedev *tod, struct tcpcb *tp) struct inpcb *inp = tp->t_inpcb; struct listen_ctx *lctx; int i, rc, v; + struct offload_settings settings; INP_WLOCK_ASSERT(inp); + rw_rlock(&sc->policy_lock); + settings = *lookup_offload_policy(sc, OPEN_TYPE_LISTEN, NULL, 0xffff, + inp); + rw_runlock(&sc->policy_lock); + if (!settings.offload) + return (0); + /* Don't start a hardware listener for any loopback address. */ if (inp->inp_vflag & INP_IPV6 && IN6_IS_ADDR_LOOPBACK(&inp->in6p_laddr)) return (0); @@ -948,13 +959,23 @@ t4_offload_socket(struct toedev *tod, void *arg, struc } static inline void -save_qids_in_mbuf(struct mbuf *m, struct vi_info *vi) +save_qids_in_mbuf(struct mbuf *m, struct vi_info *vi, + struct offload_settings *s) { uint32_t txqid, rxqid; - txqid = (arc4random() % vi->nofldtxq) + vi->first_ofld_txq; - rxqid = (arc4random() % vi->nofldrxq) + vi->first_ofld_rxq; + if (s->txq >= 0 && s->txq < vi->nofldtxq) + txqid = s->txq; + else + txqid = arc4random() % vi->nofldtxq; + txqid += vi->first_ofld_txq; + if (s->rxq >= 0 && s->rxq < vi->nofldrxq) + rxqid = s->rxq; + else + rxqid = arc4random() % vi->nofldrxq; + rxqid += vi->first_ofld_rxq; + m->m_pkthdr.flowid = (txqid << 16) | (rxqid & 0xffff); } @@ -1019,50 +1040,88 @@ t4opt_to_tcpopt(const struct tcp_options *t4opt, struc */ static uint32_t calc_opt2p(struct adapter *sc, struct port_info *pi, int rxqid, - const struct tcp_options *tcpopt, struct tcphdr *th, int ulp_mode) + const struct tcp_options *tcpopt, struct tcphdr *th, int ulp_mode, + struct cc_algo *cc, const struct offload_settings *s) { struct sge_ofld_rxq *ofld_rxq = &sc->sge.ofld_rxq[rxqid]; - uint32_t opt2; + uint32_t opt2 = 0; - opt2 = V_TX_QUEUE(sc->params.tp.tx_modq[pi->tx_chan]) | - F_RSS_QUEUE_VALID | V_RSS_QUEUE(ofld_rxq->iq.abs_id); - - if (V_tcp_do_rfc1323) { - if (tcpopt->tstamp) - opt2 |= F_TSTAMPS_EN; - if (tcpopt->sack) - opt2 |= F_SACK_EN; - if (tcpopt->wsf <= 14) - opt2 |= F_WND_SCALE_EN; + /* + * rx flow control, rx coalesce, congestion control, and tx pace are all + * explicitly set by the driver. On T5+ the ISS is also set by the + * driver to the value picked by the kernel. + */ + if (is_t4(sc)) { + opt2 |= F_RX_FC_VALID | F_RX_COALESCE_VALID; + opt2 |= F_CONG_CNTRL_VALID | F_PACE_VALID; + } else { + opt2 |= F_T5_OPT_2_VALID; /* all 4 valid */ + opt2 |= F_T5_ISS; /* ISS provided in CPL */ } - if (V_tcp_do_ecn && th->th_flags & (TH_ECE | TH_CWR)) + if (tcpopt->sack && (s->sack > 0 || (s->sack < 0 && V_tcp_do_rfc1323))) + opt2 |= F_SACK_EN; + + if (tcpopt->tstamp && + (s->tstamp > 0 || (s->tstamp < 0 && V_tcp_do_rfc1323))) + opt2 |= F_TSTAMPS_EN; + + if (tcpopt->wsf < 15 && V_tcp_do_rfc1323) + opt2 |= F_WND_SCALE_EN; + + if (th->th_flags & (TH_ECE | TH_CWR) && + (s->ecn > 0 || (s->ecn < 0 && V_tcp_do_ecn))) opt2 |= F_CCTRL_ECN; - /* RX_COALESCE is always a valid value (0 or M_RX_COALESCE). */ - if (is_t4(sc)) - opt2 |= F_RX_COALESCE_VALID; + /* XXX: F_RX_CHANNEL for multiple rx c-chan support goes here. */ + + opt2 |= V_TX_QUEUE(sc->params.tp.tx_modq[pi->tx_chan]); + + /* These defaults are subject to ULP specific fixups later. */ + opt2 |= V_RX_FC_DDP(0) | V_RX_FC_DISABLE(0); + + opt2 |= V_PACE(0); + + if (s->cong_algo >= 0) + opt2 |= V_CONG_CNTRL(s->cong_algo); + else if (sc->tt.cong_algorithm >= 0) + opt2 |= V_CONG_CNTRL(sc->tt.cong_algorithm & M_CONG_CNTRL); else { - opt2 |= F_T5_OPT_2_VALID; - opt2 |= F_T5_ISS; + if (strcasecmp(cc->name, "reno") == 0) + opt2 |= V_CONG_CNTRL(CONG_ALG_RENO); + else if (strcasecmp(cc->name, "tahoe") == 0) + opt2 |= V_CONG_CNTRL(CONG_ALG_TAHOE); + if (strcasecmp(cc->name, "newreno") == 0) + opt2 |= V_CONG_CNTRL(CONG_ALG_NEWRENO); + if (strcasecmp(cc->name, "highspeed") == 0) + opt2 |= V_CONG_CNTRL(CONG_ALG_HIGHSPEED); + else { + /* + * Use newreno in case the algorithm selected by the + * host stack is not supported by the hardware. + */ + opt2 |= V_CONG_CNTRL(CONG_ALG_NEWRENO); + } } - if (sc->tt.rx_coalesce) + + if (s->rx_coalesce > 0 || (s->rx_coalesce < 0 && sc->tt.rx_coalesce)) opt2 |= V_RX_COALESCE(M_RX_COALESCE); - if (sc->tt.cong_algorithm != -1) - opt2 |= V_CONG_CNTRL(sc->tt.cong_algorithm & M_CONG_CNTRL); + /* Note that ofld_rxq is already set according to s->rxq. */ + opt2 |= F_RSS_QUEUE_VALID; + opt2 |= V_RSS_QUEUE(ofld_rxq->iq.abs_id); #ifdef USE_DDP_RX_FLOW_CONTROL if (ulp_mode == ULP_MODE_TCPDDP) - opt2 |= F_RX_FC_VALID | F_RX_FC_DDP; + opt2 |= F_RX_FC_DDP; #endif + if (ulp_mode == ULP_MODE_TLS) { - opt2 |= F_RX_FC_VALID; opt2 &= ~V_RX_COALESCE(M_RX_COALESCE); opt2 |= F_RX_FC_DISABLE; } - return htobe32(opt2); + return (htobe32(opt2)); } static void @@ -1199,6 +1258,7 @@ do_pass_accept_req(struct sge_iq *iq, const struct rss #ifdef INVARIANTS unsigned int opcode = G_CPL_OPCODE(be32toh(OPCODE_TID(cpl))); #endif + struct offload_settings settings; KASSERT(opcode == CPL_PASS_ACCEPT_REQ, ("%s: unexpected opcode 0x%x", __func__, opcode)); @@ -1334,15 +1394,23 @@ found: REJECT_PASS_ACCEPT(); } so = inp->inp_socket; + rw_rlock(&sc->policy_lock); + settings = *lookup_offload_policy(sc, OPEN_TYPE_PASSIVE, m, 0xffff, inp); + rw_runlock(&sc->policy_lock); + if (!settings.offload) { + INP_WUNLOCK(inp); + free(wr, M_CXGBE); + REJECT_PASS_ACCEPT(); + } - mtu_idx = find_best_mtu_idx(sc, &inc, be16toh(cpl->tcpopt.mss)); + mtu_idx = find_best_mtu_idx(sc, &inc, &settings); rscale = cpl->tcpopt.wsf && V_tcp_do_rfc1323 ? select_rcv_wscale() : 0; /* opt0 rcv_bufsiz initially, assumes its normal meaning later */ wnd = max(so->sol_sbrcv_hiwat, MIN_RCV_WND); wnd = min(wnd, MAX_RCV_WND); rx_credits = min(wnd >> 10, M_RCV_BUFSIZ); - save_qids_in_mbuf(m, vi); + save_qids_in_mbuf(m, vi, &settings); get_qids_from_mbuf(m, NULL, &rxqid); if (is_t4(sc)) @@ -1352,7 +1420,7 @@ found: INIT_TP_WR_MIT_CPL(rpl5, CPL_PASS_ACCEPT_RPL, tid); } - ulp_mode = select_ulp_mode(so, sc); + ulp_mode = select_ulp_mode(so, sc, &settings); switch (ulp_mode) { case ULP_MODE_TCPDDP: synqe->flags |= TPF_SYNQE_TCPDDP; @@ -1361,8 +1429,10 @@ found: synqe->flags |= TPF_SYNQE_TLS; break; } - rpl->opt0 = calc_opt0(so, vi, e, mtu_idx, rscale, rx_credits, ulp_mode); - rpl->opt2 = calc_opt2p(sc, pi, rxqid, &cpl->tcpopt, &th, ulp_mode); + rpl->opt0 = calc_opt0(so, vi, e, mtu_idx, rscale, rx_credits, ulp_mode, + &settings); + rpl->opt2 = calc_opt2p(sc, pi, rxqid, &cpl->tcpopt, &th, ulp_mode, + CC_ALGO(intotcpcb(inp)), &settings); synqe->tid = tid; synqe->lctx = lctx; Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Sat Apr 14 17:41:54 2018 (r332505) +++ head/sys/dev/cxgbe/tom/t4_tom.c Sat Apr 14 19:07:56 2018 (r332506) @@ -51,6 +51,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include #include @@ -137,15 +139,11 @@ alloc_toepcb(struct vi_info *vi, int txqid, int rxqid, txsd_total = tx_credits / howmany(sizeof(struct fw_ofld_tx_data_wr) + 1, 16); - if (txqid < 0) - txqid = (arc4random() % vi->nofldtxq) + vi->first_ofld_txq; KASSERT(txqid >= vi->first_ofld_txq && txqid < vi->first_ofld_txq + vi->nofldtxq, ("%s: txqid %d for vi %p (first %d, n %d)", __func__, txqid, vi, vi->first_ofld_txq, vi->nofldtxq)); - if (rxqid < 0) - rxqid = (arc4random() % vi->nofldrxq) + vi->first_ofld_rxq; KASSERT(rxqid >= vi->first_ofld_rxq && rxqid < vi->first_ofld_rxq + vi->nofldrxq, ("%s: rxqid %d for vi %p (first %d, n %d)", __func__, rxqid, vi, @@ -569,27 +567,28 @@ queue_tid_release(struct adapter *sc, int tid) } /* - * What mtu_idx to use, given a 4-tuple and/or an MSS cap + * What mtu_idx to use, given a 4-tuple. Note that both s->mss and tcp_mssopt + * have the MSS that we should advertise in our SYN. Advertised MSS doesn't + * account for any TCP options so the effective MSS (only payload, no headers or + * options) could be different. We fill up tp->t_maxseg with the effective MSS + * at the end of the 3-way handshake. */ int -find_best_mtu_idx(struct adapter *sc, struct in_conninfo *inc, int pmss) +find_best_mtu_idx(struct adapter *sc, struct in_conninfo *inc, + struct offload_settings *s) { unsigned short *mtus = &sc->params.mtus[0]; - int i, mss, n; + int i, mss, mtu; - KASSERT(inc != NULL || pmss > 0, - ("%s: at least one of inc/pmss must be specified", __func__)); + MPASS(inc != NULL); - mss = inc ? tcp_mssopt(inc) : pmss; - if (pmss > 0 && mss > pmss) - mss = pmss; - + mss = s->mss > 0 ? s->mss : tcp_mssopt(inc); if (inc->inc_flags & INC_ISIPV6) - n = sizeof(struct ip6_hdr) + sizeof(struct tcphdr); + mtu = mss + sizeof(struct ip6_hdr) + sizeof(struct tcphdr); else - n = sizeof(struct ip) + sizeof(struct tcphdr); + mtu = mss + sizeof(struct ip) + sizeof(struct tcphdr); - for (i = 0; i < NMTUS - 1 && mtus[i + 1] <= mss + n; i++) + for (i = 0; i < NMTUS - 1 && mtus[i + 1] <= mtu; i++) continue; return (i); @@ -632,34 +631,33 @@ select_rcv_wscale(void) */ uint64_t calc_opt0(struct socket *so, struct vi_info *vi, struct l2t_entry *e, - int mtu_idx, int rscale, int rx_credits, int ulp_mode) + int mtu_idx, int rscale, int rx_credits, int ulp_mode, + struct offload_settings *s) { + int keepalive; uint64_t opt0; + MPASS(so != NULL); + MPASS(vi != NULL); KASSERT(rx_credits <= M_RCV_BUFSIZ, ("%s: rcv_bufsiz too high", __func__)); opt0 = F_TCAM_BYPASS | V_WND_SCALE(rscale) | V_MSS_IDX(mtu_idx) | - V_ULP_MODE(ulp_mode) | V_RCV_BUFSIZ(rx_credits); + V_ULP_MODE(ulp_mode) | V_RCV_BUFSIZ(rx_credits) | + V_L2T_IDX(e->idx) | V_SMAC_SEL(vi->smt_idx) | + V_TX_CHAN(vi->pi->tx_chan); - if (so != NULL) { + keepalive = tcp_always_keepalive || so_options_get(so) & SO_KEEPALIVE; + opt0 |= V_KEEP_ALIVE(keepalive != 0); + + if (s->nagle < 0) { struct inpcb *inp = sotoinpcb(so); struct tcpcb *tp = intotcpcb(inp); - int keepalive = tcp_always_keepalive || - so_options_get(so) & SO_KEEPALIVE; opt0 |= V_NAGLE((tp->t_flags & TF_NODELAY) == 0); - opt0 |= V_KEEP_ALIVE(keepalive != 0); - } + } else + opt0 |= V_NAGLE(s->nagle != 0); - if (e != NULL) - opt0 |= V_L2T_IDX(e->idx); - - if (vi != NULL) { - opt0 |= V_SMAC_SEL(vi->smt_idx); - opt0 |= V_TX_CHAN(vi->pi->tx_chan); - } - return htobe64(opt0); } @@ -720,12 +718,15 @@ is_tls_sock(struct socket *so, struct adapter *sc) } int -select_ulp_mode(struct socket *so, struct adapter *sc) +select_ulp_mode(struct socket *so, struct adapter *sc, + struct offload_settings *s) { - if (can_tls_offload(sc) && is_tls_sock(so, sc)) + if (can_tls_offload(sc) && + (s->tls > 0 || (s->tls < 0 && is_tls_sock(so, sc)))) return (ULP_MODE_TLS); - else if (sc->tt.ddp && (so->so_options & SO_NO_DDP) == 0) + else if (s->ddp > 0 || + (s->ddp < 0 && sc->tt.ddp && (so->so_options & SO_NO_DDP) == 0)) return (ULP_MODE_TCPDDP); else return (ULP_MODE_NONE); @@ -1091,6 +1092,181 @@ free_tom_data(struct adapter *sc, struct tom_data *td) free_tid_tabs(&sc->tids); free(td, M_CXGBE); +} + +static char * +prepare_pkt(int open_type, uint16_t vtag, struct inpcb *inp, int *pktlen, + int *buflen) +{ + char *pkt; + struct tcphdr *th; + int ipv6, len; + const int maxlen = + max(sizeof(struct ether_header), sizeof(struct ether_vlan_header)) + + max(sizeof(struct ip), sizeof(struct ip6_hdr)) + + sizeof(struct tcphdr); + + MPASS(open_type == OPEN_TYPE_ACTIVE || open_type == OPEN_TYPE_LISTEN); + + pkt = malloc(maxlen, M_CXGBE, M_ZERO | M_NOWAIT); + if (pkt == NULL) + return (NULL); + + ipv6 = inp->inp_vflag & INP_IPV6; + len = 0; + + if (vtag == 0xffff) { + struct ether_header *eh = (void *)pkt; + + if (ipv6) + eh->ether_type = htons(ETHERTYPE_IPV6); + else + eh->ether_type = htons(ETHERTYPE_IP); + + len += sizeof(*eh); + } else { + struct ether_vlan_header *evh = (void *)pkt; + + evh->evl_encap_proto = htons(ETHERTYPE_VLAN); + evh->evl_tag = htons(vtag); + if (ipv6) + evh->evl_proto = htons(ETHERTYPE_IPV6); + else + evh->evl_proto = htons(ETHERTYPE_IP); + + len += sizeof(*evh); + } + + if (ipv6) { + struct ip6_hdr *ip6 = (void *)&pkt[len]; + + ip6->ip6_vfc = IPV6_VERSION; + ip6->ip6_plen = htons(sizeof(struct tcphdr)); + ip6->ip6_nxt = IPPROTO_TCP; + if (open_type == OPEN_TYPE_ACTIVE) { + ip6->ip6_src = inp->in6p_laddr; + ip6->ip6_dst = inp->in6p_faddr; + } else if (open_type == OPEN_TYPE_LISTEN) { + ip6->ip6_src = inp->in6p_laddr; + ip6->ip6_dst = ip6->ip6_src; + } + + len += sizeof(*ip6); + } else { + struct ip *ip = (void *)&pkt[len]; + + ip->ip_v = IPVERSION; + ip->ip_hl = sizeof(*ip) >> 2; + ip->ip_tos = inp->inp_ip_tos; + ip->ip_len = htons(sizeof(struct ip) + sizeof(struct tcphdr)); + ip->ip_ttl = inp->inp_ip_ttl; + ip->ip_p = IPPROTO_TCP; + if (open_type == OPEN_TYPE_ACTIVE) { + ip->ip_src = inp->inp_laddr; + ip->ip_dst = inp->inp_faddr; + } else if (open_type == OPEN_TYPE_LISTEN) { + ip->ip_src = inp->inp_laddr; + ip->ip_dst = ip->ip_src; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Apr 14 21:54:23 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 71DF5F9D2ED; Sat, 14 Apr 2018 21:54:23 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 273B07F76C; Sat, 14 Apr 2018 21:54:23 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1DC922DD76; Sat, 14 Apr 2018 21:54:23 +0000 (UTC) (envelope-from eadler@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id w3ELsMGw018629; Sat, 14 Apr 2018 21:54:22 GMT (envelope-from eadler@FreeBSD.org) Received: (from eadler@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3ELsM4a018627; Sat, 14 Apr 2018 21:54:22 GMT (envelope-from eadler@FreeBSD.org) Message-Id: <201804142154.w3ELsM4a018627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eadler set sender to eadler@FreeBSD.org using -f From: Eitan Adler Date: Sat, 14 Apr 2018 21:54:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332508 - in head/contrib/amd: . amd X-SVN-Group: head X-SVN-Commit-Author: eadler X-SVN-Commit-Paths: in head/contrib/amd: . amd X-SVN-Commit-Revision: 332508 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 14 Apr 2018 21:54:23 -0000 Author: eadler Date: Sat Apr 14 21:54:22 2018 New Revision: 332508 URL: https://svnweb.freebsd.org/changeset/base/332508 Log: amd: correct formatting of 'SEE ALSO' Modified: head/contrib/amd/FREEBSD-upgrade head/contrib/amd/amd/amd.8 Modified: head/contrib/amd/FREEBSD-upgrade ============================================================================== --- head/contrib/amd/FREEBSD-upgrade Sat Apr 14 20:49:38 2018 (r332507) +++ head/contrib/amd/FREEBSD-upgrade Sat Apr 14 21:54:22 2018 (r332508) @@ -32,6 +32,7 @@ https://bugzilla.am-utils.org for inclusion in the nex Local changes: amd/amd.8 + - corrected formatting of SEE ALSO r1.17 Uniformly refer to a file system as "file system" r1.16 Add the am-utils homepage to SEE ALSO r1.15 s/BSD/.Bx/ where appropriate Modified: head/contrib/amd/amd/amd.8 ============================================================================== --- head/contrib/amd/amd/amd.8 Sat Apr 14 20:49:38 2018 (r332507) +++ head/contrib/amd/amd/amd.8 Sat Apr 14 21:54:22 2018 (r332508) @@ -362,15 +362,15 @@ number of process context switches. A weird imagination is most useful to gain full advantage of all the features. .Sh SEE ALSO -.Xr domainname 1, -.Xr hostname 1, -.Xr syslog 3. -.Xr amd.conf 5, -.Xr mtab 5, -.Xr amq 8, -.Xr automount 8, -.Xr mount 8, -.Xr umount 8, +.Xr domainname 1 , +.Xr hostname 1 , +.Xr syslog 3 , +.Xr amd.conf 5 , +.Xr mtab 5 , +.Xr amq 8 , +.Xr automount 8 , +.Xr mount 8 , +.Xr umount 8 .Pp .Dq am-utils .Xr info 1 From owner-svn-src-head@freebsd.org Sat Apr 14 22:14:19 2018 Return-Path: Delivered-To: svn-src-head@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 37F12F9E7FA; Sat, 14 Apr 2018 22:14:19 +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.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id E0C79827BE; Sat, 14 Apr 2018 22:14:18 +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 D53972E0A0; Sat, 14 Apr 2018 22:14:18 +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 w3EMEIN8028632; Sat, 14 Apr 2018 22:14:18 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id w3EMEIRu028631; Sat, 14 Apr 2018 22:14:18 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201804142214.w3EMEIRu028631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Sat, 14 Apr 2018 22:14:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r332509 - head/sys/i386/i386 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/i386/i386 X-SVN-Commit-Revision: 332509 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.25 Precedence: list List-Id: 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, 14 Apr 2018 22:14:19 -0000 Author: imp Date: Sat Apr 14 22:14:18 2018 New Revision: 332509 URL: https://svnweb.freebsd.org/changeset/base/332509 Log: Make first a 'bool' instead of a 'boolean_t'. 'bool' is preferred to 'boolean_t'. We only get the boolean_t definition by header pollution (though the same is true for bool). Since we use both, switch entirely to bool. Note: We still have TRUE/FALSE instead of true/false in heavy use in the rest of the file. These are with ints of various flavors, so that's appropriate, even though we should eventually migrate to bool and true/false (though the tables they are in are nicely packed with short and wouldn't be so nicely packed with bool, another reason to leave it alone for now). Modified: head/sys/i386/i386/db_disasm.c Modified: head/sys/i386/i386/db_disasm.c ============================================================================== --- head/sys/i386/i386/db_disasm.c Sat Apr 14 21:54:22 2018 (r332508) +++ head/sys/i386/i386/db_disasm.c Sat Apr 14 22:14:18 2018 (r332509) @@ -1166,7 +1166,7 @@ db_disasm(db_addr_t loc, bool altfmt) int i_size; int i_mode; int regmodrm = 0; - boolean_t first; + bool first; int displ; int prefix; int rep; @@ -1338,9 +1338,9 @@ db_disasm(db_addr_t loc, bool altfmt) } } db_printf("\t"); - for (first = TRUE; + for (first = true; i_mode != 0; - i_mode >>= 8, first = FALSE) + i_mode >>= 8, first = false) { if (!first) db_printf(",");