From owner-svn-src-all@freebsd.org Sun Oct 20 00:43:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E8E515B11E; Sun, 20 Oct 2019 00:43:20 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46wgx36BL3z3KkH; Sun, 20 Oct 2019 00:43:19 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x9K0h6B7030773; Sat, 19 Oct 2019 17:43:06 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x9K0h5YZ030772; Sat, 19 Oct 2019 17:43:05 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201910200043.x9K0h5YZ030772@gndrsh.dnsmgr.net> Subject: Re: svn commit: r353365 - head/usr.bin/procstat In-Reply-To: To: Jeremie Le Hen Date: Sat, 19 Oct 2019 17:43:05 -0700 (PDT) CC: rgrimes@freebsd.org, src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 46wgx36BL3z3KkH X-Spamd-Bar: ----- X-Spamd-Result: default: False [-5.93 / 15.00]; NEURAL_HAM_MEDIUM(-0.93)[-0.933,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 00:43:20 -0000 > On Thu, Oct 10, 2019 at 11:27 PM Rodney W. Grimes > wrote: > > > > > Author: jlh > > > Date: Wed Oct 9 20:05:14 2019 > > > New Revision: 353365 > > > URL: https://svnweb.freebsd.org/changeset/base/353365 > > > > > > Log: > > > Add a missing macro for the previous commit (IS_INADDR_ANY()). > > > > Can we write it the same was as it is 100+ other places? > > 1022}# find . -type f | xargs grep "== INADDR_ANY" | wc > > 131 781 9607 > > Done in r353768. Thanks! Thank you. > > > Modified: > > > head/usr.bin/procstat/procstat_files.c > > > > > > Modified: head/usr.bin/procstat/procstat_files.c > > > ============================================================================== > > > --- head/usr.bin/procstat/procstat_files.c Wed Oct 9 20:01:23 2019 (r353364) > > > +++ head/usr.bin/procstat/procstat_files.c Wed Oct 9 20:05:14 2019 (r353365) > > > @@ -94,6 +94,7 @@ addr_to_string(struct sockaddr_storage *ss, char *buff > > > struct sockaddr_in6 *sin6; > > > struct sockaddr_in *sin; > > > struct sockaddr_un *sun; > > > +#define IS_INADDR_ANY(x) ((x).s_addr == INADDR_ANY) > > > > > > switch (ss->ss_family) { > > > case AF_LOCAL: > > > > > > > -- > > Rod Grimes rgrimes@freebsd.org > > > > -- > Jeremie Le Hen > jlh@FreeBSD.org > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sun Oct 20 04:15:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ABF94152D5E; Sun, 20 Oct 2019 04:15:05 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46wmdJ2c9Vz4LcB; Sun, 20 Oct 2019 04:14:59 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.125.17]) by shaw.ca with ESMTPA id M2cJiYIELUIS2M2cKiUUs0; Sat, 19 Oct 2019 22:14:57 -0600 X-Authority-Analysis: v=2.3 cv=N41X6F1B c=1 sm=1 tr=0 a=VFtTW3WuZNDh6VkGe7fA3g==:117 a=VFtTW3WuZNDh6VkGe7fA3g==:17 a=8nJEP1OIZ-IA:10 a=XobE76Q3jBoA:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=8JuyV68ynUFHwCkUd98A:9 a=wPNLvfGTeEIA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=Z5ABNNGmrOfJ6cZ5bIyy:22 a=bWyr8ysk75zN3GCy5bjg:22 Received: from slippy.cwsent.com (slippy [10.1.1.91]) by spqr.komquats.com (Postfix) with ESMTPS id 41B645A55; Sat, 19 Oct 2019 21:14:55 -0700 (PDT) Received: from slippy.cwsent.com (localhost [127.0.0.1]) by slippy.cwsent.com (8.15.2/8.15.2) with ESMTP id x9K4EspE081470; Sat, 19 Oct 2019 21:14:54 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Received: from slippy (cy@localhost) by slippy.cwsent.com (8.15.2/8.15.2/Submit) with ESMTP id x9K4Es6d081467; Sat, 19 Oct 2019 21:14:54 -0700 (PDT) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <201910200414.x9K4Es6d081467@slippy.cwsent.com> X-Authentication-Warning: slippy.cwsent.com: cy owned process doing -bs X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: Re: svn commit: r343774 - in vendor-crypto/openssh/dist: . contrib/redhat contrib/suse openbsd-compat regress regress/misc/fuzz-harness regress/unittests/sshkey regress/unittests/sshkey/testdata regres... In-reply-to: <201902051503.x15F3rMN050696@repo.freebsd.org> References: <201902051503.x15F3rMN050696@repo.freebsd.org> Comments: In-reply-to =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= message dated "Tue, 05 Feb 2019 15:03:53 +0000." Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit Date: Sat, 19 Oct 2019 21:14:54 -0700 X-CMAE-Envelope: MS4wfMrfitOsgSL1b4rA4G3TgPJf+7sGokTICuJmijA53iURzgQjxIlLRshbdF/FZrHpx4CIe8aJPWe2HkV0E78FeORP3LnRpK5voG8Yhky6+BTPvMpbKKYb vXGJLPhDIQtppECJmJMBd0R84mxaMnIvsYqiZGHaI7gxVIhkCbjkfeMk+OV3WK6zdtJJIAjPyvPK9cX0tzPeKOtuDrcGhNDC0smdtVmpyKHW/2n7+yUaOOR5 uxcGh6CVZLz8eehmK6/Kh4eJ0j7G43VdrI/Kpe8iyn3o0Xk81LLGLQaqpwSw8yh7 X-Rspamd-Queue-Id: 46wmdJ2c9Vz4LcB X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; spf=none (mx1.freebsd.org: domain of cy.schubert@cschubert.com has no SPF policy when checking 64.59.134.12) smtp.mailfrom=cy.schubert@cschubert.com X-Spamd-Result: default: False [-2.44 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; RECEIVED_SPAMHAUS_PBL(0.00)[17.125.67.70.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.11]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; HAS_REPLYTO(0.00)[Cy.Schubert@cschubert.com]; MV_CASE(0.50)[]; LONG_SUBJ(1.52)[203]; IP_SCORE(-2.36)[ip: (-6.31), ipnet: 64.59.128.0/20(-3.04), asn: 6327(-2.37), country: CA(-0.09)]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLYTO_EQ_FROM(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[12.134.59.64.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; R_SPF_NA(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6327, ipnet:64.59.128.0/20, country:CA]; RCVD_TLS_LAST(0.00)[]; RWL_MAILSPIKE_POSSIBLE(0.00)[12.134.59.64.rep.mailspike.net : 127.0.0.17] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 04:15:05 -0000 In message <201902051503.x15F3rMN050696@repo.freebsd.org>, =?UTF-8?Q?Dag-Erling _Sm=c3=b8rgrav?= writes: > Author: des > Date: Tue Feb 5 15:03:53 2019 > New Revision: 343774 > URL: https://svnweb.freebsd.org/changeset/base/343774 > > Log: > Vendor import of OpenSSH 7.9p1. > Hi des@, Are there plans to merge this into head? -- Cheers, Cy Schubert FreeBSD UNIX: Web: http://www.FreeBSD.org The need of the many outweighs the greed of the few. From owner-svn-src-all@freebsd.org Sun Oct 20 10:48:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A3DC15B43C; Sun, 20 Oct 2019 10:48:29 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46wxMK1Srpz4cBB; Sun, 20 Oct 2019 10:48:29 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 16C73A97B; Sun, 20 Oct 2019 10:48:29 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KAmTI2036279; Sun, 20 Oct 2019 10:48:29 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KAmR1O036272; Sun, 20 Oct 2019 10:48:27 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201910201048.x9KAmR1O036272@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 20 Oct 2019 10:48:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353773 - in head/sys: arm/mv arm64/conf conf X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: arm/mv arm64/conf conf X-SVN-Commit-Revision: 353773 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 10:48:29 -0000 Author: mmel Date: Sun Oct 20 10:48:27 2019 New Revision: 353773 URL: https://svnweb.freebsd.org/changeset/base/353773 Log: Update Armada 8k drivers to cover newly imported DT and latest changes in simple multifunction driver. - follow interrupt changes in DT. Split old ICU driver to function oriented parts and add drivers for newly defined parts (system error interrupts). - Many drivers are children of simple multifunction driver. But after r349596 simple MF driver doesn't longer exports memory resources, and all children must use syscon interface to access their registers. Adapt affected drivers to this fact. MFC after: 3 weeks Added: head/sys/arm/mv/mv_ap806_sei.c (contents, props changed) head/sys/arm/mv/mv_cp110_icu_bus.c (contents, props changed) Modified: head/sys/arm/mv/mv_ap806_clock.c head/sys/arm/mv/mv_ap806_gicp.c head/sys/arm/mv/mv_cp110_clock.c head/sys/arm/mv/mv_cp110_icu.c head/sys/arm/mv/mv_thermal.c head/sys/arm/mv/mvebu_pinctrl.c head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm/mv/mv_ap806_clock.c ============================================================================== --- head/sys/arm/mv/mv_ap806_clock.c Sun Oct 20 01:09:14 2019 (r353772) +++ head/sys/arm/mv/mv_ap806_clock.c Sun Oct 20 10:48:27 2019 (r353773) @@ -44,13 +44,15 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include +#include #include #include -#include +#include "syscon_if.h" + static struct clk_fixed_def ap806_clk_cluster_0 = { .clkdef.id = 0, .clkdef.name = "ap806-cpu-cluster-0", @@ -92,23 +94,19 @@ static struct clk_fixed_def ap806_clk_sdio = { }; struct mv_ap806_clock_softc { - struct simplebus_softc simplebus_sc; device_t dev; - struct resource *res; + struct syscon *syscon; }; -static struct resource_spec mv_ap806_clock_res_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE | RF_SHAREABLE }, - { -1, 0 } -}; + static struct ofw_compat_data compat_data[] = { - {"marvell,ap806-clock", 1}, - {NULL, 0} + {"marvell,ap806-clock", 1}, + {NULL, 0} }; -#define RD4(sc, reg) bus_read_4((sc)->res, (reg)) -#define WR4(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) +#define RD4(sc, reg) SYSCON_READ_4((sc)->syscon, (reg)) +#define WR4(sc, reg, val) SYSCON_WRITE_4((sc)->syscon, (reg), (val)) static int mv_ap806_clock_probe(device_t dev) @@ -135,8 +133,9 @@ mv_ap806_clock_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; - if (bus_alloc_resources(dev, mv_ap806_clock_res_spec, &sc->res) != 0) { - device_printf(dev, "cannot allocate resources for device\n"); + if (SYSCON_GET_HANDLE(sc->dev, &sc->syscon) != 0 || + sc->syscon == NULL) { + device_printf(dev, "cannot get syscon for device\n"); return (ENXIO); } @@ -160,7 +159,8 @@ mv_ap806_clock_attach(device_t dev) clock_freq = 1333000000; break; default: - device_printf(dev, "Cannot guess clock freq with reg %x\n", reg & 0x1f); + device_printf(dev, "Cannot guess clock freq with reg %x\n", + reg & 0x1f); return (ENXIO); break; }; Modified: head/sys/arm/mv/mv_ap806_gicp.c ============================================================================== --- head/sys/arm/mv/mv_ap806_gicp.c Sun Oct 20 01:09:14 2019 (r353772) +++ head/sys/arm/mv/mv_ap806_gicp.c Sun Oct 20 10:48:27 2019 (r353773) @@ -60,6 +60,7 @@ struct mv_ap806_gicp_softc { ssize_t spi_ranges_cnt; uint32_t *spi_ranges; + struct intr_map_data_fdt *parent_map_data; }; static struct ofw_compat_data compat_data[] = { @@ -96,11 +97,13 @@ mv_ap806_gicp_attach(device_t dev) /* Look for our parent */ if ((intr_parent = ofw_bus_find_iparent(node)) == 0) { - device_printf(dev, "Cannot find our parent interrupt controller\n"); + device_printf(dev, + "Cannot find our parent interrupt controller\n"); return (ENXIO); } if ((sc->parent = OF_device_from_xref(intr_parent)) == NULL) { - device_printf(dev, "cannot find parent interrupt controller device\n"); + device_printf(dev, + "cannot find parent interrupt controller device\n"); return (ENXIO); } @@ -112,7 +115,10 @@ mv_ap806_gicp_attach(device_t dev) device_printf(dev, "Cannot register GICP\n"); return (ENXIO); } - + /* Allocate GIC compatible mapping entry (3 cells) */ + sc->parent_map_data = (struct intr_map_data_fdt *)intr_alloc_map_data( + INTR_MAP_DATA_FDT, sizeof(struct intr_map_data_fdt) + + + 3 * sizeof(phandle_t), M_WAITOK | M_ZERO); OF_device_register_xref(xref, dev); return (0); @@ -125,6 +131,45 @@ mv_ap806_gicp_detach(device_t dev) return (EBUSY); } +static struct intr_map_data * +mv_ap806_gicp_convert_map_data(struct mv_ap806_gicp_softc *sc, + struct intr_map_data *data) +{ + struct intr_map_data_fdt *daf; + uint32_t i, irq_num, irq_type; + + daf = (struct intr_map_data_fdt *)data; + if (daf->ncells != 2) + return (NULL); + + irq_num = daf->cells[0]; + irq_type = daf->cells[1]; + if (irq_num >= MV_AP806_GICP_MAX_NIRQS) + return (NULL); + + /* Construct GIC compatible mapping. */ + sc->parent_map_data->ncells = 3; + sc->parent_map_data->cells[0] = 0; /* SPI */ + sc->parent_map_data->cells[2] = irq_type; + + /* Map the interrupt number to SPI number */ + for (i = 0; i < sc->spi_ranges_cnt / 2; i += 2) { + if (irq_num < sc->spi_ranges[i + 1]) { + irq_num += sc->spi_ranges[i]; + break; + } + + irq_num -= sc->spi_ranges[i]; + } + + sc->parent_map_data->cells[1] = irq_num - 32; + + return ((struct intr_map_data *)sc->parent_map_data); +} + + + + static int mv_ap806_gicp_activate_intr(device_t dev, struct intr_irqsrc *isrc, struct resource *res, struct intr_map_data *data) @@ -132,6 +177,9 @@ mv_ap806_gicp_activate_intr(device_t dev, struct intr_ struct mv_ap806_gicp_softc *sc; sc = device_get_softc(dev); + data = mv_ap806_gicp_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_ACTIVATE_INTR(sc->parent, isrc, res, data)); } @@ -161,36 +209,20 @@ mv_ap806_gicp_map_intr(device_t dev, struct intr_map_d struct intr_irqsrc **isrcp) { struct mv_ap806_gicp_softc *sc; - struct intr_map_data_fdt *daf; - uint32_t group, irq_num, irq_type; - int i; + int ret; sc = device_get_softc(dev); if (data->type != INTR_MAP_DATA_FDT) return (ENOTSUP); - daf = (struct intr_map_data_fdt *)data; - if (daf->ncells != 3 || daf->cells[0] >= MV_AP806_GICP_MAX_NIRQS) + data = mv_ap806_gicp_convert_map_data(sc, data); + if (data == NULL) return (EINVAL); - group = daf->cells[0]; - irq_num = daf->cells[1]; - irq_type = daf->cells[2]; - - /* Map the interrupt number to spi number */ - for (i = 0; i < sc->spi_ranges_cnt / 2; i += 2) { - if (irq_num < sc->spi_ranges[i + 1]) { - irq_num += sc->spi_ranges[i]; - break; - } - - irq_num -= sc->spi_ranges[i]; - } - - daf->cells[1] = irq_num - 32; - - return (PIC_MAP_INTR(sc->parent, data, isrcp)); + ret = PIC_MAP_INTR(sc->parent, data, isrcp); + (*isrcp)->isrc_dev = sc->dev; + return(ret); } static int @@ -201,6 +233,10 @@ mv_ap806_gicp_deactivate_intr(device_t dev, struct int sc = device_get_softc(dev); + data = mv_ap806_gicp_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); + return (PIC_DEACTIVATE_INTR(sc->parent, isrc, res, data)); } @@ -211,6 +247,9 @@ mv_ap806_gicp_setup_intr(device_t dev, struct intr_irq struct mv_ap806_gicp_softc *sc; sc = device_get_softc(dev); + data = mv_ap806_gicp_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_SETUP_INTR(sc->parent, isrc, res, data)); } @@ -222,6 +261,9 @@ mv_ap806_gicp_teardown_intr(device_t dev, struct intr_ struct mv_ap806_gicp_softc *sc; sc = device_get_softc(dev); + data = mv_ap806_gicp_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_TEARDOWN_INTR(sc->parent, isrc, res, data)); } Added: head/sys/arm/mv/mv_ap806_sei.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/mv_ap806_sei.c Sun Oct 20 10:48:27 2019 (r353773) @@ -0,0 +1,419 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include + +#include +#include + +#include "pic_if.h" + +#define MV_AP806_SEI_LOCK(_sc) mtx_lock(&(_sc)->mtx) +#define MV_AP806_SEI_UNLOCK(_sc) mtx_unlock(&(_sc)->mtx) +#define MV_AP806_SEI_LOCK_INIT(_sc) mtx_init(&_sc->mtx, \ + device_get_nameunit(_sc->dev), "mv_ap806_sei", MTX_DEF) +#define MV_AP806_SEI_LOCK_DESTROY(_sc) mtx_destroy(&_sc->mtx); +#define MV_AP806_SEI_ASSERT_LOCKED(_sc) mtx_assert(&_sc->mtx, MA_OWNED); +#define MV_AP806_SEI_ASSERT_UNLOCKED(_sc) mtx_assert(&_sc->mtx, MA_NOTOWNED); + +#define MV_AP806_SEI_MAX_NIRQS 64 +#define GICP_SECR0 0x00 +#define GICP_SECR1 0x04 +#define GICP_SECR(i) (0x00 + (((i)/32) * 0x4)) +#define GICP_SECR_BIT(i) ((i) % 32) +#define GICP_SEMR0 0x20 +#define GICP_SEMR1 0x24 +#define GICP_SEMR(i) (0x20 + (((i)/32) * 0x4)) +#define GICP_SEMR_BIT(i) ((i) % 32) + + + +struct mv_ap806_sei_irqsrc { + struct intr_irqsrc isrc; + u_int irq; +}; + +struct mv_ap806_sei_softc { + device_t dev; + struct resource *mem_res; + struct resource *irq_res; + void *irq_ih; + struct mtx mtx; + + struct mv_ap806_sei_irqsrc *isrcs; +}; + +static struct ofw_compat_data compat_data[] = { + {"marvell,ap806-sei", 1}, + {NULL, 0} +}; + +#define RD4(sc, reg) bus_read_4((sc)->mem_res, (reg)) +#define WR4(sc, reg, val) bus_write_4((sc)->mem_res, (reg), (val)) + +static inline void +mv_ap806_sei_isrc_mask(struct mv_ap806_sei_softc *sc, + struct mv_ap806_sei_irqsrc *sisrc, uint32_t val) +{ + uint32_t tmp; + int bit; + + bit = GICP_SEMR_BIT(sisrc->irq); + MV_AP806_SEI_LOCK(sc); + tmp = RD4(sc, GICP_SEMR(sisrc->irq)); + if (val != 0) + tmp |= 1 << bit; + else + tmp &= ~(1 << bit); + WR4(sc, GICP_SEMR(sisrc->irq), tmp); + MV_AP806_SEI_UNLOCK(sc); +} + +static inline void +mv_ap806_sei_isrc_eoi(struct mv_ap806_sei_softc *sc, + struct mv_ap806_sei_irqsrc *sisrc) +{ + + WR4(sc, GICP_SECR(sisrc->irq), GICP_SECR_BIT(sisrc->irq)); +} + +static void +mv_ap806_sei_enable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + mv_ap806_sei_isrc_mask(sc, sisrc, 0); +} + +static void +mv_ap806_sei_disable_intr(device_t dev, struct intr_irqsrc *isrc) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + mv_ap806_sei_isrc_mask(sc, sisrc, 1); +} + +static int +mv_ap806_sei_map(device_t dev, struct intr_map_data *data, u_int *irqp) +{ + struct mv_ap806_sei_softc *sc; + struct intr_map_data_fdt *daf; + u_int irq; + + sc = device_get_softc(dev); + + if (data->type != INTR_MAP_DATA_FDT) + return (ENOTSUP); + + daf = (struct intr_map_data_fdt *)data; + if (daf->ncells != 1 || daf->cells[0] >= MV_AP806_SEI_MAX_NIRQS) + return (EINVAL); + irq = daf->cells[0]; + if (irqp != NULL) + *irqp = irq; + + return(0); +} + +static int +mv_ap806_sei_map_intr(device_t dev, struct intr_map_data *data, + struct intr_irqsrc **isrcp) +{ + struct mv_ap806_sei_softc *sc; + u_int irq; + int rv; + + sc = device_get_softc(dev); + rv = mv_ap806_sei_map(dev, data, &irq); + if (rv == 0) + *isrcp = &sc->isrcs[irq].isrc; + + return (rv); +} + + + +static int +mv_ap806_sei_setup_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + u_int irq; + int rv; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + if (data == NULL) + return (ENOTSUP); + rv = mv_ap806_sei_map(dev, data, &irq); + if (rv != 0) + return (rv); + if (irq != sisrc->irq) + return (EINVAL); + mv_ap806_sei_isrc_mask(sc, sisrc, 0); + return (0); +} + +static int +mv_ap806_sei_teardown_intr(device_t dev, struct intr_irqsrc *isrc, + struct resource *res, struct intr_map_data *data) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + + mv_ap806_sei_isrc_mask(sc, sisrc, 1); + return (0); +} + +static void +mv_ap806_sei_pre_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + + mv_ap806_sei_isrc_mask(sc, sisrc, 1); + mv_ap806_sei_isrc_eoi(sc, sisrc); +} + +static void +mv_ap806_sei_post_ithread(device_t dev, struct intr_irqsrc *isrc) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + + mv_ap806_sei_isrc_mask(sc, sisrc, 1); +} + +static void +mv_ap806_sei_post_filter(device_t dev, struct intr_irqsrc *isrc) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sisrc; + + sc = device_get_softc(dev); + sisrc = (struct mv_ap806_sei_irqsrc *)isrc; + + mv_ap806_sei_isrc_mask(sc, sisrc, 1); + mv_ap806_sei_isrc_eoi(sc, sisrc); +} + +/* ---------------------------------------------------------------------------- + * + * B u s i n t e r f a c e + */ +static int +mv_ap806_sei_intr(void *arg) +{ + struct mv_ap806_sei_softc *sc; + struct mv_ap806_sei_irqsrc *sirq; + struct trapframe *tf; + uint64_t cause; + u_int irq; + + sc = (struct mv_ap806_sei_softc *)arg; + tf = curthread->td_intr_frame; + while (1) { + cause = RD4(sc, GICP_SECR1); + cause <<= 32; + cause |= RD4(sc, GICP_SECR0); + + irq = ffsll(cause); + if (irq == 0) break; + irq--; + sirq = &sc->isrcs[irq]; + if (intr_isrc_dispatch(&sirq->isrc, tf) != 0) { + mv_ap806_sei_isrc_mask(sc, sirq, 0); + mv_ap806_sei_isrc_eoi(sc, sirq); + device_printf(sc->dev, + "Stray irq %u disabled\n", irq); + } + } + + return (FILTER_HANDLED); +} + + +static int +mv_ap806_sei_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Marvell SEI"); + return (BUS_PROBE_DEFAULT); +} + +static int +mv_ap806_sei_attach(device_t dev) +{ + struct mv_ap806_sei_softc *sc; + phandle_t xref, node; + uint32_t irq; + const char *name; + int rv, rid; + + sc = device_get_softc(dev); + sc->dev = dev; + node = ofw_bus_get_node(dev); + MV_AP806_SEI_LOCK_INIT(sc); + + /* Allocate resources. */ + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "Cannot allocate memory resources\n"); + rv = ENXIO; + goto fail; + } + + rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); + if (sc->irq_res == NULL) { + device_printf(dev, "Cannot allocate IRQ resources\n"); + rv = ENXIO; + goto fail; + } + + /* Mask all interrupts) */ + WR4(sc, GICP_SEMR0, 0xFFFFFFFF); + WR4(sc, GICP_SEMR1, 0xFFFFFFFF); + + /* Create all interrupt sources */ + sc->isrcs = malloc(sizeof(*sc->isrcs) * MV_AP806_SEI_MAX_NIRQS, + M_DEVBUF, M_WAITOK | M_ZERO); + name = device_get_nameunit(sc->dev); + for (irq = 0; irq < MV_AP806_SEI_MAX_NIRQS; irq++) { + sc->isrcs[irq].irq = irq; + rv = intr_isrc_register(&sc->isrcs[irq].isrc, + sc->dev, 0, "%s,%u", name, irq); + if (rv != 0) + goto fail; /* XXX deregister ISRCs */ + } + xref = OF_xref_from_node(node);; + if (intr_pic_register(dev, xref) == NULL) { + device_printf(dev, "Cannot register SEI\n"); + rv = ENXIO; + goto fail; + } + if (bus_setup_intr(dev, sc->irq_res,INTR_TYPE_MISC | INTR_MPSAFE, + mv_ap806_sei_intr, NULL, sc, &sc->irq_ih)) { + device_printf(dev, + "Unable to register interrupt handler\n"); + rv = ENXIO; + goto fail; + } + + OF_device_register_xref(xref, dev); + return (0); + +fail: + if (sc->irq_ih != NULL) + bus_teardown_intr(dev, sc->irq_res, sc->irq_ih); + if (sc->irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); + if (sc->mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res); + MV_AP806_SEI_LOCK_DESTROY(sc); + return (ENXIO); +} + +static int +mv_ap806_sei_detach(device_t dev) +{ + + return (EBUSY); +} + + +static device_method_t mv_ap806_sei_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, mv_ap806_sei_probe), + DEVMETHOD(device_attach, mv_ap806_sei_attach), + DEVMETHOD(device_detach, mv_ap806_sei_detach), + + /* Interrupt controller interface */ + DEVMETHOD(pic_disable_intr, mv_ap806_sei_disable_intr), + DEVMETHOD(pic_enable_intr, mv_ap806_sei_enable_intr), + DEVMETHOD(pic_map_intr, mv_ap806_sei_map_intr), + DEVMETHOD(pic_setup_intr, mv_ap806_sei_setup_intr), + DEVMETHOD(pic_teardown_intr, mv_ap806_sei_teardown_intr), + DEVMETHOD(pic_post_filter, mv_ap806_sei_post_filter), + DEVMETHOD(pic_post_ithread, mv_ap806_sei_post_ithread), + DEVMETHOD(pic_pre_ithread, mv_ap806_sei_pre_ithread), + + DEVMETHOD_END +}; + +static devclass_t mv_ap806_sei_devclass; + +static driver_t mv_ap806_sei_driver = { + "mv_ap806_sei", + mv_ap806_sei_methods, + sizeof(struct mv_ap806_sei_softc), +}; + +EARLY_DRIVER_MODULE(mv_ap806_sei, simplebus, mv_ap806_sei_driver, + mv_ap806_sei_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_MIDDLE); Modified: head/sys/arm/mv/mv_cp110_clock.c ============================================================================== --- head/sys/arm/mv/mv_cp110_clock.c Sun Oct 20 01:09:14 2019 (r353772) +++ head/sys/arm/mv/mv_cp110_clock.c Sun Oct 20 10:48:27 2019 (r353773) @@ -44,17 +44,17 @@ __FBSDID("$FreeBSD$"); #include #include -#include +#include +#include +#include #include #include -#include -#include - #include #include "clkdev_if.h" +#include "syscon_if.h" /* Clocks */ static struct clk_fixed_def cp110_clk_pll_0 = { @@ -126,24 +126,19 @@ static struct cp110_gate cp110_gates[] = { }; struct mv_cp110_clock_softc { - struct simplebus_softc simplebus_sc; device_t dev; - struct resource *res; + struct syscon *syscon; struct mtx mtx; }; -static struct resource_spec mv_cp110_clock_res_spec[] = { - { SYS_RES_MEMORY, 0, RF_ACTIVE | RF_SHAREABLE }, - { -1, 0 } -}; static struct ofw_compat_data compat_data[] = { {"marvell,cp110-clock", 1}, {NULL, 0} }; -#define RD4(sc, reg) bus_read_4((sc)->res, (reg)) -#define WR4(sc, reg, val) bus_write_4((sc)->res, (reg), (val)) +#define RD4(sc, reg) SYSCON_READ_4((sc)->syscon, (reg)) +#define WR4(sc, reg, val) SYSCON_WRITE_4((sc)->syscon, (reg), (val)) static char * mv_cp110_clock_name(device_t dev, const char *name) @@ -201,8 +196,9 @@ mv_cp110_clock_attach(device_t dev) sc = device_get_softc(dev); sc->dev = dev; - if (bus_alloc_resources(dev, mv_cp110_clock_res_spec, &sc->res) != 0) { - device_printf(dev, "cannot allocate resources for device\n"); + if (SYSCON_GET_HANDLE(sc->dev, &sc->syscon) != 0 || + sc->syscon == NULL) { + device_printf(dev, "cannot get syscon for device\n"); return (ENXIO); } Modified: head/sys/arm/mv/mv_cp110_icu.c ============================================================================== --- head/sys/arm/mv/mv_cp110_icu.c Sun Oct 20 01:09:14 2019 (r353772) +++ head/sys/arm/mv/mv_cp110_icu.c Sun Oct 20 10:48:27 2019 (r353773) @@ -49,6 +49,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "pic_if.h" #define ICU_GRP_NSR 0x0 @@ -72,6 +73,7 @@ struct mv_cp110_icu_softc { device_t dev; device_t parent; struct resource *res; + struct intr_map_data_fdt *parent_map_data; }; static struct resource_spec mv_cp110_icu_res_spec[] = { @@ -80,8 +82,9 @@ static struct resource_spec mv_cp110_icu_res_spec[] = }; static struct ofw_compat_data compat_data[] = { - {"marvell,cp110-icu", 1}, - {NULL, 0} + {"marvell,cp110-icu-nsr", 1}, + {"marvell,cp110-icu-sei", 2}, + {NULL, 0} }; #define RD4(sc, reg) bus_read_4((sc)->res, (reg)) @@ -130,6 +133,11 @@ mv_cp110_icu_attach(device_t dev) device_printf(dev, "Cannot register ICU\n"); goto fail; } + + /* Allocate GICP compatible mapping entry (2 cells) */ + sc->parent_map_data = (struct intr_map_data_fdt *)intr_alloc_map_data( + INTR_MAP_DATA_FDT, sizeof(struct intr_map_data_fdt) + + + 3 * sizeof(phandle_t), M_WAITOK | M_ZERO); return (0); fail: @@ -137,6 +145,35 @@ fail: return (ENXIO); } +static struct intr_map_data * +mv_cp110_icu_convert_map_data(struct mv_cp110_icu_softc *sc, struct intr_map_data *data) +{ + struct intr_map_data_fdt *daf; + uint32_t reg, irq_no, irq_type; + + daf = (struct intr_map_data_fdt *)data; + if (daf->ncells != 2) + return (NULL); + irq_no = daf->cells[0]; + irq_type = daf->cells[1]; + if (irq_no >= MV_CP110_ICU_MAX_NIRQS) + return (NULL); + if (irq_type != IRQ_TYPE_LEVEL_HIGH && + irq_type != IRQ_TYPE_EDGE_RISING) + return (NULL); + + /* We rely on fact that ICU->GIC mapping is preset by bootstrap. */ + reg = RD4(sc, ICU_INT_CFG(irq_no)); + + /* Construct GICP compatible mapping. */ + sc->parent_map_data->ncells = 2; + sc->parent_map_data->cells[0] = reg & ICU_INT_MASK; + sc->parent_map_data->cells[1] = irq_type; + + return ((struct intr_map_data *)sc->parent_map_data); +} + + static int mv_cp110_icu_detach(device_t dev) { @@ -151,7 +188,9 @@ mv_cp110_icu_activate_intr(device_t dev, struct intr_i struct mv_cp110_icu_softc *sc; sc = device_get_softc(dev); - + data = mv_cp110_icu_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_ACTIVATE_INTR(sc->parent, isrc, res, data)); } @@ -159,7 +198,6 @@ static void mv_cp110_icu_enable_intr(device_t dev, struct intr_irqsrc *isrc) { struct mv_cp110_icu_softc *sc; - sc = device_get_softc(dev); PIC_ENABLE_INTR(sc->parent, isrc); @@ -175,32 +213,43 @@ mv_cp110_icu_disable_intr(device_t dev, struct intr_ir PIC_DISABLE_INTR(sc->parent, isrc); } + + static int mv_cp110_icu_map_intr(device_t dev, struct intr_map_data *data, struct intr_irqsrc **isrcp) { struct mv_cp110_icu_softc *sc; struct intr_map_data_fdt *daf; - uint32_t reg; + uint32_t reg, irq_no, irq_type; + int ret; sc = device_get_softc(dev); if (data->type != INTR_MAP_DATA_FDT) return (ENOTSUP); + /* Parse original */ daf = (struct intr_map_data_fdt *)data; - if (daf->ncells != 3 || daf->cells[0] >= MV_CP110_ICU_MAX_NIRQS) + if (daf->ncells != 2) return (EINVAL); + irq_no = daf->cells[0]; + irq_type = daf->cells[1]; + data = mv_cp110_icu_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); - reg = RD4(sc, ICU_INT_CFG(daf->cells[1])); + reg = RD4(sc, ICU_INT_CFG(irq_no)); + reg |= ICU_INT_ENABLE; + if (irq_type == IRQ_TYPE_LEVEL_HIGH) + reg &= ~ICU_INT_EDGE; + else + reg |= ICU_INT_EDGE; + WR4(sc, ICU_INT_CFG(irq_no), reg); - if ((reg & ICU_INT_ENABLE) == 0) { - reg |= ICU_INT_ENABLE; - WR4(sc, ICU_INT_CFG(daf->cells[1]), reg); - } - - daf->cells[1] = reg & ICU_INT_MASK; - return (PIC_MAP_INTR(sc->parent, data, isrcp)); + ret = PIC_MAP_INTR(sc->parent, data, isrcp); + (*isrcp)->isrc_dev = sc->dev; + return (ret); } static int @@ -210,6 +259,9 @@ mv_cp110_icu_deactivate_intr(device_t dev, struct intr struct mv_cp110_icu_softc *sc; sc = device_get_softc(dev); + data = mv_cp110_icu_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_DEACTIVATE_INTR(sc->parent, isrc, res, data)); } @@ -221,6 +273,9 @@ mv_cp110_icu_setup_intr(device_t dev, struct intr_irqs struct mv_cp110_icu_softc *sc; sc = device_get_softc(dev); + data = mv_cp110_icu_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_SETUP_INTR(sc->parent, isrc, res, data)); } @@ -232,6 +287,9 @@ mv_cp110_icu_teardown_intr(device_t dev, struct intr_i struct mv_cp110_icu_softc *sc; sc = device_get_softc(dev); + data = mv_cp110_icu_convert_map_data(sc, data); + if (data == NULL) + return (EINVAL); return (PIC_TEARDOWN_INTR(sc->parent, isrc, res, data)); } @@ -295,5 +353,5 @@ static driver_t mv_cp110_icu_driver = { sizeof(struct mv_cp110_icu_softc), }; -EARLY_DRIVER_MODULE(mv_cp110_icu, simplebus, mv_cp110_icu_driver, +EARLY_DRIVER_MODULE(mv_cp110_icu, mv_cp110_icu_bus, mv_cp110_icu_driver, mv_cp110_icu_devclass, 0, 0, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LAST); Added: head/sys/arm/mv/mv_cp110_icu_bus.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/mv/mv_cp110_icu_bus.c Sun Oct 20 10:48:27 2019 (r353773) @@ -0,0 +1,78 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include + +static struct ofw_compat_data compat_data[] = { + {"marvell,cp110-icu", 1}, + {NULL, 0} +}; + +static int +mv_cp110_icu_bus_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Marvell Interrupt Consolidation Unit Bus"); + return (BUS_PROBE_DEFAULT); +} + +static device_method_t mv_cp110_icu_bus_methods[] = { + DEVMETHOD(device_probe, mv_cp110_icu_bus_probe), + + DEVMETHOD_END +}; + +DEFINE_CLASS_1(mv_cp110_icu_bus, mv_cp110_icu_bus_driver, + mv_cp110_icu_bus_methods, sizeof(struct simple_mfd_softc), + simple_mfd_driver); + +static devclass_t mv_cp110_icu_bus_devclass; +EARLY_DRIVER_MODULE(mv_cp110_icu_bus, simplebus, mv_cp110_icu_bus_driver, + mv_cp110_icu_bus_devclass, 0, 0, BUS_PASS_INTERRUPT); +MODULE_VERSION(mv_cp110_icu_bus, 1); Modified: head/sys/arm/mv/mv_thermal.c ============================================================================== --- head/sys/arm/mv/mv_thermal.c Sun Oct 20 01:09:14 2019 (r353772) +++ head/sys/arm/mv/mv_thermal.c Sun Oct 20 10:48:27 2019 (r353773) @@ -44,13 +44,14 @@ __FBSDID("$FreeBSD$"); #include #include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Oct 20 11:11:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9A3615BB47; Sun, 20 Oct 2019 11:11:33 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46wxsx3t7Lz4d7f; Sun, 20 Oct 2019 11:11:33 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67FDCAD5D; Sun, 20 Oct 2019 11:11:33 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KBBX72049075; Sun, 20 Oct 2019 11:11:33 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KBBWXP049070; Sun, 20 Oct 2019 11:11:32 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <201910201111.x9KBBWXP049070@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 20 Oct 2019 11:11:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353774 - in head/sys: conf dev/pci X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: conf dev/pci X-SVN-Commit-Revision: 353774 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 11:11:33 -0000 Author: mmel Date: Sun Oct 20 11:11:32 2019 New Revision: 353774 URL: https://svnweb.freebsd.org/changeset/base/353774 Log: Add driver for DesignWare PCIE core, and its Armada 8K specific attachement. MFC after: 3 weeks Added: head/sys/dev/pci/pci_dw.c (contents, props changed) head/sys/dev/pci/pci_dw.h (contents, props changed) head/sys/dev/pci/pci_dw_if.m (contents, props changed) head/sys/dev/pci/pci_dw_mv.c (contents, props changed) Modified: head/sys/conf/files.arm64 Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Sun Oct 20 10:48:27 2019 (r353773) +++ head/sys/conf/files.arm64 Sun Oct 20 11:11:32 2019 (r353774) @@ -246,6 +246,9 @@ dev/ofw/ofwpci.c optional fdt pci dev/pci/pci_host_generic.c optional pci dev/pci/pci_host_generic_acpi.c optional pci acpi dev/pci/pci_host_generic_fdt.c optional pci fdt +dev/pci/pci_dw_mv.c optional pci fdt +dev/pci/pci_dw.c optional pci fdt +dev/pci/pci_dw_if.m optional pci fdt dev/psci/psci.c standard dev/psci/smccc_arm64.S standard dev/psci/smccc.c standard Added: head/sys/dev/pci/pci_dw.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/pci/pci_dw.c Sun Oct 20 11:11:32 2019 (r353774) @@ -0,0 +1,697 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +/* Base class for all Synopsys DesignWare PCI/PCIe drivers */ + +#include +__FBSDID("$FreeBSD$"); + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "pcib_if.h" +#include "pci_dw_if.h" + +#define DEBUG +#ifdef DEBUG +#define debugf(fmt, args...) do { printf(fmt,##args); } while (0) +#else +#define debugf(fmt, args...) +#endif + +#define DBI_WR1(sc, reg, val) pci_dw_dbi_wr1((sc)->dev, reg, val) +#define DBI_WR2(sc, reg, val) pci_dw_dbi_wr2((sc)->dev, reg, val) +#define DBI_WR4(sc, reg, val) pci_dw_dbi_wr4((sc)->dev, reg, val) +#define DBI_RD1(sc, reg) pci_dw_dbi_rd1((sc)->dev, reg) +#define DBI_RD2(sc, reg) pci_dw_dbi_rd2((sc)->dev, reg) +#define DBI_RD4(sc, reg) pci_dw_dbi_rd4((sc)->dev, reg) + +#define PCI_BUS_SHIFT 20 +#define PCI_SLOT_SHIFT 15 +#define PCI_FUNC_SHIFT 12 +#define PCI_BUS_MASK 0xFF +#define PCI_SLOT_MASK 0x1F +#define PCI_FUNC_MASK 0x07 +#define PCI_REG_MASK 0xFFF + + +#define IATU_CFG_BUS(bus) ((uint64_t)((bus) & 0xff) << 24) +#define IATU_CFG_SLOT(slot) ((uint64_t)((slot) & 0x1f) << 19) +#define IATU_CFG_FUNC(func) ((uint64_t)((func) & 0x07) << 16) + + + +static uint32_t +pci_dw_dbi_read(device_t dev, u_int reg, int width) +{ + struct pci_dw_softc *sc; + + sc = device_get_softc(dev); + MPASS(sc->dbi_res != NULL); + + switch (width) { + case 4: + return (bus_read_4(sc->dbi_res, reg)); + case 2: + return (bus_read_2(sc->dbi_res, reg)); + case 1: + return (bus_read_1(sc->dbi_res, reg)); + default: + device_printf(sc->dev, "Unsupported width: %d\n", width); + return (0xFFFFFFFF); + } +} + +static void +pci_dw_dbi_write(device_t dev, u_int reg, uint32_t val, int width) +{ + struct pci_dw_softc *sc; + + sc = device_get_softc(dev); + MPASS(sc->dbi_res != NULL); + + switch (width) { + case 4: + bus_write_4(sc->dbi_res, reg, val); + break; + case 2: + bus_write_2(sc->dbi_res, reg, val); + break; + case 1: + bus_write_1(sc->dbi_res, reg, val); + break; + default: + device_printf(sc->dev, "Unsupported width: %d\n", width); + break; + } +} + + +static void +pci_dw_dbi_protect(struct pci_dw_softc *sc, bool protect) +{ + uint32_t reg; + + reg = DBI_RD4(sc, DW_MISC_CONTROL_1); + if (protect) + reg &= ~DBI_RO_WR_EN; + else + reg |= DBI_RO_WR_EN; + DBI_WR4(sc, DW_MISC_CONTROL_1, reg); +} + +static bool +pci_dw_check_dev(struct pci_dw_softc *sc, u_int bus, u_int slot, u_int func, + u_int reg) +{ + bool status; + int rv; + + if (bus < sc->bus_start || bus > sc->bus_end || slot > PCI_SLOTMAX || + func > PCI_FUNCMAX || reg > PCI_REGMAX) + return (false); + + /* link is needed for access to all non-root busses */ + if (bus != sc->root_bus) { + rv = PCI_DW_GET_LINK(sc->dev, &status); + if (rv != 0 || !status) + return (false); + return (true); + } + + /* we have only 1 device with 1 function root port */ + if (slot > 0 || func > 0) + return (false); + return (true); +} + +/* Map one uoutbound ATU region */ +static int +pci_dw_map_out_atu(struct pci_dw_softc *sc, int idx, int type, + uint64_t pa, uint64_t pci_addr, uint32_t size) +{ + uint32_t reg; + int i; + + if (size == 0) + return (0); + + DBI_WR4(sc, DW_IATU_VIEWPORT, IATU_REGION_INDEX(idx)); + DBI_WR4(sc, DW_IATU_LWR_BASE_ADDR, pa & 0xFFFFFFFF); + DBI_WR4(sc, DW_IATU_UPPER_BASE_ADDR, (pa >> 32) & 0xFFFFFFFF); + DBI_WR4(sc, DW_IATU_LIMIT_ADDR, (pa + size - 1) & 0xFFFFFFFF); + DBI_WR4(sc, DW_IATU_LWR_TARGET_ADDR, pci_addr & 0xFFFFFFFF); + DBI_WR4(sc, DW_IATU_UPPER_TARGET_ADDR, (pci_addr >> 32) & 0xFFFFFFFF); + DBI_WR4(sc, DW_IATU_CTRL1, IATU_CTRL1_TYPE(type)); + DBI_WR4(sc, DW_IATU_CTRL2, IATU_CTRL2_REGION_EN); + + /* Wait until setup becomes valid */ + for (i = 10; i > 0; i--) { + reg = DBI_RD4(sc, DW_IATU_CTRL2); + if (reg & IATU_CTRL2_REGION_EN) + return (0); + DELAY(5); + } + device_printf(sc->dev, + "Cannot map outbound region(%d) in iATU\n", idx); + return (ETIMEDOUT); +} + +static int +pci_dw_setup_hw(struct pci_dw_softc *sc) +{ + uint32_t reg; + int rv; + + pci_dw_dbi_protect(sc, false); + + /* Setup config registers */ + DBI_WR1(sc, PCIR_CLASS, PCIC_BRIDGE); + DBI_WR1(sc, PCIR_SUBCLASS, PCIS_BRIDGE_PCI); + DBI_WR4(sc, PCIR_BAR(0), 4); + DBI_WR4(sc, PCIR_BAR(1), 0); + DBI_WR1(sc, PCIR_INTPIN, 1); + DBI_WR1(sc, PCIR_PRIBUS_1, sc->root_bus); + DBI_WR1(sc, PCIR_SECBUS_1, sc->sub_bus); + DBI_WR1(sc, PCIR_SUBBUS_1, sc->bus_end); + DBI_WR2(sc, PCIR_COMMAND, + PCIM_CMD_PORTEN | PCIM_CMD_MEMEN | + PCIM_CMD_BUSMASTEREN | PCIM_CMD_SERRESPEN); + pci_dw_dbi_protect(sc, true); + + /* Setup outbound memory window */ + rv = pci_dw_map_out_atu(sc, 0, IATU_CTRL1_TYPE_MEM, + sc->mem_range.host, sc->mem_range.pci, sc->mem_range.size); + if (rv != 0) + return (rv); + + /* If we have enouht viewports ..*/ + if (sc->num_viewport >= 3) { + /* Setup outbound I/O window */ + rv = pci_dw_map_out_atu(sc, 0, IATU_CTRL1_TYPE_MEM, + sc->io_range.host, sc->io_range.pci, sc->io_range.size); + if (rv != 0) + return (rv); + } + /* XXX Should we handle also prefetch memory? */ + + + /* Adjust number of lanes */ + reg = DBI_RD4(sc, DW_PORT_LINK_CTRL); + reg &= ~PORT_LINK_CAPABLE(~0); + switch (sc->num_lanes) { + case 1: + reg |= PORT_LINK_CAPABLE(PORT_LINK_CAPABLE_1); + break; + case 2: + reg |= PORT_LINK_CAPABLE(PORT_LINK_CAPABLE_2); + break; + case 4: + reg |= PORT_LINK_CAPABLE(PORT_LINK_CAPABLE_4); + break; + case 8: + reg |= PORT_LINK_CAPABLE(PORT_LINK_CAPABLE_8); + break; + case 16: + reg |= PORT_LINK_CAPABLE(PORT_LINK_CAPABLE_16); + break; + case 32: + reg |= PORT_LINK_CAPABLE(PORT_LINK_CAPABLE_32); + break; + default: + device_printf(sc->dev, + "'num-lanes' property have invalid value: %d\n", + sc->num_lanes); + return (EINVAL); + } + DBI_WR4(sc, DW_PORT_LINK_CTRL, reg); + + + /* And link width */ + reg = DBI_RD4(sc, DW_GEN2_CTRL); + reg &= ~GEN2_CTRL_NUM_OF_LANES(~0); + switch (sc->num_lanes) { + case 1: + reg |= GEN2_CTRL_NUM_OF_LANES(GEN2_CTRL_NUM_OF_LANES_1); + break; + case 2: + reg |= GEN2_CTRL_NUM_OF_LANES(GEN2_CTRL_NUM_OF_LANES_2); + break; + case 4: + reg |= GEN2_CTRL_NUM_OF_LANES(GEN2_CTRL_NUM_OF_LANES_4); + break; + case 8: + reg |= GEN2_CTRL_NUM_OF_LANES(GEN2_CTRL_NUM_OF_LANES_8); + break; + case 16: + reg |= GEN2_CTRL_NUM_OF_LANES(GEN2_CTRL_NUM_OF_LANES_16); + break; + case 32: + reg |= GEN2_CTRL_NUM_OF_LANES(GEN2_CTRL_NUM_OF_LANES_32); + break; + } + DBI_WR4(sc, DW_GEN2_CTRL, reg); + + reg = DBI_RD4(sc, DW_GEN2_CTRL); + reg |= DIRECT_SPEED_CHANGE; + DBI_WR4(sc, DW_GEN2_CTRL, reg); + + + return (0); +} + +static int +pci_dw_decode_ranges(struct pci_dw_softc *sc, struct ofw_pci_range *ranges, + int nranges) +{ + int i; + + for (i = 0; i < nranges; i++) { + if ((ranges[i].pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) == + OFW_PCI_PHYS_HI_SPACE_IO) { + if (sc->io_range.size != 0) { + device_printf(sc->dev, + "Duplicated IO range found in DT\n"); + return (ENXIO); + } + sc->io_range = ranges[i]; + } + if (((ranges[i].pci_hi & OFW_PCI_PHYS_HI_SPACEMASK) == + OFW_PCI_PHYS_HI_SPACE_MEM32)) { + if (ranges[i].pci_hi & OFW_PCI_PHYS_HI_PREFETCHABLE) { + if (sc->pref_mem_range.size != 0) { + device_printf(sc->dev, + "Duplicated memory range found " + "in DT\n"); + return (ENXIO); + } + sc->pref_mem_range = ranges[i]; + } else { + if (sc->mem_range.size != 0) { + device_printf(sc->dev, + "Duplicated memory range found " + "in DT\n"); + return (ENXIO); + } + sc->mem_range = ranges[i]; + } + } + } + if ((sc->io_range.size == 0) || (sc->mem_range.size == 0)) { + device_printf(sc->dev, + " Not all required ranges are found in DT\n"); + return (ENXIO); + } + return (0); +} + + + +/*----------------------------------------------------------------------------- + * + * P C I B I N T E R F A C E + */ + +static uint32_t +pci_dw_read_config(device_t dev, u_int bus, u_int slot, + u_int func, u_int reg, int bytes) +{ + struct pci_dw_softc *sc; + struct resource *res; + uint32_t data; + uint64_t addr; + int type, rv; + + sc = device_get_softc(dev); + + if (!pci_dw_check_dev(sc, bus, slot, func, reg)) + return (0xFFFFFFFFU); + + if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || + (reg > PCI_REGMAX)) + return (0xFFFFFFFFU); + + if (bus == sc->root_bus) { + res = (sc->dbi_res); + } else { + addr = IATU_CFG_BUS(bus) | IATU_CFG_SLOT(slot) | + IATU_CFG_FUNC(func); + if (bus == sc->sub_bus) + type = IATU_CTRL1_TYPE_CFG0; + else + type = IATU_CTRL1_TYPE_CFG1; + rv = pci_dw_map_out_atu(sc, 1, type, + sc->cfg_pa, addr, sc->cfg_size); + if (rv != 0) + return (0xFFFFFFFFU); + res = sc->cfg_res; + } + + switch (bytes) { + case 1: + data = bus_read_1(res, reg); + break; + case 2: + data = bus_read_2(res, reg); + break; + case 4: + data = bus_read_4(res, reg); + break; + default: + data = 0xFFFFFFFFU; + } + + return (data); + +} + +static void +pci_dw_write_config(device_t dev, u_int bus, u_int slot, + u_int func, u_int reg, uint32_t val, int bytes) +{ + struct pci_dw_softc *sc; + struct resource *res; + uint64_t addr; + int type, rv; + + sc = device_get_softc(dev); + if (!pci_dw_check_dev(sc, bus, slot, func, reg)) + return; + + if ((slot > PCI_SLOTMAX) || (func > PCI_FUNCMAX) || + (reg > PCI_REGMAX)) + return; + + if (bus == sc->root_bus) { + res = (sc->dbi_res); + } else { + addr = IATU_CFG_BUS(bus) | IATU_CFG_SLOT(slot) | + IATU_CFG_FUNC(func); + if (bus == sc->sub_bus) + type = IATU_CTRL1_TYPE_CFG0; + else + type = IATU_CTRL1_TYPE_CFG1; + rv = pci_dw_map_out_atu(sc, 1, type, + sc->cfg_pa, addr, sc->cfg_size); + if (rv != 0) + return ; + res = sc->cfg_res; + } + + + switch (bytes) { + case 1: + bus_write_1(res, reg, val); + break; + case 2: + bus_write_2(res, reg, val); + break; + case 4: + bus_write_4(res, reg, val); + break; + default: + break; + } +} + +static int +pci_dw_alloc_msi(device_t pci, device_t child, int count, + int maxcount, int *irqs) +{ + phandle_t msi_parent; + int rv; + + rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), + &msi_parent, NULL); + if (rv != 0) + return (rv); + + return (intr_alloc_msi(pci, child, msi_parent, count, maxcount, + irqs)); +} + +static int +pci_dw_release_msi(device_t pci, device_t child, int count, int *irqs) +{ + phandle_t msi_parent; + int rv; + + rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), + &msi_parent, NULL); + if (rv != 0) + return (rv); + return (intr_release_msi(pci, child, msi_parent, count, irqs)); +} + +static int +pci_dw_map_msi(device_t pci, device_t child, int irq, uint64_t *addr, + uint32_t *data) +{ + phandle_t msi_parent; + int rv; + + rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), + &msi_parent, NULL); + if (rv != 0) + return (rv); + + return (intr_map_msi(pci, child, msi_parent, irq, addr, data)); +} + +static int +pci_dw_alloc_msix(device_t pci, device_t child, int *irq) +{ + phandle_t msi_parent; + int rv; + + rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), + &msi_parent, NULL); + if (rv != 0) + return (rv); + return (intr_alloc_msix(pci, child, msi_parent, irq)); +} + +static int +pci_dw_release_msix(device_t pci, device_t child, int irq) +{ + phandle_t msi_parent; + int rv; + + rv = ofw_bus_msimap(ofw_bus_get_node(pci), pci_get_rid(child), + &msi_parent, NULL); + if (rv != 0) + return (rv); + return (intr_release_msix(pci, child, msi_parent, irq)); +} + +static int +pci_dw_get_id(device_t pci, device_t child, enum pci_id_type type, + uintptr_t *id) +{ + phandle_t node; + int rv; + uint32_t rid; + uint16_t pci_rid; + + if (type != PCI_ID_MSI) + return (pcib_get_id(pci, child, type, id)); + + node = ofw_bus_get_node(pci); + pci_rid = pci_get_rid(child); + + rv = ofw_bus_msimap(node, pci_rid, NULL, &rid); + if (rv != 0) + return (rv); + *id = rid; + + return (0); +} + +/*----------------------------------------------------------------------------- + * + * B U S / D E V I C E I N T E R F A C E + */ +static bus_dma_tag_t +pci_dw_get_dma_tag(device_t dev, device_t child) +{ + struct pci_dw_softc *sc; + + sc = device_get_softc(dev); + return (sc->dmat); +} + +int +pci_dw_init(device_t dev) +{ + struct pci_dw_softc *sc; + int rv, rid; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->node = ofw_bus_get_node(dev); + + mtx_init(&sc->mtx, "pci_dw_mtx", NULL, MTX_DEF); + + /* XXXn Should not be this configurable ? */ + sc->bus_start = 0; + sc->bus_end = 255; + sc->root_bus = 0; + sc->sub_bus = 1; + + /* Read FDT properties */ + if (!sc->coherent) + sc->coherent = OF_hasprop(sc->node, "dma-coherent"); + + rv = OF_getencprop(sc->node, "num-viewport", &sc->num_viewport, + sizeof(sc->num_viewport)); + if (rv != sizeof(sc->num_viewport)) + sc->num_viewport = 2; + + rv = OF_getencprop(sc->node, "num-lanes", &sc->num_lanes, + sizeof(sc->num_viewport)); + if (rv != sizeof(sc->num_lanes)) + sc->num_lanes = 1; + if (sc->num_lanes != 1 && sc->num_lanes != 2 && + sc->num_lanes != 4 && sc->num_lanes != 8) { + device_printf(dev, + "invalid number of lanes: %d\n",sc->num_lanes); + sc->num_lanes = 0; + rv = ENXIO; + goto out; + } + + rid = 0; + rv = ofw_bus_find_string_index(sc->node, "reg-names", "config", &rid); + if (rv != 0) { + device_printf(dev, "Cannot get config space memory\n"); + rv = ENXIO; + goto out; + } + sc->cfg_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->cfg_res == NULL) { + device_printf(dev, "Cannot allocate config space(rid: %d)\n", + rid); + rv = ENXIO; + goto out; + } + + /* Fill up config region related variables */ + sc->cfg_size = rman_get_size(sc->cfg_res); + sc->cfg_pa = rman_get_start(sc->cfg_res) ; + + if (bootverbose) + device_printf(dev, "Bus is%s cache-coherent\n", + sc->coherent ? "" : " not"); + rv = bus_dma_tag_create(bus_get_dma_tag(dev), /* parent */ + 1, 0, /* alignment, bounds */ + BUS_SPACE_MAXADDR, /* lowaddr */ + BUS_SPACE_MAXADDR, /* highaddr */ + NULL, NULL, /* filter, filterarg */ + BUS_SPACE_MAXSIZE, /* maxsize */ + BUS_SPACE_UNRESTRICTED, /* nsegments */ + BUS_SPACE_MAXSIZE, /* maxsegsize */ + sc->coherent ? BUS_DMA_COHERENT : 0, /* flags */ + NULL, NULL, /* lockfunc, lockarg */ + &sc->dmat); + if (rv != 0) + goto out; + + rv = ofw_pci_init(dev); + if (rv != 0) + goto out; + rv = pci_dw_decode_ranges(sc, sc->ofw_pci.sc_range, + sc->ofw_pci.sc_nrange); + if (rv != 0) + goto out; + + rv = pci_dw_setup_hw(sc); + if (rv != 0) + goto out; + + device_add_child(dev, "pci", -1); + + return (bus_generic_attach(dev)); +out: + /* XXX Cleanup */ + return (rv); +} + +static device_method_t pci_dw_methods[] = { + + /* Bus interface */ + DEVMETHOD(bus_get_dma_tag, pci_dw_get_dma_tag), + + /* pcib interface */ + DEVMETHOD(pcib_read_config, pci_dw_read_config), + DEVMETHOD(pcib_write_config, pci_dw_write_config), + DEVMETHOD(pcib_alloc_msi, pci_dw_alloc_msi), + DEVMETHOD(pcib_release_msi, pci_dw_release_msi), + DEVMETHOD(pcib_alloc_msix, pci_dw_alloc_msix), + DEVMETHOD(pcib_release_msix, pci_dw_release_msix), + DEVMETHOD(pcib_map_msi, pci_dw_map_msi), + DEVMETHOD(pcib_get_id, pci_dw_get_id), + + /* OFW bus interface */ + DEVMETHOD(ofw_bus_get_compat, ofw_bus_gen_get_compat), + DEVMETHOD(ofw_bus_get_model, ofw_bus_gen_get_model), + DEVMETHOD(ofw_bus_get_name, ofw_bus_gen_get_name), + DEVMETHOD(ofw_bus_get_node, ofw_bus_gen_get_node), + DEVMETHOD(ofw_bus_get_type, ofw_bus_gen_get_type), + + /* PCI DW interface */ + DEVMETHOD(pci_dw_dbi_read, pci_dw_dbi_read), + DEVMETHOD(pci_dw_dbi_write, pci_dw_dbi_write), + DEVMETHOD_END +}; + +DEFINE_CLASS_1(pcib, pci_dw_driver, pci_dw_methods, + sizeof(struct pci_dw_softc), ofw_pci_driver); Added: head/sys/dev/pci/pci_dw.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/pci/pci_dw.h Sun Oct 20 11:11:32 2019 (r353774) @@ -0,0 +1,158 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * + * $FreeBSD$ + * + */ + +#ifndef _PCI_DW_H_ +#define _PCI_DW_H_ + +#include "pci_dw_if.h" + + +/* DesignWare CIe configuration registers */ +#define DW_PORT_LINK_CTRL 0x710 +#define PORT_LINK_CAPABLE(n) (((n) & 0x3F) << 16) +#define PORT_LINK_CAPABLE_1 0x01 +#define PORT_LINK_CAPABLE_2 0x03 +#define PORT_LINK_CAPABLE_4 0x07 +#define PORT_LINK_CAPABLE_8 0x0F +#define PORT_LINK_CAPABLE_16 0x1F +#define PORT_LINK_CAPABLE_32 0x3F + + +#define DW_GEN2_CTRL 0x80C +#define DIRECT_SPEED_CHANGE (1 << 17) +#define GEN2_CTRL_NUM_OF_LANES(n) (((n) & 0x3F) << 8) +#define GEN2_CTRL_NUM_OF_LANES_1 0x01 +#define GEN2_CTRL_NUM_OF_LANES_2 0x03 +#define GEN2_CTRL_NUM_OF_LANES_4 0x07 +#define GEN2_CTRL_NUM_OF_LANES_8 0x0F +#define GEN2_CTRL_NUM_OF_LANES_16 0x1F +#define GEN2_CTRL_NUM_OF_LANES_32 0x3F + +#define DW_MSI_ADDR_LO 0x820 +#define DW_MSI_ADDR_HI 0x824 +#define DW_MSI_INTR0_ENABLE 0x828 +#define DW_MSI_INTR0_MASK 0x82C +#define DW_MSI_INTR0_STATUS 0x830 + + +#define DW_MISC_CONTROL_1 0x8BC +#define DBI_RO_WR_EN (1 << 0) + +#define DW_IATU_VIEWPORT 0x900 +#define IATU_REGION_INBOUND (1U << 31) +#define IATU_REGION_INDEX(x) ((x) & 0x7) +#define DW_IATU_CTRL1 0x904 +#define IATU_CTRL1_TYPE(x) ((x) & 0x1F) +#define IATU_CTRL1_TYPE_MEM 0x0 +#define IATU_CTRL1_TYPE_IO 0x2 +#define IATU_CTRL1_TYPE_CFG0 0x4 +#define IATU_CTRL1_TYPE_CFG1 0x5 +#define DW_IATU_CTRL2 0x908 +#define IATU_CTRL2_REGION_EN (1U << 31) +#define DW_IATU_LWR_BASE_ADDR 0x90C +#define DW_IATU_UPPER_BASE_ADDR 0x910 +#define DW_IATU_LIMIT_ADDR 0x914 +#define DW_IATU_LWR_TARGET_ADDR 0x918 +#define DW_IATU_UPPER_TARGET_ADDR 0x91C + + +struct pci_dw_softc { + struct ofw_pci_softc ofw_pci; /* Must be first */ + + /* Filled by attachement stub */ + struct resource *dbi_res; + + /* pci_dw variables */ + device_t dev; + phandle_t node; + struct mtx mtx; + struct resource *cfg_res; + + struct ofw_pci_range mem_range; + struct ofw_pci_range pref_mem_range; + struct ofw_pci_range io_range; + + bool coherent; + bus_dma_tag_t dmat; + + int num_lanes; + int num_viewport; + bus_addr_t cfg_pa; /* PA of config memoty */ + bus_size_t cfg_size; /* size of config region */ + + u_int bus_start; + u_int bus_end; + u_int root_bus; + u_int sub_bus; +}; + +DECLARE_CLASS(pci_dw_driver); + + +static inline void +pci_dw_dbi_wr4(device_t dev, u_int reg, uint32_t val) +{ + PCI_DW_DBI_WRITE(dev, reg, val, 4); +} + +static inline void +pci_dw_dbi_wr2(device_t dev, u_int reg, uint16_t val) +{ + PCI_DW_DBI_WRITE(dev, reg, val, 2); +} + +static inline void +pci_dw_dbi_wr1(device_t dev, u_int reg, uint8_t val) +{ + PCI_DW_DBI_WRITE(dev, reg, val, 1); +} + +static inline uint32_t +pci_dw_dbi_rd4(device_t dev, u_int reg) +{ + return (PCI_DW_DBI_READ(dev, reg, 4)); +} + +static inline uint16_t +pci_dw_dbi_rd2(device_t dev, u_int reg) +{ + return ((uint16_t)PCI_DW_DBI_READ(dev, reg, 2)); +} + +static inline uint8_t +pci_dw_dbi_rd1(device_t dev, u_int reg) +{ + return ((uint8_t)PCI_DW_DBI_READ(dev, reg, 1)); +} + +int pci_dw_init(device_t); + +#endif /* __PCI_HOST_GENERIC_H_ */ Added: head/sys/dev/pci/pci_dw_if.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/pci/pci_dw_if.m Sun Oct 20 11:11:32 2019 (r353774) @@ -0,0 +1,73 @@ +#- +# Copyright (c) 2019 Michal Meloun +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +#include + +INTERFACE pci_dw; + + +/** + * Read from dbi space. + * The reg argument is a byte offset into dbi space. + * The width argument (which should be 1, 2 or 4) specifies how + * many bytes to read from that offset. + */ +METHOD uint32_t dbi_read{ + device_t dev; + u_int reg; + int width; +}; + +/** + * Write to dbi space. + * The reg argument is a byte offset into dbi space. + * The width argument (which should be 1, 2 or 4) specifies how + * many bytes to write to that offset. + */ +METHOD void dbi_write{ + device_t dev; + u_int reg; + uint32_t value; + int width; +}; + +/** + * Start or stop link + */ +METHOD int set_link{ + device_t dev; + bool start; +}; + +/** + * Query link status (up/down) + */ +METHOD int get_link{ + device_t dev; + bool *status; +}; Added: head/sys/dev/pci/pci_dw_mv.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/pci/pci_dw_mv.c Sun Oct 20 11:11:32 2019 (r353774) @@ -0,0 +1,328 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +/* Armada 8k DesignWare PCIe driver */ + +#include +__FBSDID("$FreeBSD$"); + + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Sun Oct 20 14:15:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B8451604A1; Sun, 20 Oct 2019 14:15:47 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46x1yW22Jlz3HwH; Sun, 20 Oct 2019 14:15:47 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A05FD07E; Sun, 20 Oct 2019 14:15:47 +0000 (UTC) (envelope-from vmaffione@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KEFlLV059444; Sun, 20 Oct 2019 14:15:47 GMT (envelope-from vmaffione@FreeBSD.org) Received: (from vmaffione@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KEFkEO059439; Sun, 20 Oct 2019 14:15:46 GMT (envelope-from vmaffione@FreeBSD.org) Message-Id: <201910201415.x9KEFkEO059439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: vmaffione set sender to vmaffione@FreeBSD.org using -f From: Vincenzo Maffione Date: Sun, 20 Oct 2019 14:15:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353775 - in head: sys/dev/netmap tools/tools/netmap X-SVN-Group: head X-SVN-Commit-Author: vmaffione X-SVN-Commit-Paths: in head: sys/dev/netmap tools/tools/netmap X-SVN-Commit-Revision: 353775 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 14:15:47 -0000 Author: vmaffione Date: Sun Oct 20 14:15:45 2019 New Revision: 353775 URL: https://svnweb.freebsd.org/changeset/base/353775 Log: netmap: minor misc improvements - use ring->head rather than ring->cur in lb(8) - use strlcat() rather than strncat() - fix bandwidth computation in pkt-gen(8) MFC after: 1 week Modified: head/sys/dev/netmap/netmap.c head/sys/dev/netmap/netmap_legacy.c head/sys/dev/netmap/netmap_mem2.c head/tools/tools/netmap/lb.c head/tools/tools/netmap/pkt-gen.c Modified: head/sys/dev/netmap/netmap.c ============================================================================== --- head/sys/dev/netmap/netmap.c Sun Oct 20 11:11:32 2019 (r353774) +++ head/sys/dev/netmap/netmap.c Sun Oct 20 14:15:45 2019 (r353775) @@ -3316,7 +3316,8 @@ nmreq_getoption(struct nmreq_header *hdr, uint16_t req if (!hdr->nr_options) return NULL; - opt_tab = (struct nmreq_option **)(hdr->nr_options) - (NETMAP_REQ_OPT_MAX + 1); + opt_tab = (struct nmreq_option **)((uintptr_t)hdr->nr_options) - + (NETMAP_REQ_OPT_MAX + 1); return opt_tab[reqtype]; } Modified: head/sys/dev/netmap/netmap_legacy.c ============================================================================== --- head/sys/dev/netmap/netmap_legacy.c Sun Oct 20 11:11:32 2019 (r353774) +++ head/sys/dev/netmap/netmap_legacy.c Sun Oct 20 14:15:45 2019 (r353775) @@ -100,7 +100,7 @@ nmreq_register_from_legacy(struct nmreq *nmr, struct n /* No space for the pipe suffix. */ return ENOBUFS; } - strncat(hdr->nr_name, suffix, strlen(suffix)); + strlcat(hdr->nr_name, suffix, sizeof(hdr->nr_name)); req->nr_mode = NR_REG_ALL_NIC; req->nr_ringid = 0; } Modified: head/sys/dev/netmap/netmap_mem2.c ============================================================================== --- head/sys/dev/netmap/netmap_mem2.c Sun Oct 20 11:11:32 2019 (r353774) +++ head/sys/dev/netmap/netmap_mem2.c Sun Oct 20 14:15:45 2019 (r353775) @@ -2447,8 +2447,8 @@ netmap_mem_pt_guest_ifp_del(struct netmap_mem_d *nmd, } else { ptnmd->pt_ifs = curr->next; } - nm_prinf("removed (ifp=%p,nifp_offset=%u)", - curr->ifp, curr->nifp_offset); + nm_prinf("removed (ifp=%s,nifp_offset=%u)", + curr->ifp->if_xname, curr->nifp_offset); nm_os_free(curr); ret = 0; break; Modified: head/tools/tools/netmap/lb.c ============================================================================== --- head/tools/tools/netmap/lb.c Sun Oct 20 11:11:32 2019 (r353774) +++ head/tools/tools/netmap/lb.c Sun Oct 20 14:15:45 2019 (r353775) @@ -652,7 +652,7 @@ int main(int argc, char **argv) /* extract the base name */ char *nscan = strncmp(glob_arg.ifname, "netmap:", 7) ? glob_arg.ifname : glob_arg.ifname + 7; - strncpy(glob_arg.base_name, nscan, MAX_IFNAMELEN-1); + strncpy(glob_arg.base_name, nscan, MAX_IFNAMELEN - 1); for (nscan = glob_arg.base_name; *nscan && !index("-*^{}/@", *nscan); nscan++) ; *nscan = '\0'; @@ -948,8 +948,8 @@ run: struct netmap_ring *rxring = NETMAP_RXRING(rxport->nmd->nifp, i); //D("prepare to scan rings"); - int next_cur = rxring->cur; - struct netmap_slot *next_slot = &rxring->slot[next_cur]; + int next_head = rxring->head; + struct netmap_slot *next_slot = &rxring->slot[next_head]; const char *next_buf = NETMAP_BUF(rxring, next_slot->buf_idx); while (!nm_ring_empty(rxring)) { struct netmap_slot *rs = next_slot; @@ -963,14 +963,14 @@ run: non_ip++; // XXX ?? } // prefetch the buffer for the next round - next_cur = nm_ring_next(rxring, next_cur); - next_slot = &rxring->slot[next_cur]; + next_head = nm_ring_next(rxring, next_head); + next_slot = &rxring->slot[next_head]; next_buf = NETMAP_BUF(rxring, next_slot->buf_idx); __builtin_prefetch(next_buf); // 'B' is just a hashing seed rs->buf_idx = forward_packet(g, rs); rs->flags |= NS_BUF_CHANGED; - rxring->head = rxring->cur = next_cur; + rxring->head = rxring->cur = next_head; batch++; if (unlikely(batch >= glob_arg.batch)) { Modified: head/tools/tools/netmap/pkt-gen.c ============================================================================== --- head/tools/tools/netmap/pkt-gen.c Sun Oct 20 11:11:32 2019 (r353774) +++ head/tools/tools/netmap/pkt-gen.c Sun Oct 20 14:15:45 2019 (r353775) @@ -2634,7 +2634,7 @@ main_thread(struct glob_arg *g) D("%spps %s(%spkts %sbps in %llu usec) %.2f avg_batch %d min_space", norm(b1, pps, normalize), b4, norm(b2, (double)x.pkts, normalize), - norm(b3, (double)x.bytes*8+(double)x.pkts*g->framing, normalize), + norm(b3, 1000000*((double)x.bytes*8+(double)x.pkts*g->framing)/usec, normalize), (unsigned long long)usec, abs, (int)cur.min_space); prev = cur; @@ -2973,6 +2973,7 @@ main(int arc, char **argv) g.options |= OPT_DUMP; break; case 'C': + D("WARNING: the 'C' option is deprecated, use the '+conf:' libnetmap option instead"); g.nmr_config = strdup(optarg); break; case 'H': From owner-svn-src-all@freebsd.org Sun Oct 20 14:45:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECE7F160DFE; Sun, 20 Oct 2019 14:45:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46x2cb5p04z3K5r; Sun, 20 Oct 2019 14:45:19 +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 AB4BDD5B9; Sun, 20 Oct 2019 14:45:19 +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 x9KEjJqu077112; Sun, 20 Oct 2019 14:45:19 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KEjJSf077111; Sun, 20 Oct 2019 14:45:19 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910201445.x9KEjJSf077111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Sun, 20 Oct 2019 14:45:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353776 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 353776 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 14:45:20 -0000 Author: dim Date: Sun Oct 20 14:45:19 2019 New Revision: 353776 URL: https://svnweb.freebsd.org/changeset/base/353776 Log: Follow up on r351916 by also bumping the version suffix to 12.1 in Makefile.libcompat. Reported by: Jeremy Cox Modified: stable/12/Makefile.libcompat Modified: stable/12/Makefile.libcompat ============================================================================== --- stable/12/Makefile.libcompat Sun Oct 20 14:15:45 2019 (r353775) +++ stable/12/Makefile.libcompat Sun Oct 20 14:45:19 2019 (r353776) @@ -17,7 +17,7 @@ LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} .if ${WANT_COMPILER_TYPE} == gcc || \ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) .else -LIB32CPUFLAGS+= -target x86_64-unknown-freebsd12.0 +LIB32CPUFLAGS+= -target x86_64-unknown-freebsd12.1 .endif LIB32CPUFLAGS+= -m32 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ @@ -49,9 +49,9 @@ LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} .endif .else .if ${TARGET_ARCH:Mmips64el*} != "" -LIB32CPUFLAGS= -target mipsel-unknown-freebsd12.0 +LIB32CPUFLAGS= -target mipsel-unknown-freebsd12.1 .else -LIB32CPUFLAGS= -target mips-unknown-freebsd12.0 +LIB32CPUFLAGS= -target mips-unknown-freebsd12.1 .endif .endif LIB32CPUFLAGS+= -mabi=32 From owner-svn-src-all@freebsd.org Sun Oct 20 15:50:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9922F161FFD; Sun, 20 Oct 2019 15:50:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46x43t3ZG3z3M5J; Sun, 20 Oct 2019 15:50:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DEBEE044; Sun, 20 Oct 2019 15:50:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KFoY2t012540; Sun, 20 Oct 2019 15:50:34 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KFoYQh012538; Sun, 20 Oct 2019 15:50:34 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910201550.x9KFoYQh012538@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Sun, 20 Oct 2019 15:50:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353777 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 353777 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 15:50:34 -0000 Author: jhibbits Date: Sun Oct 20 15:50:33 2019 New Revision: 353777 URL: https://svnweb.freebsd.org/changeset/base/353777 Log: powerpc/booke: Don't zero MAS8, it's unnecessary MAS8 is hypervisor privileged, defining the logical partition (VM) to operate on for TLB accesses. It's already guaranteed to be cleared when booting bare metal (bootloader needs it zeroed to work), and we can't touch it from a guest. Assume that if/when we eventually port bhyve to PowerPC (and Book-E) the hypervisor module will take care of managing MAS8. This saves several (tens) of clocks on each TLB miss. MFC after: 2 weeks Modified: head/sys/powerpc/booke/locore.S head/sys/powerpc/booke/trap_subr.S Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Sun Oct 20 14:45:19 2019 (r353776) +++ head/sys/powerpc/booke/locore.S Sun Oct 20 15:50:33 2019 (r353777) @@ -252,7 +252,6 @@ __start: isync li %r4, 0 mtspr SPR_MAS7, %r4 - bl zero_mas8 isync tlbwe isync @@ -510,7 +509,6 @@ bp_kernload: isync li %r4, 0 mtspr SPR_MAS7, %r4 - bl zero_mas8 isync tlbwe isync @@ -702,7 +700,6 @@ tlb1_temp_mapping_as1: mflr %r3 li %r4, 0 mtspr SPR_MAS7, %r4 - bl zero_mas8 mtlr %r3 isync tlbwe @@ -738,24 +735,6 @@ tlb1_inval_all_but_current: 2: addi %r4, %r4, 1 cmpw %r4, %r3 /* Check if this is the last entry */ bne 1b - blr - -/* - * MAS8 conditional zeroing. - */ -.globl zero_mas8 -zero_mas8: - mfpvr %r20 - rlwinm %r20, %r20, 16, 16, 31 - cmpli 0, 0, %r20, FSL_E500mc - beq 1f - cmpli 0, 0, %r20, FSL_E5500 - beq 1f - - blr -1: - li %r20, 0 - mtspr SPR_MAS8, %r20 blr #endif Modified: head/sys/powerpc/booke/trap_subr.S ============================================================================== --- head/sys/powerpc/booke/trap_subr.S Sun Oct 20 14:45:19 2019 (r353776) +++ head/sys/powerpc/booke/trap_subr.S Sun Oct 20 15:50:33 2019 (r353777) @@ -767,7 +767,6 @@ search_failed: li %r23, 0 mtspr SPR_MAS7, %r23 - bl zero_mas8 isync tlbwe @@ -903,10 +902,6 @@ tlb_fill_entry: mtspr SPR_MAS2, %r27 mtspr SPR_MAS3, %r22 mtspr SPR_MAS7, %r23 - - mflr %r21 - bl zero_mas8 - mtlr %r21 isync tlbwe From owner-svn-src-all@freebsd.org Sun Oct 20 17:40:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9CE516699C; Sun, 20 Oct 2019 17:40:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46x6W644vrz4D3T; Sun, 20 Oct 2019 17:40:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6EE8EF4D3; Sun, 20 Oct 2019 17:40:50 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KHeoVK098420; Sun, 20 Oct 2019 17:40:50 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KHeoFD098419; Sun, 20 Oct 2019 17:40:50 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201910201740.x9KHeoFD098419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Sun, 20 Oct 2019 17:40:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353778 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: marius X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 353778 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 17:40:50 -0000 Author: marius Date: Sun Oct 20 17:40:50 2019 New Revision: 353778 URL: https://svnweb.freebsd.org/changeset/base/353778 Log: - In em_intr(), just call em_handle_link() instead of duplicating it. - In em_msix_link(), properly handle IGB-class devices after the iflib(4) conversion again by only setting EM_MSIX_LINK for the EM-class 82574 and by re-arming link interrupts unconditionally, i. e. not only in case of spurious interrupts. This fixes the interface link state change detection for the IGB-class. [1] - In em_if_update_admin_status(), only re-arm the link state change interrupt for 82574 and also only if such a device uses MSI-X, i. e. takes advantage of autoclearing. In case of INTx and MSI as well as for LEM- and IGB-class devices, re-arming isn't appropriate here and setting EM_MSIX_LINK isn't either. While at it, consistently take advantage of the hw variable. PR: 236724 [1] Differential Revision: https://reviews.freebsd.org/D21924 Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Sun Oct 20 15:50:33 2019 (r353777) +++ head/sys/dev/e1000/if_em.c Sun Oct 20 17:40:50 2019 (r353778) @@ -1395,10 +1395,8 @@ em_intr(void *arg) IFDI_INTR_DISABLE(ctx); /* Link status change */ - if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { - adapter->hw.mac.get_link_status = 1; - iflib_admin_intr_deferred(ctx); - } + if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) + em_handle_link(ctx); if (reg_icr & E1000_ICR_RXO) adapter->rx_overruns++; @@ -1481,22 +1479,24 @@ em_msix_link(void *arg) if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { em_handle_link(adapter->ctx); - } else { - E1000_WRITE_REG(&adapter->hw, E1000_IMS, - EM_MSIX_LINK | E1000_IMS_LSC); - if (adapter->hw.mac.type >= igb_mac_min) - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, adapter->link_mask); + } else if (adapter->hw.mac.type == e1000_82574) { + /* Only re-arm 82574 if em_if_update_admin_status() won't. */ + E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | + E1000_IMS_LSC); } - /* - * Because we must read the ICR for this interrupt - * it may clear other causes using autoclear, for - * this reason we simply create a soft interrupt - * for all these vectors. - */ - if (reg_icr && adapter->hw.mac.type < igb_mac_min) { - E1000_WRITE_REG(&adapter->hw, - E1000_ICS, adapter->ims); + if (adapter->hw.mac.type == e1000_82574) { + /* + * Because we must read the ICR for this interrupt it may + * clear other causes using autoclear, for this reason we + * simply create a soft interrupt for all these vectors. + */ + if (reg_icr) + E1000_WRITE_REG(&adapter->hw, E1000_ICS, adapter->ims); + } else { + /* Re-arm unconditionally */ + E1000_WRITE_REG(&adapter->hw, E1000_IMS, E1000_IMS_LSC); + E1000_WRITE_REG(&adapter->hw, E1000_EIMS, adapter->link_mask); } return (FILTER_HANDLED); @@ -1512,7 +1512,6 @@ em_handle_link(void *context) iflib_admin_intr_deferred(ctx); } - /********************************************************************* * * Media Ioctl callback @@ -1829,14 +1828,15 @@ em_if_update_admin_status(if_ctx_t ctx) em_update_stats_counters(adapter); /* Reset LAA into RAR[0] on 82571 */ - if ((adapter->hw.mac.type == e1000_82571) && - e1000_get_laa_state_82571(&adapter->hw)) - e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); + if (hw->mac.type == e1000_82571 && e1000_get_laa_state_82571(hw)) + e1000_rar_set(hw, hw->mac.addr, 0); - if (adapter->hw.mac.type < em_mac_min) + if (hw->mac.type < em_mac_min) lem_smartspeed(adapter); - - E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | E1000_IMS_LSC); + else if (hw->mac.type == e1000_82574 && + adapter->intr_type == IFLIB_INTR_MSIX) + E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | + E1000_IMS_LSC); } static void From owner-svn-src-all@freebsd.org Sun Oct 20 20:29:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D06E1697E4; Sun, 20 Oct 2019 20:29:18 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xBFV0qlJz4KW5; Sun, 20 Oct 2019 20:29:18 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F3F1919305; Sun, 20 Oct 2019 20:29:17 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KKTH34098692; Sun, 20 Oct 2019 20:29:17 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KKTHwA098691; Sun, 20 Oct 2019 20:29:17 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201910202029.x9KKTHwA098691@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sun, 20 Oct 2019 20:29:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353779 - head/sbin/ping6 X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/sbin/ping6 X-SVN-Commit-Revision: 353779 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 20:29:18 -0000 Author: asomers Date: Sun Oct 20 20:29:17 2019 New Revision: 353779 URL: https://svnweb.freebsd.org/changeset/base/353779 Log: Fix option names in the Examples section of the manual page This corrects an oversight from r351423. Submitted by: Ján Sučan MFC after: Never Differential Revision: https://reviews.freebsd.org/D22093 Modified: head/sbin/ping6/ping6.8 Modified: head/sbin/ping6/ping6.8 ============================================================================== --- head/sbin/ping6/ping6.8 Sun Oct 20 17:40:50 2019 (r353778) +++ head/sbin/ping6/ping6.8 Sun Oct 20 20:29:17 2019 (r353779) @@ -29,7 +29,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 22, 2019 +.Dd October 20, 2019 .Dt PING6 8 .Os .Sh NAME @@ -473,13 +473,13 @@ The address is named the link-local all-node multicast address, and the packet would reach every node on the network link. .Bd -literal -offset indent -ping6 -w ff02::1%wi0 +ping6 -y ff02::1%wi0 .Ed .Pp The following will probe addresses assigned to the destination node, .Li dst.foo.com . .Bd -literal -offset indent -ping6 -a agl dst.foo.com +ping6 -k agl dst.foo.com .Ed .Sh SEE ALSO .Xr netstat 1 , From owner-svn-src-all@freebsd.org Sun Oct 20 20:57:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D79AB169DC7; Sun, 20 Oct 2019 20:57:58 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xBtZ5P1Hz4LPZ; Sun, 20 Oct 2019 20:57:58 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D25019837; Sun, 20 Oct 2019 20:57:58 +0000 (UTC) (envelope-from brueffer@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KKvwTC016203; Sun, 20 Oct 2019 20:57:58 GMT (envelope-from brueffer@FreeBSD.org) Received: (from brueffer@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KKvwWF016202; Sun, 20 Oct 2019 20:57:58 GMT (envelope-from brueffer@FreeBSD.org) Message-Id: <201910202057.x9KKvwWF016202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brueffer set sender to brueffer@FreeBSD.org using -f From: Christian Brueffer Date: Sun, 20 Oct 2019 20:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353780 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: brueffer X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 353780 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 20:57:58 -0000 Author: brueffer Date: Sun Oct 20 20:57:57 2019 New Revision: 353780 URL: https://svnweb.freebsd.org/changeset/base/353780 Log: Add a manpage for ng_pipe(4). Submitted by: Lutz Donnerhacke Reviewed by: bcr (previous version) MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22067 Added: head/share/man/man4/ng_pipe.4 (contents, props changed) Modified: head/share/man/man4/Makefile Modified: head/share/man/man4/Makefile ============================================================================== --- head/share/man/man4/Makefile Sun Oct 20 20:29:17 2019 (r353779) +++ head/share/man/man4/Makefile Sun Oct 20 20:57:57 2019 (r353780) @@ -351,6 +351,7 @@ MAN= aac.4 \ ng_netflow.4 \ ng_one2many.4 \ ng_patch.4 \ + ng_pipe.4 \ ng_ppp.4 \ ng_pppoe.4 \ ng_pptpgre.4 \ Added: head/share/man/man4/ng_pipe.4 ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/share/man/man4/ng_pipe.4 Sun Oct 20 20:57:57 2019 (r353780) @@ -0,0 +1,215 @@ +.\" Copyright (c) 2019 Lutz Donnerhacke +.\" Copyright (c) 2004-2008 University of Zagreb +.\" Copyright (c) 2007-2008 FreeBSD Foundation +.\" All rights reserved. +.\" +.\" Redistribution and use in source and binary forms, with or without +.\" modification, are permitted provided that the following conditions +.\" are met: +.\" 1. Redistributions of source code must retain the above copyright +.\" notice, this list of conditions and the following disclaimer. +.\" 2. Redistributions in binary form must reproduce the above copyright +.\" notice, this list of conditions and the following disclaimer in the +.\" documentation and/or other materials provided with the distribution. +.\" +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +.\" SUCH DAMAGE. +.\" +.\" $FreeBSD$ +.\" +.Dd October 17, 2019 +.Dt NG_PIPE 4 +.Os +.Sh NAME +.Nm ng_pipe +.Nd Traffic manipulating netgraph node type +.Sh SYNOPSIS +.In netgraph/ng_pipe.h +.Sh DESCRIPTION +The +.Nm pipe +node type manipulates traffic by emulating bandwidth and delay, as well as +random packet losses. +.Sh HOOKS +This node type supports the following hooks: +.Bl -tag -width ".Va upper" +.It Va upper +Hook leading to upper layer protocols. +.It Va lower +Hook leading to lower layer protocols. +.El +.Pp +Traffic flowing from +.Va upper +to +.Va lower +is considered +.Sy downstream +traffic. +Traffic flowing from +.Va lower +to +.Va upper +is considered +.Sy upstream +traffic. +.Sh MODE OF OPERATION +Data received on a hook - both in upstream and downstream direction - +is put into an inbound queue. +If inbound queue is full, discard one frame +depending on dropping policy (from the head or from the tail of the +queue). +.Pp +There are three mutually exclusive modes for the input queue: +.Bl -tag -width foo +.It Dv "First In First Out (FIFO)" +A single queue holds packets in chronological order. +.It Dv Weighted fair queuing (WFQ) +There are multiple queues for different traffic flows (based on IPv4 +IPs). +The longest queue is truncated if necessary. +This approach +assumes that the stalling flow is the flow with the most packets currently +on hold. +.It Dv Deficit Round Robin (DRR) +This mode is similar to WFQ, but packets are not taken out in +strict chronological order. +In principle oldest packets come first, +but not too many packets from the same flow. +.El +.Pp +It is possible to configure a duplication probability. +As the dice +decides, the currently active packet stays in the queue while a copy +of the packet is sent out. +Nothing prevents a packet from being +duplicated multiple times. +.Pp +Packets are dropped with an increasing probability depending on the +size of the packet, if a +.Va ber +(bit error rate) is configured. +.Pp +Surviving packets are delayed by the time the packet would need to +travel through a link of the configured bandwidth. +If this outbound +queue is full, the packet is dropped. +.Sh CONTROL MESSAGES +This node type supports the generic control messages and the following +specific messages. +.Bl -tag -width foo +.It Dv NGM_PIPE_SET_CFG Pq Ic setcfg +Set node configuration to the one specified in +.Vt "struct ng_pipe_cfg" +.Pp +Note: To set a value to zero, specify -1 instead. +This allows omitting configuration values, which should not be +modified. +.It Dv NGM_PIPE_GET_CFG Pq Ic getcfg +Return current node configuration as +.Vt "struct ng_pipe_cfg" +.Bd -literal +struct ng_pipe_cfg { + u_int64_t bandwidth; /* bits per second */ + u_int64_t delay; /* additional delay, usec */ + u_int32_t header_offset; /* offset of IP header in bytes */ + u_int32_t overhead; /* assumed L2 overhead in bytes */ + struct ng_pipe_hookcfg downstream; + struct ng_pipe_hookcfg upstream; +}; + +/* Config structure for one hook */ +struct ng_pipe_hookcfg { + u_int64_t bandwidth; /* bits per second */ + u_int64_t ber; /* errors per 2^48 bits */ + u_int32_t qin_size_limit; /* number of queue items */ + u_int32_t qout_size_limit; /* number of queue items */ + u_int32_t duplicate; /* probability in % */ + u_int32_t fifo; /* 0 = off, 1 = on */ + u_int32_t drr; /* 0 = off, 1 = 2048 bytes, or x bytes */ + u_int32_t wfq; /* 0 = off, 1 = on */ + u_int32_t droptail; /* 0 = off, 1 = on */ + u_int32_t drophead; /* 0 = off, 1 = on */ +}; +.Ed +.It Dv NGM_PIPE_GET_STATS Pq Ic getstats +Return node statistics as +.Vt "struct ng_pipe_stats" +.Bd -literal +/* Statistics structure for one hook */ +struct ng_pipe_hookstat { + u_int64_t fwd_octets; + u_int64_t fwd_frames; + u_int64_t in_disc_octets; + u_int64_t in_disc_frames; + u_int64_t out_disc_octets; + u_int64_t out_disc_frames; +}; + +/* Statistics structure returned by NGM_PIPE_GET_STATS */ +struct ng_pipe_stats { + struct ng_pipe_hookstat downstream; + struct ng_pipe_hookstat upstream; +}; +.Ed +.It Dv NGM_PIPE_CLR_STATS Pq Ic clrstats +Clear node statistics. +.It Dv NGM_PIPE_GETCLR_STATS Pq Ic getclrstats +Atomically return and clear node statistics. +.It Dv NGM_PIPE_GET_RUN Pq Ic getrun +Return node statistics as +.Vt "struct ng_pipe_run" +.Bd -literal +/* Runtime structure for one hook */ +struct ng_pipe_hookrun { + u_int32_t fifo_queues; + u_int32_t qin_octets; + u_int32_t qin_frames; + u_int32_t qout_octets; + u_int32_t qout_frames; +}; + +/* Runtime structure returned by NGM_PIPE_GET_RUN */ +struct ng_pipe_run { + struct ng_pipe_hookrun downstream; + struct ng_pipe_hookrun upstream; +}; +.Ed +.El +.Sh SHUTDOWN +This node shuts down upon receipt of a +.Dv NGM_SHUTDOWN +control message, or when all hooks have been disconnected. +.Sh EXAMPLES +Limit outgoing data rate over fxp0 Ethernet interface to 20Mbps in +fifo mode and incoming to 50kbps in drr mode and 2% duplicate +probability. +.Bd -literal -offset indent +/usr/sbin/ngctl -f- <<-SEQ + mkpeer fxp0: pipe lower lower + name fxp0:lower fxp0_pipe + connect fxp0: fxp0_pipe: upper upper + msg fxp0_pipe: setcfg { downstream={ bandwidth=20000000 fifo=1 } } + msg fxp0_pipe: setcfg { upstream={ bandwidth=500000 drr=1 duplicate=2 } } +SEQ +.Ed +.Sh SEE ALSO +.Xr netgraph 4 , +.Xr ngctl 8 +.Sh AUTHORS +.An Lutz Donnerhacke Aq Mt lutz@donnerhacke.de +.Pq man page +.Sh BUGS +Error handling for memory issues is missing. +If kernel memory cannot be allocated immediately, a kernel panic will +be triggered. +Same happens if an mbuf is fragmented within the transport headers. From owner-svn-src-all@freebsd.org Sun Oct 20 21:03:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F402016AF77; Sun, 20 Oct 2019 21:03:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xC1J6Dsqz4Mrx; Sun, 20 Oct 2019 21:03:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9F4119B38; Sun, 20 Oct 2019 21:03:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KL3mtK021741; Sun, 20 Oct 2019 21:03:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KL3md1021740; Sun, 20 Oct 2019 21:03:48 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910202103.x9KL3md1021740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 20 Oct 2019 21:03:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353781 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353781 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 21:03:49 -0000 Author: kevans Date: Sun Oct 20 21:03:48 2019 New Revision: 353781 URL: https://svnweb.freebsd.org/changeset/base/353781 Log: tuntap(4): Drop TUN_IASET This flag appears to have been effectively unused since introduction to if_tun(4) -- drop it now. Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Sun Oct 20 20:57:57 2019 (r353780) +++ head/sys/net/if_tuntap.c Sun Oct 20 21:03:48 2019 (r353781) @@ -120,7 +120,7 @@ struct tuntap_softc { u_short tun_flags; /* misc flags */ #define TUN_OPEN 0x0001 #define TUN_INITED 0x0002 -#define TUN_IASET 0x0008 +#define TUN_UNUSED1 0x0008 #define TUN_DSTADDR 0x0010 #define TUN_LMODE 0x0020 #define TUN_RWAIT 0x0040 @@ -1191,10 +1191,6 @@ tuninit(struct ifnet *ifp) CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { if (ifa->ifa_addr->sa_family == AF_INET) { struct sockaddr_in *si; - - si = (struct sockaddr_in *)ifa->ifa_addr; - if (si->sin_addr.s_addr) - tp->tun_flags |= TUN_IASET; si = (struct sockaddr_in *)ifa->ifa_dstaddr; if (si && si->sin_addr.s_addr) From owner-svn-src-all@freebsd.org Sun Oct 20 21:06:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B7AF16B0F5; Sun, 20 Oct 2019 21:06:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xC4L3ZXcz4N5n; Sun, 20 Oct 2019 21:06:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5DF1D19B3D; Sun, 20 Oct 2019 21:06:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KL6QCr022052; Sun, 20 Oct 2019 21:06:26 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KL6QXN022051; Sun, 20 Oct 2019 21:06:26 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910202106.x9KL6QXN022051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 20 Oct 2019 21:06:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353782 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353782 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 21:06:26 -0000 Author: kevans Date: Sun Oct 20 21:06:25 2019 New Revision: 353782 URL: https://svnweb.freebsd.org/changeset/base/353782 Log: tuntap(4): break out after setting TUN_DSTADDR This is now the only flag we set in this loop, terminate early. Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Sun Oct 20 21:03:48 2019 (r353781) +++ head/sys/net/if_tuntap.c Sun Oct 20 21:06:25 2019 (r353782) @@ -1193,8 +1193,10 @@ tuninit(struct ifnet *ifp) struct sockaddr_in *si; si = (struct sockaddr_in *)ifa->ifa_dstaddr; - if (si && si->sin_addr.s_addr) + if (si && si->sin_addr.s_addr) { tp->tun_flags |= TUN_DSTADDR; + break; + } } } NET_EPOCH_EXIT(et); From owner-svn-src-all@freebsd.org Sun Oct 20 22:01:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 012BF16C201; Sun, 20 Oct 2019 22:01:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xDHz5wP2z4QKS; Sun, 20 Oct 2019 22:01:35 +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 AF1AF1A597; Sun, 20 Oct 2019 22:01:35 +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 x9KM1Zk2057116; Sun, 20 Oct 2019 22:01:35 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KM1Zpi056866; Sun, 20 Oct 2019 22:01:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910202201.x9KM1Zpi056866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 20 Oct 2019 22:01:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353783 - in stable: 11/sys/kern 11/sys/sys 12/sys/kern 12/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/kern 11/sys/sys 12/sys/kern 12/sys/sys X-SVN-Commit-Revision: 353783 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 22:01:36 -0000 Author: kevans Date: Sun Oct 20 22:01:35 2019 New Revision: 353783 URL: https://svnweb.freebsd.org/changeset/base/353783 Log: MFC r353128-r353129: fully initialize cloned devices w/ make_dev_args r353128: kern_conf: fully initialize cloned devices with make_dev_args, too Attempting to initialize si_drv{1,2} with mda_si_drv{1,2} does not work if you are operating on cloned devices. clone_create must be called prior to the make_dev* family to create/return the device on the clonelist as needed. This device is later returned early in newdev(), prior to si_drv{0,1,2} initialization. This patch simply breaks out of the loop if we've found a device and finishes init. r353129: Remove the remnants of SI_CHEAPCLONE SI_CHEAPCLONE was introduced in r66067 for use with cloned bpfs. It was later also used in tty, tun, tap at points. The rough timeline for being removed in each of these is as follows: - r181690: bpf switched to use cdevpriv API by ed@ - r181905: ed@ rewrote the TTY later to be mpsafe - r204464: kib@ removes it from tun/tap, declaring it unused I've not yet been able to dig up any other consumers in the intervening 9 years. It is no longer set on any devices in the tree and leaves an interesting situation in make_dev_sv where we're ok with the device already being set SI_NAMED. Modified: stable/11/sys/kern/kern_conf.c stable/11/sys/sys/conf.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/kern/kern_conf.c stable/12/sys/sys/conf.h Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/kern/kern_conf.c ============================================================================== --- stable/11/sys/kern/kern_conf.c Sun Oct 20 21:06:25 2019 (r353782) +++ stable/11/sys/kern/kern_conf.c Sun Oct 20 22:01:35 2019 (r353783) @@ -164,12 +164,6 @@ dev_rel(struct cdev *dev) dev->si_refcount--; KASSERT(dev->si_refcount >= 0, ("dev_rel(%s) gave negative count", devtoname(dev))); -#if 0 - if (dev->si_usecount == 0 && - (dev->si_flags & SI_CHEAPCLONE) && (dev->si_flags & SI_NAMED)) - ; - else -#endif if (dev->si_devsw == NULL && dev->si_refcount == 0) { LIST_REMOVE(dev, si_list); flag = 1; @@ -573,20 +567,41 @@ newdev(struct make_dev_args *args, struct cdev *si) mtx_assert(&devmtx, MA_OWNED); csw = args->mda_devsw; + si2 = NULL; if (csw->d_flags & D_NEEDMINOR) { /* We may want to return an existing device */ LIST_FOREACH(si2, &csw->d_devs, si_list) { if (dev2unit(si2) == args->mda_unit) { dev_free_devlocked(si); - return (si2); + si = si2; + break; } } + + /* + * If we're returning an existing device, we should make sure + * it isn't already initialized. This would have been caught + * in consumers anyways, but it's good to catch such a case + * early. We still need to complete initialization of the + * device, and we'll use whatever make_dev_args were passed in + * to do so. + */ + KASSERT(si2 == NULL || (si2->si_flags & SI_NAMED) == 0, + ("make_dev() by driver %s on pre-existing device (min=%x, name=%s)", + args->mda_devsw->d_name, dev2unit(si2), devtoname(si2))); } si->si_drv0 = args->mda_unit; - si->si_devsw = csw; si->si_drv1 = args->mda_si_drv1; si->si_drv2 = args->mda_si_drv2; - LIST_INSERT_HEAD(&csw->d_devs, si, si_list); + /* Only push to csw->d_devs if it's not a cloned device. */ + if (si2 == NULL) { + si->si_devsw = csw; + LIST_INSERT_HEAD(&csw->d_devs, si, si_list); + } else { + KASSERT(si->si_devsw == csw, + ("%s: inconsistent devsw between clone_create() and make_dev()", + __func__)); + } return (si); } @@ -796,17 +811,6 @@ make_dev_sv(struct make_dev_args *args1, struct cdev * dev_refl(dev); if ((args.mda_flags & MAKEDEV_ETERNAL) != 0) dev->si_flags |= SI_ETERNAL; - if (dev->si_flags & SI_CHEAPCLONE && - dev->si_flags & SI_NAMED) { - /* - * This is allowed as it removes races and generally - * simplifies cloning devices. - * XXX: still ?? - */ - dev_unlock_and_free(); - *dres = dev; - return (0); - } KASSERT(!(dev->si_flags & SI_NAMED), ("make_dev() by driver %s on pre-existing device (min=%x, name=%s)", args.mda_devsw->d_name, dev2unit(dev), devtoname(dev))); @@ -1541,7 +1545,6 @@ DB_SHOW_COMMAND(cdev, db_show_cdev) SI_FLAG(SI_ETERNAL); SI_FLAG(SI_ALIAS); SI_FLAG(SI_NAMED); - SI_FLAG(SI_CHEAPCLONE); SI_FLAG(SI_CHILD); SI_FLAG(SI_DUMPDEV); SI_FLAG(SI_CLONELIST); Modified: stable/11/sys/sys/conf.h ============================================================================== --- stable/11/sys/sys/conf.h Sun Oct 20 21:06:25 2019 (r353782) +++ stable/11/sys/sys/conf.h Sun Oct 20 22:01:35 2019 (r353783) @@ -57,7 +57,7 @@ struct cdev { #define SI_ETERNAL 0x0001 /* never destroyed */ #define SI_ALIAS 0x0002 /* carrier of alias name */ #define SI_NAMED 0x0004 /* make_dev{_alias} has been called */ -#define SI_CHEAPCLONE 0x0008 /* can be removed_dev'ed when vnode reclaims */ +#define SI_UNUSED1 0x0008 /* unused */ #define SI_CHILD 0x0010 /* child of another struct cdev **/ #define SI_DUMPDEV 0x0080 /* is kernel dumpdev */ #define SI_CLONELIST 0x0200 /* on a clone list */ From owner-svn-src-all@freebsd.org Sun Oct 20 22:01:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D26316C321; Sun, 20 Oct 2019 22:01:36 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xDJ02qHnz4QKX; Sun, 20 Oct 2019 22:01:36 +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 43C4C1A59A; Sun, 20 Oct 2019 22:01:36 +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 x9KM1a3d057334; Sun, 20 Oct 2019 22:01:36 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KM1Zwr057332; Sun, 20 Oct 2019 22:01:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910202201.x9KM1Zwr057332@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 20 Oct 2019 22:01:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353783 - in stable: 11/sys/kern 11/sys/sys 12/sys/kern 12/sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/sys/kern 11/sys/sys 12/sys/kern 12/sys/sys X-SVN-Commit-Revision: 353783 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 22:01:36 -0000 Author: kevans Date: Sun Oct 20 22:01:35 2019 New Revision: 353783 URL: https://svnweb.freebsd.org/changeset/base/353783 Log: MFC r353128-r353129: fully initialize cloned devices w/ make_dev_args r353128: kern_conf: fully initialize cloned devices with make_dev_args, too Attempting to initialize si_drv{1,2} with mda_si_drv{1,2} does not work if you are operating on cloned devices. clone_create must be called prior to the make_dev* family to create/return the device on the clonelist as needed. This device is later returned early in newdev(), prior to si_drv{0,1,2} initialization. This patch simply breaks out of the loop if we've found a device and finishes init. r353129: Remove the remnants of SI_CHEAPCLONE SI_CHEAPCLONE was introduced in r66067 for use with cloned bpfs. It was later also used in tty, tun, tap at points. The rough timeline for being removed in each of these is as follows: - r181690: bpf switched to use cdevpriv API by ed@ - r181905: ed@ rewrote the TTY later to be mpsafe - r204464: kib@ removes it from tun/tap, declaring it unused I've not yet been able to dig up any other consumers in the intervening 9 years. It is no longer set on any devices in the tree and leaves an interesting situation in make_dev_sv where we're ok with the device already being set SI_NAMED. Modified: stable/12/sys/kern/kern_conf.c stable/12/sys/sys/conf.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/kern/kern_conf.c stable/11/sys/sys/conf.h Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/kern/kern_conf.c ============================================================================== --- stable/12/sys/kern/kern_conf.c Sun Oct 20 21:06:25 2019 (r353782) +++ stable/12/sys/kern/kern_conf.c Sun Oct 20 22:01:35 2019 (r353783) @@ -166,12 +166,6 @@ dev_rel(struct cdev *dev) dev->si_refcount--; KASSERT(dev->si_refcount >= 0, ("dev_rel(%s) gave negative count", devtoname(dev))); -#if 0 - if (dev->si_usecount == 0 && - (dev->si_flags & SI_CHEAPCLONE) && (dev->si_flags & SI_NAMED)) - ; - else -#endif if (dev->si_devsw == NULL && dev->si_refcount == 0) { LIST_REMOVE(dev, si_list); flag = 1; @@ -575,20 +569,41 @@ newdev(struct make_dev_args *args, struct cdev *si) mtx_assert(&devmtx, MA_OWNED); csw = args->mda_devsw; + si2 = NULL; if (csw->d_flags & D_NEEDMINOR) { /* We may want to return an existing device */ LIST_FOREACH(si2, &csw->d_devs, si_list) { if (dev2unit(si2) == args->mda_unit) { dev_free_devlocked(si); - return (si2); + si = si2; + break; } } + + /* + * If we're returning an existing device, we should make sure + * it isn't already initialized. This would have been caught + * in consumers anyways, but it's good to catch such a case + * early. We still need to complete initialization of the + * device, and we'll use whatever make_dev_args were passed in + * to do so. + */ + KASSERT(si2 == NULL || (si2->si_flags & SI_NAMED) == 0, + ("make_dev() by driver %s on pre-existing device (min=%x, name=%s)", + args->mda_devsw->d_name, dev2unit(si2), devtoname(si2))); } si->si_drv0 = args->mda_unit; - si->si_devsw = csw; si->si_drv1 = args->mda_si_drv1; si->si_drv2 = args->mda_si_drv2; - LIST_INSERT_HEAD(&csw->d_devs, si, si_list); + /* Only push to csw->d_devs if it's not a cloned device. */ + if (si2 == NULL) { + si->si_devsw = csw; + LIST_INSERT_HEAD(&csw->d_devs, si, si_list); + } else { + KASSERT(si->si_devsw == csw, + ("%s: inconsistent devsw between clone_create() and make_dev()", + __func__)); + } return (si); } @@ -798,17 +813,6 @@ make_dev_sv(struct make_dev_args *args1, struct cdev * dev_refl(dev); if ((args.mda_flags & MAKEDEV_ETERNAL) != 0) dev->si_flags |= SI_ETERNAL; - if (dev->si_flags & SI_CHEAPCLONE && - dev->si_flags & SI_NAMED) { - /* - * This is allowed as it removes races and generally - * simplifies cloning devices. - * XXX: still ?? - */ - dev_unlock_and_free(); - *dres = dev; - return (0); - } KASSERT(!(dev->si_flags & SI_NAMED), ("make_dev() by driver %s on pre-existing device (min=%x, name=%s)", args.mda_devsw->d_name, dev2unit(dev), devtoname(dev))); @@ -1543,7 +1547,6 @@ DB_SHOW_COMMAND(cdev, db_show_cdev) SI_FLAG(SI_ETERNAL); SI_FLAG(SI_ALIAS); SI_FLAG(SI_NAMED); - SI_FLAG(SI_CHEAPCLONE); SI_FLAG(SI_CHILD); SI_FLAG(SI_DUMPDEV); SI_FLAG(SI_CLONELIST); Modified: stable/12/sys/sys/conf.h ============================================================================== --- stable/12/sys/sys/conf.h Sun Oct 20 21:06:25 2019 (r353782) +++ stable/12/sys/sys/conf.h Sun Oct 20 22:01:35 2019 (r353783) @@ -59,7 +59,7 @@ struct cdev { #define SI_ETERNAL 0x0001 /* never destroyed */ #define SI_ALIAS 0x0002 /* carrier of alias name */ #define SI_NAMED 0x0004 /* make_dev{_alias} has been called */ -#define SI_CHEAPCLONE 0x0008 /* can be removed_dev'ed when vnode reclaims */ +#define SI_UNUSED1 0x0008 /* unused */ #define SI_CHILD 0x0010 /* child of another struct cdev **/ #define SI_DUMPDEV 0x0080 /* is kernel dumpdev */ #define SI_CLONELIST 0x0200 /* on a clone list */ From owner-svn-src-all@freebsd.org Sun Oct 20 22:05:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D479716C54E; Sun, 20 Oct 2019 22:05:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xDP25Kdgz4Qpk; Sun, 20 Oct 2019 22:05:58 +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 9B9531A5ED; Sun, 20 Oct 2019 22:05:58 +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 x9KM5w66057857; Sun, 20 Oct 2019 22:05:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KM5vpn057854; Sun, 20 Oct 2019 22:05:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910202205.x9KM5vpn057854@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 20 Oct 2019 22:05:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353784 - in stable: 11/lib/libbe 11/sbin/bectl 12/lib/libbe 12/sbin/bectl X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/lib/libbe 11/sbin/bectl 12/lib/libbe 12/sbin/bectl X-SVN-Commit-Revision: 353784 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 22:05:58 -0000 Author: kevans Date: Sun Oct 20 22:05:57 2019 New Revision: 353784 URL: https://svnweb.freebsd.org/changeset/base/353784 Log: MFC r353644, r353646, r353663: bectl(8) origin auto-destroy r353644: libbe(3): add needed bits for be_destroy to auto-destroy some origins New BEs can be created from either an existing snapshot or an existing BE. If an existing BE is chosen (either implicitly via 'bectl create' or explicitly via 'bectl create -e foo bar', for instance), then bectl will create a snapshot of the current BE or "foo" with be_snapshot, with a name formatted like: strftime("%F-%T") and a serial added to it. This commit adds the needed bits for libbe or consumers to determine if a snapshot names matches one of these auto-created snapshots (with some light validation of the date/time/serial), and also a be_destroy flag to specify that the origin should be automatically destroyed if possible. A future commit to bectl will specify BE_DESTROY_AUTOORIGIN by default so we clean up the origin in the most common case, non-user-managed snapshots. r353646: bectl(8): destroy: use BE_DESTROY_AUTOORIGIN if -o is not specified -o will force the origin to be destroyed unconditionally. BE_DESTROY_AUTOORIGIN, on the other hand, will only destroy the origin if it matches the format used by be_snapshot. This lets us clean up the snapshots that are clearly not user-managed (because we're creating them) while leaving user-created snapshots in place and warning that they're still around when the BE created goes away. r353663: libbe(3): Fix destroy of imported BE w/ AUTOORIGIN Imported BE, much like the activated BE, will not have an origin that we can fetch/examine for destruction. be_destroy should not return BE_ERR_NOORIGIN for failure to get the origin property for BE_DESTROY_AUTOORIGIN, because we don't really know going into it that there's even an origin to be destroyed. BE_DESTROY_NEEDORIGIN has been renamed to BE_DESTROY_WANTORIGIN because only a subset of it *needs* the origin, so 'need' is too strong of verbiage. This was caught by jenkins and the bectl tests, but kevans failed to run the bectl tests prior to commit. Modified: stable/11/lib/libbe/be.c stable/11/lib/libbe/be.h stable/11/lib/libbe/libbe.3 stable/11/sbin/bectl/bectl.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/lib/libbe/be.c stable/12/lib/libbe/be.h stable/12/lib/libbe/libbe.3 stable/12/sbin/bectl/bectl.c Directory Properties: stable/12/ (props changed) Modified: stable/11/lib/libbe/be.c ============================================================================== --- stable/11/lib/libbe/be.c Sun Oct 20 22:01:35 2019 (r353783) +++ stable/11/lib/libbe/be.c Sun Oct 20 22:05:57 2019 (r353784) @@ -229,6 +229,7 @@ be_destroy_cb(zfs_handle_t *zfs_hdl, void *data) return (0); } +#define BE_DESTROY_WANTORIGIN (BE_DESTROY_ORIGIN | BE_DESTROY_AUTOORIGIN) /* * Destroy the boot environment or snapshot specified by the name * parameter. Options are or'd together with the possible values: @@ -264,11 +265,25 @@ be_destroy(libbe_handle_t *lbh, const char *name, int if (fs == NULL) return (set_error(lbh, BE_ERR_ZFSOPEN)); - if ((options & BE_DESTROY_ORIGIN) != 0 && + if ((options & BE_DESTROY_WANTORIGIN) != 0 && zfs_prop_get(fs, ZFS_PROP_ORIGIN, origin, sizeof(origin), - NULL, NULL, 0, 1) != 0) + NULL, NULL, 0, 1) != 0 && + (options & BE_DESTROY_ORIGIN) != 0) return (set_error(lbh, BE_ERR_NOORIGIN)); + /* + * If the caller wants auto-origin destruction and the origin + * name matches one of our automatically created snapshot names + * (i.e. strftime("%F-%T") with a serial at the end), then + * we'll set the DESTROY_ORIGIN flag and nuke it + * be_is_auto_snapshot_name is exported from libbe(3) so that + * the caller can determine if it needs to warn about the origin + * not being destroyed or not. + */ + if ((options & BE_DESTROY_AUTOORIGIN) != 0 && *origin != '\0' && + be_is_auto_snapshot_name(lbh, origin)) + options |= BE_DESTROY_ORIGIN; + /* Don't destroy a mounted dataset unless force is specified */ if ((mounted = zfs_is_mounted(fs, NULL)) != 0) { if (force) { @@ -341,6 +356,25 @@ be_setup_snapshot_name(libbe_handle_t *lbh, char *buf, if (!zfs_dataset_exists(lbh->lzh, buf, ZFS_TYPE_SNAPSHOT)) return; } +} + +bool +be_is_auto_snapshot_name(libbe_handle_t *lbh, const char *name) +{ + const char *snap; + int day, hour, minute, month, second, serial, year; + + if ((snap = strchr(name, '@')) == NULL) + return (false); + ++snap; + /* We'll grab the individual components and do some light validation. */ + if (sscanf(snap, "%d-%d-%d-%d:%d:%d-%d", &year, &month, &day, &hour, + &minute, &second, &serial) != 7) + return (false); + return (year >= 1970) && (month >= 1 && month <= 12) && + (day >= 1 && day <= 31) && (hour >= 0 && hour <= 23) && + (minute >= 0 && minute <= 59) && (second >= 0 && second <= 60) && + serial >= 0; } int Modified: stable/11/lib/libbe/be.h ============================================================================== --- stable/11/lib/libbe/be.h Sun Oct 20 22:01:35 2019 (r353783) +++ stable/11/lib/libbe/be.h Sun Oct 20 22:05:57 2019 (r353784) @@ -82,6 +82,8 @@ void be_prop_list_free(nvlist_t *be_list); int be_activate(libbe_handle_t *, const char *, bool); +bool be_is_auto_snapshot_name(libbe_handle_t *, const char *); + /* Bootenv creation functions */ int be_create(libbe_handle_t *, const char *); int be_create_depth(libbe_handle_t *, const char *, const char *, int); @@ -97,6 +99,7 @@ int be_rename(libbe_handle_t *, const char *, const ch typedef enum { BE_DESTROY_FORCE = 1 << 0, BE_DESTROY_ORIGIN = 1 << 1, + BE_DESTROY_AUTOORIGIN = 1 << 2, } be_destroy_opt_t; int be_destroy(libbe_handle_t *, const char *, int); Modified: stable/11/lib/libbe/libbe.3 ============================================================================== --- stable/11/lib/libbe/libbe.3 Sun Oct 20 22:01:35 2019 (r353783) +++ stable/11/lib/libbe/libbe.3 Sun Oct 20 22:05:57 2019 (r353784) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 22, 2019 +.Dd October 16, 2019 .Dt LIBBE 3 .Os .Sh NAME @@ -59,6 +59,9 @@ .Ft const char * Ns .Fn be_root_path "libbe_handle_t *hdl" .Pp +.Ft bool Ns +.Fn be_is_auto_snapshot_name "libbe_handle_t *hdl" "const char *snap" +.Pp .Ft int .Fn be_create "libbe_handle_t *hdl" "const char *be_name" .Pp @@ -212,6 +215,18 @@ active on reboot. The .Fn be_root_path function returns the boot environment root path. +.Pp +The +.Fn be_is_auto_snapshot_name +function is used to determine if the given snapshot name matches the format that +the +.Fn be_snapshot +function will use by default if it is not given a snapshot name to use. +It returns +.Dv true +if the name matches the format, and +.Dv false +if it does not. .Pp The .Fn be_create Modified: stable/11/sbin/bectl/bectl.c ============================================================================== --- stable/11/sbin/bectl/bectl.c Sun Oct 20 22:01:35 2019 (r353783) +++ stable/11/sbin/bectl/bectl.c Sun Oct 20 22:05:57 2019 (r353784) @@ -376,6 +376,7 @@ bectl_cmd_destroy(int argc, char *argv[]) /* We'll emit a notice if there's an origin to be cleaned up */ if ((flags & BE_DESTROY_ORIGIN) == 0 && strchr(target, '@') == NULL) { + flags |= BE_DESTROY_AUTOORIGIN; if (be_root_concat(be, target, targetds) != 0) goto destroy; if (be_prop_list_alloc(&props) != 0) @@ -384,7 +385,8 @@ bectl_cmd_destroy(int argc, char *argv[]) be_prop_list_free(props); goto destroy; } - if (nvlist_lookup_string(props, "origin", &origin) == 0) + if (nvlist_lookup_string(props, "origin", &origin) == 0 && + !be_is_auto_snapshot_name(be, origin)) fprintf(stderr, "bectl destroy: leaving origin '%s' intact\n", origin); be_prop_list_free(props); From owner-svn-src-all@freebsd.org Sun Oct 20 22:05:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CF40516C55A; Sun, 20 Oct 2019 22:05:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xDP3586gz4Qpl; Sun, 20 Oct 2019 22:05:59 +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 94D471A5EE; Sun, 20 Oct 2019 22:05:59 +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 x9KM5xZ8057866; Sun, 20 Oct 2019 22:05:59 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KM5w26057863; Sun, 20 Oct 2019 22:05:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910202205.x9KM5w26057863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 20 Oct 2019 22:05:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353784 - in stable: 11/lib/libbe 11/sbin/bectl 12/lib/libbe 12/sbin/bectl X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/lib/libbe 11/sbin/bectl 12/lib/libbe 12/sbin/bectl X-SVN-Commit-Revision: 353784 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 22:05:59 -0000 Author: kevans Date: Sun Oct 20 22:05:57 2019 New Revision: 353784 URL: https://svnweb.freebsd.org/changeset/base/353784 Log: MFC r353644, r353646, r353663: bectl(8) origin auto-destroy r353644: libbe(3): add needed bits for be_destroy to auto-destroy some origins New BEs can be created from either an existing snapshot or an existing BE. If an existing BE is chosen (either implicitly via 'bectl create' or explicitly via 'bectl create -e foo bar', for instance), then bectl will create a snapshot of the current BE or "foo" with be_snapshot, with a name formatted like: strftime("%F-%T") and a serial added to it. This commit adds the needed bits for libbe or consumers to determine if a snapshot names matches one of these auto-created snapshots (with some light validation of the date/time/serial), and also a be_destroy flag to specify that the origin should be automatically destroyed if possible. A future commit to bectl will specify BE_DESTROY_AUTOORIGIN by default so we clean up the origin in the most common case, non-user-managed snapshots. r353646: bectl(8): destroy: use BE_DESTROY_AUTOORIGIN if -o is not specified -o will force the origin to be destroyed unconditionally. BE_DESTROY_AUTOORIGIN, on the other hand, will only destroy the origin if it matches the format used by be_snapshot. This lets us clean up the snapshots that are clearly not user-managed (because we're creating them) while leaving user-created snapshots in place and warning that they're still around when the BE created goes away. r353663: libbe(3): Fix destroy of imported BE w/ AUTOORIGIN Imported BE, much like the activated BE, will not have an origin that we can fetch/examine for destruction. be_destroy should not return BE_ERR_NOORIGIN for failure to get the origin property for BE_DESTROY_AUTOORIGIN, because we don't really know going into it that there's even an origin to be destroyed. BE_DESTROY_NEEDORIGIN has been renamed to BE_DESTROY_WANTORIGIN because only a subset of it *needs* the origin, so 'need' is too strong of verbiage. This was caught by jenkins and the bectl tests, but kevans failed to run the bectl tests prior to commit. Modified: stable/12/lib/libbe/be.c stable/12/lib/libbe/be.h stable/12/lib/libbe/libbe.3 stable/12/sbin/bectl/bectl.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/libbe/be.c stable/11/lib/libbe/be.h stable/11/lib/libbe/libbe.3 stable/11/sbin/bectl/bectl.c Directory Properties: stable/11/ (props changed) Modified: stable/12/lib/libbe/be.c ============================================================================== --- stable/12/lib/libbe/be.c Sun Oct 20 22:01:35 2019 (r353783) +++ stable/12/lib/libbe/be.c Sun Oct 20 22:05:57 2019 (r353784) @@ -229,6 +229,7 @@ be_destroy_cb(zfs_handle_t *zfs_hdl, void *data) return (0); } +#define BE_DESTROY_WANTORIGIN (BE_DESTROY_ORIGIN | BE_DESTROY_AUTOORIGIN) /* * Destroy the boot environment or snapshot specified by the name * parameter. Options are or'd together with the possible values: @@ -264,11 +265,25 @@ be_destroy(libbe_handle_t *lbh, const char *name, int if (fs == NULL) return (set_error(lbh, BE_ERR_ZFSOPEN)); - if ((options & BE_DESTROY_ORIGIN) != 0 && + if ((options & BE_DESTROY_WANTORIGIN) != 0 && zfs_prop_get(fs, ZFS_PROP_ORIGIN, origin, sizeof(origin), - NULL, NULL, 0, 1) != 0) + NULL, NULL, 0, 1) != 0 && + (options & BE_DESTROY_ORIGIN) != 0) return (set_error(lbh, BE_ERR_NOORIGIN)); + /* + * If the caller wants auto-origin destruction and the origin + * name matches one of our automatically created snapshot names + * (i.e. strftime("%F-%T") with a serial at the end), then + * we'll set the DESTROY_ORIGIN flag and nuke it + * be_is_auto_snapshot_name is exported from libbe(3) so that + * the caller can determine if it needs to warn about the origin + * not being destroyed or not. + */ + if ((options & BE_DESTROY_AUTOORIGIN) != 0 && *origin != '\0' && + be_is_auto_snapshot_name(lbh, origin)) + options |= BE_DESTROY_ORIGIN; + /* Don't destroy a mounted dataset unless force is specified */ if ((mounted = zfs_is_mounted(fs, NULL)) != 0) { if (force) { @@ -341,6 +356,25 @@ be_setup_snapshot_name(libbe_handle_t *lbh, char *buf, if (!zfs_dataset_exists(lbh->lzh, buf, ZFS_TYPE_SNAPSHOT)) return; } +} + +bool +be_is_auto_snapshot_name(libbe_handle_t *lbh, const char *name) +{ + const char *snap; + int day, hour, minute, month, second, serial, year; + + if ((snap = strchr(name, '@')) == NULL) + return (false); + ++snap; + /* We'll grab the individual components and do some light validation. */ + if (sscanf(snap, "%d-%d-%d-%d:%d:%d-%d", &year, &month, &day, &hour, + &minute, &second, &serial) != 7) + return (false); + return (year >= 1970) && (month >= 1 && month <= 12) && + (day >= 1 && day <= 31) && (hour >= 0 && hour <= 23) && + (minute >= 0 && minute <= 59) && (second >= 0 && second <= 60) && + serial >= 0; } int Modified: stable/12/lib/libbe/be.h ============================================================================== --- stable/12/lib/libbe/be.h Sun Oct 20 22:01:35 2019 (r353783) +++ stable/12/lib/libbe/be.h Sun Oct 20 22:05:57 2019 (r353784) @@ -82,6 +82,8 @@ void be_prop_list_free(nvlist_t *be_list); int be_activate(libbe_handle_t *, const char *, bool); +bool be_is_auto_snapshot_name(libbe_handle_t *, const char *); + /* Bootenv creation functions */ int be_create(libbe_handle_t *, const char *); int be_create_depth(libbe_handle_t *, const char *, const char *, int); @@ -97,6 +99,7 @@ int be_rename(libbe_handle_t *, const char *, const ch typedef enum { BE_DESTROY_FORCE = 1 << 0, BE_DESTROY_ORIGIN = 1 << 1, + BE_DESTROY_AUTOORIGIN = 1 << 2, } be_destroy_opt_t; int be_destroy(libbe_handle_t *, const char *, int); Modified: stable/12/lib/libbe/libbe.3 ============================================================================== --- stable/12/lib/libbe/libbe.3 Sun Oct 20 22:01:35 2019 (r353783) +++ stable/12/lib/libbe/libbe.3 Sun Oct 20 22:05:57 2019 (r353784) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 22, 2019 +.Dd October 16, 2019 .Dt LIBBE 3 .Os .Sh NAME @@ -59,6 +59,9 @@ .Ft const char * Ns .Fn be_root_path "libbe_handle_t *hdl" .Pp +.Ft bool Ns +.Fn be_is_auto_snapshot_name "libbe_handle_t *hdl" "const char *snap" +.Pp .Ft int .Fn be_create "libbe_handle_t *hdl" "const char *be_name" .Pp @@ -212,6 +215,18 @@ active on reboot. The .Fn be_root_path function returns the boot environment root path. +.Pp +The +.Fn be_is_auto_snapshot_name +function is used to determine if the given snapshot name matches the format that +the +.Fn be_snapshot +function will use by default if it is not given a snapshot name to use. +It returns +.Dv true +if the name matches the format, and +.Dv false +if it does not. .Pp The .Fn be_create Modified: stable/12/sbin/bectl/bectl.c ============================================================================== --- stable/12/sbin/bectl/bectl.c Sun Oct 20 22:01:35 2019 (r353783) +++ stable/12/sbin/bectl/bectl.c Sun Oct 20 22:05:57 2019 (r353784) @@ -376,6 +376,7 @@ bectl_cmd_destroy(int argc, char *argv[]) /* We'll emit a notice if there's an origin to be cleaned up */ if ((flags & BE_DESTROY_ORIGIN) == 0 && strchr(target, '@') == NULL) { + flags |= BE_DESTROY_AUTOORIGIN; if (be_root_concat(be, target, targetds) != 0) goto destroy; if (be_prop_list_alloc(&props) != 0) @@ -384,7 +385,8 @@ bectl_cmd_destroy(int argc, char *argv[]) be_prop_list_free(props); goto destroy; } - if (nvlist_lookup_string(props, "origin", &origin) == 0) + if (nvlist_lookup_string(props, "origin", &origin) == 0 && + !be_is_auto_snapshot_name(be, origin)) fprintf(stderr, "bectl destroy: leaving origin '%s' intact\n", origin); be_prop_list_free(props); From owner-svn-src-all@freebsd.org Sun Oct 20 22:39:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14C6016CF47; Sun, 20 Oct 2019 22:39:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xF7w6pxmz4SFC; Sun, 20 Oct 2019 22:39:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD0A71AB29; Sun, 20 Oct 2019 22:39:40 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KMdeof075556; Sun, 20 Oct 2019 22:39:40 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KMdeGT075555; Sun, 20 Oct 2019 22:39:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910202239.x9KMdeGT075555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 20 Oct 2019 22:39:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353785 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353785 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 22:39:41 -0000 Author: kevans Date: Sun Oct 20 22:39:40 2019 New Revision: 353785 URL: https://svnweb.freebsd.org/changeset/base/353785 Log: tuntap(4): Use make_dev_s to avoid si_drv1 race This allows us to avoid some dance in tunopen for dealing with the possibility of dev->si_drv1 being NULL as it's set prior to the devfs node being created in all cases. There's still the possibility that the tun device hasn't been fully initialized, since that's done after the devfs node was created. Alleviate this by returning ENXIO if we're not to that point of tuncreate yet. This work is what sparked r353128, full initialization of cloned devices w/ specified make_dev_args. Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Sun Oct 20 22:05:57 2019 (r353784) +++ head/sys/net/if_tuntap.c Sun Oct 20 22:39:40 2019 (r353785) @@ -209,6 +209,8 @@ SYSCTL_INT(_net_link_tap, OID_AUTO, devfs_cloning, CTL "Enable legacy devfs interface creation"); SYSCTL_INT(_net_link_tap, OID_AUTO, debug, CTLFLAG_RW, &tundebug, 0, ""); +static int tun_create_device(struct tuntap_driver *drv, int unit, + struct ucred *cr, struct cdev **dev, const char *name); static int tun_busy_locked(struct tuntap_softc *tp); static void tun_unbusy_locked(struct tuntap_softc *tp); static int tun_busy(struct tuntap_softc *tp); @@ -217,7 +219,7 @@ static void tun_unbusy(struct tuntap_softc *tp); static int tuntap_name2info(const char *name, int *unit, int *flags); static void tunclone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev); -static void tuncreate(struct cdev *dev, struct tuntap_driver *); +static void tuncreate(struct cdev *dev); static void tunrename(void *arg, struct ifnet *ifp); static int tunifioctl(struct ifnet *, u_long, caddr_t); static void tuninit(struct ifnet *); @@ -544,16 +546,15 @@ tun_clone_create(struct if_clone *ifc, char *name, siz snprintf(name, IFNAMSIZ, "%s%d", drv->cdevsw.d_name, unit); /* find any existing device, or allocate new unit number */ + dev = NULL; i = clone_create(&drv->clones, &drv->cdevsw, &unit, &dev, 0); - if (i) { - /* No preexisting struct cdev *, create one */ - dev = make_dev(&drv->cdevsw, unit, UID_UUCP, GID_DIALER, 0600, - "%s%d", drv->cdevsw.d_name, unit); - } + /* No preexisting struct cdev *, create one */ + if (i != 0) + i = tun_create_device(drv, unit, NULL, &dev, name); + if (i == 0) + tuncreate(dev); - tuncreate(dev, drv); - - return (0); + return (i); } static void @@ -608,12 +609,11 @@ tunclone(void *arg, struct ucred *cred, char *name, in name, u); name = devname; } - /* No preexisting struct cdev *, create one */ - *dev = make_dev_credf(MAKEDEV_REF, &drv->cdevsw, u, cred, - UID_UUCP, GID_DIALER, 0600, "%s", name); - } - if_clone_create(name, namelen, NULL); + i = tun_create_device(drv, u, cred, dev, name); + } + if (i == 0) + if_clone_create(name, namelen, NULL); out: CURVNET_RESTORE(); } @@ -791,6 +791,46 @@ MODULE_VERSION(if_tuntap, 1); MODULE_VERSION(if_tun, 1); MODULE_VERSION(if_tap, 1); +static int +tun_create_device(struct tuntap_driver *drv, int unit, struct ucred *cr, + struct cdev **dev, const char *name) +{ + struct make_dev_args args; + struct tuntap_softc *tp; + int error; + + tp = malloc(sizeof(*tp), M_TUN, M_WAITOK | M_ZERO); + mtx_init(&tp->tun_mtx, "tun_mtx", NULL, MTX_DEF); + cv_init(&tp->tun_cv, "tun_condvar"); + tp->tun_flags = drv->ident_flags; + tp->tun_drv = drv; + + make_dev_args_init(&args); + if (cr != NULL) + args.mda_flags = MAKEDEV_REF; + args.mda_devsw = &drv->cdevsw; + args.mda_cr = cr; + args.mda_uid = UID_UUCP; + args.mda_gid = GID_DIALER; + args.mda_mode = 0600; + args.mda_unit = unit; + args.mda_si_drv1 = tp; + error = make_dev_s(&args, dev, "%s", name); + if (error != 0) { + free(tp, M_TUN); + return (error); + } + + KASSERT((*dev)->si_drv1 != NULL, + ("Failed to set si_drv1 at %s creation", name)); + tp->tun_dev = *dev; + knlist_init_mtx(&tp->tun_rsel.si_note, &tp->tun_mtx); + mtx_lock(&tunmtx); + TAILQ_INSERT_TAIL(&tunhead, tp, tun_list); + mtx_unlock(&tunmtx); + return (0); +} + static void tunstart(struct ifnet *ifp) { @@ -883,49 +923,43 @@ tunstart_l2(struct ifnet *ifp) TUN_UNLOCK(tp); } /* tunstart_l2 */ - /* XXX: should return an error code so it can fail. */ static void -tuncreate(struct cdev *dev, struct tuntap_driver *drv) +tuncreate(struct cdev *dev) { - struct tuntap_softc *sc; + struct tuntap_driver *drv; + struct tuntap_softc *tp; struct ifnet *ifp; struct ether_addr eaddr; int iflags; u_char type; - sc = malloc(sizeof(*sc), M_TUN, M_WAITOK | M_ZERO); - mtx_init(&sc->tun_mtx, "tun_mtx", NULL, MTX_DEF); - cv_init(&sc->tun_cv, "tun_condvar"); - sc->tun_flags = drv->ident_flags; - sc->tun_dev = dev; - sc->tun_drv = drv; - mtx_lock(&tunmtx); - TAILQ_INSERT_TAIL(&tunhead, sc, tun_list); - mtx_unlock(&tunmtx); + tp = dev->si_drv1; + KASSERT(tp != NULL, + ("si_drv1 should have been initialized at creation")); + drv = tp->tun_drv; iflags = IFF_MULTICAST; - if ((sc->tun_flags & TUN_L2) != 0) { + if ((tp->tun_flags & TUN_L2) != 0) { type = IFT_ETHER; iflags |= IFF_BROADCAST | IFF_SIMPLEX; } else { type = IFT_PPP; iflags |= IFF_POINTOPOINT; } - ifp = sc->tun_ifp = if_alloc(type); + ifp = tp->tun_ifp = if_alloc(type); if (ifp == NULL) panic("%s%d: failed to if_alloc() interface.\n", drv->cdevsw.d_name, dev2unit(dev)); - ifp->if_softc = sc; + ifp->if_softc = tp; if_initname(ifp, drv->cdevsw.d_name, dev2unit(dev)); ifp->if_ioctl = tunifioctl; ifp->if_flags = iflags; IFQ_SET_MAXLEN(&ifp->if_snd, ifqmaxlen); - knlist_init_mtx(&sc->tun_rsel.si_note, &sc->tun_mtx); ifp->if_capabilities |= IFCAP_LINKSTATE; ifp->if_capenable |= IFCAP_LINKSTATE; - if ((sc->tun_flags & TUN_L2) != 0) { + if ((tp->tun_flags & TUN_L2) != 0) { ifp->if_mtu = ETHERMTU; ifp->if_init = tunifinit; ifp->if_start = tunstart_l2; @@ -943,11 +977,10 @@ tuncreate(struct cdev *dev, struct tuntap_driver *drv) if_attach(ifp); bpfattach(ifp, DLT_NULL, sizeof(u_int32_t)); } - dev->si_drv1 = sc; - TUN_LOCK(sc); - sc->tun_flags |= TUN_INITED; - TUN_UNLOCK(sc); + TUN_LOCK(tp); + tp->tun_flags |= TUN_INITED; + TUN_UNLOCK(tp); TUNDEBUG(ifp, "interface %s is created, minor = %#x\n", ifp->if_xname, dev2unit(dev)); @@ -1008,7 +1041,6 @@ static int tunopen(struct cdev *dev, int flag, int mode, struct thread *td) { struct ifnet *ifp; - struct tuntap_driver *drv; struct tuntap_softc *tp; int error, tunflags; @@ -1031,22 +1063,16 @@ tunopen(struct cdev *dev, int flag, int mode, struct t } } - /* - * XXXRW: Non-atomic test and set of dev->si_drv1 requires - * synchronization. - */ tp = dev->si_drv1; - if (!tp) { - drv = tuntap_driver_from_flags(tunflags); - if (drv == NULL) { - CURVNET_RESTORE(); - return (ENXIO); - } - tuncreate(dev, drv); - tp = dev->si_drv1; - } + KASSERT(tp != NULL, + ("si_drv1 should have been initialized at creation")); TUN_LOCK(tp); + if ((tp->tun_flags & TUN_INITED) == 0) { + TUN_UNLOCK(tp); + CURVNET_RESTORE(); + return (ENXIO); + } if ((tp->tun_flags & (TUN_OPEN | TUN_DYING)) != 0) { TUN_UNLOCK(tp); CURVNET_RESTORE(); From owner-svn-src-all@freebsd.org Sun Oct 20 22:55:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E27A216D423; Sun, 20 Oct 2019 22:55:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xFVW5m26z4Stc; Sun, 20 Oct 2019 22:55:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA2CE1AEB4; Sun, 20 Oct 2019 22:55:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9KMtlT7086928; Sun, 20 Oct 2019 22:55:47 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9KMtlki086927; Sun, 20 Oct 2019 22:55:47 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910202255.x9KMtlki086927@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sun, 20 Oct 2019 22:55:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353786 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353786 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 20 Oct 2019 22:55:47 -0000 Author: kevans Date: Sun Oct 20 22:55:47 2019 New Revision: 353786 URL: https://svnweb.freebsd.org/changeset/base/353786 Log: tuntap(4): use cdevpriv w/ dtor for last close instead of d_close cdevpriv dtors will be called when the reference count on the associated struct file drops to 0, while d_close can be unreliable for cleaning up state at "last close" for a number of reasons. As far as tunclose/tundtor is concerned the difference is minimal, so make the switch. Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Sun Oct 20 22:39:40 2019 (r353785) +++ head/sys/net/if_tuntap.c Sun Oct 20 22:55:47 2019 (r353786) @@ -220,6 +220,7 @@ static int tuntap_name2info(const char *name, int *uni static void tunclone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev); static void tuncreate(struct cdev *dev); +static void tundtor(void *data); static void tunrename(void *arg, struct ifnet *ifp); static int tunifioctl(struct ifnet *, u_long, caddr_t); static void tuninit(struct ifnet *); @@ -238,7 +239,6 @@ static int tun_clone_destroy(struct if_clone *, struct static void tun_vnethdr_set(struct ifnet *ifp, int vhdrlen); static d_open_t tunopen; -static d_close_t tunclose; static d_read_t tunread; static d_write_t tunwrite; static d_ioctl_t tunioctl; @@ -278,7 +278,6 @@ static struct tuntap_driver { .d_version = D_VERSION, .d_flags = D_NEEDMINOR, .d_open = tunopen, - .d_close = tunclose, .d_read = tunread, .d_write = tunwrite, .d_ioctl = tunioctl, @@ -296,7 +295,6 @@ static struct tuntap_driver { .d_version = D_VERSION, .d_flags = D_NEEDMINOR, .d_open = tunopen, - .d_close = tunclose, .d_read = tunread, .d_write = tunwrite, .d_ioctl = tunioctl, @@ -314,7 +312,6 @@ static struct tuntap_driver { .d_version = D_VERSION, .d_flags = D_NEEDMINOR, .d_open = tunopen, - .d_close = tunclose, .d_read = tunread, .d_write = tunwrite, .d_ioctl = tunioctl, @@ -1100,24 +1097,33 @@ tunopen(struct cdev *dev, int flag, int mode, struct t if_link_state_change(ifp, LINK_STATE_UP); TUNDEBUG(ifp, "open\n"); TUN_UNLOCK(tp); + + /* + * This can fail with either ENOENT or EBUSY. This is in the middle of + * d_open, so ENOENT should not be possible. EBUSY is possible, but + * the only cdevpriv dtor being set will be tundtor and the softc being + * passed is constant for a given cdev. We ignore the possible error + * because of this as either "unlikely" or "not actually a problem." + */ + (void)devfs_set_cdevpriv(tp, tundtor); CURVNET_RESTORE(); return (0); } /* - * tunclose - close the device - mark i/f down & delete + * tundtor - tear down the device - mark i/f down & delete * routing info */ -static int -tunclose(struct cdev *dev, int foo, int bar, struct thread *td) +static void +tundtor(void *data) { struct proc *p; struct tuntap_softc *tp; struct ifnet *ifp; bool l2tun; - p = td->td_proc; - tp = dev->si_drv1; + tp = data; + p = curproc; ifp = TUN2IFP(tp); TUN_LOCK(tp); @@ -1133,7 +1139,7 @@ tunclose(struct cdev *dev, int foo, int bar, struct th if (p->p_pid != tp->tun_pid) { log(LOG_INFO, "pid %d (%s), %s: tun/tap protocol violation, non-controlling process closed last.\n", - p->p_pid, p->p_comm, dev->si_name); + p->p_pid, p->p_comm, tp->tun_dev->si_name); } /* @@ -1193,7 +1199,6 @@ out: tun_unbusy_locked(tp); TUN_UNLOCK(tp); - return (0); } static void From owner-svn-src-all@freebsd.org Mon Oct 21 00:08:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64C6D16E88A; Mon, 21 Oct 2019 00:08:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xH6Y1r5sz4WG3; Mon, 21 Oct 2019 00:08:37 +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 21DAC1BB19; Mon, 21 Oct 2019 00:08:37 +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 x9L08bAa027875; Mon, 21 Oct 2019 00:08:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L08ZQt027865; Mon, 21 Oct 2019 00:08:35 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910210008.x9L08ZQt027865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 00:08:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353787 - in stable/12/sys: kern vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/sys: kern vm X-SVN-Commit-Revision: 353787 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 00:08:37 -0000 Author: kevans Date: Mon Oct 21 00:08:34 2019 New Revision: 353787 URL: https://svnweb.freebsd.org/changeset/base/353787 Log: MFC r351650, r351795-r351796: writemapping accounting for posixshm r351650: posixshm: switch to OBJT_SWAP in advance of other changes Future changes to posixshm will start tracking writeable mappings in order to support file sealing. Tracking writeable mappings for an OBJT_DEFAULT object is complicated as it may be swapped out and converted to an OBJT_SWAP. One may generically add this tracking for vm_object, but this is difficult to do without increasing memory footprint of vm_object and blowing up memory usage by a significant amount. On the other hand, the swap pager can be expanded to track writeable mappings without increasing vm_object size. This change is currently in D21456. Switch over to OBJT_SWAP in advance of the other changes to the swap pager and posixshm. r351795: vm pager: writemapping accounting for OBJT_SWAP Currently writemapping accounting is only done for vnode_pager which does some accounting on the underlying vnode. Extend this to allow accounting to be possible for any of the pager types. New pageops are added to update/release writecount that need to be implemented for any pager wishing to do said accounting, and we implement these methods now for both vnode_pager (unchanged) and swap_pager. The primary motivation for this is to allow other systems with OBJT_SWAP objects to check if their objects have any write mappings and reject operations with EBUSY if so. posixshm will be the first to do so in order to reject adding write seals to the shmfd if any writable mappings exist. r351796: posixshm: start counting writeable mappings r351650 switched posixshm to using OBJT_SWAP for shm_object r351795 added support to the swap_pager for tracking writeable mappings Take advantage of this and start tracking writeable mappings; fd sealing will use this to reject a seal on writing with EBUSY if any such mapping exist. Modified: stable/12/sys/kern/uipc_shm.c stable/12/sys/kern/vfs_vnops.c stable/12/sys/vm/swap_pager.c stable/12/sys/vm/vm_map.c stable/12/sys/vm/vm_map.h stable/12/sys/vm/vm_mmap.c stable/12/sys/vm/vm_object.h stable/12/sys/vm/vm_pager.h stable/12/sys/vm/vnode_pager.c stable/12/sys/vm/vnode_pager.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/uipc_shm.c ============================================================================== --- stable/12/sys/kern/uipc_shm.c Sun Oct 20 22:55:47 2019 (r353786) +++ stable/12/sys/kern/uipc_shm.c Mon Oct 21 00:08:34 2019 (r353787) @@ -554,7 +554,7 @@ shm_alloc(struct ucred *ucred, mode_t mode) shmfd->shm_uid = ucred->cr_uid; shmfd->shm_gid = ucred->cr_gid; shmfd->shm_mode = mode; - shmfd->shm_object = vm_pager_allocate(OBJT_DEFAULT, NULL, + shmfd->shm_object = vm_pager_allocate(OBJT_SWAP, NULL, shmfd->shm_size, VM_PROT_DEFAULT, 0, ucred); KASSERT(shmfd->shm_object != NULL, ("shm_create: vm_pager_allocate")); shmfd->shm_object->pg_color = 0; @@ -900,6 +900,7 @@ shm_mmap(struct file *fp, vm_map_t map, vm_offset_t *a struct shmfd *shmfd; vm_prot_t maxprot; int error; + bool writecnt; shmfd = fp->f_data; maxprot = VM_PROT_NONE; @@ -910,10 +911,10 @@ shm_mmap(struct file *fp, vm_map_t map, vm_offset_t *a if ((fp->f_flag & FWRITE) != 0) maxprot |= VM_PROT_WRITE; + writecnt = (flags & MAP_SHARED) != 0 && (prot & VM_PROT_WRITE) != 0; + /* Don't permit shared writable mappings on read-only descriptors. */ - if ((flags & MAP_SHARED) != 0 && - (maxprot & VM_PROT_WRITE) == 0 && - (prot & VM_PROT_WRITE) != 0) + if (writecnt && (maxprot & VM_PROT_WRITE) == 0) return (EACCES); maxprot &= cap_maxprot; @@ -936,10 +937,16 @@ shm_mmap(struct file *fp, vm_map_t map, vm_offset_t *a mtx_unlock(&shm_timestamp_lock); vm_object_reference(shmfd->shm_object); + if (writecnt) + vm_pager_update_writecount(shmfd->shm_object, 0, objsize); error = vm_mmap_object(map, addr, objsize, prot, maxprot, flags, - shmfd->shm_object, foff, FALSE, td); - if (error != 0) + shmfd->shm_object, foff, writecnt, td); + if (error != 0) { + if (writecnt) + vm_pager_release_writecount(shmfd->shm_object, 0, + objsize); vm_object_deallocate(shmfd->shm_object); + } return (error); } Modified: stable/12/sys/kern/vfs_vnops.c ============================================================================== --- stable/12/sys/kern/vfs_vnops.c Sun Oct 20 22:55:47 2019 (r353786) +++ stable/12/sys/kern/vfs_vnops.c Mon Oct 21 00:08:34 2019 (r353787) @@ -86,7 +86,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include +#include #ifdef HWPMC_HOOKS #include @@ -2483,7 +2483,7 @@ vn_mmap(struct file *fp, vm_map_t map, vm_offset_t *ad * writecount, then undo that now. */ if (writecounted) - vnode_pager_release_writecount(object, 0, size); + vm_pager_release_writecount(object, 0, size); vm_object_deallocate(object); } #ifdef HWPMC_HOOKS Modified: stable/12/sys/vm/swap_pager.c ============================================================================== --- stable/12/sys/vm/swap_pager.c Sun Oct 20 22:55:47 2019 (r353786) +++ stable/12/sys/vm/swap_pager.c Mon Oct 21 00:08:34 2019 (r353787) @@ -375,6 +375,10 @@ static boolean_t static void swap_pager_init(void); static void swap_pager_unswapped(vm_page_t); static void swap_pager_swapoff(struct swdevt *sp); +static void swap_pager_update_writecount(vm_object_t object, + vm_offset_t start, vm_offset_t end); +static void swap_pager_release_writecount(vm_object_t object, + vm_offset_t start, vm_offset_t end); struct pagerops swappagerops = { .pgo_init = swap_pager_init, /* early system initialization of pager */ @@ -385,6 +389,8 @@ struct pagerops swappagerops = { .pgo_putpages = swap_pager_putpages, /* pageout */ .pgo_haspage = swap_pager_haspage, /* get backing store status for page */ .pgo_pageunswapped = swap_pager_unswapped, /* remove swap related to page */ + .pgo_update_writecount = swap_pager_update_writecount, + .pgo_release_writecount = swap_pager_release_writecount, }; /* @@ -610,6 +616,7 @@ swap_pager_alloc_init(void *handle, struct ucred *cred object = vm_object_allocate(OBJT_SWAP, OFF_TO_IDX(offset + PAGE_MASK + size)); + object->un_pager.swp.writemappings = 0; object->handle = handle; if (cred != NULL) { object->cred = cred; @@ -1920,6 +1927,7 @@ swp_pager_meta_build(vm_object_t object, vm_pindex_t p atomic_thread_fence_rel(); object->type = OBJT_SWAP; + object->un_pager.swp.writemappings = 0; KASSERT(object->handle == NULL, ("default pager with handle")); } @@ -3004,4 +3012,28 @@ sysctl_swap_async_max(SYSCTL_HANDLER_ARGS) mtx_unlock(&pbuf_mtx); return (0); +} + +static void +swap_pager_update_writecount(vm_object_t object, vm_offset_t start, + vm_offset_t end) +{ + + VM_OBJECT_WLOCK(object); + KASSERT((object->flags & OBJ_NOSPLIT) != 0, + ("Splittable object with writecount")); + object->un_pager.swp.writemappings += (vm_ooffset_t)end - start; + VM_OBJECT_WUNLOCK(object); +} + +static void +swap_pager_release_writecount(vm_object_t object, vm_offset_t start, + vm_offset_t end) +{ + + VM_OBJECT_WLOCK(object); + KASSERT((object->flags & OBJ_NOSPLIT) != 0, + ("Splittable object with writecount")); + object->un_pager.swp.writemappings -= (vm_ooffset_t)end - start; + VM_OBJECT_WUNLOCK(object); } Modified: stable/12/sys/vm/vm_map.c ============================================================================== --- stable/12/sys/vm/vm_map.c Sun Oct 20 22:55:47 2019 (r353786) +++ stable/12/sys/vm/vm_map.c Mon Oct 21 00:08:34 2019 (r353787) @@ -574,10 +574,10 @@ vm_map_process_deferred(void) td->td_map_def_user = NULL; while (entry != NULL) { next = entry->next; - MPASS((entry->eflags & (MAP_ENTRY_VN_WRITECNT | - MAP_ENTRY_VN_EXEC)) != (MAP_ENTRY_VN_WRITECNT | + MPASS((entry->eflags & (MAP_ENTRY_WRITECNT | + MAP_ENTRY_VN_EXEC)) != (MAP_ENTRY_WRITECNT | MAP_ENTRY_VN_EXEC)); - if ((entry->eflags & MAP_ENTRY_VN_WRITECNT) != 0) { + if ((entry->eflags & MAP_ENTRY_WRITECNT) != 0) { /* * Decrement the object's writemappings and * possibly the vnode's v_writecount. @@ -586,7 +586,7 @@ vm_map_process_deferred(void) ("Submap with writecount")); object = entry->object.vm_object; KASSERT(object != NULL, ("No object for writecount")); - vnode_pager_release_writecount(object, entry->start, + vm_pager_release_writecount(object, entry->start, entry->end); } vm_map_entry_set_vnode_text(entry, false); @@ -1484,8 +1484,8 @@ vm_map_insert(vm_map_t map, vm_object_t object, vm_oof protoeflags |= MAP_ENTRY_GROWS_DOWN; if (cow & MAP_STACK_GROWS_UP) protoeflags |= MAP_ENTRY_GROWS_UP; - if (cow & MAP_VN_WRITECOUNT) - protoeflags |= MAP_ENTRY_VN_WRITECNT; + if (cow & MAP_WRITECOUNT) + protoeflags |= MAP_ENTRY_WRITECNT; if (cow & MAP_VN_EXEC) protoeflags |= MAP_ENTRY_VN_EXEC; if ((cow & MAP_CREATE_GUARD) != 0) @@ -2196,7 +2196,7 @@ _vm_map_clip_start(vm_map_t map, vm_map_entry_t entry, vm_map_entry_set_vnode_text(new_entry, true); /* * The object->un_pager.vnp.writemappings for the - * object of MAP_ENTRY_VN_WRITECNT type entry shall be + * object of MAP_ENTRY_WRITECNT type entry shall be * kept as is here. The virtual pages are * re-distributed among the clipped entries, so the sum is * left the same. @@ -3758,20 +3758,20 @@ vm_map_copy_entry( dst_entry->eflags |= MAP_ENTRY_COW | MAP_ENTRY_NEEDS_COPY; dst_entry->offset = src_entry->offset; - if (src_entry->eflags & MAP_ENTRY_VN_WRITECNT) { + if (src_entry->eflags & MAP_ENTRY_WRITECNT) { /* - * MAP_ENTRY_VN_WRITECNT cannot + * MAP_ENTRY_WRITECNT cannot * indicate write reference from * src_entry, since the entry is * marked as needs copy. Allocate a * fake entry that is used to - * decrement object->un_pager.vnp.writecount + * decrement object->un_pager writecount * at the appropriate time. Attach * fake_entry to the deferred list. */ fake_entry = vm_map_entry_create(dst_map); - fake_entry->eflags = MAP_ENTRY_VN_WRITECNT; - src_entry->eflags &= ~MAP_ENTRY_VN_WRITECNT; + fake_entry->eflags = MAP_ENTRY_WRITECNT; + src_entry->eflags &= ~MAP_ENTRY_WRITECNT; vm_object_reference(src_object); fake_entry->object.vm_object = src_object; fake_entry->start = src_entry->start; @@ -3954,7 +3954,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c * not relock it later for the assertion * correctness. */ - if (old_entry->eflags & MAP_ENTRY_VN_WRITECNT && + if (old_entry->eflags & MAP_ENTRY_WRITECNT && object->type == OBJT_VNODE) { KASSERT(((struct vnode *)object->handle)-> v_writecount > 0, @@ -3974,8 +3974,8 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c MAP_ENTRY_IN_TRANSITION); new_entry->wiring_thread = NULL; new_entry->wired_count = 0; - if (new_entry->eflags & MAP_ENTRY_VN_WRITECNT) { - vnode_pager_update_writecount(object, + if (new_entry->eflags & MAP_ENTRY_WRITECNT) { + vm_pager_update_writecount(object, new_entry->start, new_entry->end); } vm_map_entry_set_vnode_text(new_entry, true); @@ -4006,7 +4006,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c * Copied entry is COW over the old object. */ new_entry->eflags &= ~(MAP_ENTRY_USER_WIRED | - MAP_ENTRY_IN_TRANSITION | MAP_ENTRY_VN_WRITECNT); + MAP_ENTRY_IN_TRANSITION | MAP_ENTRY_WRITECNT); new_entry->wiring_thread = NULL; new_entry->wired_count = 0; new_entry->object.vm_object = NULL; @@ -4030,7 +4030,7 @@ vmspace_fork(struct vmspace *vm1, vm_ooffset_t *fork_c new_entry->end = old_entry->end; new_entry->eflags = old_entry->eflags & ~(MAP_ENTRY_USER_WIRED | MAP_ENTRY_IN_TRANSITION | - MAP_ENTRY_VN_WRITECNT | MAP_ENTRY_VN_EXEC); + MAP_ENTRY_WRITECNT | MAP_ENTRY_VN_EXEC); new_entry->protection = old_entry->protection; new_entry->max_protection = old_entry->max_protection; new_entry->inheritance = VM_INHERIT_ZERO; Modified: stable/12/sys/vm/vm_map.h ============================================================================== --- stable/12/sys/vm/vm_map.h Sun Oct 20 22:55:47 2019 (r353786) +++ stable/12/sys/vm/vm_map.h Mon Oct 21 00:08:34 2019 (r353787) @@ -145,7 +145,7 @@ struct vm_map_entry { #define MAP_ENTRY_GROWS_UP 0x00002000 /* bottom-up stacks */ #define MAP_ENTRY_WIRE_SKIPPED 0x00004000 -#define MAP_ENTRY_VN_WRITECNT 0x00008000 /* writeable vnode +#define MAP_ENTRY_WRITECNT 0x00008000 /* tracked writeable mapping */ #define MAP_ENTRY_GUARD 0x00010000 #define MAP_ENTRY_STACK_GAP_DN 0x00020000 @@ -349,7 +349,7 @@ long vmspace_resident_count(struct vmspace *vmspace); #define MAP_CREATE_GUARD 0x00000080 #define MAP_DISABLE_COREDUMP 0x00000100 #define MAP_PREFAULT_MADVISE 0x00000200 /* from (user) madvise request */ -#define MAP_VN_WRITECOUNT 0x00000400 +#define MAP_WRITECOUNT 0x00000400 #define MAP_REMAP 0x00000800 #define MAP_STACK_GROWS_DOWN 0x00001000 #define MAP_STACK_GROWS_UP 0x00002000 Modified: stable/12/sys/vm/vm_mmap.c ============================================================================== --- stable/12/sys/vm/vm_mmap.c Sun Oct 20 22:55:47 2019 (r353786) +++ stable/12/sys/vm/vm_mmap.c Mon Oct 21 00:08:34 2019 (r353787) @@ -1242,7 +1242,7 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize, } if (writex) { *writecounted = TRUE; - vnode_pager_update_writecount(obj, 0, objsize); + vm_pager_update_writecount(obj, 0, objsize); } } else { error = EINVAL; @@ -1298,7 +1298,7 @@ vm_mmap_vnode(struct thread *td, vm_size_t objsize, done: if (error != 0 && *writecounted) { *writecounted = FALSE; - vnode_pager_update_writecount(obj, objsize, 0); + vm_pager_update_writecount(obj, objsize, 0); } vput(vp); return (error); @@ -1433,7 +1433,7 @@ vm_mmap(vm_map_t map, vm_offset_t *addr, vm_size_t siz * writecount, then undo that now. */ if (writecounted) - vnode_pager_release_writecount(object, 0, size); + vm_pager_release_writecount(object, 0, size); vm_object_deallocate(object); } return (error); @@ -1522,7 +1522,7 @@ vm_mmap_object(vm_map_t map, vm_offset_t *addr, vm_siz if (flags & MAP_SHARED) docow |= MAP_INHERIT_SHARE; if (writecounted) - docow |= MAP_VN_WRITECOUNT; + docow |= MAP_WRITECOUNT; if (flags & MAP_STACK) { if (object != NULL) return (EINVAL); Modified: stable/12/sys/vm/vm_object.h ============================================================================== --- stable/12/sys/vm/vm_object.h Sun Oct 20 22:55:47 2019 (r353786) +++ stable/12/sys/vm/vm_object.h Mon Oct 21 00:08:34 2019 (r353787) @@ -167,6 +167,7 @@ struct vm_object { struct { void *swp_tmpfs; struct pctrie swp_blks; + vm_ooffset_t writemappings; } swp; } un_pager; struct ucred *cred; Modified: stable/12/sys/vm/vm_pager.h ============================================================================== --- stable/12/sys/vm/vm_pager.h Sun Oct 20 22:55:47 2019 (r353786) +++ stable/12/sys/vm/vm_pager.h Mon Oct 21 00:08:34 2019 (r353787) @@ -61,6 +61,7 @@ typedef boolean_t pgo_haspage_t(vm_object_t, vm_pindex typedef int pgo_populate_t(vm_object_t, vm_pindex_t, int, vm_prot_t, vm_pindex_t *, vm_pindex_t *); typedef void pgo_pageunswapped_t(vm_page_t); +typedef void pgo_writecount_t(vm_object_t, vm_offset_t, vm_offset_t); struct pagerops { pgo_init_t *pgo_init; /* Initialize pager. */ @@ -72,6 +73,9 @@ struct pagerops { pgo_haspage_t *pgo_haspage; /* Query page. */ pgo_populate_t *pgo_populate; /* Bulk spec pagein. */ pgo_pageunswapped_t *pgo_pageunswapped; + /* Operations for specialized writecount handling */ + pgo_writecount_t *pgo_update_writecount; + pgo_writecount_t *pgo_release_writecount; }; extern struct pagerops defaultpagerops; @@ -190,6 +194,26 @@ vm_pager_page_unswapped(vm_page_t m) VM_OBJECT_ASSERT_LOCKED(m->object); if (pagertab[m->object->type]->pgo_pageunswapped) (*pagertab[m->object->type]->pgo_pageunswapped)(m); +} + +static __inline void +vm_pager_update_writecount(vm_object_t object, vm_offset_t start, + vm_offset_t end) +{ + + if (pagertab[object->type]->pgo_update_writecount) + pagertab[object->type]->pgo_update_writecount(object, start, + end); +} + +static __inline void +vm_pager_release_writecount(vm_object_t object, vm_offset_t start, + vm_offset_t end) +{ + + if (pagertab[object->type]->pgo_release_writecount) + pagertab[object->type]->pgo_release_writecount(object, start, + end); } struct cdev_pager_ops { Modified: stable/12/sys/vm/vnode_pager.c ============================================================================== --- stable/12/sys/vm/vnode_pager.c Sun Oct 20 22:55:47 2019 (r353786) +++ stable/12/sys/vm/vnode_pager.c Mon Oct 21 00:08:34 2019 (r353787) @@ -97,6 +97,10 @@ static vm_object_t vnode_pager_alloc(void *, vm_ooffse vm_ooffset_t, struct ucred *cred); static int vnode_pager_generic_getpages_done(struct buf *); static void vnode_pager_generic_getpages_done_async(struct buf *); +static void vnode_pager_update_writecount(vm_object_t, vm_offset_t, + vm_offset_t); +static void vnode_pager_release_writecount(vm_object_t, vm_offset_t, + vm_offset_t); struct pagerops vnodepagerops = { .pgo_alloc = vnode_pager_alloc, @@ -105,6 +109,8 @@ struct pagerops vnodepagerops = { .pgo_getpages_async = vnode_pager_getpages_async, .pgo_putpages = vnode_pager_putpages, .pgo_haspage = vnode_pager_haspage, + .pgo_update_writecount = vnode_pager_update_writecount, + .pgo_release_writecount = vnode_pager_release_writecount, }; int vnode_pbuf_freecnt; @@ -1499,7 +1505,7 @@ done: VM_OBJECT_WUNLOCK(obj); } -void +static void vnode_pager_update_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end) { @@ -1528,7 +1534,7 @@ vnode_pager_update_writecount(vm_object_t object, vm_o VM_OBJECT_WUNLOCK(object); } -void +static void vnode_pager_release_writecount(vm_object_t object, vm_offset_t start, vm_offset_t end) { Modified: stable/12/sys/vm/vnode_pager.h ============================================================================== --- stable/12/sys/vm/vnode_pager.h Sun Oct 20 22:55:47 2019 (r353786) +++ stable/12/sys/vm/vnode_pager.h Mon Oct 21 00:08:34 2019 (r353787) @@ -50,12 +50,8 @@ int vnode_pager_generic_putpages(struct vnode *vp, vm_ int vnode_pager_local_getpages(struct vop_getpages_args *ap); int vnode_pager_local_getpages_async(struct vop_getpages_async_args *ap); int vnode_pager_putpages_ioflags(int pager_flags); -void vnode_pager_release_writecount(vm_object_t object, vm_offset_t start, - vm_offset_t end); void vnode_pager_undirty_pages(vm_page_t *ma, int *rtvals, int written, off_t eof, int lpos); -void vnode_pager_update_writecount(vm_object_t object, vm_offset_t start, - vm_offset_t end); #endif /* _KERNEL */ #endif /* _VNODE_PAGER_ */ From owner-svn-src-all@freebsd.org Mon Oct 21 00:52:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B0E616F54C; Mon, 21 Oct 2019 00:52:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xJ522G5Vz4Y1h; Mon, 21 Oct 2019 00:52:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 310051C3B7; Mon, 21 Oct 2019 00:52:22 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9L0qMQ7057465; Mon, 21 Oct 2019 00:52:22 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L0qLo9057463; Mon, 21 Oct 2019 00:52:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910210052.x9L0qLo9057463@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 00:52:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353788 - in head: release/picobsd/build share/man/man8 X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: release/picobsd/build share/man/man8 X-SVN-Commit-Revision: 353788 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 00:52:22 -0000 Author: kevans Date: Mon Oct 21 00:52:21 2019 New Revision: 353788 URL: https://svnweb.freebsd.org/changeset/base/353788 Log: picobsd: add deprecation notices Notices appear both in picobsd(8) (near the top for easy notice) and are also printed to stderr on every invocation of picobsd for visibility. The tentative date for removal is October 31st, as no volunteers have stepped forward at all from postings to -arch@ at least. No objection from: -arch@ MFC after: 3 days Modified: head/release/picobsd/build/picobsd head/share/man/man8/picobsd.8 Modified: head/release/picobsd/build/picobsd ============================================================================== --- head/release/picobsd/build/picobsd Mon Oct 21 00:08:34 2019 (r353787) +++ head/release/picobsd/build/picobsd Mon Oct 21 00:52:21 2019 (r353788) @@ -1019,6 +1019,7 @@ set_build_parameters() { # Main entry of the script. Initialize variables, parse command line # arguments. +1>&2 echo "WARNING: picobsd is deprecated and will be removed in FreeBSD 13.0." set_defaults while [ true ]; do Modified: head/share/man/man8/picobsd.8 ============================================================================== --- head/share/man/man8/picobsd.8 Mon Oct 21 00:08:34 2019 (r353787) +++ head/share/man/man8/picobsd.8 Mon Oct 21 00:52:21 2019 (r353788) @@ -1,6 +1,6 @@ .\" -*- nroff-fill -*- .\" $FreeBSD$ -.Dd October 1, 2013 +.Dd October 20, 2019 .Dt PICOBSD 8 .Os .Sh NAME @@ -11,6 +11,10 @@ .Op Ar options .Op Ar config-name Op Ar site-name .Sh DESCRIPTION +.Nm +is deprecated and will be removed in +.Fx 13.0 . +.Pp The .Nm utility is a script which produces a minimal implementation of From owner-svn-src-all@freebsd.org Mon Oct 21 01:24:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0E5616FF11; Mon, 21 Oct 2019 01:24:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xJnz5cvsz4ZWp; Mon, 21 Oct 2019 01:24:23 +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 A09F11C910; Mon, 21 Oct 2019 01:24:23 +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 x9L1ONLj075287; Mon, 21 Oct 2019 01:24:23 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L1OMTB075280; Mon, 21 Oct 2019 01:24:22 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910210124.x9L1OMTB075280@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 01:24:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353789 - in stable: 11/lib/libc/gen 11/lib/libc/sys 11/sys/kern 11/sys/sys 12/lib/libc/gen 12/lib/libc/sys 12/sys/kern 12/sys/sys X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/lib/libc/gen 11/lib/libc/sys 11/sys/kern 11/sys/sys 12/lib/libc/gen 12/lib/libc/sys 12/sys/kern 12/sys/sys X-SVN-Commit-Revision: 353789 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 01:24:23 -0000 Author: kevans Date: Mon Oct 21 01:24:21 2019 New Revision: 353789 URL: https://svnweb.freebsd.org/changeset/base/353789 Log: MFC r352711-r352712: Address posix_spawn(3) signal issues r352711: rfork(2): add RFSPAWN flag When RFSPAWN is passed, rfork exhibits vfork(2) semantics but also resets signal handlers in the child during creation to avoid a point of corruption of parent state from the child. This flag will be used by posix_spawn(3) to handle potential signal issues. Reviewed by: jilles, kib Differential Revision: https://reviews.freebsd.org/D19058 r352712: posix_spawn(3): handle potential signal issues with vfork Described in [1], signal handlers running in a vfork child have opportunities to corrupt the parent's state. Address this by adding a new rfork(2) flag, RFSPAWN, that has vfork(2) semantics but also resets signal handlers in the child during creation. x86 uses rfork_thread(3) instead of a direct rfork(2) because rfork with RFMEM/RFSPAWN cannot work when the return address is stored on the stack -- further information about this problem is described under RFMEM in the rfork(2) man page. Addressing this has been identified as a prerequisite to using posix_spawn in subprocess on FreeBSD [2]. [1] https://ewontfix.com/7/ [2] https://bugs.python.org/issue35823 Modified: stable/11/lib/libc/gen/posix_spawn.c stable/11/lib/libc/sys/rfork.2 stable/11/sys/kern/kern_fork.c stable/11/sys/kern/kern_sig.c stable/11/sys/sys/proc.h stable/11/sys/sys/signalvar.h stable/11/sys/sys/unistd.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/lib/libc/gen/posix_spawn.c stable/12/lib/libc/sys/rfork.2 stable/12/sys/kern/kern_fork.c stable/12/sys/kern/kern_sig.c stable/12/sys/sys/proc.h stable/12/sys/sys/signalvar.h stable/12/sys/sys/unistd.h Directory Properties: stable/12/ (props changed) Modified: stable/11/lib/libc/gen/posix_spawn.c ============================================================================== --- stable/11/lib/libc/gen/posix_spawn.c Mon Oct 21 00:52:21 2019 (r353788) +++ stable/11/lib/libc/gen/posix_spawn.c Mon Oct 21 01:24:21 2019 (r353789) @@ -192,43 +192,115 @@ process_file_actions(const posix_spawn_file_actions_t return (0); } +struct posix_spawn_args { + const char *path; + const posix_spawn_file_actions_t *fa; + const posix_spawnattr_t *sa; + char * const * argv; + char * const * envp; + int use_env_path; + int error; +}; + +#if defined(__i386__) || defined(__amd64__) +#define _RFORK_THREAD_STACK_SIZE 4096 +#endif + static int +_posix_spawn_thr(void *data) +{ + struct posix_spawn_args *psa; + char * const *envp; + + psa = data; + if (psa->sa != NULL) { + psa->error = process_spawnattr(*psa->sa); + if (psa->error) + _exit(127); + } + if (psa->fa != NULL) { + psa->error = process_file_actions(*psa->fa); + if (psa->error) + _exit(127); + } + envp = psa->envp != NULL ? psa->envp : environ; + if (psa->use_env_path) + _execvpe(psa->path, psa->argv, envp); + else + _execve(psa->path, psa->argv, envp); + psa->error = errno; + + /* This is called in such a way that it must not exit. */ + _exit(127); +} + +static int do_posix_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *fa, const posix_spawnattr_t *sa, char * const argv[], char * const envp[], int use_env_path) { + struct posix_spawn_args psa; pid_t p; - volatile int error = 0; +#ifdef _RFORK_THREAD_STACK_SIZE + char *stack; - p = vfork(); - switch (p) { - case -1: - return (errno); - case 0: - if (sa != NULL) { - error = process_spawnattr(*sa); - if (error) - _exit(127); - } - if (fa != NULL) { - error = process_file_actions(*fa); - if (error) - _exit(127); - } - if (use_env_path) - _execvpe(path, argv, envp != NULL ? envp : environ); - else - _execve(path, argv, envp != NULL ? envp : environ); - error = errno; - _exit(127); - default: - if (error != 0) - _waitpid(p, NULL, WNOHANG); - else if (pid != NULL) - *pid = p; - return (error); + stack = malloc(_RFORK_THREAD_STACK_SIZE); + if (stack == NULL) + return (ENOMEM); +#endif + psa.path = path; + psa.fa = fa; + psa.sa = sa; + psa.argv = argv; + psa.envp = envp; + psa.use_env_path = use_env_path; + psa.error = 0; + + /* + * Passing RFSPAWN to rfork(2) gives us effectively a vfork that drops + * non-ignored signal handlers. We'll fall back to the slightly less + * ideal vfork(2) if we get an EINVAL from rfork -- this should only + * happen with newer libc on older kernel that doesn't accept + * RFSPAWN. + */ +#ifdef _RFORK_THREAD_STACK_SIZE + /* + * x86 stores the return address on the stack, so rfork(2) cannot work + * as-is because the child would clobber the return address om the + * parent. Because of this, we must use rfork_thread instead while + * almost every other arch stores the return address in a register. + */ + p = rfork_thread(RFSPAWN, stack + _RFORK_THREAD_STACK_SIZE, + _posix_spawn_thr, &psa); + free(stack); +#else + p = rfork(RFSPAWN); + if (p == 0) + /* _posix_spawn_thr does not return */ + _posix_spawn_thr(&psa); +#endif + /* + * The above block should leave us in a state where we've either + * succeeded and we're ready to process the results, or we need to + * fallback to vfork() if the kernel didn't like RFSPAWN. + */ + + if (p == -1 && errno == EINVAL) { + p = vfork(); + if (p == 0) + /* _posix_spawn_thr does not return */ + _posix_spawn_thr(&psa); } + if (p == -1) + return (errno); + if (psa.error != 0) + /* Failed; ready to reap */ + _waitpid(p, NULL, WNOHANG); + else if (pid != NULL) + /* exec succeeded */ + *pid = p; + return (psa.error); } int Modified: stable/11/lib/libc/sys/rfork.2 ============================================================================== --- stable/11/lib/libc/sys/rfork.2 Mon Oct 21 00:52:21 2019 (r353788) +++ stable/11/lib/libc/sys/rfork.2 Mon Oct 21 01:24:21 2019 (r353789) @@ -5,7 +5,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 12, 2011 +.Dd September 25, 2019 .Dt RFORK 2 .Os .Sh NAME @@ -34,7 +34,9 @@ and open files. The .Fa flags argument -is the logical OR of some subset of: +is either +.Dv RFSPAWN +or the logical OR of some subset of: .Bl -tag -width ".Dv RFLINUXTHPN" .It Dv RFPROC If set a new process is created; otherwise changes affect the @@ -103,6 +105,17 @@ This is intended to mimic certain Linux clone behaviou File descriptors in a shared file descriptor table are kept open until either they are explicitly closed or all processes sharing the table exit. +.Pp +If +.Dv RFSPAWN +is passed, +.Nm +will use +.Xr vfork 2 +semantics but reset all signal actions in the child to default. +This flag is used by the +.Xr posix_spawn 3 +implementation in libc. .Pp If .Dv RFPROC Modified: stable/11/sys/kern/kern_fork.c ============================================================================== --- stable/11/sys/kern/kern_fork.c Mon Oct 21 00:52:21 2019 (r353788) +++ stable/11/sys/kern/kern_fork.c Mon Oct 21 01:24:21 2019 (r353789) @@ -170,10 +170,18 @@ sys_rfork(struct thread *td, struct rfork_args *uap) /* Don't allow kernel-only flags. */ if ((uap->flags & RFKERNELONLY) != 0) return (EINVAL); + /* RFSPAWN must not appear with others */ + if ((uap->flags & RFSPAWN) != 0 && uap->flags != RFSPAWN) + return (EINVAL); AUDIT_ARG_FFLAGS(uap->flags); bzero(&fr, sizeof(fr)); - fr.fr_flags = uap->flags; + if ((uap->flags & RFSPAWN) != 0) { + fr.fr_flags = RFFDG | RFPROC | RFPPWAIT | RFMEM; + fr.fr_flags2 = FR2_DROPSIG_CAUGHT; + } else { + fr.fr_flags = uap->flags; + } fr.fr_pidp = &pid; error = fork1(td, &fr); if (error == 0) { @@ -532,6 +540,11 @@ do_fork(struct thread *td, struct fork_req *fr, struct } else { sigacts_copy(newsigacts, p1->p_sigacts); p2->p_sigacts = newsigacts; + if ((fr->fr_flags2 & FR2_DROPSIG_CAUGHT) != 0) { + mtx_lock(&p2->p_sigacts->ps_mtx); + sig_drop_caught(p2); + mtx_unlock(&p2->p_sigacts->ps_mtx); + } } if (fr->fr_flags & RFTSIGZMB) Modified: stable/11/sys/kern/kern_sig.c ============================================================================== --- stable/11/sys/kern/kern_sig.c Mon Oct 21 00:52:21 2019 (r353788) +++ stable/11/sys/kern/kern_sig.c Mon Oct 21 01:24:21 2019 (r353789) @@ -987,12 +987,7 @@ execsigs(struct proc *p) PROC_LOCK_ASSERT(p, MA_OWNED); ps = p->p_sigacts; mtx_lock(&ps->ps_mtx); - while (SIGNOTEMPTY(ps->ps_sigcatch)) { - sig = sig_ffs(&ps->ps_sigcatch); - sigdflt(ps, sig); - if ((sigprop(sig) & SA_IGNORE) != 0) - sigqueue_delete_proc(p, sig); - } + sig_drop_caught(p); /* * As CloudABI processes cannot modify signal handlers, fully @@ -3843,4 +3838,21 @@ sigacts_shared(struct sigacts *ps) { return (ps->ps_refcnt > 1); +} + +void +sig_drop_caught(struct proc *p) +{ + int sig; + struct sigacts *ps; + + ps = p->p_sigacts; + PROC_LOCK_ASSERT(p, MA_OWNED); + mtx_assert(&ps->ps_mtx, MA_OWNED); + while (SIGNOTEMPTY(ps->ps_sigcatch)) { + sig = sig_ffs(&ps->ps_sigcatch); + sigdflt(ps, sig); + if ((sigprop(sig) & SA_IGNORE) != 0) + sigqueue_delete_proc(p, sig); + } } Modified: stable/11/sys/sys/proc.h ============================================================================== --- stable/11/sys/sys/proc.h Mon Oct 21 00:52:21 2019 (r353788) +++ stable/11/sys/sys/proc.h Mon Oct 21 01:24:21 2019 (r353789) @@ -983,6 +983,8 @@ struct fork_req { int *fr_pd_fd; int fr_pd_flags; struct filecaps *fr_pd_fcaps; + int fr_flags2; +#define FR2_DROPSIG_CAUGHT 0x00001 /* Drop caught non-DFL signals */ }; /* Modified: stable/11/sys/sys/signalvar.h ============================================================================== --- stable/11/sys/sys/signalvar.h Mon Oct 21 00:52:21 2019 (r353788) +++ stable/11/sys/sys/signalvar.h Mon Oct 21 01:24:21 2019 (r353789) @@ -379,6 +379,7 @@ void sigacts_copy(struct sigacts *dest, struct sigacts void sigacts_free(struct sigacts *ps); struct sigacts *sigacts_hold(struct sigacts *ps); int sigacts_shared(struct sigacts *ps); +void sig_drop_caught(struct proc *p); void sigexit(struct thread *td, int sig) __dead2; int sigev_findtd(struct proc *p, struct sigevent *sigev, struct thread **); int sig_ffs(sigset_t *set); Modified: stable/11/sys/sys/unistd.h ============================================================================== --- stable/11/sys/sys/unistd.h Mon Oct 21 00:52:21 2019 (r353788) +++ stable/11/sys/sys/unistd.h Mon Oct 21 01:24:21 2019 (r353789) @@ -186,11 +186,14 @@ #define RFTSIGNUM(flags) (((flags) >> RFTSIGSHIFT) & RFTSIGMASK) #define RFTSIGFLAGS(signum) ((signum) << RFTSIGSHIFT) #define RFPROCDESC (1<<28) /* return a process descriptor */ -#define RFPPWAIT (1<<31) /* parent sleeps until child exits (vfork) */ +/* kernel: parent sleeps until child exits (vfork) */ +#define RFPPWAIT (1<<31) +/* user: vfork(2) semantics, clear signals */ +#define RFSPAWN (1U<<31) #define RFFLAGS (RFFDG | RFPROC | RFMEM | RFNOWAIT | RFCFDG | \ RFTHREAD | RFSIGSHARE | RFLINUXTHPN | RFSTOPPED | RFHIGHPID | RFTSIGZMB | \ - RFPROCDESC | RFPPWAIT) -#define RFKERNELONLY (RFSTOPPED | RFHIGHPID | RFPPWAIT | RFPROCDESC) + RFPROCDESC | RFSPAWN | RFPPWAIT) +#define RFKERNELONLY (RFSTOPPED | RFHIGHPID | RFPROCDESC) #endif /* __BSD_VISIBLE */ From owner-svn-src-all@freebsd.org Mon Oct 21 01:24:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 73A9516FF2E; Mon, 21 Oct 2019 01:24: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xJp12Q0Rz4ZWr; Mon, 21 Oct 2019 01:24:25 +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 3762D1C911; Mon, 21 Oct 2019 01:24:25 +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 x9L1OPVC075300; Mon, 21 Oct 2019 01:24:25 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L1ONpm075292; Mon, 21 Oct 2019 01:24:23 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910210124.x9L1ONpm075292@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 01:24:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353789 - in stable: 11/lib/libc/gen 11/lib/libc/sys 11/sys/kern 11/sys/sys 12/lib/libc/gen 12/lib/libc/sys 12/sys/kern 12/sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/lib/libc/gen 11/lib/libc/sys 11/sys/kern 11/sys/sys 12/lib/libc/gen 12/lib/libc/sys 12/sys/kern 12/sys/sys X-SVN-Commit-Revision: 353789 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 01:24:25 -0000 Author: kevans Date: Mon Oct 21 01:24:21 2019 New Revision: 353789 URL: https://svnweb.freebsd.org/changeset/base/353789 Log: MFC r352711-r352712: Address posix_spawn(3) signal issues r352711: rfork(2): add RFSPAWN flag When RFSPAWN is passed, rfork exhibits vfork(2) semantics but also resets signal handlers in the child during creation to avoid a point of corruption of parent state from the child. This flag will be used by posix_spawn(3) to handle potential signal issues. Reviewed by: jilles, kib Differential Revision: https://reviews.freebsd.org/D19058 r352712: posix_spawn(3): handle potential signal issues with vfork Described in [1], signal handlers running in a vfork child have opportunities to corrupt the parent's state. Address this by adding a new rfork(2) flag, RFSPAWN, that has vfork(2) semantics but also resets signal handlers in the child during creation. x86 uses rfork_thread(3) instead of a direct rfork(2) because rfork with RFMEM/RFSPAWN cannot work when the return address is stored on the stack -- further information about this problem is described under RFMEM in the rfork(2) man page. Addressing this has been identified as a prerequisite to using posix_spawn in subprocess on FreeBSD [2]. [1] https://ewontfix.com/7/ [2] https://bugs.python.org/issue35823 Modified: stable/12/lib/libc/gen/posix_spawn.c stable/12/lib/libc/sys/rfork.2 stable/12/sys/kern/kern_fork.c stable/12/sys/kern/kern_sig.c stable/12/sys/sys/proc.h stable/12/sys/sys/signalvar.h stable/12/sys/sys/unistd.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/libc/gen/posix_spawn.c stable/11/lib/libc/sys/rfork.2 stable/11/sys/kern/kern_fork.c stable/11/sys/kern/kern_sig.c stable/11/sys/sys/proc.h stable/11/sys/sys/signalvar.h stable/11/sys/sys/unistd.h Directory Properties: stable/11/ (props changed) Modified: stable/12/lib/libc/gen/posix_spawn.c ============================================================================== --- stable/12/lib/libc/gen/posix_spawn.c Mon Oct 21 00:52:21 2019 (r353788) +++ stable/12/lib/libc/gen/posix_spawn.c Mon Oct 21 01:24:21 2019 (r353789) @@ -194,43 +194,115 @@ process_file_actions(const posix_spawn_file_actions_t return (0); } +struct posix_spawn_args { + const char *path; + const posix_spawn_file_actions_t *fa; + const posix_spawnattr_t *sa; + char * const * argv; + char * const * envp; + int use_env_path; + int error; +}; + +#if defined(__i386__) || defined(__amd64__) +#define _RFORK_THREAD_STACK_SIZE 4096 +#endif + static int +_posix_spawn_thr(void *data) +{ + struct posix_spawn_args *psa; + char * const *envp; + + psa = data; + if (psa->sa != NULL) { + psa->error = process_spawnattr(*psa->sa); + if (psa->error) + _exit(127); + } + if (psa->fa != NULL) { + psa->error = process_file_actions(*psa->fa); + if (psa->error) + _exit(127); + } + envp = psa->envp != NULL ? psa->envp : environ; + if (psa->use_env_path) + _execvpe(psa->path, psa->argv, envp); + else + _execve(psa->path, psa->argv, envp); + psa->error = errno; + + /* This is called in such a way that it must not exit. */ + _exit(127); +} + +static int do_posix_spawn(pid_t *pid, const char *path, const posix_spawn_file_actions_t *fa, const posix_spawnattr_t *sa, char * const argv[], char * const envp[], int use_env_path) { + struct posix_spawn_args psa; pid_t p; - volatile int error = 0; +#ifdef _RFORK_THREAD_STACK_SIZE + char *stack; - p = vfork(); - switch (p) { - case -1: - return (errno); - case 0: - if (sa != NULL) { - error = process_spawnattr(*sa); - if (error) - _exit(127); - } - if (fa != NULL) { - error = process_file_actions(*fa); - if (error) - _exit(127); - } - if (use_env_path) - _execvpe(path, argv, envp != NULL ? envp : environ); - else - _execve(path, argv, envp != NULL ? envp : environ); - error = errno; - _exit(127); - default: - if (error != 0) - _waitpid(p, NULL, WNOHANG); - else if (pid != NULL) - *pid = p; - return (error); + stack = malloc(_RFORK_THREAD_STACK_SIZE); + if (stack == NULL) + return (ENOMEM); +#endif + psa.path = path; + psa.fa = fa; + psa.sa = sa; + psa.argv = argv; + psa.envp = envp; + psa.use_env_path = use_env_path; + psa.error = 0; + + /* + * Passing RFSPAWN to rfork(2) gives us effectively a vfork that drops + * non-ignored signal handlers. We'll fall back to the slightly less + * ideal vfork(2) if we get an EINVAL from rfork -- this should only + * happen with newer libc on older kernel that doesn't accept + * RFSPAWN. + */ +#ifdef _RFORK_THREAD_STACK_SIZE + /* + * x86 stores the return address on the stack, so rfork(2) cannot work + * as-is because the child would clobber the return address om the + * parent. Because of this, we must use rfork_thread instead while + * almost every other arch stores the return address in a register. + */ + p = rfork_thread(RFSPAWN, stack + _RFORK_THREAD_STACK_SIZE, + _posix_spawn_thr, &psa); + free(stack); +#else + p = rfork(RFSPAWN); + if (p == 0) + /* _posix_spawn_thr does not return */ + _posix_spawn_thr(&psa); +#endif + /* + * The above block should leave us in a state where we've either + * succeeded and we're ready to process the results, or we need to + * fallback to vfork() if the kernel didn't like RFSPAWN. + */ + + if (p == -1 && errno == EINVAL) { + p = vfork(); + if (p == 0) + /* _posix_spawn_thr does not return */ + _posix_spawn_thr(&psa); } + if (p == -1) + return (errno); + if (psa.error != 0) + /* Failed; ready to reap */ + _waitpid(p, NULL, WNOHANG); + else if (pid != NULL) + /* exec succeeded */ + *pid = p; + return (psa.error); } int Modified: stable/12/lib/libc/sys/rfork.2 ============================================================================== --- stable/12/lib/libc/sys/rfork.2 Mon Oct 21 00:52:21 2019 (r353788) +++ stable/12/lib/libc/sys/rfork.2 Mon Oct 21 01:24:21 2019 (r353789) @@ -5,7 +5,7 @@ .\" .\" $FreeBSD$ .\" -.Dd July 12, 2011 +.Dd September 25, 2019 .Dt RFORK 2 .Os .Sh NAME @@ -34,7 +34,9 @@ and open files. The .Fa flags argument -is the logical OR of some subset of: +is either +.Dv RFSPAWN +or the logical OR of some subset of: .Bl -tag -width ".Dv RFLINUXTHPN" .It Dv RFPROC If set a new process is created; otherwise changes affect the @@ -103,6 +105,17 @@ This is intended to mimic certain Linux clone behaviou File descriptors in a shared file descriptor table are kept open until either they are explicitly closed or all processes sharing the table exit. +.Pp +If +.Dv RFSPAWN +is passed, +.Nm +will use +.Xr vfork 2 +semantics but reset all signal actions in the child to default. +This flag is used by the +.Xr posix_spawn 3 +implementation in libc. .Pp If .Dv RFPROC Modified: stable/12/sys/kern/kern_fork.c ============================================================================== --- stable/12/sys/kern/kern_fork.c Mon Oct 21 00:52:21 2019 (r353788) +++ stable/12/sys/kern/kern_fork.c Mon Oct 21 01:24:21 2019 (r353789) @@ -171,10 +171,18 @@ sys_rfork(struct thread *td, struct rfork_args *uap) /* Don't allow kernel-only flags. */ if ((uap->flags & RFKERNELONLY) != 0) return (EINVAL); + /* RFSPAWN must not appear with others */ + if ((uap->flags & RFSPAWN) != 0 && uap->flags != RFSPAWN) + return (EINVAL); AUDIT_ARG_FFLAGS(uap->flags); bzero(&fr, sizeof(fr)); - fr.fr_flags = uap->flags; + if ((uap->flags & RFSPAWN) != 0) { + fr.fr_flags = RFFDG | RFPROC | RFPPWAIT | RFMEM; + fr.fr_flags2 = FR2_DROPSIG_CAUGHT; + } else { + fr.fr_flags = uap->flags; + } fr.fr_pidp = &pid; error = fork1(td, &fr); if (error == 0) { @@ -520,6 +528,11 @@ do_fork(struct thread *td, struct fork_req *fr, struct } else { sigacts_copy(newsigacts, p1->p_sigacts); p2->p_sigacts = newsigacts; + if ((fr->fr_flags2 & FR2_DROPSIG_CAUGHT) != 0) { + mtx_lock(&p2->p_sigacts->ps_mtx); + sig_drop_caught(p2); + mtx_unlock(&p2->p_sigacts->ps_mtx); + } } if (fr->fr_flags & RFTSIGZMB) Modified: stable/12/sys/kern/kern_sig.c ============================================================================== --- stable/12/sys/kern/kern_sig.c Mon Oct 21 00:52:21 2019 (r353788) +++ stable/12/sys/kern/kern_sig.c Mon Oct 21 01:24:21 2019 (r353789) @@ -986,12 +986,7 @@ execsigs(struct proc *p) PROC_LOCK_ASSERT(p, MA_OWNED); ps = p->p_sigacts; mtx_lock(&ps->ps_mtx); - while (SIGNOTEMPTY(ps->ps_sigcatch)) { - sig = sig_ffs(&ps->ps_sigcatch); - sigdflt(ps, sig); - if ((sigprop(sig) & SIGPROP_IGNORE) != 0) - sigqueue_delete_proc(p, sig); - } + sig_drop_caught(p); /* * As CloudABI processes cannot modify signal handlers, fully @@ -3855,4 +3850,21 @@ sigacts_shared(struct sigacts *ps) { return (ps->ps_refcnt > 1); +} + +void +sig_drop_caught(struct proc *p) +{ + int sig; + struct sigacts *ps; + + ps = p->p_sigacts; + PROC_LOCK_ASSERT(p, MA_OWNED); + mtx_assert(&ps->ps_mtx, MA_OWNED); + while (SIGNOTEMPTY(ps->ps_sigcatch)) { + sig = sig_ffs(&ps->ps_sigcatch); + sigdflt(ps, sig); + if ((sigprop(sig) & SIGPROP_IGNORE) != 0) + sigqueue_delete_proc(p, sig); + } } Modified: stable/12/sys/sys/proc.h ============================================================================== --- stable/12/sys/sys/proc.h Mon Oct 21 00:52:21 2019 (r353788) +++ stable/12/sys/sys/proc.h Mon Oct 21 01:24:21 2019 (r353789) @@ -1002,6 +1002,8 @@ struct fork_req { int *fr_pd_fd; int fr_pd_flags; struct filecaps *fr_pd_fcaps; + int fr_flags2; +#define FR2_DROPSIG_CAUGHT 0x00001 /* Drop caught non-DFL signals */ }; /* Modified: stable/12/sys/sys/signalvar.h ============================================================================== --- stable/12/sys/sys/signalvar.h Mon Oct 21 00:52:21 2019 (r353788) +++ stable/12/sys/sys/signalvar.h Mon Oct 21 01:24:21 2019 (r353789) @@ -381,6 +381,7 @@ void sigacts_copy(struct sigacts *dest, struct sigacts void sigacts_free(struct sigacts *ps); struct sigacts *sigacts_hold(struct sigacts *ps); int sigacts_shared(struct sigacts *ps); +void sig_drop_caught(struct proc *p); void sigexit(struct thread *td, int sig) __dead2; int sigev_findtd(struct proc *p, struct sigevent *sigev, struct thread **); int sig_ffs(sigset_t *set); Modified: stable/12/sys/sys/unistd.h ============================================================================== --- stable/12/sys/sys/unistd.h Mon Oct 21 00:52:21 2019 (r353788) +++ stable/12/sys/sys/unistd.h Mon Oct 21 01:24:21 2019 (r353789) @@ -188,11 +188,14 @@ #define RFTSIGNUM(flags) (((flags) >> RFTSIGSHIFT) & RFTSIGMASK) #define RFTSIGFLAGS(signum) ((signum) << RFTSIGSHIFT) #define RFPROCDESC (1<<28) /* return a process descriptor */ -#define RFPPWAIT (1<<31) /* parent sleeps until child exits (vfork) */ +/* kernel: parent sleeps until child exits (vfork) */ +#define RFPPWAIT (1<<31) +/* user: vfork(2) semantics, clear signals */ +#define RFSPAWN (1U<<31) #define RFFLAGS (RFFDG | RFPROC | RFMEM | RFNOWAIT | RFCFDG | \ RFTHREAD | RFSIGSHARE | RFLINUXTHPN | RFSTOPPED | RFHIGHPID | RFTSIGZMB | \ - RFPROCDESC | RFPPWAIT) -#define RFKERNELONLY (RFSTOPPED | RFHIGHPID | RFPPWAIT | RFPROCDESC) + RFPROCDESC | RFSPAWN | RFPPWAIT) +#define RFKERNELONLY (RFSTOPPED | RFHIGHPID | RFPROCDESC) #endif /* __BSD_VISIBLE */ From owner-svn-src-all@freebsd.org Mon Oct 21 01:27:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D5806170037; Mon, 21 Oct 2019 01:27:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xJs25Jhmz4ZmG; Mon, 21 Oct 2019 01:27:02 +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 95B381C912; Mon, 21 Oct 2019 01:27:02 +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 x9L1R2TI075486; Mon, 21 Oct 2019 01:27:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L1R28g075484; Mon, 21 Oct 2019 01:27:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910210127.x9L1R28g075484@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 01:27:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353790 - in stable: 11 12 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11 12 X-SVN-Commit-Revision: 353790 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 01:27:02 -0000 Author: kevans Date: Mon Oct 21 01:27:01 2019 New Revision: 353790 URL: https://svnweb.freebsd.org/changeset/base/353790 Log: MFC r352929: Add a top-level makeman target Abstracting away the details of how src.conf(5) is generated is arguably a good thing; do so with a top-level makeman target. Modified: stable/11/Makefile stable/11/Makefile.inc1 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/Makefile stable/12/Makefile.inc1 Directory Properties: stable/12/ (props changed) Modified: stable/11/Makefile ============================================================================== --- stable/11/Makefile Mon Oct 21 01:24:21 2019 (r353789) +++ stable/11/Makefile Mon Oct 21 01:27:01 2019 (r353790) @@ -33,6 +33,7 @@ # targets - Print a list of supported TARGET/TARGET_ARCH pairs # for world and kernel targets. # toolchains - Build a toolchain for all world and kernel targets. +# makeman - Regenerate src.conf(5) # sysent - (Re)build syscall entries from syscalls.master. # xdev - xdev-build + xdev-install for the architecture # specified with XDEV and XDEV_ARCH. @@ -127,7 +128,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel bu reinstallkernel reinstallkernel.debug \ installworld kernel-toolchain libraries lint maninstall \ obj objlink rerelease showconfig tags toolchain update \ - sysent \ + makeman sysent \ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ _build-tools _compiler-metadata _cross-tools _includes _libraries \ build32 distribute32 install32 buildsoft distributesoft installsoft \ Modified: stable/11/Makefile.inc1 ============================================================================== --- stable/11/Makefile.inc1 Mon Oct 21 01:24:21 2019 (r353789) +++ stable/11/Makefile.inc1 Mon Oct 21 01:27:01 2019 (r353790) @@ -1132,6 +1132,10 @@ packageworld: .PHONY . endif .endfor +makeman: .PHONY + ${_+_}cd ${.CURDIR}/tools/build/options; sh makeman > \ + ${.CURDIR}/share/man/man5/src.conf.5 + _sysent_dirs= sys/kern _sysent_dirs+= sys/compat/freebsd32 _sysent_dirs+= sys/i386/ibcs2 From owner-svn-src-all@freebsd.org Mon Oct 21 01:27:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EAF817003C; Mon, 21 Oct 2019 01:27:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xJs32McFz4ZmH; Mon, 21 Oct 2019 01:27:03 +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 344451C913; Mon, 21 Oct 2019 01:27:03 +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 x9L1R2TR075493; Mon, 21 Oct 2019 01:27:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L1R2UR075491; Mon, 21 Oct 2019 01:27:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910210127.x9L1R2UR075491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 01:27:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353790 - in stable: 11 12 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11 12 X-SVN-Commit-Revision: 353790 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 01:27:03 -0000 Author: kevans Date: Mon Oct 21 01:27:01 2019 New Revision: 353790 URL: https://svnweb.freebsd.org/changeset/base/353790 Log: MFC r352929: Add a top-level makeman target Abstracting away the details of how src.conf(5) is generated is arguably a good thing; do so with a top-level makeman target. Modified: stable/12/Makefile stable/12/Makefile.inc1 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/Makefile stable/11/Makefile.inc1 Directory Properties: stable/11/ (props changed) Modified: stable/12/Makefile ============================================================================== --- stable/12/Makefile Mon Oct 21 01:24:21 2019 (r353789) +++ stable/12/Makefile Mon Oct 21 01:27:01 2019 (r353790) @@ -34,6 +34,7 @@ # targets - Print a list of supported TARGET/TARGET_ARCH pairs # for world and kernel targets. # toolchains - Build a toolchain for all world and kernel targets. +# makeman - Regenerate src.conf(5) # sysent - (Re)build syscall entries from syscalls.master. # xdev - xdev-build + xdev-install for the architecture # specified with TARGET and TARGET_ARCH. @@ -132,7 +133,7 @@ TGTS= all all-man buildenv buildenvvars buildkernel bu reinstallkernel reinstallkernel.debug \ installworld kernel-toolchain libraries maninstall \ obj objlink showconfig tags toolchain update \ - sysent \ + makeman sysent \ _worldtmp _legacy _bootstrap-tools _cleanobj _obj \ _build-tools _build-metadata _cross-tools _includes _libraries \ build32 distribute32 install32 buildsoft distributesoft installsoft \ Modified: stable/12/Makefile.inc1 ============================================================================== --- stable/12/Makefile.inc1 Mon Oct 21 01:24:21 2019 (r353789) +++ stable/12/Makefile.inc1 Mon Oct 21 01:27:01 2019 (r353790) @@ -1423,6 +1423,10 @@ packageworld: .PHONY . endif .endfor +makeman: .PHONY + ${_+_}cd ${.CURDIR}/tools/build/options; sh makeman > \ + ${.CURDIR}/share/man/man5/src.conf.5 + _sysent_dirs= sys/kern _sysent_dirs+= sys/compat/freebsd32 _sysent_dirs+= sys/compat/cloudabi32 \ From owner-svn-src-all@freebsd.org Mon Oct 21 03:01:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DC071715C2; Mon, 21 Oct 2019 03:01:06 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xLxY6DFDz4dtJ; Mon, 21 Oct 2019 03:01:05 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B9B4E1D933; Mon, 21 Oct 2019 03:01:05 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9L315Zk029393; Mon, 21 Oct 2019 03:01:05 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L315Do029392; Mon, 21 Oct 2019 03:01:05 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <201910210301.x9L315Do029392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Mon, 21 Oct 2019 03:01:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353791 - head/tools/tools/locale X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/tools/tools/locale X-SVN-Commit-Revision: 353791 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 03:01:06 -0000 Author: yuripv Date: Mon Oct 21 03:01:05 2019 New Revision: 353791 URL: https://svnweb.freebsd.org/changeset/base/353791 Log: tools/tools/locale: allow POSIX target to be built in parallel While it's rarely used target, more so a one not used during the buildworld, it helps when it's not taking hours (literally). Modified: head/tools/tools/locale/Makefile Modified: head/tools/tools/locale/Makefile ============================================================================== --- head/tools/tools/locale/Makefile Mon Oct 21 01:27:01 2019 (r353790) +++ head/tools/tools/locale/Makefile Mon Oct 21 03:01:05 2019 (r353791) @@ -143,37 +143,33 @@ ENCODINGS= Big5 \ KOI8-U \ SJIS \ US-ASCII \ - UTF-8 \ + UTF-8 - -POSIX: -.if exists (${UNIDIR}/tools/java/cldr.jar) - mkdir -p ${UNIDIR}/posix -. for area in ${BASE_LOCALES_OF_INTEREST} -. if !exists(${UNIDIR}/posix/${area}.UTF-8.src) +POSIX: posixsrc posixcol posixcm +.if !exists(${UNIDIR}/tools/java/cldr.jar) +.error check README about building cldr.jar +.endif +.for area in ${BASE_LOCALES_OF_INTEREST} +posixsrc: ${UNIDIR}/posix/${area}.UTF-8.src +${UNIDIR}/posix/${area}.UTF-8.src: java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ org.unicode.cldr.posix.GeneratePOSIX \ -d ${UNIDIR}/posix -m ${area} -c UTF-8 -. endif -. endfor -. for area encoding in ${COLLATION_SPECIAL} -. if !exists(${UNIDIR}/posix/${area}.${encoding}.src) +.endfor +.for area encoding in ${COLLATION_SPECIAL} +posixcol: ${UNIDIR}/posix/${area}.${encoding}.src +${UNIDIR}/posix/${area}.${encoding}.src: java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ org.unicode.cldr.posix.GeneratePOSIX \ -d ${UNIDIR}/posix -m ${area} -c ${encoding} -. endif -. endfor -. for enc in ${ENCODINGS} -. if !exists(${UNIDIR}/posix/${enc}.cm) +.endfor +.for enc in ${ENCODINGS} +posixcm: ${UNIDIR}/posix/${enc}.cm +${UNIDIR}/posix/${enc}.cm: java -DCLDR_DIR=${UNIDIR:Q} -jar ${UNIDIR}/tools/java/cldr.jar \ org.unicode.cldr.posix.GenerateCharmap \ -d ${UNIDIR}/posix -c ${enc} -. endif -. endfor -.else - @echo "Please install CLDR toolset for the desired release" - @echo "It should go at ${UNIDIR}/tools" -.endif +.endfor clean-POSIX: rm -f ${UNIDIR}/posix/* From owner-svn-src-all@freebsd.org Mon Oct 21 08:36:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D54551505A3; Mon, 21 Oct 2019 08:36:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xVNJ56XXz3xT9; Mon, 21 Oct 2019 08:36:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2ECF9215CE; Mon, 21 Oct 2019 08:36:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9L8aFDv028034; Mon, 21 Oct 2019 08:36:15 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L8aF3w028033; Mon, 21 Oct 2019 08:36:15 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910210836.x9L8aF3w028033@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 21 Oct 2019 08:36:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353792 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353792 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 08:36:16 -0000 Author: bz Date: Mon Oct 21 08:36:15 2019 New Revision: 353792 URL: https://svnweb.freebsd.org/changeset/base/353792 Log: frag6: add read-only sysctl for nfrags. Add a read-only sysctl exporting the global number of fragments (base system and all vnets). This is helpful to (a) know how many fragments are currently being processed, (b) if there are possible leaks, (c) if vnet teardown is not working correctly, and lastly (d) it can be used as part of test-suits to ensure (a) to (c). MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Mon Oct 21 03:01:05 2019 (r353791) +++ head/sys/netinet6/frag6.c Mon Oct 21 08:36:15 2019 (r353792) @@ -150,6 +150,10 @@ VNET_DEFINE_STATIC(uint32_t, ip6qb_hashseed); */ SYSCTL_DECL(_net_inet6_ip6); +SYSCTL_UINT(_net_inet6_ip6, OID_AUTO, frag6_nfrags, + CTLFLAG_RD, __DEVOLATILE(u_int *, &frag6_nfrags), 0, + "Global number of IPv6 fragments across all reassembly queues."); + static void frag6_set_bucketsize(void) { From owner-svn-src-all@freebsd.org Mon Oct 21 08:48:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49345150A47; Mon, 21 Oct 2019 08:48:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xVfm1ChXz3xyp; Mon, 21 Oct 2019 08:48:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CEC921794; Mon, 21 Oct 2019 08:48:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9L8mlP0033780; Mon, 21 Oct 2019 08:48:47 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L8mlLm033778; Mon, 21 Oct 2019 08:48:47 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910210848.x9L8mlLm033778@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 21 Oct 2019 08:48:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353793 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353793 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 08:48:48 -0000 Author: bz Date: Mon Oct 21 08:48:47 2019 New Revision: 353793 URL: https://svnweb.freebsd.org/changeset/base/353793 Log: frag6: fix vnet teardown leak When shutting down a VNET we did not cleanup the fragmentation hashes. This has multiple problems: (1) leak memory but also (2) leak on the global counters, which might eventually lead to a problem on a system starting and stopping a lot of vnets and dealing with a lot of IPv6 fragments that the counters/limits would be exhausted and processing would no longer take place. Unfortunately we do not have a useable variable to indicate when per-VNET initialization of frag6 has happened (or when destroy happened) so introduce a boolean to flag this. This is needed here as well as it was in r353635 for ip_reass.c in order to avoid tripping over the already destroyed locks if interfaces go away after the frag6 destroy. While splitting things up convert the TRY_LOCK to a LOCK operation in now frag6_drain_one(). The try-lock was derived from a manual hand-rolled implementation and carried forward all the time. We no longer can afford not to get the lock as that would mean we would continue to leak memory. Assert that all the buckets are empty before destroying to lock to ensure long-term stability of a clean shutdown. Reported by: hselasky Reviewed by: hselasky MFC after: 3 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22054 Modified: head/sys/netinet6/frag6.c head/sys/netinet6/ip6_input.c head/sys/netinet6/ip6_var.h Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Mon Oct 21 08:36:15 2019 (r353792) +++ head/sys/netinet6/frag6.c Mon Oct 21 08:48:47 2019 (r353793) @@ -100,6 +100,12 @@ struct ip6asfrag { static MALLOC_DEFINE(M_FRAG6, "frag6", "IPv6 fragment reassembly header"); +#ifdef VIMAGE +/* A flag to indicate if IPv6 fragmentation is initialized. */ +VNET_DEFINE_STATIC(bool, frag6_on); +#define V_frag6_on VNET(frag6_on) +#endif + /* System wide (global) maximum and count of packets in reassembly queues. */ static int ip6_maxfrags; static volatile u_int frag6_nfrags = 0; @@ -289,6 +295,15 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); +#ifdef VIMAGE + /* + * Skip processing if IPv6 reassembly is not initialised or + * torn down by frag6_destroy(). + */ + if (!V_frag6_on) + return; +#endif + CURVNET_SET_QUIET(ifp->if_vnet); for (i = 0; i < IP6REASS_NHASH; i++) { IP6QB_LOCK(i); @@ -929,6 +944,9 @@ frag6_init(void) } V_ip6qb_hashseed = arc4random(); V_ip6_maxfragsperpacket = 64; +#ifdef VIMAGE + V_frag6_on = true; +#endif if (!IS_DEFAULT_VNET(curvnet)) return; @@ -940,31 +958,57 @@ frag6_init(void) /* * Drain off all datagram fragments. */ +static void +frag6_drain_one(void) +{ + struct ip6q *head; + uint32_t bucket; + + for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { + IP6QB_LOCK(bucket); + head = IP6QB_HEAD(bucket); + while (head->ip6q_next != head) { + IP6STAT_INC(ip6s_fragdropped); + /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ + frag6_freef(head->ip6q_next, bucket); + } + IP6QB_UNLOCK(bucket); + } +} + void frag6_drain(void) { VNET_ITERATOR_DECL(vnet_iter); - struct ip6q *head; - uint32_t bucket; VNET_LIST_RLOCK_NOSLEEP(); VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); - for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { - if (IP6QB_TRYLOCK(bucket) == 0) - continue; - head = IP6QB_HEAD(bucket); - while (head->ip6q_next != head) { - IP6STAT_INC(ip6s_fragdropped); - /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(head->ip6q_next, bucket); - } - IP6QB_UNLOCK(bucket); - } + frag6_drain_one(); CURVNET_RESTORE(); } VNET_LIST_RUNLOCK_NOSLEEP(); } + +#ifdef VIMAGE +/* + * Clear up IPv6 reassembly structures. + */ +void +frag6_destroy(void) +{ + uint32_t bucket; + + frag6_drain_one(); + V_frag6_on = false; + for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { + KASSERT(V_ip6qb[bucket].count == 0, + ("%s: V_ip6qb[%d] (%p) count not 0 (%d)", __func__, + bucket, &V_ip6qb[bucket], V_ip6qb[bucket].count)); + mtx_destroy(&V_ip6qb[bucket].lock); + } +} +#endif /* * Put an ip fragment on a reassembly chain. Modified: head/sys/netinet6/ip6_input.c ============================================================================== --- head/sys/netinet6/ip6_input.c Mon Oct 21 08:36:15 2019 (r353792) +++ head/sys/netinet6/ip6_input.c Mon Oct 21 08:48:47 2019 (r353793) @@ -393,6 +393,7 @@ ip6_destroy(void *unused __unused) } IFNET_RUNLOCK(); + frag6_destroy(); nd6_destroy(); in6_ifattach_destroy(); Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Mon Oct 21 08:36:15 2019 (r353792) +++ head/sys/netinet6/ip6_var.h Mon Oct 21 08:48:47 2019 (r353793) @@ -392,6 +392,7 @@ int ip6_fragment(struct ifnet *, struct mbuf *, int, u int route6_input(struct mbuf **, int *, int); void frag6_init(void); +void frag6_destroy(void); int frag6_input(struct mbuf **, int *, int); void frag6_slowtimo(void); void frag6_drain(void); From owner-svn-src-all@freebsd.org Mon Oct 21 09:33:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0FD3F15241C; Mon, 21 Oct 2019 09:33:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xWfh0BB5z41WP; Mon, 21 Oct 2019 09:33:48 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD5822206A; Mon, 21 Oct 2019 09:33:47 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9L9XlIN062779; Mon, 21 Oct 2019 09:33:47 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9L9Xkig062769; Mon, 21 Oct 2019 09:33:46 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910210933.x9L9Xkig062769@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Mon, 21 Oct 2019 09:33:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353794 - in head: etc/mtree tests/sys tests/sys/netinet6 tests/sys/netinet6/frag6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head: etc/mtree tests/sys tests/sys/netinet6 tests/sys/netinet6/frag6 X-SVN-Commit-Revision: 353794 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 09:33:48 -0000 Author: bz Date: Mon Oct 21 09:33:45 2019 New Revision: 353794 URL: https://svnweb.freebsd.org/changeset/base/353794 Log: frag6: import a set of test cases In order to ensure that changing the frag6 code does not change behaviour or break code a set of test cases were implemented. Like some other test cases these use Scapy to generate packets and possibly wait for expected answers. In most cases we do check the global and per interface (netstat) statistics output using the libxo output and grep to validate fields and numbers. This is a bit hackish but we currently have no better way to match a selected number of stats only (we have to ignore some of the ND6 variables; otherwise we could use the entire list). Test cases include atomic fragments, single fragments, multi-fragments, and try to cover most error cases in the code currently. In addition vnet teardown is tested to not panic. A separate set (not in-tree currently) of probes were used in order to make sure that the test cases actually test what they should. The "sniffer" code was copied and adjusted from the netpfil version as we sometimes will not get packets or have longer timeouts to deal with. Sponsored by: Netflix Added: head/tests/sys/netinet6/ head/tests/sys/netinet6/Makefile (contents, props changed) head/tests/sys/netinet6/frag6/ head/tests/sys/netinet6/frag6/Makefile (contents, props changed) head/tests/sys/netinet6/frag6/frag6.subr (contents, props changed) head/tests/sys/netinet6/frag6/frag6_01.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_01.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_02.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_02.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_03.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_03.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_04.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_04.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_05.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_05.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_06.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_06.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_07.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_07.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_08.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_08.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_09.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_09.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_10.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_10.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_11.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_11.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_12.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_12.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_13.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_13.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_14.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_14.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_15.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_15.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_16.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_16.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_17.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_17.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_18.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_18.sh (contents, props changed) head/tests/sys/netinet6/frag6/frag6_19.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_19.sh (contents, props changed) head/tests/sys/netinet6/frag6/sniffer.py (contents, props changed) Modified: head/etc/mtree/BSD.tests.dist head/tests/sys/Makefile Modified: head/etc/mtree/BSD.tests.dist ============================================================================== --- head/etc/mtree/BSD.tests.dist Mon Oct 21 08:48:47 2019 (r353793) +++ head/etc/mtree/BSD.tests.dist Mon Oct 21 09:33:45 2019 (r353794) @@ -792,6 +792,10 @@ .. netinet .. + netinet6 + frag6 + .. + .. netipsec tunnel .. Modified: head/tests/sys/Makefile ============================================================================== --- head/tests/sys/Makefile Mon Oct 21 08:48:47 2019 (r353793) +++ head/tests/sys/Makefile Mon Oct 21 09:33:45 2019 (r353794) @@ -20,6 +20,7 @@ TESTS_SUBDIRS+= kqueue TESTS_SUBDIRS+= mac TESTS_SUBDIRS+= mqueue TESTS_SUBDIRS+= netinet +TESTS_SUBDIRS+= netinet6 TESTS_SUBDIRS+= netipsec TESTS_SUBDIRS+= netmap TESTS_SUBDIRS+= netpfil Added: head/tests/sys/netinet6/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/Makefile Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,7 @@ +# $FreeBSD$ + +TESTSDIR= ${TESTSBASE}/sys/netinet6 + +TESTS_SUBDIRS+= frag6 + +.include Added: head/tests/sys/netinet6/frag6/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/Makefile Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,76 @@ +# $FreeBSD$ + +PACKAGE= tests + +TESTSDIR= ${TESTSBASE}/sys/netinet6/frag6 +FILESDIR= ${TESTSDIR} + +# We split these up so they can run in parallel. +# Seems kyua is not running the test cases from one file in parallel. +# Otherwise we could cat the files together into one shell file. +ATF_TESTS_SH= \ + frag6_01 \ + frag6_02 \ + frag6_03 \ + frag6_04 \ + frag6_05 \ + frag6_06 \ + frag6_07 \ + frag6_08 \ + frag6_09 \ + frag6_10 \ + frag6_11 \ + frag6_12 \ + frag6_13 \ + frag6_14 \ + frag6_15 \ + frag6_16 \ + frag6_17 \ + frag6_18 \ + frag6_19 + +${PACKAGE}FILES+= frag6.subr +${PACKAGE}FILES+= sniffer.py +${PACKAGE}FILES+= frag6_01.py +${PACKAGE}FILES+= frag6_02.py +${PACKAGE}FILES+= frag6_03.py +${PACKAGE}FILES+= frag6_04.py +${PACKAGE}FILES+= frag6_05.py +${PACKAGE}FILES+= frag6_06.py +${PACKAGE}FILES+= frag6_07.py +${PACKAGE}FILES+= frag6_08.py +${PACKAGE}FILES+= frag6_09.py +${PACKAGE}FILES+= frag6_10.py +${PACKAGE}FILES+= frag6_11.py +${PACKAGE}FILES+= frag6_12.py +${PACKAGE}FILES+= frag6_13.py +${PACKAGE}FILES+= frag6_14.py +${PACKAGE}FILES+= frag6_15.py +${PACKAGE}FILES+= frag6_16.py +${PACKAGE}FILES+= frag6_17.py +${PACKAGE}FILES+= frag6_18.py +${PACKAGE}FILES+= frag6_19.py + +${PACKAGE}FILESMODE_frag6.subr= 0444 +${PACKAGE}FILESMODE_sniffer.py= 0555 +${PACKAGE}FILESMODE_frag6_01.py= 0555 +${PACKAGE}FILESMODE_frag6_02.py= 0555 +${PACKAGE}FILESMODE_frag6_03.py= 0555 +${PACKAGE}FILESMODE_frag6_04.py= 0555 +${PACKAGE}FILESMODE_frag6_05.py= 0555 +${PACKAGE}FILESMODE_frag6_06.py= 0555 +${PACKAGE}FILESMODE_frag6_07.py= 0555 +${PACKAGE}FILESMODE_frag6_08.py= 0555 +${PACKAGE}FILESMODE_frag6_09.py= 0555 +${PACKAGE}FILESMODE_frag6_10.py= 0555 +${PACKAGE}FILESMODE_frag6_11.py= 0555 +${PACKAGE}FILESMODE_frag6_12.py= 0555 +${PACKAGE}FILESMODE_frag6_13.py= 0555 +${PACKAGE}FILESMODE_frag6_14.py= 0555 +${PACKAGE}FILESMODE_frag6_15.py= 0555 +${PACKAGE}FILESMODE_frag6_16.py= 0555 +${PACKAGE}FILESMODE_frag6_17.py= 0555 +${PACKAGE}FILESMODE_frag6_18.py= 0555 +${PACKAGE}FILESMODE_frag6_19.py= 0555 + +.include Added: head/tests/sys/netinet6/frag6/frag6.subr ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6.subr Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,122 @@ +# $FreeBSD$ +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +. $(atf_get_srcdir)/../../common/vnet.subr + +frag6_head() +{ + atf_set descr 'Test IPv6 fragmentation code' + atf_set require.user root + atf_set require.progs scapy +} + +frag6_body() +{ + ids=${1:="65533"} + shift + id=`printf "%x" ${ids}` + if [ $$ -gt 65535 ]; then + xl=`printf "%x" $(($$ - 65535))` + yl="1" + else + xl=`printf "%x" $$` + yl="" + fi + + vnet_init + + ip6a="2001:db8:6666:6666:${yl}:${id}:1:${xl}" + ip6b="2001:db8:6666:6666:${yl}:${id}:2:${xl}" + + epair=$(vnet_mkepair) + ifconfig ${epair}a mtu 131071 up + ifconfig ${epair}a inet6 ${ip6a}/64 + + jname="v6t-${id}-${yl}-${xl}" + vnet_mkjail ${jname} ${epair}b + jexec ${jname} ifconfig ${epair}b mtu 131071 up + jexec ${jname} ifconfig ${epair}b inet6 ${ip6b}/64 + + # Let IPv6 ND do its thing. + #ping6 -q -c 1 ff02::1%${epair}a + #ping6 -q -c 1 ${ip6b} + sleep 3 + + # We need to try to make sure all expiry happened, otherwise there might + # be global fragments queued. (This still does not rule out that there + # are no other fragments queued anywhere else in the system). + i=0 + while test $i -lt 60; do + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + esac + sleep 1 + i=$((i + 1)) + done + case ${nf} in + 0) ;; + *) atf_fail "Global frag6_nfrags count is not zero but ${nf}" ;; + esac + + pretestf=$2 + case "${pretestf}" in + "") ;; + [A-Za-z0-9_]*) + eval ${pretestf} "${jname}" "${epair}b" + ;; + esac + + # Clear statistics. + jexec ${jname} netstat -z -s > /dev/null + + # Run fragment tests. + pyname=$(atf_get ident) + pyname=${pyname%*_[0-9]} + atf_check -s exit:0 $(atf_get_srcdir)/${pyname}.py \ + --sendif ${epair}a \ + --recvif ${epair}a \ + --src ${ip6a} \ + --to ${ip6b} + + checkf=$1 + case "${checkf}" in + "") ;; + [A-Za-z0-9_]*) + eval ${checkf} "${jname}" "${epair}b" + ;; + esac +} + +frag6_cleanup() +{ + + vnet_cleanup +} + +# end Added: head/tests/sys/netinet6/frag6/frag6_01.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_01.py Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,115 @@ +#!/usr/bin/env python +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +import argparse +import scapy.all as sp +import socket +import sys +from sniffer import Sniffer +from time import sleep + +def check_icmp6_error(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6ParamProblem) + if not icmp6: + return False + # ICMP6_PARAMPROB_HEADER 0 + if icmp6.code != 0: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Param Prob so leave it. + #icmp6.display() + return True + +def main(): + parser = argparse.ArgumentParser("frag6.py", + description="IPv6 fragementation test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface on which to check for the packet') + parser.add_argument('--src', nargs=1, + required=True, + help='The source IP address') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address') + parser.add_argument('--debug', + required=False, action='store_true', + help='Enable test debugging') + + args = parser.parse_args() + + + # Start sniffing on recvif + sniffer = Sniffer(args, check_icmp6_error) + + + ######################################################################## + # + # A single start fragment with zero length IPv6 header (jumbo). + # Make sure we do hit the Fragment case, which is tricky as the + # jumbogram needs to be > 64k. + # + # A: Jumbo-Fragment not allowed. + # R: ICMPv6 param problem. + # + #data = "6" * (65536 - 2 - 6 - 8 - 8) + data = "6" * 65512 + ip6f01 = sp.Ether() / \ + sp.IPv6(src=args.src[0], dst=args.to[0], plen=0) / \ + sp.IPv6ExtHdrHopByHop(options=sp.Jumbo(jumboplen=65536)) / \ + sp.IPv6ExtHdrFragment(offset=0, m=1, id=6) / \ + sp.UDP(dport=3456, sport=6543) / \ + data + if args.debug : + ip6f01.display() + sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) + + # We should only need to sleep 0.10 but it seems scapy + # takes time for this one. + sleep(75) + sniffer.setEnd() + sniffer.join() + if not sniffer.foundCorrectPacket: + sys.exit(1) + + sys.exit(0) + +if __name__ == '__main__': + main() Added: head/tests/sys/netinet6/frag6/frag6_01.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_01.sh Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,223 @@ +# $FreeBSD$ +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +. $(atf_get_srcdir)/frag6.subr + +atf_test_case "frag6_01" "cleanup" +frag6_01_head() { + frag6_head 1 +} + +frag6_01_check_stats() { + + local jname ifname + jname=$1 + ifname=$2 + + case "${jname}" in + "") echo "ERROR: jname is empty"; return ;; + esac + case "${ifname}" in + "") echo "ERROR: ifname is empty"; return ;; + esac + + # Defaults are: IPV6_FRAGTTL 120 slowtimo ticks. + # pfslowtimo() is run at hz/2. So this takes 60s. + # This is awefully long for a test case. + # The Python script has to wait for this already to get the ICMPv6 + # hence we do not sleep here anymore. + + + # + # Check selection of global UDP stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p udp --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 9) ;; + *) jexec ${jname} netstat -s -p udp --libxo xml,pretty + atf_fail "Global UDP statistics do not match: ${count} != 9" ;; + esac + + # + # Check selection of global IPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p ip6 --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 20) ;; + *) jexec ${jname} netstat -s -p ip6 --libxo xml,pretty + atf_fail "Global IPv6 statistics do not match: ${count} != 20" ;; + esac + + # + # Check selection of global ICMPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p icmp6 --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 22) ;; + *) jexec ${jname} netstat -s -p icmp6 --libxo xml,pretty + atf_fail "Global ICMPv6 statistics do not match: ${count} != 22" ;; + esac + + # + # Check selection of interface IPv6 stats. + # XXX-BZ TODO FIXME reassembly-failed should be 1? + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p ip6 -I ${ifname} --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 14) ;; + *) jexec ${jname} netstat -s -p ip6 -I ${ifname} --libxo xml,pretty + atf_fail "Interface IPv6 statistics do not match: ${count} != 14" ;; + esac + + # + # Check selection of interface ICMPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p icmp6 -I ${ifname} --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 21) ;; + *) jexec ${jname} netstat -s -p icmp6 -I ${ifname} --libxo xml,pretty + atf_fail "Interface ICMPv6 statistics do not match: ${count} != 21" ;; + esac +} + +frag6_01_body() { + + atf_skip "Sending IPv6 Jumbograms needs 1 kernel changes and BPF fixes" + + frag6_body 1 frag6_01_check_stats +} + +frag6_01_cleanup() { + frag6_cleanup 1 +} + +atf_init_test_cases() +{ + atf_add_test_case "frag6_01" +} Added: head/tests/sys/netinet6/frag6/frag6_02.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_02.py Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,108 @@ +#!/usr/bin/env python +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +import argparse +import scapy.all as sp +import socket +import sys +from sniffer import Sniffer +from time import sleep + +def check_icmp6_error(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6ParamProblem) + if not icmp6: + return False + # ICMP6_PARAMPROB_HEADER 0 + if icmp6.code != 0: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Param Prob so leave it. + #icmp6.display() + return True + +def main(): + parser = argparse.ArgumentParser("frag6.py", + description="IPv6 fragementation test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface on which to check for the packet') + parser.add_argument('--src', nargs=1, + required=True, + help='The source IP address') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address') + parser.add_argument('--debug', + required=False, action='store_true', + help='Enable test debugging') + + args = parser.parse_args() + + + # Start sniffing on recvif + sniffer = Sniffer(args, check_icmp6_error) + + + ######################################################################## + # + # A single start fragment with payload length not % 8. + # + # A: Error handling in code. + # R: ICMPv6 param problem. + # + data = "6" * 1287 + ip6f01 = sp.Ether() / \ + sp.IPv6(src=args.src[0], dst=args.to[0]) / \ + sp.IPv6ExtHdrFragment(offset=0, m=1, id=5) / \ + sp.UDP(dport=3456, sport=6543) / \ + data + if args.debug : + ip6f01.display() + sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) + + sleep(0.10) + sniffer.join() + if not sniffer.foundCorrectPacket: + sys.exit(1) + + sys.exit(0) + +if __name__ == '__main__': + main() Added: head/tests/sys/netinet6/frag6/frag6_02.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_02.sh Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,220 @@ +# $FreeBSD$ +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +. $(atf_get_srcdir)/frag6.subr + +atf_test_case "frag6_02" "cleanup" +frag6_02_head() { + frag6_head 2 +} + +frag6_02_check_stats() { + + local jname ifname + jname=$1 + ifname=$2 + + case "${jname}" in + "") echo "ERROR: jname is empty"; return ;; + esac + case "${ifname}" in + "") echo "ERROR: ifname is empty"; return ;; + esac + + # Defaults are: IPV6_FRAGTTL 120 slowtimo ticks. + # pfslowtimo() is run at hz/2. So this takes 60s. + # This is awefully long for a test case. + # The Python script has to wait for this already to get the ICMPv6 + # hence we do not sleep here anymore. + + + # + # Check selection of global UDP stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p udp --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 9) ;; + *) jexec ${jname} netstat -s -p udp --libxo xml,pretty + atf_fail "Global UDP statistics do not match: ${count} != 9" ;; + esac + + # + # Check selection of global IPv6 stats. + # XXX-TODO no global stats for this case? + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p ip6 --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 20) ;; + *) jexec ${jname} netstat -s -p ip6 --libxo xml,pretty + atf_fail "Global IPv6 statistics do not match: ${count} != 20" ;; + esac + + # + # Check selection of global ICMPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p icmp6 --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 22) ;; + *) jexec ${jname} netstat -s -p icmp6 --libxo xml,pretty + atf_fail "Global ICMPv6 statistics do not match: ${count} != 22" ;; + esac + + # + # Check selection of interface IPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 +EOF + count=`jexec ${jname} netstat -s -p ip6 -I ${ifname} --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 14) ;; + *) jexec ${jname} netstat -s -p ip6 -I ${ifname} --libxo xml,pretty + atf_fail "Interface IPv6 statistics do not match: ${count} != 14" ;; + esac + + # + # Check selection of interface ICMPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p icmp6 -I ${ifname} --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 21) ;; + *) jexec ${jname} netstat -s -p icmp6 -I ${ifname} --libxo xml,pretty + atf_fail "Interface ICMPv6 statistics do not match: ${count} != 21" ;; + esac +} + +frag6_02_body() { + frag6_body 2 frag6_02_check_stats +} + +frag6_02_cleanup() { + frag6_cleanup 2 +} + +atf_init_test_cases() +{ + atf_add_test_case "frag6_02" +} Added: head/tests/sys/netinet6/frag6/frag6_03.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_03.py Mon Oct 21 09:33:45 2019 (r353794) @@ -0,0 +1,106 @@ +#!/usr/bin/env python +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +import argparse +import scapy.all as sp +import socket +import sys +from sniffer import Sniffer +from time import sleep + +def check_icmp6_error(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6DestUnreach) + if not icmp6: + return False + # ICMP6_DST_UNREACH_NOPORT 4 + if icmp6.code != 4: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Dest Unreach / Port Unreach so leave it. + #icmp6.display() + return True + +def main(): + parser = argparse.ArgumentParser("frag6.py", + description="IPv6 fragementation test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface on which to check for the packet') + parser.add_argument('--src', nargs=1, + required=True, + help='The source IP address') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address') + parser.add_argument('--debug', + required=False, action='store_true', + help='Enable test debugging') + + args = parser.parse_args() + + + # Start sniffing on recvif + sniffer = Sniffer(args, check_icmp6_error) + + *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 21 11:56:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D1A5154E65; Mon, 21 Oct 2019 11:56:58 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xZqt1qJYz47mQ; Mon, 21 Oct 2019 11:56:58 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1BF9D239D5; Mon, 21 Oct 2019 11:56:58 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LBuvVs045876; Mon, 21 Oct 2019 11:56:57 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LBuvLB045875; Mon, 21 Oct 2019 11:56:57 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201910211156.x9LBuvLB045875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Mon, 21 Oct 2019 11:56:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353795 - head/sys/powerpc/aim X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/sys/powerpc/aim X-SVN-Commit-Revision: 353795 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 11:56:58 -0000 Author: luporl Date: Mon Oct 21 11:56:57 2019 New Revision: 353795 URL: https://svnweb.freebsd.org/changeset/base/353795 Log: [PPC64] Add minidump support to PowerNV Implementation of PowerNV specific minidump code. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D21643 Modified: head/sys/powerpc/aim/moea64_native.c Modified: head/sys/powerpc/aim/moea64_native.c ============================================================================== --- head/sys/powerpc/aim/moea64_native.c Mon Oct 21 09:33:45 2019 (r353794) +++ head/sys/powerpc/aim/moea64_native.c Mon Oct 21 11:56:57 2019 (r353795) @@ -213,6 +213,12 @@ static struct rwlock moea64_eviction_lock; static volatile struct pate *moea64_part_table; /* + * Dump function. + */ +static void *moea64_dump_pmap_native(mmu_t mmu, void *ctx, void *buf, + u_long *nbytes); + +/* * PTE calls. */ static int moea64_pte_insert_native(mmu_t, struct pvo_entry *); @@ -233,6 +239,7 @@ static mmu_method_t moea64_native_methods[] = { /* Internal interfaces */ MMUMETHOD(mmu_bootstrap, moea64_bootstrap_native), MMUMETHOD(mmu_cpu_bootstrap, moea64_cpu_bootstrap_native), + MMUMETHOD(mmu_dump_pmap, moea64_dump_pmap_native), MMUMETHOD(moea64_pte_synch, moea64_pte_synch_native), MMUMETHOD(moea64_pte_clear, moea64_pte_clear_native), @@ -787,3 +794,21 @@ moea64_pte_insert_native(mmu_t mmu, struct pvo_entry * return (-1); } +static void * +moea64_dump_pmap_native(mmu_t mmu, void *ctx, void *buf, u_long *nbytes) +{ + struct dump_context *dctx; + u_long ptex, ptex_end; + + dctx = (struct dump_context *)ctx; + ptex = dctx->ptex; + ptex_end = ptex + dctx->blksz / sizeof(struct lpte); + ptex_end = MIN(ptex_end, dctx->ptex_end); + *nbytes = (ptex_end - ptex) * sizeof(struct lpte); + + if (*nbytes == 0) + return (NULL); + + dctx->ptex = ptex_end; + return (__DEVOLATILE(struct lpte *, moea64_pteg_table) + ptex); +} From owner-svn-src-all@freebsd.org Mon Oct 21 12:21:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1A5F7156053; Mon, 21 Oct 2019 12:21:57 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xbNh6ndbz49Xb; Mon, 21 Oct 2019 12:21:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD41C23ED8; Mon, 21 Oct 2019 12:21:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LCLuU0062518; Mon, 21 Oct 2019 12:21:56 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LCLuEh062517; Mon, 21 Oct 2019 12:21:56 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910211221.x9LCLuEh062517@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Mon, 21 Oct 2019 12:21:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353796 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353796 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 12:21:57 -0000 Author: avg Date: Mon Oct 21 12:21:56 2019 New Revision: 353796 URL: https://svnweb.freebsd.org/changeset/base/353796 Log: debug,kassert.warnings is a statistic, not a tunable MFC after: 1 week Modified: head/sys/kern/kern_shutdown.c Modified: head/sys/kern/kern_shutdown.c ============================================================================== --- head/sys/kern/kern_shutdown.c Mon Oct 21 11:56:57 2019 (r353795) +++ head/sys/kern/kern_shutdown.c Mon Oct 21 12:21:56 2019 (r353796) @@ -713,7 +713,7 @@ SYSCTL_INT(_debug_kassert, OID_AUTO, do_log, KASSERT_R &kassert_do_log, 0, "If warn_only is enabled, log (1) or do not log (0) assertion violations"); -SYSCTL_INT(_debug_kassert, OID_AUTO, warnings, KASSERT_RWTUN, +SYSCTL_INT(_debug_kassert, OID_AUTO, warnings, CTLFLAG_RD | CTLFLAG_STATS, &kassert_warnings, 0, "number of KASSERTs that have been triggered"); SYSCTL_INT(_debug_kassert, OID_AUTO, log_panic_at, KASSERT_RWTUN, From owner-svn-src-all@freebsd.org Mon Oct 21 14:34:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 38CBD158E53; Mon, 21 Oct 2019 14:34: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xfKs0jPnz4LQr; Mon, 21 Oct 2019 14:34: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 F046325608; Mon, 21 Oct 2019 14:34:40 +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 x9LEYeuU040392; Mon, 21 Oct 2019 14:34:40 GMT (envelope-from ae@FreeBSD.org) Received: (from ae@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LEYeZl040391; Mon, 21 Oct 2019 14:34:40 GMT (envelope-from ae@FreeBSD.org) Message-Id: <201910211434.x9LEYeZl040391@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: ae set sender to ae@FreeBSD.org using -f From: "Andrey V. Elsukov" Date: Mon, 21 Oct 2019 14:34:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353797 - stable/11/sbin/ipfw X-SVN-Group: stable-11 X-SVN-Commit-Author: ae X-SVN-Commit-Paths: stable/11/sbin/ipfw X-SVN-Commit-Revision: 353797 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 14:34:41 -0000 Author: ae Date: Mon Oct 21 14:34:40 2019 New Revision: 353797 URL: https://svnweb.freebsd.org/changeset/base/353797 Log: MFC r353545: Explicitly initialize the memory buffer to store O_ICMP6TYPE opcode. By default next_cmd() initializes only first u32 of opcode. O_ICMP6TYPE opcode has array of bit masks to store corresponding ICMPv6 types. An opcode that precedes O_ICMP6TYPE, e.g. O_IP6_DST, can have variable length and during opcode filling it can modify memory that will be used by O_ICMP6TYPE opcode. Without explicit initialization this leads to creation of wrong opcode. Reported by: Boris N. Lytochkin Obtained from: Yandex LLC Modified: stable/11/sbin/ipfw/ipv6.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sbin/ipfw/ipv6.c ============================================================================== --- stable/11/sbin/ipfw/ipv6.c Mon Oct 21 12:21:56 2019 (r353796) +++ stable/11/sbin/ipfw/ipv6.c Mon Oct 21 14:34:40 2019 (r353797) @@ -143,6 +143,7 @@ fill_icmp6types(ipfw_insn_icmp6 *cmd, char *av, int cb uint8_t type; CHECK_LENGTH(cblen, F_INSN_SIZE(ipfw_insn_icmp6)); + memset(cmd, 0, sizeof(*cmd)); while (*av) { if (*av == ',') av++; From owner-svn-src-all@freebsd.org Mon Oct 21 14:38:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 95A06158F25; Mon, 21 Oct 2019 14:38:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xfPw3Pg7z4LbM; Mon, 21 Oct 2019 14:38:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53F5A25609; Mon, 21 Oct 2019 14:38:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LEcCt5040600; Mon, 21 Oct 2019 14:38:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LEcB1v040599; Mon, 21 Oct 2019 14:38:11 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910211438.x9LEcB1v040599@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 14:38:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353798 - in head: . sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: . sys/net X-SVN-Commit-Revision: 353798 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 14:38:12 -0000 Author: kevans Date: Mon Oct 21 14:38:11 2019 New Revision: 353798 URL: https://svnweb.freebsd.org/changeset/base/353798 Log: tuntap(4): restrict scope of net.link.tap.user_open slightly net.link.tap.user_open has historically allowed non-root users to do devfs cloning and open /dev/tap* nodes based on permissions. Loosen this up to make it only allow users to do devfs cloning -- we no longer check it in tunopen. This allows tap devices to be created that can actually be opened by a user, rather than swiftly restricting them to root because the magic sysctl has not been set. The sysctl has not yet been completely deprecated, because more thought is needed for how to handle the devfs cloning case. There is not an easy suitable replacement for the sysctl there, and more care needs to be placed in determining whether that's OK or not. PR: 200185 Modified: head/UPDATING head/sys/net/if_tuntap.c Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Oct 21 14:34:40 2019 (r353797) +++ head/UPDATING Mon Oct 21 14:38:11 2019 (r353798) @@ -26,6 +26,15 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: disable the most expensive debugging functionality run "ln -s 'abort:false,junk:false' /etc/malloc.conf".) +20191021: + The net.link.tap.user_open sysctl no longer prevents user opening of + already created /dev/tapNN devices. Access is still controlled by + node permissions, just like tun devices. The net.link.tap.user_open + sysctl is now used only to allow users to perform devfs cloning of + tap devices, and the subsequent open may not succeed if the user is not + in the appropriate group. This sysctl may be deprecated/removed + completely in the future. + 20191009: mips, powerpc, and sparc64 are no longer built as part of universe / tinderbox unless MAKE_OBSOLETE_GCC is defined. If Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Mon Oct 21 14:34:40 2019 (r353797) +++ head/sys/net/if_tuntap.c Mon Oct 21 14:38:11 2019 (r353798) @@ -181,7 +181,7 @@ static const char vmnetname[] = "vmnet"; static MALLOC_DEFINE(M_TUN, tunname, "Tunnel Interface"); static int tundebug = 0; static int tundclone = 1; -static int tap_allow_uopen = 0; /* allow user open() */ +static int tap_allow_uopen = 0; /* allow user devfs cloning */ static int tapuponopen = 0; /* IFF_UP on open() */ static int tapdclone = 1; /* enable devfs cloning */ @@ -202,7 +202,7 @@ SYSCTL_INT(_net_link_tun, OID_AUTO, devfs_cloning, CTL static SYSCTL_NODE(_net_link, OID_AUTO, tap, CTLFLAG_RW, 0, "Ethernet tunnel software network interface"); SYSCTL_INT(_net_link_tap, OID_AUTO, user_open, CTLFLAG_RW, &tap_allow_uopen, 0, - "Allow user to open /dev/tap (based on node permissions)"); + "Enable legacy devfs interface creation for all users"); SYSCTL_INT(_net_link_tap, OID_AUTO, up_on_open, CTLFLAG_RW, &tapuponopen, 0, "Bring interface up when /dev/tap is opened"); SYSCTL_INT(_net_link_tap, OID_AUTO, devfs_cloning, CTLFLAG_RWTUN, &tapdclone, 0, @@ -1047,17 +1047,6 @@ tunopen(struct cdev *dev, int flag, int mode, struct t if (error != 0) { CURVNET_RESTORE(); return (error); /* Shouldn't happen */ - } - - if ((tunflags & TUN_L2) != 0) { - /* Restrict? */ - if (tap_allow_uopen == 0) { - error = priv_check(td, PRIV_NET_TAP); - if (error != 0) { - CURVNET_RESTORE(); - return (error); - } - } } tp = dev->si_drv1; From owner-svn-src-all@freebsd.org Mon Oct 21 17:17:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EAA9615C28D; Mon, 21 Oct 2019 17:17:21 +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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xjxY5nWQz4TGS; Mon, 21 Oct 2019 17:17:21 +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 A55452726B; Mon, 21 Oct 2019 17:17:21 +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 x9LHHLa1034347; Mon, 21 Oct 2019 17:17:21 GMT (envelope-from gjb@FreeBSD.org) Received: (from gjb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LHHLRd034346; Mon, 21 Oct 2019 17:17:21 GMT (envelope-from gjb@FreeBSD.org) Message-Id: <201910211717.x9LHHLRd034346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gjb set sender to gjb@FreeBSD.org using -f From: Glen Barber Date: Mon, 21 Oct 2019 17:17:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r353799 - releng/12.1 X-SVN-Group: releng X-SVN-Commit-Author: gjb X-SVN-Commit-Paths: releng/12.1 X-SVN-Commit-Revision: 353799 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 17:17:22 -0000 Author: gjb Date: Mon Oct 21 17:17:21 2019 New Revision: 353799 URL: https://svnweb.freebsd.org/changeset/base/353799 Log: MFC r353776 (dim): Follow up on r351916 by also bumping the version suffix to 12.1 in Makefile.libcompat. Approved by: re (kib) Sponsored by: Rubicon Communications, LLC (Netgate) Modified: releng/12.1/Makefile.libcompat Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/Makefile.libcompat ============================================================================== --- releng/12.1/Makefile.libcompat Mon Oct 21 14:38:11 2019 (r353798) +++ releng/12.1/Makefile.libcompat Mon Oct 21 17:17:21 2019 (r353799) @@ -17,7 +17,7 @@ LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} .if ${WANT_COMPILER_TYPE} == gcc || \ (defined(X_COMPILER_TYPE) && ${X_COMPILER_TYPE} == gcc) .else -LIB32CPUFLAGS+= -target x86_64-unknown-freebsd12.0 +LIB32CPUFLAGS+= -target x86_64-unknown-freebsd12.1 .endif LIB32CPUFLAGS+= -m32 LIB32WMAKEENV= MACHINE=i386 MACHINE_ARCH=i386 \ @@ -49,9 +49,9 @@ LIB32CPUFLAGS= -march=${TARGET_CPUTYPE} .endif .else .if ${TARGET_ARCH:Mmips64el*} != "" -LIB32CPUFLAGS= -target mipsel-unknown-freebsd12.0 +LIB32CPUFLAGS= -target mipsel-unknown-freebsd12.1 .else -LIB32CPUFLAGS= -target mips-unknown-freebsd12.0 +LIB32CPUFLAGS= -target mips-unknown-freebsd12.1 .endif .endif LIB32CPUFLAGS+= -mabi=32 From owner-svn-src-all@freebsd.org Mon Oct 21 17:45:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BB0215C8F2; Mon, 21 Oct 2019 17:45:03 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xkYV6NrFz4VMK; Mon, 21 Oct 2019 17:45:02 +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 BEA6527799; Mon, 21 Oct 2019 17:45:02 +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 x9LHj264051663; Mon, 21 Oct 2019 17:45:02 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LHj031051652; Mon, 21 Oct 2019 17:45:00 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910211745.x9LHj031051652@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 21 Oct 2019 17:45:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353800 - in stable/12: share/man/man5 tools/build/options X-SVN-Group: stable-12 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable/12: share/man/man5 tools/build/options X-SVN-Commit-Revision: 353800 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 17:45:03 -0000 Author: dim Date: Mon Oct 21 17:45:00 2019 New Revision: 353800 URL: https://svnweb.freebsd.org/changeset/base/353800 Log: MFC r339524 (by imp): Add missing options. WITHOUT_LOADER_LUA is only needed since we turned it off by default on powerpc and sparc64 in r338203. Same with WITHOUT_LOADER_GEIL. WITH_NVME, WITHOUT_NVME, WITH_LOADER_FORCE_LE have been needed since they were added. MFC r353737: Provide a src.conf(5) description for the new WITHOUT_CAROOT option, and rename the WITH_LOADER_VERIEXEC_PASS_MANFIEST description to its correct name. Also correct a bunch of spelling errors in that description. Added: stable/12/tools/build/options/WITHOUT_LOADER_LUA - copied unchanged from r339524, head/tools/build/options/WITHOUT_LOADER_LUA stable/12/tools/build/options/WITHOUT_NVME - copied unchanged from r339524, head/tools/build/options/WITHOUT_NVME stable/12/tools/build/options/WITH_LOADER_FORCE_LE - copied unchanged from r339524, head/tools/build/options/WITH_LOADER_FORCE_LE stable/12/tools/build/options/WITH_LOADER_GELI - copied unchanged from r339524, head/tools/build/options/WITH_LOADER_GELI stable/12/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANIFEST - copied unchanged from r353737, head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANIFEST stable/12/tools/build/options/WITH_NVME - copied unchanged from r339524, head/tools/build/options/WITH_NVME Deleted: stable/12/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANFIEST Modified: stable/12/share/man/man5/src.conf.5 stable/12/tools/build/options/WITH_LOADER_VERIEXEC stable/12/tools/build/options/WITH_VERIEXEC Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man5/src.conf.5 ============================================================================== --- stable/12/share/man/man5/src.conf.5 Mon Oct 21 17:17:21 2019 (r353799) +++ stable/12/share/man/man5/src.conf.5 Mon Oct 21 17:45:00 2019 (r353800) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd September 26, 2019 +.Dd October 21, 2019 .Dt SRC.CONF 5 .Os .Sh NAME @@ -1252,11 +1252,24 @@ with support for verification based on certificates ob .It Va WITH_LOADER_FIREWIRE Enable firewire support in /boot/loader on x86. This option is a nop on all other platforms. +.It Va WITH_LOADER_FORCE_LE +Set to force the powerpc boot loader to launch the kernel in little +endian mode. .It Va WITHOUT_LOADER_GELI Disable inclusion of GELI crypto support in the boot chain binaries. .Pp This is a default setting on powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +.It Va WITH_LOADER_GELI +Set to build GELI bootloader support. +.Pp +This is a default setting on +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64. +.It Va WITHOUT_LOADER_LUA +Set to not build LUA bindings for the boot loader. +.Pp +This is a default setting on +powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. .It Va WITH_LOADER_LUA Set to build LUA bindings for the boot loader. .Pp @@ -1285,10 +1298,10 @@ arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, .It Va WITH_LOADER_VERIEXEC Enable building .Xr loader 8 -with support for verifcation similar to Verified Exec. +with support for verification similar to Verified Exec. .Pp -It depends on -.Va WITH_BEARSSL +Depends on +.Va WITH_BEARSSL . When set, these options are also in effect: .Pp .Bl -inset -compact @@ -1297,6 +1310,14 @@ When set, these options are also in effect: .Va WITHOUT_LOADER_EFI_SECUREBOOT is set explicitly) .El +.It Va WITH_LOADER_VERIEXEC_PASS_MANIFEST +Enable building +.Xr loader 8 +with support to pass a verified manifest to the kernel. +The kernel has to be built with a module to parse the manifest. +.Pp +Depends on +.Va WITH_LOADER_VERIEXEC . .It Va WITHOUT_LOADER_ZFS Set to not build ZFS file system boot loader support. .It Va WITHOUT_LOCALES @@ -1502,6 +1523,17 @@ will not be built either if this option is set. Set to not build .Xr ntpd 8 and related programs. +.It Va WITHOUT_NVME +Set to not build nvme related tools and kernel modules. +.Pp +This is a default setting on +arm/arm, arm/armv6, arm/armv7, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +.It Va WITH_NVME +Set to build nvme related tools and kernel modules. + +.Pp +This is a default setting on +amd64/amd64, i386/i386 and powerpc/powerpc64. .It Va WITH_OFED Set to build the .Dq "OpenFabrics Enterprise Distribution" @@ -1919,8 +1951,8 @@ which loads the contents of verified manifests into th for use by .Xr mac_veriexec 4 .Pp -It depends on -.Va WITH_BEARSSL +Depends on +.Va WITH_BEARSSL . .It Va WITHOUT_VI Set to not build and install vi, view, ex and related programs. .It Va WITHOUT_VT Copied: stable/12/tools/build/options/WITHOUT_LOADER_LUA (from r339524, head/tools/build/options/WITHOUT_LOADER_LUA) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITHOUT_LOADER_LUA Mon Oct 21 17:45:00 2019 (r353800, copy of r339524, head/tools/build/options/WITHOUT_LOADER_LUA) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to not build LUA bindings for the boot loader. Copied: stable/12/tools/build/options/WITHOUT_NVME (from r339524, head/tools/build/options/WITHOUT_NVME) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITHOUT_NVME Mon Oct 21 17:45:00 2019 (r353800, copy of r339524, head/tools/build/options/WITHOUT_NVME) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to not build nvme related tools and kernel modules. Copied: stable/12/tools/build/options/WITH_LOADER_FORCE_LE (from r339524, head/tools/build/options/WITH_LOADER_FORCE_LE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITH_LOADER_FORCE_LE Mon Oct 21 17:45:00 2019 (r353800, copy of r339524, head/tools/build/options/WITH_LOADER_FORCE_LE) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to force the powerpc boot loader to launch the kernel in little +endian mode. Copied: stable/12/tools/build/options/WITH_LOADER_GELI (from r339524, head/tools/build/options/WITH_LOADER_GELI) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITH_LOADER_GELI Mon Oct 21 17:45:00 2019 (r353800, copy of r339524, head/tools/build/options/WITH_LOADER_GELI) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build GELI bootloader support. Modified: stable/12/tools/build/options/WITH_LOADER_VERIEXEC ============================================================================== --- stable/12/tools/build/options/WITH_LOADER_VERIEXEC Mon Oct 21 17:17:21 2019 (r353799) +++ stable/12/tools/build/options/WITH_LOADER_VERIEXEC Mon Oct 21 17:45:00 2019 (r353800) @@ -1,7 +1,7 @@ .\" $FreeBSD$ Enable building .Xr loader 8 -with support for verifcation similar to Verified Exec. +with support for verification similar to Verified Exec. .Pp -It depends on -.Va WITH_BEARSSL +Depends on +.Va WITH_BEARSSL . Copied: stable/12/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANIFEST (from r353737, head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANIFEST) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANIFEST Mon Oct 21 17:45:00 2019 (r353800, copy of r353737, head/tools/build/options/WITH_LOADER_VERIEXEC_PASS_MANIFEST) @@ -0,0 +1,8 @@ +.\" $FreeBSD$ +Enable building +.Xr loader 8 +with support to pass a verified manifest to the kernel. +The kernel has to be built with a module to parse the manifest. +.Pp +Depends on +.Va WITH_LOADER_VERIEXEC . Copied: stable/12/tools/build/options/WITH_NVME (from r339524, head/tools/build/options/WITH_NVME) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/tools/build/options/WITH_NVME Mon Oct 21 17:45:00 2019 (r353800, copy of r339524, head/tools/build/options/WITH_NVME) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to build nvme related tools and kernel modules. + Modified: stable/12/tools/build/options/WITH_VERIEXEC ============================================================================== --- stable/12/tools/build/options/WITH_VERIEXEC Mon Oct 21 17:17:21 2019 (r353799) +++ stable/12/tools/build/options/WITH_VERIEXEC Mon Oct 21 17:45:00 2019 (r353800) @@ -5,5 +5,5 @@ which loads the contents of verified manifests into th for use by .Xr mac_veriexec 4 .Pp -It depends on -.Va WITH_BEARSSL +Depends on +.Va WITH_BEARSSL . From owner-svn-src-all@freebsd.org Mon Oct 21 17:54:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B249B15CBC2; Mon, 21 Oct 2019 17:54:54 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xkmt4JxLz4W22; Mon, 21 Oct 2019 17:54:54 +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 771A627982; Mon, 21 Oct 2019 17:54:54 +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 x9LHssX7058366; Mon, 21 Oct 2019 17:54:54 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LHsrKh058362; Mon, 21 Oct 2019 17:54:53 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910211754.x9LHsrKh058362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 21 Oct 2019 17:54:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353801 - in stable/11: share/man/man5 tools/build/options X-SVN-Group: stable-11 X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in stable/11: share/man/man5 tools/build/options X-SVN-Commit-Revision: 353801 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 17:54:54 -0000 Author: dim Date: Mon Oct 21 17:54:53 2019 New Revision: 353801 URL: https://svnweb.freebsd.org/changeset/base/353801 Log: Partially MFC r339524 (by imp): Add missing options. WITHOUT_LOADER_LUA is only needed since we turned it off by default on powerpc and sparc64 in r338203. Same with WITHOUT_LOADER_GEIL. WITH_NVME, WITHOUT_NVME, WITH_LOADER_FORCE_LE have been needed since they were added. (Note the NVME options do not apply to stable/11, and have been left out of this MFC.) Added: stable/11/tools/build/options/WITHOUT_LOADER_LUA - copied unchanged from r339524, head/tools/build/options/WITHOUT_LOADER_LUA stable/11/tools/build/options/WITH_LOADER_FORCE_LE - copied unchanged from r339524, head/tools/build/options/WITH_LOADER_FORCE_LE stable/11/tools/build/options/WITH_LOADER_GELI - copied unchanged from r339524, head/tools/build/options/WITH_LOADER_GELI Modified: stable/11/share/man/man5/src.conf.5 Directory Properties: stable/11/ (props changed) Modified: stable/11/share/man/man5/src.conf.5 ============================================================================== --- stable/11/share/man/man5/src.conf.5 Mon Oct 21 17:45:00 2019 (r353800) +++ stable/11/share/man/man5/src.conf.5 Mon Oct 21 17:54:53 2019 (r353801) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd March 29, 2019 +.Dd October 21, 2019 .Dt SRC.CONF 5 .Os .Sh NAME @@ -319,43 +319,6 @@ When set, it enforces these options: .It .Va WITHOUT_LLVM_COV .El -.Pp -When set, these options are also in effect: -.Pp -.Bl -inset -compact -.It Va WITHOUT_LLVM_TARGET_AARCH64 -(unless -.Va WITH_LLVM_TARGET_AARCH64 -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_ALL -(unless -.Va WITH_LLVM_TARGET_ALL -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_ARM -(unless -.Va WITH_LLVM_TARGET_ARM -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_MIPS -(unless -.Va WITH_LLVM_TARGET_MIPS -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_POWERPC -(unless -.Va WITH_LLVM_TARGET_POWERPC -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_RISCV -(unless -.Va WITH_LLVM_TARGET_RISCV -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_SPARC -(unless -.Va WITH_LLVM_TARGET_SPARC -is set explicitly) -.It Va WITHOUT_LLVM_TARGET_X86 -(unless -.Va WITH_LLVM_TARGET_X86 -is set explicitly) -.El .It Va WITH_CLANG Set to build the Clang C/C++ compiler during the normal phase of the build. .Pp @@ -1097,20 +1060,11 @@ Set to build LLVM target support for PowerPC. .Pp This is a default setting on amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, pc98/i386, powerpc/powerpc and powerpc/powerpc64. -.It Va WITHOUT_LLVM_TARGET_RISCV -Set to not build LLVM target support for RISC-V. -The -.Va LLVM_TARGET_ALL -option should be used rather than this in most cases. -.Pp -This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, and sparc/sparc64. .It Va WITH_LLVM_TARGET_RISCV Set to build LLVM target support for RISC-V. The .Va LLVM_TARGET_ALL option should be used rather than this in most cases. -.Pp .It Va WITHOUT_LLVM_TARGET_SPARC Set to not build LLVM target support for SPARC. .Pp @@ -1134,11 +1088,24 @@ amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarc .It Va WITH_LOADER_FIREWIRE Enable firewire support in /boot/loader and /boot/zfsloader on x86. This option is a nop on all other platforms. +.It Va WITH_LOADER_FORCE_LE +Set to force the powerpc boot loader to launch the kernel in little +endian mode. .It Va WITHOUT_LOADER_GELI Disable inclusion of GELI crypto support in the boot chain binaries. .Pp This is a default setting on pc98/i386, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. +.It Va WITH_LOADER_GELI +Set to build GELI bootloader support. +.Pp +This is a default setting on +amd64/amd64, arm/arm, arm/armeb, arm/armv6, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64 and mips/mipsn32. +.It Va WITHOUT_LOADER_LUA +Set to not build LUA bindings for the boot loader. +.Pp +This is a default setting on +pc98/i386, powerpc/powerpc, powerpc/powerpc64 and sparc64/sparc64. .It Va WITH_LOADER_LUA Set to build LUA bindings for the boot loader. .Pp @@ -1164,6 +1131,11 @@ Set to build ubldr. .Pp This is a default setting on arm/arm, arm/armeb, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, powerpc/powerpc and powerpc/powerpc64. +.It Va WITH_LOADER_VERBOSE +Set to build with extra verbose debugging in the loader. +May explode already nearly too large loader over the limit. +Use with care. + .It Va WITHOUT_LOADER_ZFS Set to not build ZFS file system boot loader support. .It Va WITHOUT_LOCALES Copied: stable/11/tools/build/options/WITHOUT_LOADER_LUA (from r339524, head/tools/build/options/WITHOUT_LOADER_LUA) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITHOUT_LOADER_LUA Mon Oct 21 17:54:53 2019 (r353801, copy of r339524, head/tools/build/options/WITHOUT_LOADER_LUA) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to not build LUA bindings for the boot loader. Copied: stable/11/tools/build/options/WITH_LOADER_FORCE_LE (from r339524, head/tools/build/options/WITH_LOADER_FORCE_LE) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_LOADER_FORCE_LE Mon Oct 21 17:54:53 2019 (r353801, copy of r339524, head/tools/build/options/WITH_LOADER_FORCE_LE) @@ -0,0 +1,3 @@ +.\" $FreeBSD$ +Set to force the powerpc boot loader to launch the kernel in little +endian mode. Copied: stable/11/tools/build/options/WITH_LOADER_GELI (from r339524, head/tools/build/options/WITH_LOADER_GELI) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/11/tools/build/options/WITH_LOADER_GELI Mon Oct 21 17:54:53 2019 (r353801, copy of r339524, head/tools/build/options/WITH_LOADER_GELI) @@ -0,0 +1,2 @@ +.\" $FreeBSD$ +Set to build GELI bootloader support. From owner-svn-src-all@freebsd.org Mon Oct 21 17:59:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F18E415CC5A; Mon, 21 Oct 2019 17:59:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xksf5zhSz4W9s; Mon, 21 Oct 2019 17:59:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ACC9F2798F; Mon, 21 Oct 2019 17:59:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LHx2wl058665; Mon, 21 Oct 2019 17:59:02 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LHx2Fx058664; Mon, 21 Oct 2019 17:59:02 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211759.x9LHx2Fx058664@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 17:59:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353802 - head/sys/dev/virtio/network X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/virtio/network X-SVN-Commit-Revision: 353802 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 17:59:03 -0000 Author: glebius Date: Mon Oct 21 17:59:02 2019 New Revision: 353802 URL: https://svnweb.freebsd.org/changeset/base/353802 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/virtio/network/if_vtnet.c Modified: head/sys/dev/virtio/network/if_vtnet.c ============================================================================== --- head/sys/dev/virtio/network/if_vtnet.c Mon Oct 21 17:54:53 2019 (r353801) +++ head/sys/dev/virtio/network/if_vtnet.c Mon Oct 21 17:59:02 2019 (r353802) @@ -3285,6 +3285,34 @@ vtnet_rx_filter(struct vtnet_softc *sc) ifp->if_flags & IFF_ALLMULTI ? "enable" : "disable"); } +static u_int +vtnet_copy_ifaddr(void *arg, struct sockaddr_dl *sdl, u_int ucnt) +{ + struct vtnet_softc *sc = arg; + + if (memcmp(LLADDR(sdl), sc->vtnet_hwaddr, ETHER_ADDR_LEN) == 0) + return (0); + + if (ucnt < VTNET_MAX_MAC_ENTRIES) + bcopy(LLADDR(sdl), + &sc->vtnet_mac_filter->vmf_unicast.macs[ucnt], + ETHER_ADDR_LEN); + + return (1); +} + +static u_int +vtnet_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt) +{ + struct vtnet_mac_filter *filter = arg; + + if (mcnt < VTNET_MAX_MAC_ENTRIES) + bcopy(LLADDR(sdl), &filter->vmf_multicast.macs[mcnt], + ETHER_ADDR_LEN); + + return (1); +} + static void vtnet_rx_filter_mac(struct vtnet_softc *sc) { @@ -3293,42 +3321,23 @@ vtnet_rx_filter_mac(struct vtnet_softc *sc) struct sglist_seg segs[4]; struct sglist sg; struct ifnet *ifp; - struct ifaddr *ifa; - struct ifmultiaddr *ifma; - int ucnt, mcnt, promisc, allmulti, error; + bool promisc, allmulti; + u_int ucnt, mcnt; + int error; uint8_t ack; ifp = sc->vtnet_ifp; filter = sc->vtnet_mac_filter; - ucnt = 0; - mcnt = 0; - promisc = 0; - allmulti = 0; VTNET_CORE_LOCK_ASSERT(sc); KASSERT(sc->vtnet_flags & VTNET_FLAG_CTRL_RX, ("%s: CTRL_RX feature not negotiated", __func__)); /* Unicast MAC addresses: */ - if_addr_rlock(ifp); - CK_STAILQ_FOREACH(ifa, &ifp->if_addrhead, ifa_link) { - if (ifa->ifa_addr->sa_family != AF_LINK) - continue; - else if (memcmp(LLADDR((struct sockaddr_dl *)ifa->ifa_addr), - sc->vtnet_hwaddr, ETHER_ADDR_LEN) == 0) - continue; - else if (ucnt == VTNET_MAX_MAC_ENTRIES) { - promisc = 1; - break; - } + ucnt = if_foreach_lladdr(ifp, vtnet_copy_ifaddr, sc); + promisc = (ucnt > VTNET_MAX_MAC_ENTRIES); - bcopy(LLADDR((struct sockaddr_dl *)ifa->ifa_addr), - &filter->vmf_unicast.macs[ucnt], ETHER_ADDR_LEN); - ucnt++; - } - if_addr_runlock(ifp); - - if (promisc != 0) { + if (promisc) { filter->vmf_unicast.nentries = 0; if_printf(ifp, "more than %d MAC addresses assigned, " "falling back to promiscuous mode\n", @@ -3337,22 +3346,10 @@ vtnet_rx_filter_mac(struct vtnet_softc *sc) filter->vmf_unicast.nentries = ucnt; /* Multicast MAC addresses: */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - else if (mcnt == VTNET_MAX_MAC_ENTRIES) { - allmulti = 1; - break; - } + mcnt = if_foreach_llmaddr(ifp, vtnet_copy_maddr, filter); + allmulti = (mcnt > VTNET_MAX_MAC_ENTRIES); - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - &filter->vmf_multicast.macs[mcnt], ETHER_ADDR_LEN); - mcnt++; - } - if_maddr_runlock(ifp); - - if (allmulti != 0) { + if (allmulti) { filter->vmf_multicast.nentries = 0; if_printf(ifp, "more than %d multicast MAC addresses " "assigned, falling back to all-multicast mode\n", @@ -3360,7 +3357,7 @@ vtnet_rx_filter_mac(struct vtnet_softc *sc) } else filter->vmf_multicast.nentries = mcnt; - if (promisc != 0 && allmulti != 0) + if (promisc && allmulti) goto out; hdr.class = VIRTIO_NET_CTRL_MAC; From owner-svn-src-all@freebsd.org Mon Oct 21 17:59:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C47915CCC2; Mon, 21 Oct 2019 17:59:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xksx0sPPz4WJD; Mon, 21 Oct 2019 17:59:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01B7E27990; Mon, 21 Oct 2019 17:59:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LHxGQQ058721; Mon, 21 Oct 2019 17:59:16 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LHxGZC058720; Mon, 21 Oct 2019 17:59:16 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211759.x9LHxGZC058720@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 17:59:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353803 - head/sys/dev/vmware/vmxnet3 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/vmware/vmxnet3 X-SVN-Commit-Revision: 353803 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 17:59:17 -0000 Author: glebius Date: Mon Oct 21 17:59:16 2019 New Revision: 353803 URL: https://svnweb.freebsd.org/changeset/base/353803 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c Modified: head/sys/dev/vmware/vmxnet3/if_vmx.c ============================================================================== --- head/sys/dev/vmware/vmxnet3/if_vmx.c Mon Oct 21 17:59:02 2019 (r353802) +++ head/sys/dev/vmware/vmxnet3/if_vmx.c Mon Oct 21 17:59:16 2019 (r353803) @@ -1995,12 +1995,23 @@ vmxnet3_vlan_unregister(if_ctx_t ctx, uint16_t tag) vmxnet3_update_vlan_filter(iflib_get_softc(ctx), 0, tag); } +static u_int +vmxnet3_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int count) +{ + struct vmxnet3_softc *sc = arg; + + if (count < VMXNET3_MULTICAST_MAX) + bcopy(LLADDR(sdl), &sc->vmx_mcast[count * ETHER_ADDR_LEN], + ETHER_ADDR_LEN); + + return (1); +} + static void vmxnet3_set_rxfilter(struct vmxnet3_softc *sc, int flags) { struct ifnet *ifp; struct vmxnet3_driver_shared *ds; - struct ifmultiaddr *ifma; u_int mode; ifp = sc->vmx_ifp; @@ -2012,24 +2023,10 @@ vmxnet3_set_rxfilter(struct vmxnet3_softc *sc, int fla if (flags & IFF_ALLMULTI) mode |= VMXNET3_RXMODE_ALLMULTI; else { - int cnt = 0, overflow = 0; + int cnt; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - else if (cnt == VMXNET3_MULTICAST_MAX) { - overflow = 1; - break; - } - - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - &sc->vmx_mcast[cnt*ETHER_ADDR_LEN], ETHER_ADDR_LEN); - cnt++; - } - if_maddr_runlock(ifp); - - if (overflow != 0) { + cnt = if_foreach_llmaddr(ifp, vmxnet3_hash_maddr, sc); + if (cnt >= VMXNET3_MULTICAST_MAX) { cnt = 0; mode |= VMXNET3_RXMODE_ALLMULTI; } else if (cnt > 0) From owner-svn-src-all@freebsd.org Mon Oct 21 17:59:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2C9B215CD44; Mon, 21 Oct 2019 17:59:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xktf0Nwxz4WR9; Mon, 21 Oct 2019 17:59:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E4DF227991; Mon, 21 Oct 2019 17:59:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LHxrxE058790; Mon, 21 Oct 2019 17:59:53 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LHxrcx058789; Mon, 21 Oct 2019 17:59:53 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211759.x9LHxrcx058789@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 17:59:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353804 - head/sys/dev/ae X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/ae X-SVN-Commit-Revision: 353804 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 17:59:54 -0000 Author: glebius Date: Mon Oct 21 17:59:53 2019 New Revision: 353804 URL: https://svnweb.freebsd.org/changeset/base/353804 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/ae/if_ae.c Modified: head/sys/dev/ae/if_ae.c ============================================================================== --- head/sys/dev/ae/if_ae.c Mon Oct 21 17:59:16 2019 (r353803) +++ head/sys/dev/ae/if_ae.c Mon Oct 21 17:59:53 2019 (r353804) @@ -2031,12 +2031,21 @@ ae_rxvlan(ae_softc_t *sc) AE_WRITE_4(sc, AE_MAC_REG, val); } +static u_int +ae_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *mchash = arg; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + + return (1); +} + static void ae_rxfilter(ae_softc_t *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc; uint32_t mchash[2]; uint32_t rxcfg; @@ -2072,15 +2081,7 @@ ae_rxfilter(ae_softc_t *sc) * Load multicast tables. */ bzero(mchash, sizeof(mchash)); - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, ae_hash_maddr, &mchash); AE_WRITE_4(sc, AE_REG_MHT0, mchash[0]); AE_WRITE_4(sc, AE_REG_MHT1, mchash[1]); AE_WRITE_4(sc, AE_MAC_REG, rxcfg); From owner-svn-src-all@freebsd.org Mon Oct 21 18:00:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2529615CDD4; Mon, 21 Oct 2019 18:00:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xkv60FcPz4WZK; Mon, 21 Oct 2019 18:00:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E161D2799A; Mon, 21 Oct 2019 18:00:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI0HUc058934; Mon, 21 Oct 2019 18:00:17 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI0HKV058933; Mon, 21 Oct 2019 18:00:17 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211800.x9LI0HKV058933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:00:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353805 - head/sys/dev/age X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/age X-SVN-Commit-Revision: 353805 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:00:18 -0000 Author: glebius Date: Mon Oct 21 18:00:17 2019 New Revision: 353805 URL: https://svnweb.freebsd.org/changeset/base/353805 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/age/if_age.c Modified: head/sys/dev/age/if_age.c ============================================================================== --- head/sys/dev/age/if_age.c Mon Oct 21 17:59:53 2019 (r353804) +++ head/sys/dev/age/if_age.c Mon Oct 21 18:00:17 2019 (r353805) @@ -3140,12 +3140,22 @@ age_rxvlan(struct age_softc *sc) CSR_WRITE_4(sc, AGE_MAC_CFG, reg); } +static u_int +age_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *mchash = arg; + uint32_t crc; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + + return (1); +} + static void age_rxfilter(struct age_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc; uint32_t mchash[2]; uint32_t rxcfg; @@ -3170,16 +3180,7 @@ age_rxfilter(struct age_softc *sc) /* Program new filter. */ bzero(mchash, sizeof(mchash)); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->age_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, age_hash_maddr, mchash); CSR_WRITE_4(sc, AGE_MAR0, mchash[0]); CSR_WRITE_4(sc, AGE_MAR1, mchash[1]); From owner-svn-src-all@freebsd.org Mon Oct 21 18:05:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22CCA15CFF7; Mon, 21 Oct 2019 18:05:44 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl1N06GQz4X3X; Mon, 21 Oct 2019 18:05:44 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D773A27B4D; Mon, 21 Oct 2019 18:05:43 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI5h1C064761; Mon, 21 Oct 2019 18:05:43 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI5h3h064760; Mon, 21 Oct 2019 18:05:43 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211805.x9LI5h3h064760@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:05:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353806 - head/sys/dev/al_eth X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/al_eth X-SVN-Commit-Revision: 353806 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:05:44 -0000 Author: glebius Date: Mon Oct 21 18:05:43 2019 New Revision: 353806 URL: https://svnweb.freebsd.org/changeset/base/353806 Log: Convert to if_foreach_llmaddr() KPI. This driver seems to have a bug. The bug was carefully saved during conversion. In the al_eth_mac_table_unicast_add() the argument 'addr', which is the actual address is unused. So, the function is called as many times as we have addresses, but with the exactly same argument list. This doesn't make any sense, but was preserved. Modified: head/sys/dev/al_eth/al_eth.c Modified: head/sys/dev/al_eth/al_eth.c ============================================================================== --- head/sys/dev/al_eth/al_eth.c Mon Oct 21 18:00:17 2019 (r353805) +++ head/sys/dev/al_eth/al_eth.c Mon Oct 21 18:05:43 2019 (r353806) @@ -603,7 +603,7 @@ al_dma_free_coherent(bus_dma_tag_t tag, bus_dmamap_t m static void al_eth_mac_table_unicast_add(struct al_eth_adapter *adapter, - uint8_t idx, uint8_t *addr, uint8_t udma_mask) + uint8_t idx, uint8_t udma_mask) { struct al_eth_fwd_mac_table_entry entry = { { 0 } }; @@ -2876,6 +2876,30 @@ al_get_counter(struct ifnet *ifp, ift_counter cnt) } } +static u_int +al_count_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + unsigned char *mac; + + mac = LLADDR(sdl); + /* default mc address inside mac address */ + if (mac[3] != 0 && mac[4] != 0 && mac[5] != 1) + return (1); + else + return (0); +} + +static u_int +al_program_addr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct al_eth_adapter *adapter = arg; + + al_eth_mac_table_unicast_add(adapter, + AL_ETH_MAC_TABLE_UNICAST_IDX_BASE + 1 + cnt, 1); + + return (1); +} + /* * Unicast, Multicast and Promiscuous mode set * @@ -2884,44 +2908,17 @@ al_get_counter(struct ifnet *ifp, ift_counter cnt) * responsible for configuring the hardware for proper unicast, multicast, * promiscuous mode, and all-multi behavior. */ -#define MAX_NUM_MULTICAST_ADDRESSES 32 -#define MAX_NUM_ADDRESSES 32 - static void al_eth_set_rx_mode(struct al_eth_adapter *adapter) { struct ifnet *ifp = adapter->netdev; - struct ifmultiaddr *ifma; /* multicast addresses configured */ - struct ifaddr *ifua; /* unicast address */ - int mc = 0; - int uc = 0; + int mc, uc; uint8_t i; - unsigned char *mac; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - if (mc == MAX_NUM_MULTICAST_ADDRESSES) - break; + /* XXXGL: why generic count won't work? */ + mc = if_foreach_llmaddr(ifp, al_count_maddr, NULL); + uc = if_lladdr_count(ifp); - mac = LLADDR((struct sockaddr_dl *) ifma->ifma_addr); - /* default mc address inside mac address */ - if (mac[3] != 0 && mac[4] != 0 && mac[5] != 1) - mc++; - } - if_maddr_runlock(ifp); - - if_addr_rlock(ifp); - CK_STAILQ_FOREACH(ifua, &ifp->if_addrhead, ifa_link) { - if (ifua->ifa_addr->sa_family != AF_LINK) - continue; - if (uc == MAX_NUM_ADDRESSES) - break; - uc++; - } - if_addr_runlock(ifp); - if ((ifp->if_flags & IFF_PROMISC) != 0) { al_eth_mac_table_promiscuous_set(adapter, true); } else { @@ -2957,18 +2954,7 @@ al_eth_set_rx_mode(struct al_eth_adapter *adapter) } /* set new addresses */ - i = AL_ETH_MAC_TABLE_UNICAST_IDX_BASE + 1; - if_addr_rlock(ifp); - CK_STAILQ_FOREACH(ifua, &ifp->if_addrhead, ifa_link) { - if (ifua->ifa_addr->sa_family != AF_LINK) { - continue; - } - al_eth_mac_table_unicast_add(adapter, i, - (unsigned char *)ifua->ifa_addr, 1); - i++; - } - if_addr_runlock(ifp); - + if_foreach_lladdr(ifp, al_program_addr, adapter); } al_eth_mac_table_promiscuous_set(adapter, false); } @@ -3001,7 +2987,7 @@ al_eth_config_rx_fwd(struct al_eth_adapter *adapter) * MAC address and all broadcast. all the rest will be dropped. */ al_eth_mac_table_unicast_add(adapter, AL_ETH_MAC_TABLE_UNICAST_IDX_BASE, - adapter->mac_addr, 1); + 1); al_eth_mac_table_broadcast_add(adapter, AL_ETH_MAC_TABLE_BROADCAST_IDX, 1); al_eth_mac_table_promiscuous_set(adapter, false); From owner-svn-src-all@freebsd.org Mon Oct 21 18:06:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3A4515D061; Mon, 21 Oct 2019 18:06:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl1p4nHKz4XBT; Mon, 21 Oct 2019 18:06:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 886FC27B4E; Mon, 21 Oct 2019 18:06:06 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI66rt064832; Mon, 21 Oct 2019 18:06:06 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6647064831; Mon, 21 Oct 2019 18:06:06 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6647064831@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353807 - head/sys/dev/alc X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/alc X-SVN-Commit-Revision: 353807 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:06 -0000 Author: glebius Date: Mon Oct 21 18:06:06 2019 New Revision: 353807 URL: https://svnweb.freebsd.org/changeset/base/353807 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/alc/if_alc.c Modified: head/sys/dev/alc/if_alc.c ============================================================================== --- head/sys/dev/alc/if_alc.c Mon Oct 21 18:05:43 2019 (r353806) +++ head/sys/dev/alc/if_alc.c Mon Oct 21 18:06:06 2019 (r353807) @@ -4581,12 +4581,22 @@ alc_rxvlan(struct alc_softc *sc) CSR_WRITE_4(sc, ALC_MAC_CFG, reg); } +static u_int +alc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *mchash = arg; + uint32_t crc; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + + return (1); +} + static void alc_rxfilter(struct alc_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc; uint32_t mchash[2]; uint32_t rxcfg; @@ -4609,15 +4619,7 @@ alc_rxfilter(struct alc_softc *sc) goto chipit; } - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->alc_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, alc_hash_maddr, mchash); chipit: CSR_WRITE_4(sc, ALC_MAR0, mchash[0]); From owner-svn-src-all@freebsd.org Mon Oct 21 18:06:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0692015D084; Mon, 21 Oct 2019 18:06:10 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl1s6PrRz4XCh; Mon, 21 Oct 2019 18:06:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB6FA27B4F; Mon, 21 Oct 2019 18:06:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI69x4064879; Mon, 21 Oct 2019 18:06:09 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI69hE064878; Mon, 21 Oct 2019 18:06:09 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI69hE064878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353808 - head/sys/dev/ale X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/ale X-SVN-Commit-Revision: 353808 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:10 -0000 Author: glebius Date: Mon Oct 21 18:06:09 2019 New Revision: 353808 URL: https://svnweb.freebsd.org/changeset/base/353808 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/ale/if_ale.c Modified: head/sys/dev/ale/if_ale.c ============================================================================== --- head/sys/dev/ale/if_ale.c Mon Oct 21 18:06:06 2019 (r353807) +++ head/sys/dev/ale/if_ale.c Mon Oct 21 18:06:09 2019 (r353808) @@ -3008,12 +3008,21 @@ ale_rxvlan(struct ale_softc *sc) CSR_WRITE_4(sc, ALE_MAC_CFG, reg); } +static u_int +ale_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *mchash = arg; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + + return (1); +} + static void ale_rxfilter(struct ale_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc; uint32_t mchash[2]; uint32_t rxcfg; @@ -3038,16 +3047,7 @@ ale_rxfilter(struct ale_softc *sc) /* Program new filter. */ bzero(mchash, sizeof(mchash)); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->ale_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - mchash[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, ale_hash_maddr, &mchash); CSR_WRITE_4(sc, ALE_MAR0, mchash[0]); CSR_WRITE_4(sc, ALE_MAR1, mchash[1]); From owner-svn-src-all@freebsd.org Mon Oct 21 18:06:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C114B15D0C2; Mon, 21 Oct 2019 18:06:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl1z4nvzz4XQQ; Mon, 21 Oct 2019 18:06:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76E7327B50; Mon, 21 Oct 2019 18:06:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6FNn064929; Mon, 21 Oct 2019 18:06:15 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6FXS064928; Mon, 21 Oct 2019 18:06:15 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6FXS064928@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353809 - head/sys/dev/ath X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/ath X-SVN-Commit-Revision: 353809 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:15 -0000 Author: glebius Date: Mon Oct 21 18:06:15 2019 New Revision: 353809 URL: https://svnweb.freebsd.org/changeset/base/353809 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/ath/if_ath.c Modified: head/sys/dev/ath/if_ath.c ============================================================================== --- head/sys/dev/ath/if_ath.c Mon Oct 21 18:06:09 2019 (r353808) +++ head/sys/dev/ath/if_ath.c Mon Oct 21 18:06:15 2019 (r353809) @@ -3591,6 +3591,25 @@ ath_update_promisc(struct ieee80211com *ic) DPRINTF(sc, ATH_DEBUG_MODE, "%s: RX filter 0x%x\n", __func__, rfilt); } +static u_int +ath_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t val, *mfilt = arg; + char *dl; + uint8_t pos; + + /* calculate XOR of eight 6bit values */ + dl = LLADDR(sdl); + val = le32dec(dl + 0); + pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; + val = le32dec(dl + 3); + pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val; + pos &= 0x3f; + mfilt[pos / 32] |= (1 << (pos % 32)); + + return (1); +} + /* * Driver-internal mcast update call. * @@ -3605,35 +3624,13 @@ ath_update_mcast_hw(struct ath_softc *sc) /* calculate and install multicast filter */ if (ic->ic_allmulti == 0) { struct ieee80211vap *vap; - struct ifnet *ifp; - struct ifmultiaddr *ifma; /* * Merge multicast addresses to form the hardware filter. */ mfilt[0] = mfilt[1] = 0; - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - ifp = vap->iv_ifp; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - caddr_t dl; - uint32_t val; - uint8_t pos; - - /* calculate XOR of eight 6bit values */ - dl = LLADDR((struct sockaddr_dl *) - ifma->ifma_addr); - val = le32dec(dl + 0); - pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ - val; - val = le32dec(dl + 3); - pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ - val; - pos &= 0x3f; - mfilt[pos / 32] |= (1 << (pos % 32)); - } - if_maddr_runlock(ifp); - } + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + if_foreach_llmaddr(vap->iv_ifp, ath_hash_maddr, &mfilt); } else mfilt[0] = mfilt[1] = ~0; From owner-svn-src-all@freebsd.org Mon Oct 21 18:06:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED84815D10E; Mon, 21 Oct 2019 18:06:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl235P38z4XSX; Mon, 21 Oct 2019 18:06:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CDB227B51; Mon, 21 Oct 2019 18:06:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6Jil064979; Mon, 21 Oct 2019 18:06:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6JqS064978; Mon, 21 Oct 2019 18:06:19 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6JqS064978@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353810 - head/sys/dev/bce X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/bce X-SVN-Commit-Revision: 353810 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:20 -0000 Author: glebius Date: Mon Oct 21 18:06:19 2019 New Revision: 353810 URL: https://svnweb.freebsd.org/changeset/base/353810 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/bce/if_bce.c Modified: head/sys/dev/bce/if_bce.c ============================================================================== --- head/sys/dev/bce/if_bce.c Mon Oct 21 18:06:15 2019 (r353809) +++ head/sys/dev/bce/if_bce.c Mon Oct 21 18:06:19 2019 (r353810) @@ -8065,14 +8065,25 @@ bce_intr_exit: /* Returns: */ /* Nothing. */ /****************************************************************************/ +static u_int +bce_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + u32 *hashes = arg; + int h; + + h = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN) & 0xFF; + hashes[(h & 0xE0) >> 5] |= 1 << (h & 0x1F); + + return (1); +} + static void bce_set_rx_mode(struct bce_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; u32 hashes[NUM_MC_HASH_REGISTERS] = { 0, 0, 0, 0, 0, 0, 0, 0 }; u32 rx_mode, sort_mode; - int h, i; + int i; DBENTER(BCE_VERBOSE_MISC); @@ -8115,16 +8126,7 @@ bce_set_rx_mode(struct bce_softc *sc) } else { /* Accept one or more multicast(s). */ DBPRINT(sc, BCE_INFO_MISC, "Enabling selective multicast mode.\n"); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_le(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) & 0xFF; - hashes[(h & 0xE0) >> 5] |= 1 << (h & 0x1F); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, bce_hash_maddr, hashes); for (i = 0; i < NUM_MC_HASH_REGISTERS; i++) REG_WR(sc, BCE_EMAC_MULTICAST_HASH0 + (i * 4), hashes[i]); From owner-svn-src-all@freebsd.org Mon Oct 21 18:06:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41B5615D158; Mon, 21 Oct 2019 18:06:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl276gN8z4XZZ; Mon, 21 Oct 2019 18:06:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF7EC27B52; Mon, 21 Oct 2019 18:06:23 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6NQK065029; Mon, 21 Oct 2019 18:06:23 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6NVu065028; Mon, 21 Oct 2019 18:06:23 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6NVu065028@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353811 - head/sys/dev/bfe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/bfe X-SVN-Commit-Revision: 353811 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:24 -0000 Author: glebius Date: Mon Oct 21 18:06:23 2019 New Revision: 353811 URL: https://svnweb.freebsd.org/changeset/base/353811 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/bfe/if_bfe.c Modified: head/sys/dev/bfe/if_bfe.c ============================================================================== --- head/sys/dev/bfe/if_bfe.c Mon Oct 21 18:06:19 2019 (r353810) +++ head/sys/dev/bfe/if_bfe.c Mon Oct 21 18:06:23 2019 (r353811) @@ -1080,13 +1080,21 @@ bfe_cam_write(struct bfe_softc *sc, u_char *data, int bfe_wait_bit(sc, BFE_CAM_CTRL, BFE_CAM_BUSY, 10000, 1); } +static u_int +bfe_write_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct bfe_softc *sc = arg; + + bfe_cam_write(sc, LLADDR(sdl), cnt + 1); + + return (1); +} + static void bfe_set_rx_mode(struct bfe_softc *sc) { struct ifnet *ifp = sc->bfe_ifp; - struct ifmultiaddr *ifma; u_int32_t val; - int i = 0; BFE_LOCK_ASSERT(sc); @@ -1104,20 +1112,13 @@ bfe_set_rx_mode(struct bfe_softc *sc) CSR_WRITE_4(sc, BFE_CAM_CTRL, 0); - bfe_cam_write(sc, IF_LLADDR(sc->bfe_ifp), i++); + bfe_cam_write(sc, IF_LLADDR(sc->bfe_ifp), 0); if (ifp->if_flags & IFF_ALLMULTI) val |= BFE_RXCONF_ALLMULTI; else { val &= ~BFE_RXCONF_ALLMULTI; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - bfe_cam_write(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr), i++); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, bfe_write_maddr, sc); } CSR_WRITE_4(sc, BFE_RXCONF, val); From owner-svn-src-all@freebsd.org Mon Oct 21 18:06:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A3C0F15D19A; Mon, 21 Oct 2019 18:06:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl2C3NqRz4Xh4; Mon, 21 Oct 2019 18:06:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5657A27B53; Mon, 21 Oct 2019 18:06:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6RdD065077; Mon, 21 Oct 2019 18:06:27 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6RQL065076; Mon, 21 Oct 2019 18:06:27 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6RQL065076@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353812 - head/sys/dev/bge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/bge X-SVN-Commit-Revision: 353812 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:27 -0000 Author: glebius Date: Mon Oct 21 18:06:26 2019 New Revision: 353812 URL: https://svnweb.freebsd.org/changeset/base/353812 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/bge/if_bge.c Modified: head/sys/dev/bge/if_bge.c ============================================================================== --- head/sys/dev/bge/if_bge.c Mon Oct 21 18:06:23 2019 (r353811) +++ head/sys/dev/bge/if_bge.c Mon Oct 21 18:06:26 2019 (r353812) @@ -1621,33 +1621,32 @@ bge_setpromisc(struct bge_softc *sc) BGE_CLRBIT(sc, BGE_RX_MODE, BGE_RXMODE_RX_PROMISC); } +static u_int +bge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int h; + + h = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN) & 0x7F; + hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F); + + return (1); +} + static void bge_setmulti(struct bge_softc *sc) { if_t ifp; - int mc_count = 0; uint32_t hashes[4] = { 0, 0, 0, 0 }; - int h, i, mcnt; - unsigned char *mta; + int i; BGE_LOCK_ASSERT(sc); ifp = sc->bge_ifp; - mc_count = if_multiaddr_count(ifp, -1); - mta = malloc(sizeof(unsigned char) * ETHER_ADDR_LEN * - mc_count, M_DEVBUF, M_NOWAIT); - - if(mta == NULL) { - device_printf(sc->bge_dev, - "Failed to allocated temp mcast list\n"); - return; - } - if (if_getflags(ifp) & IFF_ALLMULTI || if_getflags(ifp) & IFF_PROMISC) { for (i = 0; i < 4; i++) CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), 0xFFFFFFFF); - free(mta, M_DEVBUF); return; } @@ -1655,17 +1654,10 @@ bge_setmulti(struct bge_softc *sc) for (i = 0; i < 4; i++) CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), 0); - if_multiaddr_array(ifp, mta, &mcnt, mc_count); - for(i = 0; i < mcnt; i++) { - h = ether_crc32_le(mta + (i * ETHER_ADDR_LEN), - ETHER_ADDR_LEN) & 0x7F; - hashes[(h & 0x60) >> 5] |= 1 << (h & 0x1F); - } + if_foreach_llmaddr(ifp, bge_hash_maddr, hashes); for (i = 0; i < 4; i++) CSR_WRITE_4(sc, BGE_MAR0 + (i * 4), hashes[i]); - - free(mta, M_DEVBUF); } static void From owner-svn-src-all@freebsd.org Mon Oct 21 18:06:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5DC815D206; Mon, 21 Oct 2019 18:06:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl2J3wMPz4Xr6; Mon, 21 Oct 2019 18:06:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 683EF27B54; Mon, 21 Oct 2019 18:06:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6Wb7065129; Mon, 21 Oct 2019 18:06:32 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6Wtq065127; Mon, 21 Oct 2019 18:06:32 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6Wtq065127@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353813 - head/sys/dev/bxe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/bxe X-SVN-Commit-Revision: 353813 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:33 -0000 Author: glebius Date: Mon Oct 21 18:06:31 2019 New Revision: 353813 URL: https://svnweb.freebsd.org/changeset/base/353813 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/bxe/bxe.c head/sys/dev/bxe/bxe.h Modified: head/sys/dev/bxe/bxe.c ============================================================================== --- head/sys/dev/bxe/bxe.c Mon Oct 21 18:06:26 2019 (r353812) +++ head/sys/dev/bxe/bxe.c Mon Oct 21 18:06:31 2019 (r353813) @@ -12065,27 +12065,31 @@ bxe_initial_phy_init(struct bxe_softc *sc, return (rc); } -/* must be called under IF_ADDR_LOCK */ +static u_int +bxe_push_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct ecore_mcast_list_elem *mc_mac = arg; + + mc_mac += cnt; + mc_mac->mac = (uint8_t *)LLADDR(sdl); + + return (1); +} + static int bxe_init_mcast_macs_list(struct bxe_softc *sc, struct ecore_mcast_ramrod_params *p) { if_t ifp = sc->ifp; - int mc_count = 0; - struct ifmultiaddr *ifma; + int mc_count; struct ecore_mcast_list_elem *mc_mac; - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) { - continue; - } - - mc_count++; - } - ECORE_LIST_INIT(&p->mcast_list); p->mcast_list_len = 0; + /* XXXGL: multicast count may change later */ + mc_count = if_llmaddr_count(ifp); + if (!mc_count) { return (0); } @@ -12097,20 +12101,15 @@ bxe_init_mcast_macs_list(struct bxe_softc return (-1); } bzero(mc_mac, (sizeof(*mc_mac) * mc_count)); + if_foreach_llmaddr(ifp, bxe_push_maddr, mc_mac); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) { - continue; - } - - mc_mac->mac = (uint8_t *)LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - ECORE_LIST_PUSH_TAIL(&mc_mac->link, &p->mcast_list); - + for (int i = 0; i < mc_count; i ++) { + ECORE_LIST_PUSH_TAIL(&mc_mac[i].link, &p->mcast_list); BLOGD(sc, DBG_LOAD, "Setting MCAST %02X:%02X:%02X:%02X:%02X:%02X and mc_count %d\n", - mc_mac->mac[0], mc_mac->mac[1], mc_mac->mac[2], - mc_mac->mac[3], mc_mac->mac[4], mc_mac->mac[5], mc_count); - mc_mac++; + mc_mac[i].mac[0], mc_mac[i].mac[1], mc_mac[i].mac[2], + mc_mac[i].mac[3], mc_mac[i].mac[4], mc_mac[i].mac[5], + mc_count); } p->mcast_list_len = mc_count; @@ -12171,69 +12170,59 @@ bxe_set_mc_list(struct bxe_softc *sc) return (rc); } +struct bxe_set_addr_ctx { + struct bxe_softc *sc; + unsigned long ramrod_flags; + int rc; +}; + +static u_int +bxe_set_addr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct bxe_set_addr_ctx *ctx = arg; + struct ecore_vlan_mac_obj *mac_obj = &ctx->sc->sp_objs->mac_obj; + int rc; + + if (ctx->rc < 0) + return (0); + + rc = bxe_set_mac_one(ctx->sc, (uint8_t *)LLADDR(sdl), mac_obj, TRUE, + ECORE_UC_LIST_MAC, &ctx->ramrod_flags); + + /* do not treat adding same MAC as an error */ + if (rc == -EEXIST) + BLOGD(ctx->sc, DBG_SP, "Failed to schedule ADD operations (EEXIST)\n"); + else if (rc < 0) { + BLOGE(ctx->sc, "Failed to schedule ADD operations (%d)\n", rc); + ctx->rc = rc; + } + + return (1); +} + static int bxe_set_uc_list(struct bxe_softc *sc) { if_t ifp = sc->ifp; struct ecore_vlan_mac_obj *mac_obj = &sc->sp_objs->mac_obj; - struct ifaddr *ifa; - unsigned long ramrod_flags = 0; + struct bxe_set_addr_ctx ctx = { sc, 0, 0 }; int rc; -#if __FreeBSD_version < 800000 - IF_ADDR_LOCK(ifp); -#else - if_addr_rlock(ifp); -#endif - /* first schedule a cleanup up of old configuration */ rc = bxe_del_all_macs(sc, mac_obj, ECORE_UC_LIST_MAC, FALSE); if (rc < 0) { BLOGE(sc, "Failed to schedule delete of all ETH MACs (%d)\n", rc); -#if __FreeBSD_version < 800000 - IF_ADDR_UNLOCK(ifp); -#else - if_addr_runlock(ifp); -#endif return (rc); } - ifa = if_getifaddr(ifp); /* XXX Is this structure */ - while (ifa) { - if (ifa->ifa_addr->sa_family != AF_LINK) { - ifa = CK_STAILQ_NEXT(ifa, ifa_link); - continue; - } + if_foreach_lladdr(ifp, bxe_set_addr, &ctx); + if (ctx.rc < 0) + return (ctx.rc); - rc = bxe_set_mac_one(sc, (uint8_t *)LLADDR((struct sockaddr_dl *)ifa->ifa_addr), - mac_obj, TRUE, ECORE_UC_LIST_MAC, &ramrod_flags); - if (rc == -EEXIST) { - BLOGD(sc, DBG_SP, "Failed to schedule ADD operations (EEXIST)\n"); - /* do not treat adding same MAC as an error */ - rc = 0; - } else if (rc < 0) { - BLOGE(sc, "Failed to schedule ADD operations (%d)\n", rc); -#if __FreeBSD_version < 800000 - IF_ADDR_UNLOCK(ifp); -#else - if_addr_runlock(ifp); -#endif - return (rc); - } - - ifa = CK_STAILQ_NEXT(ifa, ifa_link); - } - -#if __FreeBSD_version < 800000 - IF_ADDR_UNLOCK(ifp); -#else - if_addr_runlock(ifp); -#endif - /* Execute the pending commands */ - bit_set(&ramrod_flags, RAMROD_CONT); + bit_set(&ctx.ramrod_flags, RAMROD_CONT); return (bxe_set_mac_one(sc, NULL, mac_obj, FALSE /* don't care */, - ECORE_UC_LIST_MAC, &ramrod_flags)); + ECORE_UC_LIST_MAC, &ctx.ramrod_flags)); } static void Modified: head/sys/dev/bxe/bxe.h ============================================================================== --- head/sys/dev/bxe/bxe.h Mon Oct 21 18:06:26 2019 (r353812) +++ head/sys/dev/bxe/bxe.h Mon Oct 21 18:06:31 2019 (r353813) @@ -1492,29 +1492,8 @@ struct bxe_softc { #define BXE_STATS_UNLOCK(sc) mtx_unlock(&sc->stats_mtx) #define BXE_STATS_LOCK_ASSERT(sc) mtx_assert(&sc->stats_mtx, MA_OWNED) -#if __FreeBSD_version < 800000 -#define BXE_MCAST_LOCK(sc) \ - do { \ - mtx_lock(&sc->mcast_mtx); \ - IF_ADDR_LOCK(sc->ifp); \ - } while (0) -#define BXE_MCAST_UNLOCK(sc) \ - do { \ - IF_ADDR_UNLOCK(sc->ifp); \ - mtx_unlock(&sc->mcast_mtx); \ - } while (0) -#else -#define BXE_MCAST_LOCK(sc) \ - do { \ - mtx_lock(&sc->mcast_mtx); \ - if_maddr_rlock(sc->ifp); \ - } while (0) -#define BXE_MCAST_UNLOCK(sc) \ - do { \ - if_maddr_runlock(sc->ifp); \ - mtx_unlock(&sc->mcast_mtx); \ - } while (0) -#endif +#define BXE_MCAST_LOCK(sc) mtx_lock(&sc->mcast_mtx); +#define BXE_MCAST_UNLOCK(sc) mtx_unlock(&sc->mcast_mtx); #define BXE_MCAST_LOCK_ASSERT(sc) mtx_assert(&sc->mcast_mtx, MA_OWNED) int dmae_ready; From owner-svn-src-all@freebsd.org Mon Oct 21 18:06:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D76AF15D322; Mon, 21 Oct 2019 18:06:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl2j5Q57z4Y5h; Mon, 21 Oct 2019 18:06:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E2D327B55; Mon, 21 Oct 2019 18:06:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6r85065197; Mon, 21 Oct 2019 18:06:53 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6rou065196; Mon, 21 Oct 2019 18:06:53 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6rou065196@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353814 - head/sys/dev/fxp X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/fxp X-SVN-Commit-Revision: 353814 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:53 -0000 Author: glebius Date: Mon Oct 21 18:06:53 2019 New Revision: 353814 URL: https://svnweb.freebsd.org/changeset/base/353814 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/fxp/if_fxp.c Modified: head/sys/dev/fxp/if_fxp.c ============================================================================== --- head/sys/dev/fxp/if_fxp.c Mon Oct 21 18:06:31 2019 (r353813) +++ head/sys/dev/fxp/if_fxp.c Mon Oct 21 18:06:53 2019 (r353814) @@ -245,7 +245,7 @@ static void fxp_discard_rfabuf(struct fxp_softc *sc, struct fxp_rx *rxp); static int fxp_new_rfabuf(struct fxp_softc *sc, struct fxp_rx *rxp); -static int fxp_mc_addrs(struct fxp_softc *sc); +static void fxp_mc_addrs(struct fxp_softc *sc); static void fxp_mc_setup(struct fxp_softc *sc); static uint16_t fxp_eeprom_getword(struct fxp_softc *sc, int offset, int autosize); @@ -2976,27 +2976,37 @@ fxp_ioctl(if_t ifp, u_long command, caddr_t data) return (error); } +static u_int +fxp_setup_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct fxp_softc *sc = arg; + struct fxp_cb_mcs *mcsp = sc->mcsp; + + if (mcsp->mc_cnt < MAXMCADDR) + bcopy(LLADDR(sdl), mcsp->mc_addr[mcsp->mc_cnt * ETHER_ADDR_LEN], + ETHER_ADDR_LEN); + mcsp->mc_cnt++; + return (1); +} + /* * Fill in the multicast address list and return number of entries. */ -static int +static void fxp_mc_addrs(struct fxp_softc *sc) { struct fxp_cb_mcs *mcsp = sc->mcsp; if_t ifp = sc->ifp; - int nmcasts = 0; if ((if_getflags(ifp) & IFF_ALLMULTI) == 0) { - if_maddr_rlock(ifp); - if_setupmultiaddr(ifp, mcsp->mc_addr, &nmcasts, MAXMCADDR); - if (nmcasts >= MAXMCADDR) { + mcsp->mc_cnt = 0; + if_foreach_llmaddr(sc->ifp, fxp_setup_maddr, sc); + if (mcsp->mc_cnt >= MAXMCADDR) { if_setflagbits(ifp, IFF_ALLMULTI, 0); - nmcasts = 0; + mcsp->mc_cnt = 0; } - if_maddr_runlock(ifp); } - mcsp->mc_cnt = htole16(nmcasts * ETHER_ADDR_LEN); - return (nmcasts); + mcsp->mc_cnt = htole16(mcsp->mc_cnt * ETHER_ADDR_LEN); } /* From owner-svn-src-all@freebsd.org Mon Oct 21 18:06:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1EE215D36D; Mon, 21 Oct 2019 18:06:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl2p0Jmcz4Y82; Mon, 21 Oct 2019 18:06:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DE6DD27B56; Mon, 21 Oct 2019 18:06:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI6vrv065250; Mon, 21 Oct 2019 18:06:57 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI6v9b065249; Mon, 21 Oct 2019 18:06:57 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211806.x9LI6v9b065249@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:06:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353815 - head/sys/dev/gem X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/gem X-SVN-Commit-Revision: 353815 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:06:58 -0000 Author: glebius Date: Mon Oct 21 18:06:57 2019 New Revision: 353815 URL: https://svnweb.freebsd.org/changeset/base/353815 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/gem/if_gem.c Modified: head/sys/dev/gem/if_gem.c ============================================================================== --- head/sys/dev/gem/if_gem.c Mon Oct 21 18:06:53 2019 (r353814) +++ head/sys/dev/gem/if_gem.c Mon Oct 21 18:06:57 2019 (r353815) @@ -2202,14 +2202,27 @@ gem_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (error); } +static u_int +gem_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *hash = arg; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + /* We just want the 8 most significant bits. */ + crc >>= 24; + /* Set the corresponding bit in the filter. */ + hash[crc >> 4] |= 1 << (15 - (crc & 15)); + + return (1); +} + static void gem_setladrf(struct gem_softc *sc) { struct ifnet *ifp = sc->sc_ifp; - struct ifmultiaddr *inm; int i; uint32_t hash[16]; - uint32_t crc, v; + uint32_t v; GEM_LOCK_ASSERT(sc, MA_OWNED); @@ -2245,23 +2258,8 @@ gem_setladrf(struct gem_softc *sc) * is the MSB). */ - /* Clear the hash table. */ memset(hash, 0, sizeof(hash)); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { - if (inm->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - inm->ifma_addr), ETHER_ADDR_LEN); - - /* We just want the 8 most significant bits. */ - crc >>= 24; - - /* Set the corresponding bit in the filter. */ - hash[crc >> 4] |= 1 << (15 - (crc & 15)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, gem_hash_maddr, hash); v |= GEM_MAC_RX_HASH_FILTER; From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 32A2615D3BA; Mon, 21 Oct 2019 18:07:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl2v3Zk7z4YKk; Mon, 21 Oct 2019 18:07:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4D2927B57; Mon, 21 Oct 2019 18:07:02 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI727n065311; Mon, 21 Oct 2019 18:07:02 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI72dA065310; Mon, 21 Oct 2019 18:07:02 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI72dA065310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353816 - head/sys/dev/hme X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/hme X-SVN-Commit-Revision: 353816 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:04 -0000 Author: glebius Date: Mon Oct 21 18:07:02 2019 New Revision: 353816 URL: https://svnweb.freebsd.org/changeset/base/353816 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/hme/if_hme.c Modified: head/sys/dev/hme/if_hme.c ============================================================================== --- head/sys/dev/hme/if_hme.c Mon Oct 21 18:06:57 2019 (r353815) +++ head/sys/dev/hme/if_hme.c Mon Oct 21 18:07:02 2019 (r353816) @@ -1656,6 +1656,20 @@ hme_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (error); } +static u_int +hme_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *hash = arg; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + /* Just want the 6 most significant bits. */ + crc >>= 26; + /* Set the corresponding bit in the filter. */ + hash[crc >> 4] |= 1 << (crc & 0xf); + + return (1); +} + /* * Set up the logical address filter. */ @@ -1663,8 +1677,6 @@ static void hme_setladrf(struct hme_softc *sc, int reenable) { struct ifnet *ifp = sc->sc_ifp; - struct ifmultiaddr *inm; - u_int32_t crc; u_int32_t hash[4]; u_int32_t macc; @@ -1721,21 +1733,7 @@ hme_setladrf(struct hme_softc *sc, int reenable) * selects the word, while the rest of the bits select the bit within * the word. */ - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { - if (inm->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - inm->ifma_addr), ETHER_ADDR_LEN); - - /* Just want the 6 most significant bits. */ - crc >>= 26; - - /* Set the corresponding bit in the filter. */ - hash[crc >> 4] |= 1 << (crc & 0xf); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, hme_hash_maddr, &hash); chipit: /* Now load the hash table into the chip */ From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 170A915D407; Mon, 21 Oct 2019 18:07:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl2z6wMDz4YNP; Mon, 21 Oct 2019 18:07:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D24A727B58; Mon, 21 Oct 2019 18:07:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI77CF065360; Mon, 21 Oct 2019 18:07:07 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI770m065359; Mon, 21 Oct 2019 18:07:07 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI770m065359@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353817 - head/sys/dev/le X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/le X-SVN-Commit-Revision: 353817 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:08 -0000 Author: glebius Date: Mon Oct 21 18:07:07 2019 New Revision: 353817 URL: https://svnweb.freebsd.org/changeset/base/353817 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/le/lance.c Modified: head/sys/dev/le/lance.c ============================================================================== --- head/sys/dev/le/lance.c Mon Oct 21 18:07:02 2019 (r353816) +++ head/sys/dev/le/lance.c Mon Oct 21 18:07:07 2019 (r353817) @@ -577,6 +577,27 @@ lance_ioctl(struct ifnet *ifp, u_long cmd, caddr_t dat return (error); } +struct lance_hash_maddr_ctx { + struct lance_softc *sc; + uint16_t *af; +}; + +static u_int +lance_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct lance_hash_maddr_ctx *ctx = arg; + struct lance_softc *sc = ctx->sc; + uint32_t crc; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + /* Just want the 6 most significant bits. */ + crc >>= 26; + /* Set the corresponding bit in the filter. */ + ctx->af[crc >> 4] |= LE_HTOLE16(1 << (crc & 0xf)); + + return (1); +} + /* * Set up the logical address filter. */ @@ -584,8 +605,7 @@ void lance_setladrf(struct lance_softc *sc, uint16_t *af) { struct ifnet *ifp = sc->sc_ifp; - struct ifmultiaddr *ifma; - uint32_t crc; + struct lance_hash_maddr_ctx ctx = { sc, af }; /* * Set up multicast address filter by passing all multicast addresses @@ -601,21 +621,7 @@ lance_setladrf(struct lance_softc *sc, uint16_t *af) } af[0] = af[1] = af[2] = af[3] = 0x0000; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - - /* Just want the 6 most significant bits. */ - crc >>= 26; - - /* Set the corresponding bit in the filter. */ - af[crc >> 4] |= LE_HTOLE16(1 << (crc & 0xf)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, lance_hash_maddr, &ctx); } /* From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 137EB15D45E; Mon, 21 Oct 2019 18:07:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl335zGwz4YTb; Mon, 21 Oct 2019 18:07:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8818227B59; Mon, 21 Oct 2019 18:07:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7BFo065412; Mon, 21 Oct 2019 18:07:11 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7BVI065411; Mon, 21 Oct 2019 18:07:11 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7BVI065411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353818 - head/sys/dev/lge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/lge X-SVN-Commit-Revision: 353818 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:12 -0000 Author: glebius Date: Mon Oct 21 18:07:11 2019 New Revision: 353818 URL: https://svnweb.freebsd.org/changeset/base/353818 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/lge/if_lge.c Modified: head/sys/dev/lge/if_lge.c ============================================================================== --- head/sys/dev/lge/if_lge.c Mon Oct 21 18:07:07 2019 (r353817) +++ head/sys/dev/lge/if_lge.c Mon Oct 21 18:07:11 2019 (r353818) @@ -367,13 +367,25 @@ lge_miibus_statchg(dev) return; } +static u_int +lge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int count) +{ + uint32_t h, *hashes = arg; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + return (1); +} + static void lge_setmulti(sc) struct lge_softc *sc; { struct ifnet *ifp; - struct ifmultiaddr *ifma; - u_int32_t h = 0, hashes[2] = { 0, 0 }; + uint32_t hashes[2] = { 0, 0 }; ifp = sc->lge_ifp; LGE_LOCK_ASSERT(sc); @@ -392,18 +404,7 @@ lge_setmulti(sc) CSR_WRITE_4(sc, LGE_MAR1, 0); /* now program new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, lge_hash_maddr, hashes); CSR_WRITE_4(sc, LGE_MAR0, hashes[0]); CSR_WRITE_4(sc, LGE_MAR1, hashes[1]); From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29B2215D4BD; Mon, 21 Oct 2019 18:07:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl376PKLz4Ybp; Mon, 21 Oct 2019 18:07:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BEA7B27B5A; Mon, 21 Oct 2019 18:07:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7Fun065472; Mon, 21 Oct 2019 18:07:15 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7Ftl065471; Mon, 21 Oct 2019 18:07:15 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7Ftl065471@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353819 - head/sys/dev/mge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/mge X-SVN-Commit-Revision: 353819 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:16 -0000 Author: glebius Date: Mon Oct 21 18:07:15 2019 New Revision: 353819 URL: https://svnweb.freebsd.org/changeset/base/353819 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/mge/if_mge.c Modified: head/sys/dev/mge/if_mge.c ============================================================================== --- head/sys/dev/mge/if_mge.c Mon Oct 21 18:07:11 2019 (r353818) +++ head/sys/dev/mge/if_mge.c Mon Oct 21 18:07:15 2019 (r353819) @@ -2032,45 +2032,51 @@ mge_crc8(uint8_t *data, int size) return(crc); } +struct mge_hash_maddr_ctx { + uint32_t smt[MGE_MCAST_REG_NUMBER]; + uint32_t omt[MGE_MCAST_REG_NUMBER]; +}; + +static u_int +mge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + static const uint8_t special[5] = { 0x01, 0x00, 0x5E, 0x00, 0x00 }; + struct mge_hash_maddr_ctx *ctx = arg; + static const uint8_t v = (MGE_RX_DEFAULT_QUEUE << 1) | 1; + uint8_t *mac; + int i; + + mac = LLADDR(sdl); + if (memcmp(mac, special, sizeof(special)) == 0) { + i = mac[5]; + ctx->smt[i >> 2] |= v << ((i & 0x03) << 3); + } else { + i = mge_crc8(mac, ETHER_ADDR_LEN); + ctx->omt[i >> 2] |= v << ((i & 0x03) << 3); + } + return (1); +} + static void mge_setup_multicast(struct mge_softc *sc) { - uint8_t special[5] = { 0x01, 0x00, 0x5E, 0x00, 0x00 }; - uint8_t v = (MGE_RX_DEFAULT_QUEUE << 1) | 1; - uint32_t smt[MGE_MCAST_REG_NUMBER]; - uint32_t omt[MGE_MCAST_REG_NUMBER]; + struct mge_hash_maddr_ctx ctx; struct ifnet *ifp = sc->ifp; - struct ifmultiaddr *ifma; - uint8_t *mac; + static const uint8_t v = (MGE_RX_DEFAULT_QUEUE << 1) | 1; int i; if (ifp->if_flags & IFF_ALLMULTI) { for (i = 0; i < MGE_MCAST_REG_NUMBER; i++) - smt[i] = omt[i] = (v << 24) | (v << 16) | (v << 8) | v; + ctx.smt[i] = ctx.omt[i] = + (v << 24) | (v << 16) | (v << 8) | v; } else { - memset(smt, 0, sizeof(smt)); - memset(omt, 0, sizeof(omt)); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - mac = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - if (memcmp(mac, special, sizeof(special)) == 0) { - i = mac[5]; - smt[i >> 2] |= v << ((i & 0x03) << 3); - } else { - i = mge_crc8(mac, ETHER_ADDR_LEN); - omt[i >> 2] |= v << ((i & 0x03) << 3); - } - } - if_maddr_runlock(ifp); + memset(&ctx, 0, sizeof(ctx)); + if_foreach_llmaddr(ifp, mge_hash_maddr, &ctx); } for (i = 0; i < MGE_MCAST_REG_NUMBER; i++) { - MGE_WRITE(sc, MGE_DA_FILTER_SPEC_MCAST(i), smt[i]); - MGE_WRITE(sc, MGE_DA_FILTER_OTH_MCAST(i), omt[i]); + MGE_WRITE(sc, MGE_DA_FILTER_SPEC_MCAST(i), ctx.smt[i]); + MGE_WRITE(sc, MGE_DA_FILTER_OTH_MCAST(i), ctx.omt[i]); } } From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5069D15D519; Mon, 21 Oct 2019 18:07:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3D1055z4Yjc; Mon, 21 Oct 2019 18:07:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A436427B5B; Mon, 21 Oct 2019 18:07:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7Jfo065519; Mon, 21 Oct 2019 18:07:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7Jar065518; Mon, 21 Oct 2019 18:07:19 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7Jar065518@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353820 - head/sys/dev/msk X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/msk X-SVN-Commit-Revision: 353820 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:20 -0000 Author: glebius Date: Mon Oct 21 18:07:19 2019 New Revision: 353820 URL: https://svnweb.freebsd.org/changeset/base/353820 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/msk/if_msk.c Modified: head/sys/dev/msk/if_msk.c ============================================================================== --- head/sys/dev/msk/if_msk.c Mon Oct 21 18:07:15 2019 (r353819) +++ head/sys/dev/msk/if_msk.c Mon Oct 21 18:07:19 2019 (r353820) @@ -573,14 +573,27 @@ msk_miibus_statchg(device_t dev) } } +static u_int +msk_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *mchash = arg; + uint32_t crc; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + /* Just want the 6 least significant bits. */ + crc &= 0x3f; + /* Set the corresponding bit in the hash table. */ + mchash[crc >> 5] |= 1 << (crc & 0x1f); + + return (1); +} + static void msk_rxfilter(struct msk_if_softc *sc_if) { struct msk_softc *sc; struct ifnet *ifp; - struct ifmultiaddr *ifma; uint32_t mchash[2]; - uint32_t crc; uint16_t mode; sc = sc_if->msk_softc; @@ -599,18 +612,7 @@ msk_rxfilter(struct msk_if_softc *sc_if) mchash[1] = 0xffff; } else { mode |= GM_RXCR_UCF_ENA; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - /* Just want the 6 least significant bits. */ - crc &= 0x3f; - /* Set the corresponding bit in the hash table. */ - mchash[crc >> 5] |= 1 << (crc & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, msk_hash_maddr, mchash); if (mchash[0] != 0 || mchash[1] != 0) mode |= GM_RXCR_MCF_ENA; } From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BC9DC15D57C; Mon, 21 Oct 2019 18:07:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3K1KCmz4YrP; Mon, 21 Oct 2019 18:07:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D7ABF27B5C; Mon, 21 Oct 2019 18:07:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7OoE065569; Mon, 21 Oct 2019 18:07:24 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7OZu065568; Mon, 21 Oct 2019 18:07:24 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7OZu065568@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353821 - head/sys/dev/nfe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/nfe X-SVN-Commit-Revision: 353821 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:25 -0000 Author: glebius Date: Mon Oct 21 18:07:24 2019 New Revision: 353821 URL: https://svnweb.freebsd.org/changeset/base/353821 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/nfe/if_nfe.c Modified: head/sys/dev/nfe/if_nfe.c ============================================================================== --- head/sys/dev/nfe/if_nfe.c Mon Oct 21 18:07:19 2019 (r353820) +++ head/sys/dev/nfe/if_nfe.c Mon Oct 21 18:07:24 2019 (r353821) @@ -2557,75 +2557,67 @@ nfe_encap(struct nfe_softc *sc, struct mbuf **m_head) return (0); } +struct nfe_hash_maddr_ctx { + uint8_t addr[ETHER_ADDR_LEN]; + uint8_t mask[ETHER_ADDR_LEN]; +}; +static u_int +nfe_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct nfe_hash_maddr_ctx *ctx = arg; + uint8_t *addrp, mcaddr; + int j; + + addrp = LLADDR(sdl); + for (j = 0; j < ETHER_ADDR_LEN; j++) { + mcaddr = addrp[j]; + ctx->addr[j] &= mcaddr; + ctx->mask[j] &= ~mcaddr; + } + + return (1); +} + static void nfe_setmulti(struct nfe_softc *sc) { if_t ifp = sc->nfe_ifp; - int i, mc_count, mcnt; + struct nfe_hash_maddr_ctx ctx; uint32_t filter; - uint8_t addr[ETHER_ADDR_LEN], mask[ETHER_ADDR_LEN]; uint8_t etherbroadcastaddr[ETHER_ADDR_LEN] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; - uint8_t *mta; + int i; NFE_LOCK_ASSERT(sc); if ((if_getflags(ifp) & (IFF_ALLMULTI | IFF_PROMISC)) != 0) { - bzero(addr, ETHER_ADDR_LEN); - bzero(mask, ETHER_ADDR_LEN); + bzero(ctx.addr, ETHER_ADDR_LEN); + bzero(ctx.mask, ETHER_ADDR_LEN); goto done; } - bcopy(etherbroadcastaddr, addr, ETHER_ADDR_LEN); - bcopy(etherbroadcastaddr, mask, ETHER_ADDR_LEN); + bcopy(etherbroadcastaddr, ctx.addr, ETHER_ADDR_LEN); + bcopy(etherbroadcastaddr, ctx.mask, ETHER_ADDR_LEN); - mc_count = if_multiaddr_count(ifp, -1); - mta = malloc(sizeof(uint8_t) * ETHER_ADDR_LEN * mc_count, M_DEVBUF, - M_NOWAIT); + if_foreach_llmaddr(ifp, nfe_hash_maddr, &ctx); - /* Unable to get memory - process without filtering */ - if (mta == NULL) { - device_printf(sc->nfe_dev, "nfe_setmulti: failed to allocate" - "temp multicast buffer!\n"); - - bzero(addr, ETHER_ADDR_LEN); - bzero(mask, ETHER_ADDR_LEN); - goto done; - } - - if_multiaddr_array(ifp, mta, &mcnt, mc_count); - - for (i = 0; i < mcnt; i++) { - uint8_t *addrp; - int j; - - addrp = mta + (i * ETHER_ADDR_LEN); - for (j = 0; j < ETHER_ADDR_LEN; j++) { - u_int8_t mcaddr = addrp[j]; - addr[j] &= mcaddr; - mask[j] &= ~mcaddr; - } - } - - free(mta, M_DEVBUF); - for (i = 0; i < ETHER_ADDR_LEN; i++) { - mask[i] |= addr[i]; + ctx.mask[i] |= ctx.addr[i]; } done: - addr[0] |= 0x01; /* make sure multicast bit is set */ + ctx.addr[0] |= 0x01; /* make sure multicast bit is set */ - NFE_WRITE(sc, NFE_MULTIADDR_HI, - addr[3] << 24 | addr[2] << 16 | addr[1] << 8 | addr[0]); + NFE_WRITE(sc, NFE_MULTIADDR_HI, ctx.addr[3] << 24 | ctx.addr[2] << 16 | + ctx.addr[1] << 8 | ctx.addr[0]); NFE_WRITE(sc, NFE_MULTIADDR_LO, - addr[5] << 8 | addr[4]); - NFE_WRITE(sc, NFE_MULTIMASK_HI, - mask[3] << 24 | mask[2] << 16 | mask[1] << 8 | mask[0]); + ctx.addr[5] << 8 | ctx.addr[4]); + NFE_WRITE(sc, NFE_MULTIMASK_HI, ctx.mask[3] << 24 | ctx.mask[2] << 16 | + ctx.mask[1] << 8 | ctx.mask[0]); NFE_WRITE(sc, NFE_MULTIMASK_LO, - mask[5] << 8 | mask[4]); + ctx.mask[5] << 8 | ctx.mask[4]); filter = NFE_READ(sc, NFE_RXFILTER); filter &= NFE_PFF_RX_PAUSE; From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 64A1815D5D4; Mon, 21 Oct 2019 18:07:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3N6rYMz4YxW; Mon, 21 Oct 2019 18:07:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCB3527B5D; Mon, 21 Oct 2019 18:07:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7Smj065619; Mon, 21 Oct 2019 18:07:28 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7SSu065618; Mon, 21 Oct 2019 18:07:28 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7SSu065618@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353822 - head/sys/dev/nge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/nge X-SVN-Commit-Revision: 353822 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:29 -0000 Author: glebius Date: Mon Oct 21 18:07:28 2019 New Revision: 353822 URL: https://svnweb.freebsd.org/changeset/base/353822 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/nge/if_nge.c Modified: head/sys/dev/nge/if_nge.c ============================================================================== --- head/sys/dev/nge/if_nge.c Mon Oct 21 18:07:24 2019 (r353821) +++ head/sys/dev/nge/if_nge.c Mon Oct 21 18:07:28 2019 (r353822) @@ -661,13 +661,33 @@ nge_miibus_statchg(device_t dev) CSR_READ_4(sc, NGE_GPIO) & ~NGE_GPIO_GP3_OUT); } +static u_int +nge_write_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct nge_softc *sc = arg; + uint32_t h; + int bit, index; + + /* + * From the 11 bits returned by the crc routine, the top 7 + * bits represent the 16-bit word in the mcast hash table + * that needs to be updated, and the lower 4 bits represent + * which bit within that byte needs to be set. + */ + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 21; + index = (h >> 4) & 0x7F; + bit = h & 0xF; + CSR_WRITE_4(sc, NGE_RXFILT_CTL, NGE_FILTADDR_MCAST_LO + (index * 2)); + NGE_SETBIT(sc, NGE_RXFILT_DATA, (1 << bit)); + + return (1); +} + static void nge_rxfilter(struct nge_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t h, i, rxfilt; - int bit, index; + uint32_t i, rxfilt; NGE_LOCK_ASSERT(sc); ifp = sc->nge_ifp; @@ -720,26 +740,7 @@ nge_rxfilter(struct nge_softc *sc) CSR_WRITE_4(sc, NGE_RXFILT_DATA, 0); } - /* - * From the 11 bits returned by the crc routine, the top 7 - * bits represent the 16-bit word in the mcast hash table - * that needs to be updated, and the lower 4 bits represent - * which bit within that byte needs to be set. - */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 21; - index = (h >> 4) & 0x7F; - bit = h & 0xF; - CSR_WRITE_4(sc, NGE_RXFILT_CTL, - NGE_FILTADDR_MCAST_LO + (index * 2)); - NGE_SETBIT(sc, NGE_RXFILT_DATA, (1 << bit)); - } - if_maddr_runlock(ifp); - + if_foreach_llmaddr(ifp, nge_write_maddr, sc); done: CSR_WRITE_4(sc, NGE_RXFILT_CTL, rxfilt); /* Turn the receive filter on. */ From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 20F4115D631; Mon, 21 Oct 2019 18:07:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3S6Ydnz4Z61; Mon, 21 Oct 2019 18:07:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7FC0627B5E; Mon, 21 Oct 2019 18:07:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7WcX065669; Mon, 21 Oct 2019 18:07:32 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7W13065668; Mon, 21 Oct 2019 18:07:32 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7W13065668@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353823 - head/sys/dev/re X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/re X-SVN-Commit-Revision: 353823 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:33 -0000 Author: glebius Date: Mon Oct 21 18:07:32 2019 New Revision: 353823 URL: https://svnweb.freebsd.org/changeset/base/353823 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/re/if_re.c Modified: head/sys/dev/re/if_re.c ============================================================================== --- head/sys/dev/re/if_re.c Mon Oct 21 18:07:28 2019 (r353822) +++ head/sys/dev/re/if_re.c Mon Oct 21 18:07:32 2019 (r353823) @@ -649,6 +649,20 @@ re_miibus_statchg(device_t dev) */ } +static u_int +re_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t h, *hashes = arg; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} + /* * Set the RX configuration and 64-bit multicast hash filter. */ @@ -656,9 +670,8 @@ static void re_set_rxmode(struct rl_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t hashes[2] = { 0, 0 }; - uint32_t h, rxfilt; + uint32_t h, hashes[2] = { 0, 0 }; + uint32_t rxfilt; RL_LOCK_ASSERT(sc); @@ -683,18 +696,7 @@ re_set_rxmode(struct rl_softc *sc) goto done; } - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, re_hash_maddr, hashes); if (hashes[0] != 0 || hashes[1] != 0) { /* From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E69E15D669; Mon, 21 Oct 2019 18:07:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3X6BQ8z4ZBp; Mon, 21 Oct 2019 18:07:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C43727B5F; Mon, 21 Oct 2019 18:07:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7aOj065716; Mon, 21 Oct 2019 18:07:36 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7aVV065715; Mon, 21 Oct 2019 18:07:36 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7aVV065715@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353824 - head/sys/dev/rl X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/rl X-SVN-Commit-Revision: 353824 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:37 -0000 Author: glebius Date: Mon Oct 21 18:07:35 2019 New Revision: 353824 URL: https://svnweb.freebsd.org/changeset/base/353824 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/rl/if_rl.c Modified: head/sys/dev/rl/if_rl.c ============================================================================== --- head/sys/dev/rl/if_rl.c Mon Oct 21 18:07:32 2019 (r353823) +++ head/sys/dev/rl/if_rl.c Mon Oct 21 18:07:35 2019 (r353824) @@ -509,6 +509,21 @@ rl_miibus_statchg(device_t dev) */ } +static u_int +rl_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int h; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} + /* * Program the 64-bit multicast hash filter. */ @@ -516,9 +531,7 @@ static void rl_rxfilter(struct rl_softc *sc) { struct ifnet *ifp = sc->rl_ifp; - int h = 0; uint32_t hashes[2] = { 0, 0 }; - struct ifmultiaddr *ifma; uint32_t rxfilt; RL_LOCK_ASSERT(sc); @@ -539,18 +552,7 @@ rl_rxfilter(struct rl_softc *sc) hashes[1] = 0xFFFFFFFF; } else { /* Now program new ones. */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, rl_hash_maddr, hashes); if (hashes[0] != 0 || hashes[1] != 0) rxfilt |= RL_RXCFG_RX_MULTI; } From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6AF7C15D6E4; Mon, 21 Oct 2019 18:07:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3d1Fs7z4ZKf; Mon, 21 Oct 2019 18:07:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0CAE127B60; Mon, 21 Oct 2019 18:07:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7erj065766; Mon, 21 Oct 2019 18:07:40 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7eaP065765; Mon, 21 Oct 2019 18:07:40 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7eaP065765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353825 - head/sys/dev/sge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/sge X-SVN-Commit-Revision: 353825 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:41 -0000 Author: glebius Date: Mon Oct 21 18:07:40 2019 New Revision: 353825 URL: https://svnweb.freebsd.org/changeset/base/353825 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/sge/if_sge.c Modified: head/sys/dev/sge/if_sge.c ============================================================================== --- head/sys/dev/sge/if_sge.c Mon Oct 21 18:07:35 2019 (r353824) +++ head/sys/dev/sge/if_sge.c Mon Oct 21 18:07:40 2019 (r353825) @@ -442,12 +442,22 @@ sge_miibus_statchg(device_t dev) } } +static u_int +sge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int count) +{ + uint32_t crc, *hashes = arg; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + hashes[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); + + return (1); +} + static void sge_rxfilter(struct sge_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc, hashes[2]; + uint32_t hashes[2]; uint16_t rxfilt; SGE_LOCK_ASSERT(sc); @@ -468,15 +478,7 @@ sge_rxfilter(struct sge_softc *sc) rxfilt |= AcceptMulticast; hashes[0] = hashes[1] = 0; /* Now program new ones. */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - hashes[crc >> 31] |= 1 << ((crc >> 26) & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, sge_hash_maddr, hashes); } CSR_WRITE_2(sc, RxMacControl, rxfilt); CSR_WRITE_4(sc, RxHashTable, hashes[0]); From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8829D15D738; Mon, 21 Oct 2019 18:07:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3j2l4pz4ZRg; Mon, 21 Oct 2019 18:07:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3848727B61; Mon, 21 Oct 2019 18:07:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7j0r065816; Mon, 21 Oct 2019 18:07:45 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7j69065815; Mon, 21 Oct 2019 18:07:45 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7j69065815@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353826 - head/sys/dev/sis X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/sis X-SVN-Commit-Revision: 353826 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:45 -0000 Author: glebius Date: Mon Oct 21 18:07:44 2019 New Revision: 353826 URL: https://svnweb.freebsd.org/changeset/base/353826 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/sis/if_sis.c Modified: head/sys/dev/sis/if_sis.c ============================================================================== --- head/sys/dev/sis/if_sis.c Mon Oct 21 18:07:40 2019 (r353825) +++ head/sys/dev/sis/if_sis.c Mon Oct 21 18:07:44 2019 (r353826) @@ -694,13 +694,29 @@ sis_rxfilter(struct sis_softc *sc) sis_rxfilter_sis(sc); } +static u_int +sis_write_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct sis_softc *sc = arg; + uint32_t h; + int bit, index; + + h = sis_mchash(sc, LLADDR(sdl)); + index = h >> 3; + bit = h & 0x1F; + CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_FMEM_LO + index); + if (bit > 0xF) + bit -= 0x10; + SIS_SETBIT(sc, SIS_RXFILT_DATA, (1 << bit)); + + return (1); +} + static void sis_rxfilter_ns(struct sis_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t h, i, filter; - int bit, index; + uint32_t i, filter; ifp = sc->sis_ifp; filter = CSR_READ_4(sc, SIS_RXFILT_CTL); @@ -743,21 +759,7 @@ sis_rxfilter_ns(struct sis_softc *sc) CSR_WRITE_4(sc, SIS_RXFILT_DATA, 0); } - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = sis_mchash(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - index = h >> 3; - bit = h & 0x1F; - CSR_WRITE_4(sc, SIS_RXFILT_CTL, NS_FILTADDR_FMEM_LO + - index); - if (bit > 0xF) - bit -= 0x10; - SIS_SETBIT(sc, SIS_RXFILT_DATA, (1 << bit)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, sis_write_maddr, sc); } /* Turn the receive filter on */ @@ -765,13 +767,29 @@ sis_rxfilter_ns(struct sis_softc *sc) CSR_READ_4(sc, SIS_RXFILT_CTL); } +struct sis_hash_maddr_ctx { + struct sis_softc *sc; + uint16_t hashes[16]; +}; + +static u_int +sis_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct sis_hash_maddr_ctx *ctx = arg; + uint32_t h; + + h = sis_mchash(ctx->sc, LLADDR(sdl)); + ctx->hashes[h >> 4] |= 1 << (h & 0xf); + + return (1); +} + static void sis_rxfilter_sis(struct sis_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t filter, h, i, n; - uint16_t hashes[16]; + struct sis_hash_maddr_ctx ctx; + uint32_t filter, i, n; ifp = sc->sis_ifp; @@ -796,31 +814,21 @@ sis_rxfilter_sis(struct sis_softc *sc) if (ifp->if_flags & IFF_PROMISC) filter |= SIS_RXFILTCTL_ALLPHYS; for (i = 0; i < n; i++) - hashes[i] = ~0; + ctx.hashes[i] = ~0; } else { for (i = 0; i < n; i++) - hashes[i] = 0; - i = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = sis_mchash(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - hashes[h >> 4] |= 1 << (h & 0xf); - i++; - } - if_maddr_runlock(ifp); - if (i > n) { + ctx.hashes[i] = 0; + ctx.sc = sc; + if (if_foreach_llmaddr(ifp, sis_hash_maddr, &ctx) > n) { filter |= SIS_RXFILTCTL_ALLMULTI; for (i = 0; i < n; i++) - hashes[i] = ~0; + ctx.hashes[i] = ~0; } } for (i = 0; i < n; i++) { CSR_WRITE_4(sc, SIS_RXFILT_CTL, (4 + i) << 16); - CSR_WRITE_4(sc, SIS_RXFILT_DATA, hashes[i]); + CSR_WRITE_4(sc, SIS_RXFILT_DATA, ctx.hashes[i]); } /* Turn the receive filter on */ From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBD1415D7A0; Mon, 21 Oct 2019 18:07:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3p4Jjmz4ZYZ; Mon, 21 Oct 2019 18:07:50 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAAAB27B62; Mon, 21 Oct 2019 18:07:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7nfc065866; Mon, 21 Oct 2019 18:07:49 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7nkp065865; Mon, 21 Oct 2019 18:07:49 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7nkp065865@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353827 - head/sys/dev/sk X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/sk X-SVN-Commit-Revision: 353827 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:51 -0000 Author: glebius Date: Mon Oct 21 18:07:49 2019 New Revision: 353827 URL: https://svnweb.freebsd.org/changeset/base/353827 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/sk/if_sk.c Modified: head/sys/dev/sk/if_sk.c ============================================================================== --- head/sys/dev/sk/if_sk.c Mon Oct 21 18:07:44 2019 (r353826) +++ head/sys/dev/sk/if_sk.c Mon Oct 21 18:07:49 2019 (r353827) @@ -718,21 +718,49 @@ sk_rxfilter(sc_if) sk_rxfilter_yukon(sc_if); } +struct sk_add_maddr_genesis_ctx { + struct sk_if_softc *sc_if; + uint32_t hashes[2]; + uint32_t mode; +}; + +static u_int +sk_add_maddr_genesis(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct sk_add_maddr_genesis_ctx *ctx = arg; + int h; + + /* + * Program the first XM_RXFILT_MAX multicast groups + * into the perfect filter. + */ + if (cnt + 1 < XM_RXFILT_MAX) { + sk_setfilt(ctx->sc_if, (uint16_t *)LLADDR(sdl), cnt + 1); + ctx->mode |= XM_MODE_RX_USE_PERFECT; + return (1); + } + h = sk_xmchash((const uint8_t *)LLADDR(sdl)); + if (h < 32) + ctx->hashes[0] |= (1 << h); + else + ctx->hashes[1] |= (1 << (h - 32)); + ctx->mode |= XM_MODE_RX_USE_HASH; + + return (1); +} + static void -sk_rxfilter_genesis(sc_if) - struct sk_if_softc *sc_if; +sk_rxfilter_genesis(struct sk_if_softc *sc_if) { struct ifnet *ifp = sc_if->sk_ifp; - u_int32_t hashes[2] = { 0, 0 }, mode; - int h = 0, i; - struct ifmultiaddr *ifma; + struct sk_add_maddr_genesis_ctx ctx = { sc_if, { 0, 0 } }; + int i; u_int16_t dummy[] = { 0, 0, 0 }; - u_int16_t maddr[(ETHER_ADDR_LEN+1)/2]; SK_IF_LOCK_ASSERT(sc_if); - mode = SK_XM_READ_4(sc_if, XM_MODE); - mode &= ~(XM_MODE_RX_PROMISC | XM_MODE_RX_USE_HASH | + ctx.mode = SK_XM_READ_4(sc_if, XM_MODE); + ctx.mode &= ~(XM_MODE_RX_PROMISC | XM_MODE_RX_USE_HASH | XM_MODE_RX_USE_PERFECT); /* First, zot all the existing perfect filters. */ for (i = 1; i < XM_RXFILT_MAX; i++) @@ -741,53 +769,39 @@ sk_rxfilter_genesis(sc_if) /* Now program new ones. */ if (ifp->if_flags & IFF_ALLMULTI || ifp->if_flags & IFF_PROMISC) { if (ifp->if_flags & IFF_ALLMULTI) - mode |= XM_MODE_RX_USE_HASH; + ctx.mode |= XM_MODE_RX_USE_HASH; if (ifp->if_flags & IFF_PROMISC) - mode |= XM_MODE_RX_PROMISC; - hashes[0] = 0xFFFFFFFF; - hashes[1] = 0xFFFFFFFF; - } else { - i = 1; - if_maddr_rlock(ifp); + ctx.mode |= XM_MODE_RX_PROMISC; + ctx.hashes[0] = 0xFFFFFFFF; + ctx.hashes[1] = 0xFFFFFFFF; + } else /* XXX want to maintain reverse semantics */ - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, - ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - /* - * Program the first XM_RXFILT_MAX multicast groups - * into the perfect filter. - */ - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - maddr, ETHER_ADDR_LEN); - if (i < XM_RXFILT_MAX) { - sk_setfilt(sc_if, maddr, i); - mode |= XM_MODE_RX_USE_PERFECT; - i++; - continue; - } - h = sk_xmchash((const uint8_t *)maddr); - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - mode |= XM_MODE_RX_USE_HASH; - } - if_maddr_runlock(ifp); - } + if_foreach_llmaddr(ifp, sk_add_maddr_genesis, &ctx); - SK_XM_WRITE_4(sc_if, XM_MODE, mode); - SK_XM_WRITE_4(sc_if, XM_MAR0, hashes[0]); - SK_XM_WRITE_4(sc_if, XM_MAR2, hashes[1]); + SK_XM_WRITE_4(sc_if, XM_MODE, ctx.mode); + SK_XM_WRITE_4(sc_if, XM_MAR0, ctx.hashes[0]); + SK_XM_WRITE_4(sc_if, XM_MAR2, ctx.hashes[1]); } +static u_int +sk_hash_maddr_yukon(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *hashes = arg; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + /* Just want the 6 least significant bits. */ + crc &= 0x3f; + /* Set the corresponding bit in the hash table. */ + hashes[crc >> 5] |= 1 << (crc & 0x1f); + + return (1); +} + static void -sk_rxfilter_yukon(sc_if) - struct sk_if_softc *sc_if; +sk_rxfilter_yukon(struct sk_if_softc *sc_if) { struct ifnet *ifp; - u_int32_t crc, hashes[2] = { 0, 0 }, mode; - struct ifmultiaddr *ifma; + uint32_t hashes[2] = { 0, 0 }, mode; SK_IF_LOCK_ASSERT(sc_if); @@ -801,18 +815,7 @@ sk_rxfilter_yukon(sc_if) hashes[1] = 0xFFFFFFFF; } else { mode |= YU_RCR_UFLEN; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - /* Just want the 6 least significant bits. */ - crc &= 0x3f; - /* Set the corresponding bit in the hash table. */ - hashes[crc >> 5] |= 1 << (crc & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, sk_hash_maddr_yukon, hashes); if (hashes[0] != 0 || hashes[1] != 0) mode |= YU_RCR_MUFLEN; } From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5756F15D7F4; Mon, 21 Oct 2019 18:07:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3s5JzZz4Zgf; Mon, 21 Oct 2019 18:07:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7974727B63; Mon, 21 Oct 2019 18:07:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7rdf065914; Mon, 21 Oct 2019 18:07:53 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7rbM065913; Mon, 21 Oct 2019 18:07:53 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7rbM065913@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353828 - head/sys/dev/ste X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/ste X-SVN-Commit-Revision: 353828 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:55 -0000 Author: glebius Date: Mon Oct 21 18:07:53 2019 New Revision: 353828 URL: https://svnweb.freebsd.org/changeset/base/353828 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/ste/if_ste.c Modified: head/sys/dev/ste/if_ste.c ============================================================================== --- head/sys/dev/ste/if_ste.c Mon Oct 21 18:07:49 2019 (r353827) +++ head/sys/dev/ste/if_ste.c Mon Oct 21 18:07:53 2019 (r353828) @@ -405,14 +405,27 @@ ste_read_eeprom(struct ste_softc *sc, uint16_t *dest, return (err ? 1 : 0); } +static u_int +ste_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int h; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) & 0x3F; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} + static void ste_rxfilter(struct ste_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; uint32_t hashes[2] = { 0, 0 }; uint8_t rxcfg; - int h; STE_LOCK_ASSERT(sc); @@ -433,18 +446,7 @@ ste_rxfilter(struct ste_softc *sc) rxcfg |= STE_RXMODE_MULTIHASH; /* Now program new ones. */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) & 0x3F; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, ste_hash_maddr, hashes); chipit: CSR_WRITE_2(sc, STE_MAR0, hashes[0] & 0xFFFF); From owner-svn-src-all@freebsd.org Mon Oct 21 18:07:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 17E0B15D848; Mon, 21 Oct 2019 18:07:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl3x44X1z4Zm5; Mon, 21 Oct 2019 18:07:57 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF19327B64; Mon, 21 Oct 2019 18:07:56 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI7ues065966; Mon, 21 Oct 2019 18:07:56 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI7uts065965; Mon, 21 Oct 2019 18:07:56 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211807.x9LI7uts065965@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:07:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353829 - head/sys/dev/stge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/stge X-SVN-Commit-Revision: 353829 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:07:58 -0000 Author: glebius Date: Mon Oct 21 18:07:56 2019 New Revision: 353829 URL: https://svnweb.freebsd.org/changeset/base/353829 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/stge/if_stge.c Modified: head/sys/dev/stge/if_stge.c ============================================================================== --- head/sys/dev/stge/if_stge.c Mon Oct 21 18:07:53 2019 (r353828) +++ head/sys/dev/stge/if_stge.c Mon Oct 21 18:07:56 2019 (r353829) @@ -2507,12 +2507,24 @@ stge_set_filter(struct stge_softc *sc) CSR_WRITE_2(sc, STGE_ReceiveMode, mode); } +static u_int +stge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *mchash = arg; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + /* Just want the 6 least significant bits. */ + crc &= 0x3f; + /* Set the corresponding bit in the hash table. */ + mchash[crc >> 5] |= 1 << (crc & 0x1f); + + return (1); +} + static void stge_set_multi(struct stge_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc; uint32_t mchash[2]; uint16_t mode; int count; @@ -2542,25 +2554,8 @@ stge_set_multi(struct stge_softc *sc) * high order bits select the register, while the rest of the bits * select the bit within the register. */ - bzero(mchash, sizeof(mchash)); - - count = 0; - if_maddr_rlock(sc->sc_ifp); - CK_STAILQ_FOREACH(ifma, &sc->sc_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - - /* Just want the 6 least significant bits. */ - crc &= 0x3f; - - /* Set the corresponding bit in the hash table. */ - mchash[crc >> 5] |= 1 << (crc & 0x1f); - count++; - } - if_maddr_runlock(ifp); + count = if_foreach_llmaddr(ifp, stge_hash_maddr, mchash); mode &= ~(RM_ReceiveMulticast | RM_ReceiveAllFrames); if (count > 0) From owner-svn-src-all@freebsd.org Mon Oct 21 18:08:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D81615D8D0; Mon, 21 Oct 2019 18:08:05 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl445HJ4z4Zxx; Mon, 21 Oct 2019 18:08:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8ECF227B65; Mon, 21 Oct 2019 18:08:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI84Ek066023; Mon, 21 Oct 2019 18:08:04 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI8448066021; Mon, 21 Oct 2019 18:08:04 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211808.x9LI8448066021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:08:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353830 - head/sys/dev/ti X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/ti X-SVN-Commit-Revision: 353830 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:08:05 -0000 Author: glebius Date: Mon Oct 21 18:08:03 2019 New Revision: 353830 URL: https://svnweb.freebsd.org/changeset/base/353830 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/ti/if_ti.c head/sys/dev/ti/if_tireg.h Modified: head/sys/dev/ti/if_ti.c ============================================================================== --- head/sys/dev/ti/if_ti.c Mon Oct 21 18:07:56 2019 (r353829) +++ head/sys/dev/ti/if_ti.c Mon Oct 21 18:08:03 2019 (r353830) @@ -207,8 +207,8 @@ static uint32_t ti_eeprom_putbyte(struct ti_softc *, i static uint8_t ti_eeprom_getbyte(struct ti_softc *, int, uint8_t *); static int ti_read_eeprom(struct ti_softc *, caddr_t, int, int); -static void ti_add_mcast(struct ti_softc *, struct ether_addr *); -static void ti_del_mcast(struct ti_softc *, struct ether_addr *); +static u_int ti_add_mcast(void *, struct sockaddr_dl *, u_int); +static u_int ti_del_mcast(void *, struct sockaddr_dl *, u_int); static void ti_setmulti(struct ti_softc *); static void ti_mem_read(struct ti_softc *, uint32_t, uint32_t, void *); @@ -1878,14 +1878,15 @@ ti_init_tx_ring(struct ti_softc *sc) * but we have to support the old way too so that Tigon 1 cards will * work. */ -static void -ti_add_mcast(struct ti_softc *sc, struct ether_addr *addr) +static u_int +ti_add_mcast(void *arg, struct sockaddr_dl *sdl, u_int count) { + struct ti_softc *sc = arg; struct ti_cmd_desc cmd; uint16_t *m; uint32_t ext[2] = {0, 0}; - m = (uint16_t *)&addr->octet[0]; + m = (uint16_t *)LLADDR(sdl); switch (sc->ti_hwrev) { case TI_HWREV_TIGON: @@ -1900,18 +1901,20 @@ ti_add_mcast(struct ti_softc *sc, struct ether_addr *a break; default: device_printf(sc->ti_dev, "unknown hwrev\n"); - break; + return (0); } + return (1); } -static void -ti_del_mcast(struct ti_softc *sc, struct ether_addr *addr) +static u_int +ti_del_mcast(void *arg, struct sockaddr_dl *sdl, u_int count) { + struct ti_softc *sc = arg; struct ti_cmd_desc cmd; uint16_t *m; uint32_t ext[2] = {0, 0}; - m = (uint16_t *)&addr->octet[0]; + m = (uint16_t *)LLADDR(sdl); switch (sc->ti_hwrev) { case TI_HWREV_TIGON: @@ -1926,8 +1929,10 @@ ti_del_mcast(struct ti_softc *sc, struct ether_addr *a break; default: device_printf(sc->ti_dev, "unknown hwrev\n"); - break; + return (0); } + + return (1); } /* @@ -1948,9 +1953,7 @@ static void ti_setmulti(struct ti_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; struct ti_cmd_desc cmd; - struct ti_mc_entry *mc; uint32_t intrs; TI_LOCK_ASSERT(sc); @@ -1969,30 +1972,10 @@ ti_setmulti(struct ti_softc *sc) CSR_WRITE_4(sc, TI_MB_HOSTINTR, 1); /* First, zot all the existing filters. */ - while (SLIST_FIRST(&sc->ti_mc_listhead) != NULL) { - mc = SLIST_FIRST(&sc->ti_mc_listhead); - ti_del_mcast(sc, &mc->mc_addr); - SLIST_REMOVE_HEAD(&sc->ti_mc_listhead, mc_entries); - free(mc, M_DEVBUF); - } + if_foreach_llmaddr(ifp, ti_del_mcast, sc); /* Now program new ones. */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - mc = malloc(sizeof(struct ti_mc_entry), M_DEVBUF, M_NOWAIT); - if (mc == NULL) { - device_printf(sc->ti_dev, - "no memory for mcast filter entry\n"); - continue; - } - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - (char *)&mc->mc_addr, ETHER_ADDR_LEN); - SLIST_INSERT_HEAD(&sc->ti_mc_listhead, mc, mc_entries); - ti_add_mcast(sc, &mc->mc_addr); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, ti_add_mcast, sc); /* Re-enable interrupts. */ CSR_WRITE_4(sc, TI_MB_HOSTINTR, intrs); Modified: head/sys/dev/ti/if_tireg.h ============================================================================== --- head/sys/dev/ti/if_tireg.h Mon Oct 21 18:07:56 2019 (r353829) +++ head/sys/dev/ti/if_tireg.h Mon Oct 21 18:08:03 2019 (r353830) @@ -1010,11 +1010,6 @@ struct ti_type { #define TI_TIMEOUT 1000 #define TI_TXCONS_UNSET 0xFFFF /* impossible value */ -struct ti_mc_entry { - struct ether_addr mc_addr; - SLIST_ENTRY(ti_mc_entry) mc_entries; -}; - typedef enum { TI_FLAG_NONE = 0x00, TI_FLAG_DEBUGING = 0x01, @@ -1048,7 +1043,6 @@ struct ti_softc { int ti_std; /* current std ring head */ int ti_mini; /* current mini ring head */ int ti_jumbo; /* current jumo ring head */ - SLIST_HEAD(__ti_mchead, ti_mc_entry) ti_mc_listhead; uint32_t ti_stat_ticks; uint32_t ti_rx_coal_ticks; uint32_t ti_tx_coal_ticks; From owner-svn-src-all@freebsd.org Mon Oct 21 18:08:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE86A15D95B; Mon, 21 Oct 2019 18:08:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl4F3hRvz4bBk; Mon, 21 Oct 2019 18:08:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6221427B66; Mon, 21 Oct 2019 18:08:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI8DcT066073; Mon, 21 Oct 2019 18:08:13 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI8Dsm066072; Mon, 21 Oct 2019 18:08:13 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211808.x9LI8Dsm066072@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:08:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353831 - head/sys/dev/vge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/vge X-SVN-Commit-Revision: 353831 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:08:13 -0000 Author: glebius Date: Mon Oct 21 18:08:12 2019 New Revision: 353831 URL: https://svnweb.freebsd.org/changeset/base/353831 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/vge/if_vge.c Modified: head/sys/dev/vge/if_vge.c ============================================================================== --- head/sys/dev/vge/if_vge.c Mon Oct 21 18:08:03 2019 (r353830) +++ head/sys/dev/vge/if_vge.c Mon Oct 21 18:08:12 2019 (r353831) @@ -529,6 +529,34 @@ vge_setvlan(struct vge_softc *sc) CSR_WRITE_1(sc, VGE_RXCFG, cfg); } +static u_int +vge_set_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct vge_softc *sc = arg; + + if (sc->vge_camidx == VGE_CAM_MAXADDRS) + return (0); + + (void )vge_cam_set(sc, LLADDR(sdl)); + + return (1); +} + +static u_int +vge_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t h, *hashes = arg; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} + + /* * Program the multicast filter. We use the 64-entry CAM filter * for perfect filtering. If there's more than 64 multicast addresses, @@ -538,10 +566,8 @@ static void vge_rxfilter(struct vge_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t h, hashes[2]; + uint32_t hashes[2]; uint8_t rxcfg; - int error = 0; VGE_LOCK_ASSERT(sc); @@ -572,33 +598,15 @@ vge_rxfilter(struct vge_softc *sc) } vge_cam_clear(sc); + /* Now program new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - error = vge_cam_set(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - if (error) - break; - } + if_foreach_llmaddr(ifp, vge_set_maddr, sc); /* If there were too many addresses, use the hash filter. */ - if (error) { + if (sc->vge_camidx == VGE_CAM_MAXADDRS) { vge_cam_clear(sc); - - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } + if_foreach_llmaddr(ifp, vge_hash_maddr, hashes); } - if_maddr_runlock(ifp); done: if (hashes[0] != 0 || hashes[1] != 0) From owner-svn-src-all@freebsd.org Mon Oct 21 18:08:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 220AF15D98F; Mon, 21 Oct 2019 18:08:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl4J6rrqz4bCq; Mon, 21 Oct 2019 18:08:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB55927B67; Mon, 21 Oct 2019 18:08:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI8G7K066123; Mon, 21 Oct 2019 18:08:16 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI8G9u066122; Mon, 21 Oct 2019 18:08:16 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211808.x9LI8G9u066122@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:08:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353832 - head/sys/dev/vr X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/vr X-SVN-Commit-Revision: 353832 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:08:17 -0000 Author: glebius Date: Mon Oct 21 18:08:16 2019 New Revision: 353832 URL: https://svnweb.freebsd.org/changeset/base/353832 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/vr/if_vr.c Modified: head/sys/dev/vr/if_vr.c ============================================================================== --- head/sys/dev/vr/if_vr.c Mon Oct 21 18:08:12 2019 (r353831) +++ head/sys/dev/vr/if_vr.c Mon Oct 21 18:08:16 2019 (r353832) @@ -432,6 +432,44 @@ vr_cam_data(struct vr_softc *sc, int type, int idx, ui return (i == VR_TIMEOUT ? ETIMEDOUT : 0); } +struct vr_hash_maddr_cam_ctx { + struct vr_softc *sc; + uint32_t mask; + int error; +}; + +static u_int +vr_hash_maddr_cam(void *arg, struct sockaddr_dl *sdl, u_int mcnt) +{ + struct vr_hash_maddr_cam_ctx *ctx = arg; + + if (ctx->error != 0) + return (0); + ctx->error = vr_cam_data(ctx->sc, VR_MCAST_CAM, mcnt, LLADDR(sdl)); + if (ctx->error != 0) { + ctx->mask = 0; + return (0); + } + ctx->mask |= 1 << mcnt; + + return (1); +} + +static u_int +vr_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int h; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} + /* * Program the 64-bit multicast hash filter. */ @@ -439,12 +477,9 @@ static void vr_set_filter(struct vr_softc *sc) { struct ifnet *ifp; - int h; uint32_t hashes[2] = { 0, 0 }; - struct ifmultiaddr *ifma; uint8_t rxfilt; int error, mcnt; - uint32_t cam_mask; VR_LOCK_ASSERT(sc); @@ -466,27 +501,18 @@ vr_set_filter(struct vr_softc *sc) /* Now program new ones. */ error = 0; - mcnt = 0; - if_maddr_rlock(ifp); if ((sc->vr_quirks & VR_Q_CAM) != 0) { + struct vr_hash_maddr_cam_ctx ctx; + /* * For hardwares that have CAM capability, use * 32 entries multicast perfect filter. */ - cam_mask = 0; - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - error = vr_cam_data(sc, VR_MCAST_CAM, mcnt, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - if (error != 0) { - cam_mask = 0; - break; - } - cam_mask |= 1 << mcnt; - mcnt++; - } - vr_cam_mask(sc, VR_MCAST_CAM, cam_mask); + ctx.sc = sc; + ctx.mask = 0; + ctx.error = 0; + mcnt = if_foreach_llmaddr(ifp, vr_hash_maddr_cam, &ctx); + vr_cam_mask(sc, VR_MCAST_CAM, ctx.mask); } if ((sc->vr_quirks & VR_Q_CAM) == 0 || error != 0) { @@ -495,20 +521,8 @@ vr_set_filter(struct vr_softc *sc) * setting multicast CAM filter failed, use hash * table based filtering. */ - mcnt = 0; - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - mcnt++; - } + mcnt = if_foreach_llmaddr(ifp, vr_hash_maddr, hashes); } - if_maddr_runlock(ifp); if (mcnt > 0) rxfilt |= VR_RXCFG_RX_MULTI; From owner-svn-src-all@freebsd.org Mon Oct 21 18:08:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B13915D9E4; Mon, 21 Oct 2019 18:08:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl4P2Hvtz4bM0; Mon, 21 Oct 2019 18:08:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2EA2827B68; Mon, 21 Oct 2019 18:08:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI8Lxq066170; Mon, 21 Oct 2019 18:08:21 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI8LxG066169; Mon, 21 Oct 2019 18:08:21 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211808.x9LI8LxG066169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:08:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353833 - head/sys/dev/vte X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/vte X-SVN-Commit-Revision: 353833 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:08:21 -0000 Author: glebius Date: Mon Oct 21 18:08:20 2019 New Revision: 353833 URL: https://svnweb.freebsd.org/changeset/base/353833 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/vte/if_vte.c Modified: head/sys/dev/vte/if_vte.c ============================================================================== --- head/sys/dev/vte/if_vte.c Mon Oct 21 18:08:16 2019 (r353832) +++ head/sys/dev/vte/if_vte.c Mon Oct 21 18:08:20 2019 (r353833) @@ -1955,27 +1955,57 @@ vte_init_rx_ring(struct vte_softc *sc) return (0); } +struct vte_maddr_ctx { + uint16_t rxfilt_perf[VTE_RXFILT_PERFECT_CNT][3]; + uint16_t mchash[4]; + u_int nperf; +}; + +static u_int +vte_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct vte_maddr_ctx *ctx = arg; + uint8_t *eaddr; + uint32_t crc; + + /* + * Program the first 3 multicast groups into the perfect filter. + * For all others, use the hash table. + */ + if (ctx->nperf < VTE_RXFILT_PERFECT_CNT) { + eaddr = LLADDR(sdl); + ctx->rxfilt_perf[ctx->nperf][0] = eaddr[1] << 8 | eaddr[0]; + ctx->rxfilt_perf[ctx->nperf][1] = eaddr[3] << 8 | eaddr[2]; + ctx->rxfilt_perf[ctx->nperf][2] = eaddr[5] << 8 | eaddr[4]; + ctx->nperf++; + + return (1); + } + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + ctx->mchash[crc >> 30] |= 1 << ((crc >> 26) & 0x0F); + + return (1); +} + static void vte_rxfilter(struct vte_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint8_t *eaddr; - uint32_t crc; - uint16_t rxfilt_perf[VTE_RXFILT_PERFECT_CNT][3]; - uint16_t mchash[4], mcr; - int i, nperf; + struct vte_maddr_ctx ctx; + uint16_t mcr; + int i; VTE_LOCK_ASSERT(sc); ifp = sc->vte_ifp; - bzero(mchash, sizeof(mchash)); + bzero(ctx.mchash, sizeof(ctx.mchash)); for (i = 0; i < VTE_RXFILT_PERFECT_CNT; i++) { - rxfilt_perf[i][0] = 0xFFFF; - rxfilt_perf[i][1] = 0xFFFF; - rxfilt_perf[i][2] = 0xFFFF; + ctx.rxfilt_perf[i][0] = 0xFFFF; + ctx.rxfilt_perf[i][1] = 0xFFFF; + ctx.rxfilt_perf[i][2] = 0xFFFF; } + ctx.nperf = 0; mcr = CSR_READ_2(sc, VTE_MCR0); mcr &= ~(MCR0_PROMISC | MCR0_MULTICAST); @@ -1987,54 +2017,32 @@ vte_rxfilter(struct vte_softc *sc) mcr |= MCR0_PROMISC; if ((ifp->if_flags & IFF_ALLMULTI) != 0) mcr |= MCR0_MULTICAST; - mchash[0] = 0xFFFF; - mchash[1] = 0xFFFF; - mchash[2] = 0xFFFF; - mchash[3] = 0xFFFF; + ctx.mchash[0] = 0xFFFF; + ctx.mchash[1] = 0xFFFF; + ctx.mchash[2] = 0xFFFF; + ctx.mchash[3] = 0xFFFF; goto chipit; } - nperf = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->vte_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - /* - * Program the first 3 multicast groups into - * the perfect filter. For all others, use the - * hash table. - */ - if (nperf < VTE_RXFILT_PERFECT_CNT) { - eaddr = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - rxfilt_perf[nperf][0] = eaddr[1] << 8 | eaddr[0]; - rxfilt_perf[nperf][1] = eaddr[3] << 8 | eaddr[2]; - rxfilt_perf[nperf][2] = eaddr[5] << 8 | eaddr[4]; - nperf++; - continue; - } - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - mchash[crc >> 30] |= 1 << ((crc >> 26) & 0x0F); - } - if_maddr_runlock(ifp); - if (mchash[0] != 0 || mchash[1] != 0 || mchash[2] != 0 || - mchash[3] != 0) + if_foreach_llmaddr(ifp, vte_hash_maddr, &ctx); + if (ctx.mchash[0] != 0 || ctx.mchash[1] != 0 || + ctx.mchash[2] != 0 || ctx.mchash[3] != 0) mcr |= MCR0_MULTICAST; chipit: /* Program multicast hash table. */ - CSR_WRITE_2(sc, VTE_MAR0, mchash[0]); - CSR_WRITE_2(sc, VTE_MAR1, mchash[1]); - CSR_WRITE_2(sc, VTE_MAR2, mchash[2]); - CSR_WRITE_2(sc, VTE_MAR3, mchash[3]); + CSR_WRITE_2(sc, VTE_MAR0, ctx.mchash[0]); + CSR_WRITE_2(sc, VTE_MAR1, ctx.mchash[1]); + CSR_WRITE_2(sc, VTE_MAR2, ctx.mchash[2]); + CSR_WRITE_2(sc, VTE_MAR3, ctx.mchash[3]); /* Program perfect filter table. */ for (i = 0; i < VTE_RXFILT_PERFECT_CNT; i++) { CSR_WRITE_2(sc, VTE_RXFILTER_PEEFECT_BASE + 8 * i + 0, - rxfilt_perf[i][0]); + ctx.rxfilt_perf[i][0]); CSR_WRITE_2(sc, VTE_RXFILTER_PEEFECT_BASE + 8 * i + 2, - rxfilt_perf[i][1]); + ctx.rxfilt_perf[i][1]); CSR_WRITE_2(sc, VTE_RXFILTER_PEEFECT_BASE + 8 * i + 4, - rxfilt_perf[i][2]); + ctx.rxfilt_perf[i][2]); } CSR_WRITE_2(sc, VTE_MCR0, mcr); CSR_READ_2(sc, VTE_MCR0); From owner-svn-src-all@freebsd.org Mon Oct 21 18:08:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DABCD15DA2E; Mon, 21 Oct 2019 18:08:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl4T4ktKz4bSF; Mon, 21 Oct 2019 18:08:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8528027B69; Mon, 21 Oct 2019 18:08:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LI8Psx066230; Mon, 21 Oct 2019 18:08:25 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI8Pa8066229; Mon, 21 Oct 2019 18:08:25 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211808.x9LI8Pa8066229@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353834 - head/sys/dev/xl X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/xl X-SVN-Commit-Revision: 353834 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:08:26 -0000 Author: glebius Date: Mon Oct 21 18:08:25 2019 New Revision: 353834 URL: https://svnweb.freebsd.org/changeset/base/353834 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/xl/if_xl.c Modified: head/sys/dev/xl/if_xl.c ============================================================================== --- head/sys/dev/xl/if_xl.c Mon Oct 21 18:08:20 2019 (r353833) +++ head/sys/dev/xl/if_xl.c Mon Oct 21 18:08:25 2019 (r353834) @@ -606,11 +606,20 @@ xl_rxfilter(struct xl_softc *sc) * NICs older than the 3c905B have only one multicast option, which * is to enable reception of all multicast frames. */ +static u_int +xl_check_maddr_90x(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint8_t *rxfilt = arg; + + *rxfilt |= XL_RXFILTER_ALLMULTI; + + return (1); +} + static void xl_rxfilter_90x(struct xl_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; u_int8_t rxfilt; XL_LOCK_ASSERT(sc); @@ -634,16 +643,8 @@ xl_rxfilter_90x(struct xl_softc *sc) rxfilt |= XL_RXFILTER_ALLFRAMES; if (ifp->if_flags & IFF_ALLMULTI) rxfilt |= XL_RXFILTER_ALLMULTI; - } else { - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - rxfilt |= XL_RXFILTER_ALLMULTI; - break; - } - if_maddr_runlock(ifp); - } + } else + if_foreach_llmaddr(sc->xl_ifp, xl_check_maddr_90x, &rxfilt); CSR_WRITE_2(sc, XL_COMMAND, rxfilt | XL_CMD_RX_SET_FILT); XL_SEL_WIN(7); @@ -651,14 +652,34 @@ xl_rxfilter_90x(struct xl_softc *sc) /* * 3c905B adapters have a hash filter that we can program. + * Note: the 3c905B currently only supports a 64-bit + * hash table, which means we really only need 6 bits, + * but the manual indicates that future chip revisions + * will have a 256-bit hash table, hence the routine + * is set up to calculate 8 bits of position info in + * case we need it some day. + * Note II, The Sequel: _CURRENT_ versions of the + * 3c905B have a 256 bit hash table. This means we have + * to use all 8 bits regardless. On older cards, the + * upper 2 bits will be ignored. Grrrr.... */ +static u_int +xl_check_maddr_90xB(void *arg, struct sockaddr_dl *sdl, u_int count) +{ + struct xl_softc *sc = arg; + uint16_t h; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) & 0xFF; + CSR_WRITE_2(sc, XL_COMMAND, h | XL_CMD_RX_SET_HASH | XL_HASH_SET); + + return (1); +} + static void xl_rxfilter_90xB(struct xl_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - int i, mcnt; - u_int16_t h; + int i; u_int8_t rxfilt; XL_LOCK_ASSERT(sc); @@ -689,31 +710,7 @@ xl_rxfilter_90xB(struct xl_softc *sc) CSR_WRITE_2(sc, XL_COMMAND, XL_CMD_RX_SET_HASH | i); /* Now program new ones. */ - mcnt = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - /* - * Note: the 3c905B currently only supports a 64-bit - * hash table, which means we really only need 6 bits, - * but the manual indicates that future chip revisions - * will have a 256-bit hash table, hence the routine - * is set up to calculate 8 bits of position info in - * case we need it some day. - * Note II, The Sequel: _CURRENT_ versions of the - * 3c905B have a 256 bit hash table. This means we have - * to use all 8 bits regardless. On older cards, the - * upper 2 bits will be ignored. Grrrr.... - */ - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) & 0xFF; - CSR_WRITE_2(sc, XL_COMMAND, - h | XL_CMD_RX_SET_HASH | XL_HASH_SET); - mcnt++; - } - if_maddr_runlock(ifp); - if (mcnt > 0) + if (if_foreach_llmaddr(sc->xl_ifp, xl_check_maddr_90xB, sc) > 0) rxfilt |= XL_RXFILTER_MULTIHASH; } From owner-svn-src-all@freebsd.org Mon Oct 21 18:09:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7322715DC39; Mon, 21 Oct 2019 18:09:00 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl5838XZz4bq2; Mon, 21 Oct 2019 18:09: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 29A8627B6A; Mon, 21 Oct 2019 18:09: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 x9LI90f0066325; Mon, 21 Oct 2019 18:09:00 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LI8vsx066307; Mon, 21 Oct 2019 18:08:57 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910211808.x9LI8vsx066307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 21 Oct 2019 18:08:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353835 - in vendor/tcsh/dist: . tests X-SVN-Group: vendor X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in vendor/tcsh/dist: . tests X-SVN-Commit-Revision: 353835 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:09:00 -0000 Author: brooks Date: Mon Oct 21 18:08:57 2019 New Revision: 353835 URL: https://svnweb.freebsd.org/changeset/base/353835 Log: Update vendor/tcsh to git 83c5be0: Upstream changes: 5. PR/113: Sobomax: avoid infinite loops for -c commands when stdout is not a tty. 4. Avoid infinite loops during history loads when merging, print a better error for errors during history load. 3. PR/88: Preserve empty arguments in :q 2. PR/94: Small apple issues (SAVESIGVEC, HOSTTYPE) 1. PR/81: Fix range matching issue where we were comparing with the range character instead of the start of range. [l-z]* would match foo Reported by: sobomax Modified: vendor/tcsh/dist/Fixes vendor/tcsh/dist/README.md vendor/tcsh/dist/glob.c vendor/tcsh/dist/host.defs vendor/tcsh/dist/sh.c vendor/tcsh/dist/sh.err.c vendor/tcsh/dist/sh.h vendor/tcsh/dist/sh.hist.c vendor/tcsh/dist/sh.lex.c vendor/tcsh/dist/tc.const.c vendor/tcsh/dist/tc.sig.h vendor/tcsh/dist/tcsh.man.new vendor/tcsh/dist/tests/lexical.at vendor/tcsh/dist/tests/subst.at vendor/tcsh/dist/tests/syntax.at vendor/tcsh/dist/tests/variables.at Modified: vendor/tcsh/dist/Fixes ============================================================================== --- vendor/tcsh/dist/Fixes Mon Oct 21 18:08:25 2019 (r353834) +++ vendor/tcsh/dist/Fixes Mon Oct 21 18:08:57 2019 (r353835) @@ -1,3 +1,11 @@ + 5. PR/113: Sobomax: avoid infinite loops for -c commands when stdout is + not a tty. + 4. Avoid infinite loops during history loads when merging, print a better + error for errors during history load. + 3. PR/88: Preserve empty arguments in :q + 2. PR/94: Small apple issues (SAVESIGVEC, HOSTTYPE) + 1. PR/81: Fix range matching issue where we were comparing with the + range character instead of the start of range. [l-z]* would match foo 12. V6.21.00 - 20190508 11. Abort history loading on words and lines too long https://bugzilla.redhat.com/show_bug.cgi?id=1598502 Modified: vendor/tcsh/dist/README.md ============================================================================== --- vendor/tcsh/dist/README.md Mon Oct 21 18:08:25 2019 (r353834) +++ vendor/tcsh/dist/README.md Mon Oct 21 18:08:57 2019 (r353835) @@ -1,4 +1,4 @@ -# Tcsh +# TCSH *C shell with file name completion and command line editing* @@ -14,10 +14,10 @@ PLEASE file any bug reports, fixes, and code for new f > https://bugs.astron.com/ Comments, questions, etc. (even flames) are welcome via email to -the Tcsh Bugs mailing list: +the tcsh mailing list: -> tcsh-bugs@astron.com -> https://mailman.astron.com/ +> tcsh@astron.com +> https://mailman.astron.com/mailman/listinfo/tcsh [![Build Status][status]][travis] Modified: vendor/tcsh/dist/glob.c ============================================================================== --- vendor/tcsh/dist/glob.c Mon Oct 21 18:08:25 2019 (r353834) +++ vendor/tcsh/dist/glob.c Mon Oct 21 18:08:57 2019 (r353835) @@ -100,7 +100,7 @@ static int Lstat (const char *, struct stat *); static int Stat (const char *, struct stat *sb); static Char *Strchr (Char *, int); #ifdef DEBUG -static void qprintf (const Char *); +static void qprintf (const char *, const Char *); #endif #define DOLLAR '$' @@ -254,19 +254,20 @@ Strchr(Char *str, int ch) #ifdef DEBUG static void -qprintf(const Char *s) +qprintf(const char *pre, const Char *s) { const Char *p; - + + xprintf("%s", pre); for (p = s; *p; p++) - printf("%c", *p & 0xff); - printf("\n"); + xprintf("%c", *p & 0xff); + xprintf("\n%s", pre); for (p = s; *p; p++) - printf("%c", *p & M_PROTECT ? '"' : ' '); - printf("\n"); + xprintf("%c", *p & M_PROTECT ? '"' : ' '); + xprintf("\n%s", pre); for (p = s; *p; p++) - printf("%c", *p & M_META ? '_' : ' '); - printf("\n"); + xprintf("%c", *p & M_META ? '_' : ' '); + xprintf("\n"); } #endif /* DEBUG */ @@ -410,7 +411,7 @@ glob(const char *pattern, int flags, int (*errfunc) (c } *bufnext = EOS; #ifdef DEBUG - qprintf(patbuf); + qprintf("patbuf=", patbuf); #endif if ((err = glob1(patbuf, pglob, no_match)) != 0) { @@ -707,7 +708,7 @@ match(const char *name, const Char *pat, const Char *p while (pat < patend || *name) { size_t lwk, pwk; - __Char wc, wk; + __Char wc, wk, wc1; c = *pat; /* Only for M_MASK bits */ if (*name == EOS) @@ -742,18 +743,20 @@ match(const char *name, const Char *pat, const Char *p pat += pwk; pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); } + wc1 = wc; while ((*pat & M_MASK) != M_END) { if ((*pat & M_MASK) == M_RNG) { __Char wc2; pat += pwk; pwk = One_Char_mbtowc(&wc2, pat, MB_LEN_MAX); - if (globcharcoll(wc, wk, 0) <= 0 && + if (globcharcoll(wc1, wk, 0) <= 0 && globcharcoll(wk, wc2, 0) <= 0) ok = 1; } else if (wc == wk) ok = 1; pat += pwk; + wc1 = wc; pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); } pat += pwk; Modified: vendor/tcsh/dist/host.defs ============================================================================== --- vendor/tcsh/dist/host.defs Mon Oct 21 18:08:25 2019 (r353834) +++ vendor/tcsh/dist/host.defs Mon Oct 21 18:08:57 2019 (r353835) @@ -854,9 +854,9 @@ enddef : newdef : defined(APPLE) && defined(MACH) comment : OS X vendor : : "apple" -hosttype: defined(i386) : "intel-pc" +hosttype: defined(i386) : "intel-mac" hosttype: defined(ppc) : "powermac" -hosttype: defined(M_amd64) : "amd" +hosttype: defined(M_amd64) : "intel-mac" ostype : : "darwin" machtype: defined(i386) : "i386" machtype: defined(M_amd64) : "x86_64" Modified: vendor/tcsh/dist/sh.c ============================================================================== --- vendor/tcsh/dist/sh.c Mon Oct 21 18:08:25 2019 (r353834) +++ vendor/tcsh/dist/sh.c Mon Oct 21 18:08:57 2019 (r353835) @@ -237,6 +237,7 @@ main(int argc, char **argv) int nofile = 0; volatile int nverbose = 0; volatile int rdirs = 0; + volatile int exitcode = 0; int quitit = 0; Char *cp; #ifdef AUTOLOGOUT @@ -1390,6 +1391,12 @@ main(int argc, char **argv) if (targinp) { + /* If this -c command caused an error before, skip processing */ + if (reenter && arginp) { + exitcode = 1; + goto done; + } + arginp = SAVE(targinp); /* * we put the command into a variable @@ -1422,6 +1429,7 @@ main(int argc, char **argv) */ process(setintr); +done: /* * Mop-up. */ @@ -1443,7 +1451,7 @@ main(int argc, char **argv) } record(); exitstat(); - return (0); + return exitcode; } void Modified: vendor/tcsh/dist/sh.err.c ============================================================================== --- vendor/tcsh/dist/sh.err.c Mon Oct 21 18:08:25 2019 (r353834) +++ vendor/tcsh/dist/sh.err.c Mon Oct 21 18:08:57 2019 (r353835) @@ -43,6 +43,7 @@ #endif char *seterr = NULL; /* Holds last error if there was one */ +extern int enterhist; #define ERR_FLAGS 0xf0000000 #define ERR_NAME 0x10000000 @@ -630,6 +631,8 @@ stderror(unsigned int id, ...) */ flush();/*FIXRESET*/ haderr = 1; /* Now to diagnostic output */ + if (enterhist) + xprintf("Can't load history: ");/*FIXRESET*/ if (flags & ERR_NAME) xprintf("%s: ", bname);/*FIXRESET*/ if ((flags & ERR_OLD)) { Modified: vendor/tcsh/dist/sh.h ============================================================================== --- vendor/tcsh/dist/sh.h Mon Oct 21 18:08:25 2019 (r353834) +++ vendor/tcsh/dist/sh.h Mon Oct 21 18:08:57 2019 (r353835) @@ -682,13 +682,27 @@ EXTERN int OLDSTD IZERO; /* Old standard input (def */ #ifdef SIGSETJMP - typedef struct { sigjmp_buf j; } jmp_buf_t; -# define setexit() sigsetjmp(reslab.j, 1) -# define _reset() siglongjmp(reslab.j, 1) + typedef struct { const char *f; size_t l; sigjmp_buf j; } jmp_buf_t; +# define tcsh_setjmp() sigsetjmp(reslab.j, 1) +# define tcsh_longjmp() siglongjmp(reslab.j, 1) +# define setexit() (reslab.f = __func__, \ + reslab.l = __LINE__, \ + sigsetjmp(reslab.j, 1)) +# define _reset() siglongjmp(reslab.j, 1) #else - typedef struct { jmp_buf j; } jmp_buf_t; -# define setexit() setjmp(reslab.j) -# define _reset() longjmp(reslab.j, 1) + typedef struct { const char *f; size_t l; jmp_buf j; } jmp_buf_t; +# define tcsh_setjmp() setjmp(reslab.j) +# define tcsh_longjmp() longjmp(reslab.j, 1) +#endif + +#define setexit() (reslab.f = __func__, \ + reslab.l = __LINE__, \ + tcsh_setjmp()) +#ifdef SETJMP_DEBUG +# define _reset() xprintf("reset %s %zu\n", reslab.f, reslab.l), \ + flush(), tcsh_longjmp() +#else +# define _reset() tcsh_longjmp() #endif #define getexit(a) (void) ((a) = reslab) Modified: vendor/tcsh/dist/sh.hist.c ============================================================================== --- vendor/tcsh/dist/sh.hist.c Mon Oct 21 18:08:25 2019 (r353834) +++ vendor/tcsh/dist/sh.hist.c Mon Oct 21 18:08:57 2019 (r353835) @@ -1281,6 +1281,7 @@ rechist(Char *fname, int ref) } if (merge) { + jmp_buf_t osetexit; if (lock) { #ifndef WINNT_NATIVE char *lockpath = strsave(short2str(fname)); @@ -1290,7 +1291,10 @@ rechist(Char *fname, int ref) cleanup_push(lockpath, dotlock_cleanup); #endif } - loadhist(fname, 1); + getexit(osetexit); + if (setexit()) + loadhist(fname, 1); + resexit(osetexit); } } rs = randsuf(); Modified: vendor/tcsh/dist/sh.lex.c ============================================================================== --- vendor/tcsh/dist/sh.lex.c Mon Oct 21 18:08:25 2019 (r353834) +++ vendor/tcsh/dist/sh.lex.c Mon Oct 21 18:08:57 2019 (r353835) @@ -1020,8 +1020,10 @@ domod(Char *cp, Char type) switch (type) { - case 'x': case 'q': + case 'x': + if (*cp == '\0') + return Strsave(STRQNULL); wp = Strsave(cp); for (xp = wp; (c = *xp) != 0; xp++) if ((c != ' ' && c != '\t') || type == 'q') Modified: vendor/tcsh/dist/tc.const.c ============================================================================== --- vendor/tcsh/dist/tc.const.c Mon Oct 21 18:08:25 2019 (r353834) +++ vendor/tcsh/dist/tc.const.c Mon Oct 21 18:08:57 2019 (r353835) @@ -253,10 +253,10 @@ Char STRnormal[] = { 'n', 'o', 'r', 'm', 'a', 'l', '\0 Char STRsldtlogout[] = { '/', '.', 'l', 'o', 'g', 'o', 'u', 't', '\0' }; Char STRjobs[] = { 'j', 'o', 'b', 's', '\0' }; Char STRdefprompt[] = { '%', '#', ' ', '\0' }; -Char STRmquestion[] = { '%', 'R', '?' | QUOTE, ' ', '\0' }; +Char STRmquestion[] = { '%', 'R', (Char)('?' | QUOTE), ' ', '\0' }; Char STRKCORRECT[] = { 'C', 'O', 'R', 'R', 'E', 'C', 'T', '>', '%', 'R', ' ', '(', 'y', '|', 'n', '|', 'e', '|', 'a', ')', - '?' | QUOTE, ' ', '\0' }; + (Char)('?' | QUOTE), ' ', '\0' }; Char STRunalias[] = { 'u', 'n', 'a', 'l', 'i', 'a', 's', '\0' }; Char STRalias[] = { 'a', 'l', 'i', 'a', 's', '\0' }; Char STRprecmd[] = { 'p', 'r', 'e', 'c', 'm', 'd', '\0' }; @@ -380,7 +380,7 @@ Char STRlistmaxrows[] = { 'l', 'i', 's', 't', 'm', 'a' Char STRlistmax[] = { 'l', 'i', 's', 't', 'm', 'a', 'x', '\0' }; Char STRlistlinks[] = { 'l', 'i', 's', 't', 'l', 'i', 'n', 'k', 's', '\0' }; Char STRDING[] = { 'D', 'I', 'N', 'G', '!', '\0' }; -Char STRQNULL[] = { '\0' | QUOTE, '\0' }; +Char STRQNULL[] = { (Char)('\0' | QUOTE), '\0' }; Char STRcorrect[] = { 'c', 'o', 'r', 'r', 'e', 'c', 't', '\0' }; Char STRcmd[] = { 'c', 'm', 'd', '\0' }; Char STRall[] = { 'a', 'l', 'l', '\0' }; Modified: vendor/tcsh/dist/tc.sig.h ============================================================================== --- vendor/tcsh/dist/tc.sig.h Mon Oct 21 18:08:25 2019 (r353834) +++ vendor/tcsh/dist/tc.sig.h Mon Oct 21 18:08:57 2019 (r353835) @@ -42,7 +42,7 @@ # include #endif /* SYSVREL > 0 */ -#if defined(__APPLE__) || defined(SUNOS4) || defined(DGUX) || defined(hp800) || (SYSVREL > 3 && defined(VFORK)) +#if defined(SUNOS4) || defined(DGUX) || defined(hp800) || (SYSVREL > 3 && defined(VFORK)) # define SAVESIGVEC #endif /* SUNOS4 || DGUX || hp800 || SVR4 & VFORK */ Modified: vendor/tcsh/dist/tcsh.man.new ============================================================================== --- vendor/tcsh/dist/tcsh.man.new Mon Oct 21 18:08:25 2019 (r353834) +++ vendor/tcsh/dist/tcsh.man.new Mon Oct 21 18:08:57 2019 (r353835) @@ -391,7 +391,7 @@ variants; see .Sx FILES . .Ss Editing We first describe -.Sx The command-line editor" +.Sx The command-line editor The .Sx Completion and listing and @@ -402,7 +402,7 @@ Finally, .Sx Editor commands lists and describes the editor commands specific to the shell and their default bindings. -.It Sx The command-line editor (+) +.Ss The command-line editor (+) Command-line input can be edited using key sequences much like those used in .Xr emacs 1 or @@ -684,9 +684,8 @@ If the .Va complete shell variable is set to .Sq enhance , -completion -1) ignores case and 2) considers periods, hyphens and underscores -.Sq ( . , +completion 1) ignores case and 2) considers periods, hyphens and underscores +.Sq ( \&. , .Sq \&- and .Sq _ ) @@ -727,7 +726,7 @@ hyphens or underscores. If the .Va complete shell variable is set to -.Sq enhance , +.Sq Enhance , completion ignores case and differences between a hyphen and an underscore word separator only when the user types a lowercase character or a hyphen. @@ -1093,17 +1092,20 @@ must be bound to a single character for this to work) or one of the following special characters may be typed: .Pp -.Sq ^W +.Bl -tag -width indent -compact +.It ^W Appends the rest of the word under the cursor to the search pattern. -delete (or any character bound to +.It delete +(or any character bound to .Ic backward-delete-char ) Undoes the effect of the last character typed and deletes a character from the search pattern if appropriate. -.Sq ^G +.It ^G If the previous search was successful, aborts the entire search. If not, goes back to the last successful search. -escape +.It escape Ends the search, leaving the current line in the input buffer. +.El .Pp Any other character not bound to .Ic self-insert-command @@ -1664,6 +1666,7 @@ The words of an input line are numbered from 0, the first (usually command) word being 0, the second word (first argument) being 1, etc. The basic word designators are: +.Pp .Bl -tag -width XXXX -offset indent -compact .It Ar 0 The first (command) word @@ -2021,7 +2024,7 @@ cause an error. .Pp Some aliases are referred to by the shell; see .Va Special aliases -.Sx Variable substitution +.Ss Variable substitution The shell maintains a list of variables, each of which has as value a list of zero or more words. The values of shell variables can be displayed and changed with the @@ -2219,7 +2222,7 @@ The following substitutions can not be modified with .Sq \&: modifiers. .Pp -.Bl -tag -width XXXXXXXX -offset indent -compact +.Bl -tag -width XXXXXXXXXX -offset indent -compact .It Ar $?name .It Ar ${?name} Substitutes the string @@ -2238,27 +2241,21 @@ if it is not. Always .Sq 0 in interactive shells. -.It Ar -$#name -${#name} +.It Ar $#name +.It Ar ${#name} Substitutes the number of words in .Va name -.It Ar -$# +.It Ar $# Equivalent to .Sq $#argv (+) -.It Ar -$% -.Va name +.It Ar $%name .It Ar ${%name} Substitutes the number of characters in .Va name (+) .Pp -$% -.Va number -.TP 8 +.It Ar $%number .It Ar ${%number} Substitutes the number of characters in .Va $argv[number] . @@ -2749,7 +2746,7 @@ file to it on standard input. The standard input and standard output of a command may be redirected with the following syntax: .Pp -.Bl -tag -width XXXXXX -offset indent -compact +.Bl -tag -width XXXXXXXXX -offset indent -compact .It Ar < name Open file .Va name @@ -3143,63 +3140,47 @@ They have the same format as before; .Va op may be one of .Pp -.PD 0 -.RS +4 -.TP 8 -.B A +.Bl -tag -width XXX -offset indent -compact +.It Ar A Last file access time, as the number of seconds since the epoch -.TP 8 -.B A: +.It Ar A: Like -.Va A +.Va Ar A , but in timestamp format, e.g., .Sq Fri May 14 16:36:10 1993 -.TP 8 -.B M +.It Ar M Last file modification time -.TP 8 -.B M: +.It Ar M: Like .Va M , but in timestamp format -.TP 8 -.B C +.It Ar C Last inode modification time -.TP 8 -.B C: +.It Ar C: Like .Va C , but in timestamp format -.TP 8 -.B D +.It Ar D Device number -.TP 8 -.B I +.It Ar I Inode number -.TP 8 -.B F +.It Ar F Composite .Va f ile identifier, in the form -.Va device -: +.Va device : .Va inode -.TP 8 -.B L +.It Ar L The name of the file pointed to by a symbolic link -.TP 8 -.B N +.It Ar N Number of (hard) links -.TP 8 -.B P +.It Ar P Permissions, in octal, without leading zero -.TP 8 -.B P: +.It Ar P: Like .Va P , with leading zero -.TP 8 -.B P\fImode +.It Ar P Equivalent to .Sq \-P .Va file @@ -3217,28 +3198,22 @@ if by group only, and .Sq 0 if by neither -.TP 8 -.B P\fImode\fB: -Like \fBP +.It Ar P: +Like +.Ar BP .Va mode , with leading zero -.TP 8 -.B U +.It Ar U Numeric userid -.TP 8 -.B U: +.It Ar U: Username, or the numeric userid if the username is unknown -.TP 8 -.B G +.It Ar G Numeric groupid -.TP 8 -.B G: +.It Ar G: Groupname, or the numeric groupid if the groupname is unknown -.TP 8 -.B Z +.It Ar Z Size, in bytes -.RE -.PD +.El .Pp Only one of these operators may appear in a multiple-operator test, and it must be the last. @@ -3791,45 +3766,24 @@ The next sections of this manual describe all of the a and .Va Special shell variables .Ss "Builtin commands" -.TP 8 -.B %\fIjob +.Bl -tag -width XXXXXXX -offset indent +.It Ar %job A synonym for the .Va fg builtin command. -.TP 8 -.B %\fIjob \fB& +.It Ar %job \&& A synonym for the .Va bg builtin command. -.TP 8 -.B : +.It Ar \&: Does nothing, successfully. .Pp -.B @ -.br -.B @ \fIname\fB = \fIexpr -.br -.B @ -.Va name -[ -.Va index -]\fB = \fIexpr -.br -.B @ \fIname -.Va ++ -|\fB-- -.PD 0 -.TP 8 -.B @ -.Va name -[ -.Va index -] -.Va ++ -|\fB-- +.It Ar @ +.It Ar @ name = expr +.It Ar @ name[index] = expr +.It Ar @ name++|-- +.It Ar @name[index]++|-- The first form prints the values of all shell variables. -.PD -.RS +8 .Pp The second form assigns the value of .Va expr @@ -3875,7 +3829,10 @@ has nothing to do with that described under .Va Expressions .Pp -The fourth and fifth forms increment (`++') or decrement (`\-\-') +The fourth and fifth forms increment ( +.Sq ++ ) +or decrement +.Sq ( -- ) .Va name or its .Va index @@ -3898,14 +3855,7 @@ are optional. Components of .Va expr must be separated by spaces. -.RE -.PD -.TP 8 -.B alias \fR[ -.Va name -[ -.Va wordlist -]] +.It Ar alias[name[wordlist]] Without arguments, prints all aliases. With .Va name @@ -3928,8 +3878,7 @@ or See also the .Va unalias builtin command. -.TP 8 -.B alloc +.It Ar alloc Shows the amount of dynamic memory acquired, broken down into used and free memory. With an argument shows the number of free and used blocks in each size @@ -3939,9 +3888,7 @@ This command's output may vary across system types, because systems other than the VAX may use a different memory allocator. .TP 8 -.B bg \fR[\fB% -.Va job -...] +.It Ar bg[%job...] Puts the specified jobs (or, without arguments, the current job) into the background, continuing each if it is stopped. .Va job @@ -3957,35 +3904,10 @@ as described under .Va Jobs .Pp -.B bindkey \fR[ -.Fl l\fR| -.Fl d\fR| -.Fl e\fR| -.Fl v\fR| -.Fl u\fR] (+) -.br -.Va bindkey -[ -.Fl a\fR] [ -.Fl b\fR] [ -.Fl k\fR] [ -.Fl r\fR] [ -.Fl \-\fR] -.Va key -(+) -.PD 0 -.TP 8 -.Va bindkey -[ -.Fl a\fR] [ -.Fl b\fR] [ -.Fl k\fR] [ -.Fl c\fR| -.Fl s\fR] [ -.Fl \-\fR] -.Va key command -(+) -.\" .B macro can't take too many words, so I used \fB in the previous tags +.It Ar bindkey Oo Fl l Ns | Ns Fl d Ns | Ns Fl e Ns | Ns Fl v Ns | Ns Fl u Oc (+) +.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl r Oc Oo Fl Fl Oc Ar key (+) +.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl c Ns | Ns Fl s Oc Oo Fl Fl Oc Ar key command (+) +.\" .It Ar macro can't take too many words, so I used \fB in the previous tags Without options, the first form lists all bound keys and the editor command to which each is bound, the second form lists the editor command to which .Va key @@ -3995,43 +3917,35 @@ the third form binds the editor command to .Va key Options include: -.PD .Pp -.PD 0 -.RS +8 -.TP 4 -.Fl l +.Bl -tag -width XXX -compact +.It Fl l Lists all editor commands and a short description of each. -.TP 4 -.Fl d +.It Fl d Binds all keys to the standard bindings for the default editor, as per .Va -e and .Va -v below. -.TP 4 -.Fl e +.It Fl e Binds all keys to .Va emacs (1)\-style bindings. Unsets .Va vimode -.TP 4 -.Fl v +.It Fl v Binds all keys to .Va vi (1)\-style bindings. Sets .Va vimode -.TP 4 -.Fl a +.It Fl a Lists or changes key-bindings in the alternative key map. This is the key map used in .Va vimode command mode. -.TP 4 -.Fl b +.It Fl b .Va key is interpreted as a control character written ^ @@ -4059,8 +3973,7 @@ or an extended prefix key written X- (e.g., .Sq X-A ). -.TP 4 -.Fl k +.It Fl k .Va key is interpreted as a symbolic arrow key name, which may be one of `down', @@ -4069,8 +3982,7 @@ is interpreted as a symbolic arrow key name, which may .Sq left or .Sq right -.TP 4 -.Fl r +.It Fl r Removes .Va key 's binding. @@ -4085,13 +3997,11 @@ to (q.v.), it unbinds .Va key completely. -.TP 4 -.Fl c +.It Fl c .Va command is interpreted as a builtin or external command instead of an editor command. -.TP 4 -.Fl s +.It Fl s .Va command is taken as a literal string and treated as terminal input when @@ -4101,15 +4011,14 @@ Bound keys in .Va command are themselves reinterpreted, and this continues for ten levels of interpretation. -.TP 4 -.Fl \- +.It Fl \&- Forces a break from option processing, so the next word is taken as .Va key -even if it begins with '\-'. -.TP 4 -.Fl u \fR(or any invalid option) +even if it begins with '\&-'. +.It Fl u +(or any invalid option) Prints a usage message. -.PD +.El .Pp .Va key may be a single character or a string. @@ -4137,48 +4046,35 @@ can contain backslashed escape sequences (in the style of System V .Va echo (1)) as follows: -.RS +4 -.TP 8 -.PD 0 -.B \ea +.Pp +.Bl -tag -width XXXX -compact -offset indent +.It \ea Bell -.TP 8 -.B \eb +.It \eb Backspace -.TP 8 -.B \ee +.It \ee Escape -.TP 8 -.B \ef +.It \ef Form feed -.TP 8 -.B \en +.It \en Newline -.TP 8 -.B \er +.It \er Carriage return -.TP 8 -.B \et +.It \et Horizontal tab -.TP 8 -.B \ev +.It \ev Vertical tab -.TP 8 -.B \e\fInnn +.It \e\fInnn The ASCII character corresponding to the octal number .Va nnn -.PD -.RE +.El .Pp `\e' nullifies the special meaning of the following character, if it has any, notably .Sq \e and .Sq ^ -.RE -.TP 8 -.B bs2cmd -.Va bs2000-command +.It bs2cmd Va bs2000-command (+) Passes .Va bs2000-command @@ -4186,8 +4082,7 @@ to the BS2000 command interpreter for execution. Only non-interactive commands can be executed, and it is not possible to execute any command that would overlay the image of the current process, like /EXECUTE or /CALL-PROCEDURE. (BS2000 only) -.TP 8 -.B break +.It break Causes execution to resume after the .Va end of the nearest @@ -4199,17 +4094,16 @@ The remaining commands on the current line are executed. Multi-level breaks are thus possible by writing them all on one line. -.TP 8 -.B breaksw +.It breaksw Causes a break from a .Va switch , resuming after the .Va endsw -.TP 8 -.B builtins \fR(+) + +.It builtins \fR(+) Prints the names of all builtin commands. -.TP 8 -.B bye \fR(+) + +.It bye \fR(+) A synonym for the .Va logout builtin command. @@ -4217,13 +4111,13 @@ Available only if the shell was so compiled; see the .Va version shell variable. -.TP 8 -.B case \fIlabel\fB: + +.It case \fIlabel\fB: A label in a .Va switch statement as discussed below. -.TP 8 -.B cd \fR[ + +.It cd \fR[ .Fl p\fR] [ .Fl l\fR] [ .Fl n\fR| @@ -4300,13 +4194,13 @@ and .Va cdtohome shell variables. .RE -.TP 8 -.B chdir + +.It chdir A synonym for the .Va cd builtin command. -.TP 8 -.B complete \fR[ + +.It complete \fR[ .Va command [\fIword\fB/\fIpattern\fB/ .Va list @@ -4350,7 +4244,7 @@ is to be completed, and may be one of the following: .PD 0 .RS +4 .TP 4 -.B c +.It c Current-word completion. .Va pattern is a glob-pattern which must match the beginning of the current word on @@ -4358,25 +4252,25 @@ the command line. .Va pattern is ignored when completing the current word. .TP 4 -.B C +.It C Like .Va c , but includes .Va pattern when completing the current word. .TP 4 -.B n +.It n Next-word completion. .Va pattern is a glob-pattern which must match the beginning of the previous word on the command line. .TP 4 -.B N +.It N Like .Va n , but must match the beginning of the word two before the current word. .TP 4 -.B p +.It p Position-dependent completion. .Va pattern is a numeric range, with the same syntax used to index shell @@ -4387,71 +4281,50 @@ variables, which must include the current word. .Va list , the list of possible completions, may be one of the following: .Pp -.PD 0 -.RS +4 -.TP 8 -.B a +.Bl -tag +.It a Aliases -.TP 8 -.B b +.It b Bindings (editor commands) -.TP 8 -.B c +.It c Commands (builtin or external commands) -.TP 8 -.B C +.It C External commands which begin with the supplied path prefix -.TP 8 -.B d +.It d Directories -.TP 8 -.B D *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 21 18:10:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9C9915DDF9; Mon, 21 Oct 2019 18:10:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7B56MPz4c2C; Mon, 21 Oct 2019 18:10:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 93B6527B87; Mon, 21 Oct 2019 18:10:46 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIAktD066502; Mon, 21 Oct 2019 18:10:46 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIAkWD066501; Mon, 21 Oct 2019 18:10:46 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211810.x9LIAkWD066501@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:10:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353836 - head/sys/dev/altera/atse X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/altera/atse X-SVN-Commit-Revision: 353836 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:10:46 -0000 Author: glebius Date: Mon Oct 21 18:10:46 2019 New Revision: 353836 URL: https://svnweb.freebsd.org/changeset/base/353836 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/altera/atse/if_atse.c Modified: head/sys/dev/altera/atse/if_atse.c ============================================================================== --- head/sys/dev/altera/atse/if_atse.c Mon Oct 21 18:08:57 2019 (r353835) +++ head/sys/dev/altera/atse/if_atse.c Mon Oct 21 18:10:46 2019 (r353836) @@ -427,12 +427,14 @@ atse_stop_locked(struct atse_softc *sc) return (0); } -static uint8_t -atse_mchash(struct atse_softc *sc __unused, const uint8_t *addr) +static u_int +atse_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) { - uint8_t x, y; + uint64_t *h = arg; + uint8_t *addr, x, y; int i, j; + addr = LLADDR(sdl); x = 0; for (i = 0; i < ETHER_ADDR_LEN; i++) { y = addr[i] & 0x01; @@ -440,14 +442,14 @@ atse_mchash(struct atse_softc *sc __unused, const uint y ^= (addr[i] >> j) & 0x01; x |= (y << i); } + *h |= (1 << x); - return (x); + return (1); } static int atse_rxfilter_locked(struct atse_softc *sc) { - struct ifmultiaddr *ifma; struct ifnet *ifp; uint32_t val4; int i; @@ -478,22 +480,13 @@ atse_rxfilter_locked(struct atse_softc *sc) */ uint64_t h; - h = 0; /* * Re-build and re-program hash table. First build the * bit-field "yes" or "no" for each slot per address, then * do all the programming afterwards. */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) { - continue; - } - - h |= (1 << atse_mchash(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr))); - } - if_maddr_runlock(ifp); + h = 0; + (void)if_foreach_llmaddr(ifp, atse_hash_maddr, &h); for (i = 0; i <= MHASH_LEN; i++) { CSR_WRITE_4(sc, MHASH_START + i, (h & (1 << i)) ? 0x01 : 0x00); From owner-svn-src-all@freebsd.org Mon Oct 21 18:10:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50E7415DE21; Mon, 21 Oct 2019 18:10:53 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7J6r4gz4c7r; Mon, 21 Oct 2019 18:10:52 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C3BFA27B94; Mon, 21 Oct 2019 18:10:52 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIAqg3066552; Mon, 21 Oct 2019 18:10:52 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIAqx4066551; Mon, 21 Oct 2019 18:10:52 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211810.x9LIAqx4066551@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:10:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353837 - head/sys/dev/bnxt X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/bnxt X-SVN-Commit-Revision: 353837 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:10:53 -0000 Author: glebius Date: Mon Oct 21 18:10:52 2019 New Revision: 353837 URL: https://svnweb.freebsd.org/changeset/base/353837 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/bnxt/if_bnxt.c Modified: head/sys/dev/bnxt/if_bnxt.c ============================================================================== --- head/sys/dev/bnxt/if_bnxt.c Mon Oct 21 18:10:46 2019 (r353836) +++ head/sys/dev/bnxt/if_bnxt.c Mon Oct 21 18:10:52 2019 (r353837) @@ -46,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -1185,30 +1186,41 @@ bnxt_stop(if_ctx_t ctx) return; } +static u_int +bnxt_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint8_t *mta = arg; + + if (cnt == BNXT_MAX_MC_ADDRS) + return (1); + + bcopy(LLADDR(sdl), &mta[cnt * ETHER_ADDR_LEN], ETHER_ADDR_LEN); + + return (1); +} + static void bnxt_multi_set(if_ctx_t ctx) { struct bnxt_softc *softc = iflib_get_softc(ctx); if_t ifp = iflib_get_ifp(ctx); uint8_t *mta; - int cnt, mcnt; + int mcnt; - mcnt = if_multiaddr_count(ifp, -1); + mta = softc->vnic_info.mc_list.idi_vaddr; + bzero(mta, softc->vnic_info.mc_list.idi_size); + mcnt = if_foreach_llmaddr(ifp, bnxt_copy_maddr, mta); if (mcnt > BNXT_MAX_MC_ADDRS) { softc->vnic_info.rx_mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; bnxt_hwrm_cfa_l2_set_rx_mask(softc, &softc->vnic_info); - } - else { + } else { softc->vnic_info.rx_mask &= ~HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; - mta = softc->vnic_info.mc_list.idi_vaddr; - bzero(mta, softc->vnic_info.mc_list.idi_size); - if_multiaddr_array(ifp, mta, &cnt, mcnt); bus_dmamap_sync(softc->vnic_info.mc_list.idi_tag, softc->vnic_info.mc_list.idi_map, BUS_DMASYNC_PREWRITE); - softc->vnic_info.mc_list_count = cnt; + softc->vnic_info.mc_list_count = mcnt; softc->vnic_info.rx_mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_MCAST; if (bnxt_hwrm_cfa_l2_set_rx_mask(softc, &softc->vnic_info)) @@ -1370,7 +1382,7 @@ bnxt_promisc_set(if_ctx_t ctx, int flags) int rc; if (ifp->if_flags & IFF_ALLMULTI || - if_multiaddr_count(ifp, -1) > BNXT_MAX_MC_ADDRS) + if_llmaddr_count(ifp) > BNXT_MAX_MC_ADDRS) softc->vnic_info.rx_mask |= HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_ALL_MCAST; else From owner-svn-src-all@freebsd.org Mon Oct 21 18:10:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B93CB15DE65; Mon, 21 Oct 2019 18:10:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7R2htmz4cGd; Mon, 21 Oct 2019 18:10:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35AF827BA5; Mon, 21 Oct 2019 18:10:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIAxKl067299; Mon, 21 Oct 2019 18:10:59 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIAxf9067298; Mon, 21 Oct 2019 18:10:59 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211810.x9LIAxf9067298@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:10:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353838 - head/sys/dev/cadence X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/cadence X-SVN-Commit-Revision: 353838 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:10:59 -0000 Author: glebius Date: Mon Oct 21 18:10:58 2019 New Revision: 353838 URL: https://svnweb.freebsd.org/changeset/base/353838 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/cadence/if_cgem.c Modified: head/sys/dev/cadence/if_cgem.c ============================================================================== --- head/sys/dev/cadence/if_cgem.c Mon Oct 21 18:10:52 2019 (r353837) +++ head/sys/dev/cadence/if_cgem.c Mon Oct 21 18:10:58 2019 (r353838) @@ -299,6 +299,21 @@ cgem_mac_hash(u_char eaddr[]) return hash; } +static u_int +cgem_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int index; + + index = cgem_mac_hash(LLADDR(sdl)); + if (index > 31) + hashes[0] |= (1 << (index - 32)); + else + hashes[1] |= (1 << index); + + return (1); +} + /* After any change in rx flags or multi-cast addresses, set up * hash registers and net config register bits. */ @@ -306,15 +321,9 @@ static void cgem_rx_filter(struct cgem_softc *sc) { if_t ifp = sc->ifp; - u_char *mta; - - int index, i, mcnt; - uint32_t hash_hi, hash_lo; + uint32_t hashes[2] = { 0, 0 }; uint32_t net_cfg; - hash_hi = 0; - hash_lo = 0; - net_cfg = RD4(sc, CGEM_NET_CFG); net_cfg &= ~(CGEM_NET_CFG_MULTI_HASH_EN | @@ -327,36 +336,17 @@ cgem_rx_filter(struct cgem_softc *sc) if ((if_getflags(ifp) & IFF_BROADCAST) == 0) net_cfg |= CGEM_NET_CFG_NO_BCAST; if ((if_getflags(ifp) & IFF_ALLMULTI) != 0) { - hash_hi = 0xffffffff; - hash_lo = 0xffffffff; - } else { - mcnt = if_multiaddr_count(ifp, -1); - mta = malloc(ETHER_ADDR_LEN * mcnt, M_DEVBUF, - M_NOWAIT); - if (mta == NULL) { - device_printf(sc->dev, - "failed to allocate temp mcast list\n"); - return; - } - if_multiaddr_array(ifp, mta, &mcnt, mcnt); - for (i = 0; i < mcnt; i++) { - index = cgem_mac_hash( - LLADDR((struct sockaddr_dl *) - (mta + (i * ETHER_ADDR_LEN)))); - if (index > 31) - hash_hi |= (1 << (index - 32)); - else - hash_lo |= (1 << index); - } - free(mta, M_DEVBUF); - } + hashes[0] = 0xffffffff; + hashes[1] = 0xffffffff; + } else + if_foreach_llmaddr(ifp, cgem_hash_maddr, hashes); - if (hash_hi != 0 || hash_lo != 0) + if (hashes[0] != 0 || hashes[1] != 0) net_cfg |= CGEM_NET_CFG_MULTI_HASH_EN; } - WR4(sc, CGEM_HASH_TOP, hash_hi); - WR4(sc, CGEM_HASH_BOT, hash_lo); + WR4(sc, CGEM_HASH_TOP, hashes[0]); + WR4(sc, CGEM_HASH_BOT, hashes[1]); WR4(sc, CGEM_NET_CFG, net_cfg); } From owner-svn-src-all@freebsd.org Mon Oct 21 18:11:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CCD4B15DEA0; Mon, 21 Oct 2019 18:11:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7X0TJYz4cKD; Mon, 21 Oct 2019 18:11:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DFAD27BA8; Mon, 21 Oct 2019 18:11:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIB3sH067384; Mon, 21 Oct 2019 18:11:03 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIB3Ah067383; Mon, 21 Oct 2019 18:11:03 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIB3Ah067383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353839 - head/sys/dev/cas X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/cas X-SVN-Commit-Revision: 353839 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:05 -0000 Author: glebius Date: Mon Oct 21 18:11:02 2019 New Revision: 353839 URL: https://svnweb.freebsd.org/changeset/base/353839 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/cas/if_cas.c Modified: head/sys/dev/cas/if_cas.c ============================================================================== --- head/sys/dev/cas/if_cas.c Mon Oct 21 18:10:58 2019 (r353838) +++ head/sys/dev/cas/if_cas.c Mon Oct 21 18:11:02 2019 (r353839) @@ -2498,14 +2498,27 @@ cas_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (error); } +static u_int +cas_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *hash = arg; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + /* We just want the 8 most significant bits. */ + crc >>= 24; + /* Set the corresponding bit in the filter. */ + hash[crc >> 4] |= 1 << (15 - (crc & 15)); + + return (1); +} + static void cas_setladrf(struct cas_softc *sc) { struct ifnet *ifp = sc->sc_ifp; - struct ifmultiaddr *inm; int i; uint32_t hash[16]; - uint32_t crc, v; + uint32_t v; CAS_LOCK_ASSERT(sc, MA_OWNED); @@ -2542,23 +2555,8 @@ cas_setladrf(struct cas_softc *sc) * is the MSB). */ - /* Clear the hash table. */ memset(hash, 0, sizeof(hash)); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { - if (inm->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - inm->ifma_addr), ETHER_ADDR_LEN); - - /* We just want the 8 most significant bits. */ - crc >>= 24; - - /* Set the corresponding bit in the filter. */ - hash[crc >> 4] |= 1 << (15 - (crc & 15)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, cas_hash_maddr, &hash); v |= CAS_MAC_RX_CONF_HFILTER; From owner-svn-src-all@freebsd.org Mon Oct 21 18:11:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4984B15DED0; Mon, 21 Oct 2019 18:11:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7d0gDhz4cWS; Mon, 21 Oct 2019 18:11:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E6D1C27BB0; Mon, 21 Oct 2019 18:11:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIB8pi067435; Mon, 21 Oct 2019 18:11:08 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIB8j5067433; Mon, 21 Oct 2019 18:11:08 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIB8j5067433@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353840 - in head/sys/dev/cxgb: . common X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys/dev/cxgb: . common X-SVN-Commit-Revision: 353840 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:09 -0000 Author: glebius Date: Mon Oct 21 18:11:08 2019 New Revision: 353840 URL: https://svnweb.freebsd.org/changeset/base/353840 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/cxgb/common/cxgb_xgmac.c head/sys/dev/cxgb/cxgb_adapter.h Modified: head/sys/dev/cxgb/common/cxgb_xgmac.c ============================================================================== --- head/sys/dev/cxgb/common/cxgb_xgmac.c Mon Oct 21 18:11:02 2019 (r353839) +++ head/sys/dev/cxgb/common/cxgb_xgmac.c Mon Oct 21 18:11:08 2019 (r353840) @@ -408,9 +408,32 @@ static int hash_hw_addr(const u8 *addr) * Configures the MAC Rx mode (promiscuity, etc) and exact and hash * address filters. */ +struct t3_mcaddr_ctx { + struct cmac *mac; + u32 hash_lo, hash_hi; +}; + +static u_int +t3_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct t3_mcaddr_ctx *ctx = arg; + int hash; + + if (ctx->mac->nucast + cnt < EXACT_ADDR_FILTERS) + set_addr_filter(ctx->mac, ctx->mac->nucast + cnt, LLADDR(sdl)); + else { + hash = hash_hw_addr(LLADDR(sdl)); + if (hash < 32) + ctx->hash_lo |= (1 << hash); + else + ctx->hash_hi |= (1 << (hash - 32)); + } + return (1); +} + int t3_mac_set_rx_mode(struct cmac *mac, struct t3_rx_mode *rm) { - u32 hash_lo, hash_hi; + struct t3_mcaddr_ctx ctx; adapter_t *adap = mac->adapter; unsigned int oft = mac->offset; @@ -422,27 +445,15 @@ int t3_mac_set_rx_mode(struct cmac *mac, struct t3_rx_ mac->promisc_map ? F_COPYALLFRAMES : 0); if (allmulti_rx_mode(rm) || mac->multiport) - hash_lo = hash_hi = 0xffffffff; + ctx.hash_lo = ctx.hash_hi = 0xffffffff; else { - u8 *addr; - int exact_addr_idx = mac->nucast; - - hash_lo = hash_hi = 0; - while ((addr = t3_get_next_mcaddr(rm))) - if (exact_addr_idx < EXACT_ADDR_FILTERS) - set_addr_filter(mac, exact_addr_idx++, addr); - else { - int hash = hash_hw_addr(addr); - - if (hash < 32) - hash_lo |= (1 << hash); - else - hash_hi |= (1 << (hash - 32)); - } + ctx.mac = mac; + ctx.hash_lo = ctx.hash_hi = 0; + if_foreach_llmaddr(rm->port->ifp, t3_hash_maddr, &ctx); } - t3_write_reg(adap, A_XGM_RX_HASH_LOW + oft, hash_lo); - t3_write_reg(adap, A_XGM_RX_HASH_HIGH + oft, hash_hi); + t3_write_reg(adap, A_XGM_RX_HASH_LOW + oft, ctx.hash_lo); + t3_write_reg(adap, A_XGM_RX_HASH_HIGH + oft, ctx.hash_hi); return 0; } Modified: head/sys/dev/cxgb/cxgb_adapter.h ============================================================================== --- head/sys/dev/cxgb/cxgb_adapter.h Mon Oct 21 18:11:02 2019 (r353839) +++ head/sys/dev/cxgb/cxgb_adapter.h Mon Oct 21 18:11:08 2019 (r353840) @@ -463,30 +463,6 @@ t3_os_pci_write_config_2(adapter_t *adapter, int reg, pci_write_config(adapter->dev, reg, val, 2); } -static __inline uint8_t * -t3_get_next_mcaddr(struct t3_rx_mode *rm) -{ - uint8_t *macaddr = NULL; - struct ifnet *ifp = rm->port->ifp; - struct ifmultiaddr *ifma; - int i = 0; - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - if (i == rm->idx) { - macaddr = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - break; - } - i++; - } - if_maddr_runlock(ifp); - - rm->idx++; - return (macaddr); -} - static __inline void t3_init_rx_mode(struct t3_rx_mode *rm, struct port_info *port) { From owner-svn-src-all@freebsd.org Mon Oct 21 18:11:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 883D515DF15; Mon, 21 Oct 2019 18:11:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7h2NG6z4ccP; Mon, 21 Oct 2019 18:11:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 01D6127BB4; Mon, 21 Oct 2019 18:11:11 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBBpR067482; Mon, 21 Oct 2019 18:11:11 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBB7m067481; Mon, 21 Oct 2019 18:11:11 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBB7m067481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353841 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 353841 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:12 -0000 Author: glebius Date: Mon Oct 21 18:11:11 2019 New Revision: 353841 URL: https://svnweb.freebsd.org/changeset/base/353841 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Mon Oct 21 18:11:08 2019 (r353840) +++ head/sys/dev/cxgbe/t4_main.c Mon Oct 21 18:11:11 2019 (r353841) @@ -4782,7 +4782,55 @@ apply_link_config(struct port_info *pi) } #define FW_MAC_EXACT_CHUNK 7 +struct mcaddr_ctx { + struct ifnet *ifp; + const uint8_t *mcaddr[FW_MAC_EXACT_CHUNK]; + uint64_t hash; + int i; + int del; + int rc; +}; +static u_int +add_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct mcaddr_ctx *ctx = arg; + struct vi_info *vi = ctx->ifp->if_softc; + struct port_info *pi = vi->pi; + struct adapter *sc = pi->adapter; + + if (ctx->rc < 0) + return (0); + + ctx->mcaddr[ctx->i] = LLADDR(sdl); + MPASS(ETHER_IS_MULTICAST(ctx->mcaddr[ctx->i])); + ctx->i++; + + if (ctx->i == FW_MAC_EXACT_CHUNK) { + ctx->rc = t4_alloc_mac_filt(sc, sc->mbox, vi->viid, ctx->del, + ctx->i, ctx->mcaddr, NULL, &ctx->hash, 0); + if (ctx->rc < 0) { + int j; + + for (j = 0; j < ctx->i; j++) { + if_printf(ctx->ifp, + "failed to add mc address" + " %02x:%02x:%02x:" + "%02x:%02x:%02x rc=%d\n", + ctx->mcaddr[j][0], ctx->mcaddr[j][1], + ctx->mcaddr[j][2], ctx->mcaddr[j][3], + ctx->mcaddr[j][4], ctx->mcaddr[j][5], + -ctx->rc); + } + return (0); + } + ctx->del = 0; + ctx->i = 0; + } + + return (1); +} + /* * Program the port's XGMAC based on parameters in ifnet. The caller also * indicates which parameters should be programmed (the rest are left alone). @@ -4838,66 +4886,51 @@ update_mac_settings(struct ifnet *ifp, int flags) } if (flags & XGMAC_MCADDRS) { - const uint8_t *mcaddr[FW_MAC_EXACT_CHUNK]; - int del = 1; - uint64_t hash = 0; - struct ifmultiaddr *ifma; - int i = 0, j; + struct epoch_tracker et; + struct mcaddr_ctx ctx; + int j; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - mcaddr[i] = - LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - MPASS(ETHER_IS_MULTICAST(mcaddr[i])); - i++; - - if (i == FW_MAC_EXACT_CHUNK) { - rc = t4_alloc_mac_filt(sc, sc->mbox, vi->viid, - del, i, mcaddr, NULL, &hash, 0); - if (rc < 0) { - rc = -rc; - for (j = 0; j < i; j++) { - if_printf(ifp, - "failed to add mc address" - " %02x:%02x:%02x:" - "%02x:%02x:%02x rc=%d\n", - mcaddr[j][0], mcaddr[j][1], - mcaddr[j][2], mcaddr[j][3], - mcaddr[j][4], mcaddr[j][5], - rc); - } - goto mcfail; - } - del = 0; - i = 0; - } + ctx.ifp = ifp; + ctx.hash = 0; + ctx.i = 0; + ctx.del = 1; + /* + * Unlike other drivers, we accumulate list of pointers into + * interface address lists and we need to keep it safe even + * after if_foreach_llmaddr() returns, thus we must enter the + * network epoch. + */ + NET_EPOCH_ENTER(et); + if_foreach_llmaddr(ifp, add_maddr, &ctx); + if (ctx.rc < 0) { + NET_EPOCH_EXIT(et); + rc = -ctx.rc; + return (rc); } - if (i > 0) { - rc = t4_alloc_mac_filt(sc, sc->mbox, vi->viid, del, i, - mcaddr, NULL, &hash, 0); + if (ctx.i > 0) { + rc = t4_alloc_mac_filt(sc, sc->mbox, vi->viid, + ctx.del, ctx.i, ctx.mcaddr, NULL, &ctx.hash, 0); + NET_EPOCH_EXIT(et); if (rc < 0) { rc = -rc; - for (j = 0; j < i; j++) { + for (j = 0; j < ctx.i; j++) { if_printf(ifp, "failed to add mc address" " %02x:%02x:%02x:" "%02x:%02x:%02x rc=%d\n", - mcaddr[j][0], mcaddr[j][1], - mcaddr[j][2], mcaddr[j][3], - mcaddr[j][4], mcaddr[j][5], + ctx.mcaddr[j][0], ctx.mcaddr[j][1], + ctx.mcaddr[j][2], ctx.mcaddr[j][3], + ctx.mcaddr[j][4], ctx.mcaddr[j][5], rc); } - goto mcfail; + return (rc); } - } + } else + NET_EPOCH_EXIT(et); - rc = -t4_set_addr_hash(sc, sc->mbox, vi->viid, 0, hash, 0); + rc = -t4_set_addr_hash(sc, sc->mbox, vi->viid, 0, ctx.hash, 0); if (rc != 0) if_printf(ifp, "failed to set mc address hash: %d", rc); -mcfail: - if_maddr_runlock(ifp); } return (rc); From owner-svn-src-all@freebsd.org Mon Oct 21 18:11:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52B2C15DF47; Mon, 21 Oct 2019 18:11:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7m0nGFz4ckY; Mon, 21 Oct 2019 18:11:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D5E6A27BBC; Mon, 21 Oct 2019 18:11:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBF6T067532; Mon, 21 Oct 2019 18:11:15 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBFO3067531; Mon, 21 Oct 2019 18:11:15 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBFO3067531@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353842 - head/sys/dev/dc X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/dc X-SVN-Commit-Revision: 353842 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:16 -0000 Author: glebius Date: Mon Oct 21 18:11:15 2019 New Revision: 353842 URL: https://svnweb.freebsd.org/changeset/base/353842 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/dc/if_dc.c Modified: head/sys/dev/dc/if_dc.c ============================================================================== --- head/sys/dev/dc/if_dc.c Mon Oct 21 18:11:11 2019 (r353841) +++ head/sys/dev/dc/if_dc.c Mon Oct 21 18:11:15 2019 (r353842) @@ -962,13 +962,24 @@ dc_mchash_be(const uint8_t *addr) * frames. We also sneak the broadcast address into the hash filter since * we need that too. */ +static u_int +dc_hash_maddr_21143(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct dc_softc *sc = arg; + uint32_t h; + + h = dc_mchash_le(sc, LLADDR(sdl)); + sc->dc_cdata.dc_sbuf[h >> 4] |= htole32(1 << (h & 0xF)); + + return (1); +} + static void dc_setfilt_21143(struct dc_softc *sc) { uint16_t eaddr[(ETHER_ADDR_LEN+1)/2]; struct dc_desc *sframe; uint32_t h, *sp; - struct ifmultiaddr *ifma; struct ifnet *ifp; int i; @@ -998,15 +1009,7 @@ dc_setfilt_21143(struct dc_softc *sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = dc_mchash_le(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - sp[h >> 4] |= htole32(1 << (h & 0xF)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, dc_hash_maddr_21143, sp); if (ifp->if_flags & IFF_BROADCAST) { h = dc_mchash_le(sc, ifp->if_broadcastaddr); @@ -1036,14 +1039,47 @@ dc_setfilt_21143(struct dc_softc *sc) sc->dc_wdog_timer = 5; } +static u_int +dc_hash_maddr_admtek_be(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int h = 0; + + h = dc_mchash_be(LLADDR(sdl)); + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} + +struct dc_hash_maddr_admtek_le_ctx { + struct dc_softc *sc; + uint32_t hashes[2]; +}; + +static u_int +dc_hash_maddr_admtek_le(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct dc_hash_maddr_admtek_le_ctx *ctx = arg; + int h = 0; + + h = dc_mchash_le(ctx->sc, LLADDR(sdl)); + if (h < 32) + ctx->hashes[0] |= (1 << h); + else + ctx->hashes[1] |= (1 << (h - 32)); + + return (1); +} + static void dc_setfilt_admtek(struct dc_softc *sc) { uint8_t eaddr[ETHER_ADDR_LEN]; struct ifnet *ifp; - struct ifmultiaddr *ifma; - int h = 0; - uint32_t hashes[2] = { 0, 0 }; + struct dc_hash_maddr_admtek_le_ctx ctx = { sc, { 0, 0 }}; ifp = sc->dc_ifp; @@ -1076,25 +1112,13 @@ dc_setfilt_admtek(struct dc_softc *sc) return; /* Now program new ones. */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - if (DC_IS_CENTAUR(sc)) - h = dc_mchash_le(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - else - h = dc_mchash_be( - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } - if_maddr_runlock(ifp); + if (DC_IS_CENTAUR(sc)) + if_foreach_llmaddr(ifp, dc_hash_maddr_admtek_le, &ctx); + else + if_foreach_llmaddr(ifp, dc_hash_maddr_admtek_be, &ctx.hashes); - CSR_WRITE_4(sc, DC_AL_MAR0, hashes[0]); - CSR_WRITE_4(sc, DC_AL_MAR1, hashes[1]); + CSR_WRITE_4(sc, DC_AL_MAR0, ctx.hashes[0]); + CSR_WRITE_4(sc, DC_AL_MAR1, ctx.hashes[1]); } static void @@ -1102,8 +1126,6 @@ dc_setfilt_asix(struct dc_softc *sc) { uint32_t eaddr[(ETHER_ADDR_LEN+3)/4]; struct ifnet *ifp; - struct ifmultiaddr *ifma; - int h = 0; uint32_t hashes[2] = { 0, 0 }; ifp = sc->dc_ifp; @@ -1149,17 +1171,7 @@ dc_setfilt_asix(struct dc_softc *sc) return; /* now program new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = dc_mchash_be(LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, dc_hash_maddr_admtek_be, hashes); CSR_WRITE_4(sc, DC_AX_FILTIDX, DC_AX_FILTIDX_MAR0); CSR_WRITE_4(sc, DC_AX_FILTDATA, hashes[0]); @@ -1167,15 +1179,29 @@ dc_setfilt_asix(struct dc_softc *sc) CSR_WRITE_4(sc, DC_AX_FILTDATA, hashes[1]); } +static u_int +dc_hash_maddr_uli(void *arg, struct sockaddr_dl *sdl, u_int mcnt) +{ + uint32_t **sp = arg; + uint8_t *ma; + + if (mcnt == DC_ULI_FILTER_NPERF) + return (0); + ma = LLADDR(sdl); + *(*sp)++ = DC_SP_MAC(ma[1] << 8 | ma[0]); + *(*sp)++ = DC_SP_MAC(ma[3] << 8 | ma[2]); + *(*sp)++ = DC_SP_MAC(ma[5] << 8 | ma[4]); + + return (1); +} + static void dc_setfilt_uli(struct dc_softc *sc) { uint8_t eaddr[ETHER_ADDR_LEN]; struct ifnet *ifp; - struct ifmultiaddr *ifma; struct dc_desc *sframe; uint32_t filter, *sp; - uint8_t *ma; int i, mcnt; ifp = sc->dc_ifp; @@ -1209,29 +1235,17 @@ dc_setfilt_uli(struct dc_softc *sc) filter &= ~(DC_NETCFG_RX_PROMISC | DC_NETCFG_RX_ALLMULTI); /* Now build perfect filters. */ - mcnt = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - if (mcnt >= DC_ULI_FILTER_NPERF) { - filter |= DC_NETCFG_RX_ALLMULTI; - break; + mcnt = if_foreach_llmaddr(ifp, dc_hash_maddr_uli, &sp); + + if (mcnt == DC_ULI_FILTER_NPERF) + filter |= DC_NETCFG_RX_ALLMULTI; + else + for (; mcnt < DC_ULI_FILTER_NPERF; mcnt++) { + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); + *sp++ = DC_SP_MAC(0xFFFF); } - ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - *sp++ = DC_SP_MAC(ma[1] << 8 | ma[0]); - *sp++ = DC_SP_MAC(ma[3] << 8 | ma[2]); - *sp++ = DC_SP_MAC(ma[5] << 8 | ma[4]); - mcnt++; - } - if_maddr_runlock(ifp); - for (; mcnt < DC_ULI_FILTER_NPERF; mcnt++) { - *sp++ = DC_SP_MAC(0xFFFF); - *sp++ = DC_SP_MAC(0xFFFF); - *sp++ = DC_SP_MAC(0xFFFF); - } - if (filter & (DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)) CSR_WRITE_4(sc, DC_NETCFG, filter & ~(DC_NETCFG_TX_ON | DC_NETCFG_RX_ON)); @@ -1258,12 +1272,22 @@ dc_setfilt_uli(struct dc_softc *sc) sc->dc_wdog_timer = 5; } +static u_int +dc_hash_maddr_xircom(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct dc_softc *sc = arg; + uint32_t h; + + h = dc_mchash_le(sc, LLADDR(sdl)); + sc->dc_cdata.dc_sbuf[h >> 4] |= htole32(1 << (h & 0xF)); + return (1); +} + static void dc_setfilt_xircom(struct dc_softc *sc) { uint16_t eaddr[(ETHER_ADDR_LEN+1)/2]; struct ifnet *ifp; - struct ifmultiaddr *ifma; struct dc_desc *sframe; uint32_t h, *sp; int i; @@ -1295,15 +1319,7 @@ dc_setfilt_xircom(struct dc_softc *sc) else DC_CLRBIT(sc, DC_NETCFG, DC_NETCFG_RX_ALLMULTI); - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = dc_mchash_le(sc, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - sp[h >> 4] |= htole32(1 << (h & 0xF)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, dc_hash_maddr_xircom, &sp); if (ifp->if_flags & IFF_BROADCAST) { h = dc_mchash_le(sc, ifp->if_broadcastaddr); From owner-svn-src-all@freebsd.org Mon Oct 21 18:11:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E78E15E0BC; Mon, 21 Oct 2019 18:11:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl7r5b2cz4cs3; Mon, 21 Oct 2019 18:11:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 51AE627BC7; Mon, 21 Oct 2019 18:11:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBKUv068212; Mon, 21 Oct 2019 18:11:20 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBKlx068211; Mon, 21 Oct 2019 18:11:20 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBKlx068211@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353843 - head/sys/dev/dwc X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/dwc X-SVN-Commit-Revision: 353843 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:21 -0000 Author: glebius Date: Mon Oct 21 18:11:19 2019 New Revision: 353843 URL: https://svnweb.freebsd.org/changeset/base/353843 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/dwc/if_dwc.c Modified: head/sys/dev/dwc/if_dwc.c ============================================================================== --- head/sys/dev/dwc/if_dwc.c Mon Oct 21 18:11:15 2019 (r353842) +++ head/sys/dev/dwc/if_dwc.c Mon Oct 21 18:11:19 2019 (r353843) @@ -581,13 +581,37 @@ bitreverse(uint8_t x) return (nibbletab[x & 0xf] << 4) | nibbletab[x >> 4]; } +struct dwc_hash_maddr_ctx { + struct dwc_softc *sc; + uint32_t hash[8]; +}; + +static u_int +dwc_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct dwc_hash_maddr_ctx *ctx = arg; + uint32_t crc, hashbit, hashreg; + uint8_t val; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + /* Take lower 8 bits and reverse it */ + val = bitreverse(~crc & 0xff); + if (ctx->sc->mactype == DWC_GMAC_ALT_DESC) + val >>= 2; /* Only need lower 6 bits */ + hashreg = (val >> 5); + hashbit = (val & 31); + ctx->hash[hashreg] |= (1 << hashbit); + + return (1); +} + static void dwc_setup_rxfilter(struct dwc_softc *sc) { - struct ifmultiaddr *ifma; + struct dwc_hash_maddr_ctx ctx; struct ifnet *ifp; - uint8_t *eaddr, val; - uint32_t crc, ffval, hashbit, hashreg, hi, lo, hash[8]; + uint8_t *eaddr; + uint32_t ffval, hi, lo; int nhash, i; DWC_ASSERT_LOCKED(sc); @@ -601,27 +625,13 @@ dwc_setup_rxfilter(struct dwc_softc *sc) if ((ifp->if_flags & IFF_ALLMULTI) != 0) { ffval = (FRAME_FILTER_PM); for (i = 0; i < nhash; i++) - hash[i] = ~0; + ctx.hash[i] = ~0; } else { ffval = (FRAME_FILTER_HMC); for (i = 0; i < nhash; i++) - hash[i] = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - - /* Take lower 8 bits and reverse it */ - val = bitreverse(~crc & 0xff); - if (sc->mactype == DWC_GMAC_ALT_DESC) - val >>= nhash; /* Only need lower 6 bits */ - hashreg = (val >> 5); - hashbit = (val & 31); - hash[hashreg] |= (1 << hashbit); - } - if_maddr_runlock(ifp); + ctx.hash[i] = 0; + ctx.sc = sc; + if_foreach_llmaddr(ifp, dwc_hash_maddr, &ctx); } /* @@ -641,11 +651,11 @@ dwc_setup_rxfilter(struct dwc_softc *sc) WRITE4(sc, MAC_ADDRESS_HIGH(0), hi); WRITE4(sc, MAC_FRAME_FILTER, ffval); if (sc->mactype == DWC_GMAC_ALT_DESC) { - WRITE4(sc, GMAC_MAC_HTLOW, hash[0]); - WRITE4(sc, GMAC_MAC_HTHIGH, hash[1]); + WRITE4(sc, GMAC_MAC_HTLOW, ctx.hash[0]); + WRITE4(sc, GMAC_MAC_HTHIGH, ctx.hash[1]); } else { for (i = 0; i < nhash; i++) - WRITE4(sc, HASH_TABLE_REG(i), hash[i]); + WRITE4(sc, HASH_TABLE_REG(i), ctx.hash[i]); } } From owner-svn-src-all@freebsd.org Mon Oct 21 18:11:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7727715E0EA; Mon, 21 Oct 2019 18:11:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8024LTz4d5G; Mon, 21 Oct 2019 18:11:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0E98427BCD; Mon, 21 Oct 2019 18:11:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBOSY068264; Mon, 21 Oct 2019 18:11:24 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBOwE068263; Mon, 21 Oct 2019 18:11:24 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBOwE068263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353844 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 353844 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:28 -0000 Author: glebius Date: Mon Oct 21 18:11:24 2019 New Revision: 353844 URL: https://svnweb.freebsd.org/changeset/base/353844 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Mon Oct 21 18:11:19 2019 (r353843) +++ head/sys/dev/e1000/if_em.c Mon Oct 21 18:11:24 2019 (r353844) @@ -1655,7 +1655,7 @@ em_disable_promisc(if_ctx_t ctx) if (if_getflags(ifp) & IFF_ALLMULTI) mcnt = MAX_NUM_MULTICAST_ADDRESSES; else - mcnt = if_multiaddr_count(ifp, MAX_NUM_MULTICAST_ADDRESSES); + mcnt = if_llmaddr_count(ifp); /* Don't disable if in MAX groups */ if (mcnt < MAX_NUM_MULTICAST_ADDRESSES) reg_rctl &= (~E1000_RCTL_MPE); @@ -1664,6 +1664,19 @@ em_disable_promisc(if_ctx_t ctx) } +static u_int +em_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + u8 *mta = arg; + + if (cnt == MAX_NUM_MULTICAST_ADDRESSES) + return (1); + + bcopy(LLADDR(sdl), &mta[cnt * ETH_ADDR_LEN], ETH_ADDR_LEN); + + return (1); +} + /********************************************************************* * Multicast Update * @@ -1695,7 +1708,7 @@ em_if_multi_set(if_ctx_t ctx) msec_delay(5); } - if_multiaddr_array(ifp, mta, &mcnt, MAX_NUM_MULTICAST_ADDRESSES); + mcnt = if_foreach_llmaddr(ifp, em_copy_maddr, mta); if (mcnt >= MAX_NUM_MULTICAST_ADDRESSES) { reg_rctl = E1000_READ_REG(&adapter->hw, E1000_RCTL); From owner-svn-src-all@freebsd.org Mon Oct 21 18:11:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B81BD15E101; Mon, 21 Oct 2019 18:11:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl812PWgz4d5Y; Mon, 21 Oct 2019 18:11:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E049327BD3; Mon, 21 Oct 2019 18:11:28 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBS0Q068311; Mon, 21 Oct 2019 18:11:28 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBSjG068310; Mon, 21 Oct 2019 18:11:28 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBSjG068310@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353845 - head/sys/dev/et X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/et X-SVN-Commit-Revision: 353845 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:29 -0000 Author: glebius Date: Mon Oct 21 18:11:28 2019 New Revision: 353845 URL: https://svnweb.freebsd.org/changeset/base/353845 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/et/if_et.c Modified: head/sys/dev/et/if_et.c ============================================================================== --- head/sys/dev/et/if_et.c Mon Oct 21 18:11:24 2019 (r353844) +++ head/sys/dev/et/if_et.c Mon Oct 21 18:11:28 2019 (r353845) @@ -1560,13 +1560,36 @@ et_free_rx_ring(struct et_softc *sc) } } +static u_int +et_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t h, *hp, *hash = arg; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + h = (h & 0x3f800000) >> 23; + + hp = &hash[0]; + if (h >= 32 && h < 64) { + h -= 32; + hp = &hash[1]; + } else if (h >= 64 && h < 96) { + h -= 64; + hp = &hash[2]; + } else if (h >= 96) { + h -= 96; + hp = &hash[3]; + } + *hp |= (1 << h); + + return (1); +} + static void et_setmulti(struct et_softc *sc) { struct ifnet *ifp; uint32_t hash[4] = { 0, 0, 0, 0 }; uint32_t rxmac_ctrl, pktfilt; - struct ifmultiaddr *ifma; int i, count; ET_LOCK_ASSERT(sc); @@ -1581,34 +1604,7 @@ et_setmulti(struct et_softc *sc) goto back; } - count = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - uint32_t *hp, h; - - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - h = (h & 0x3f800000) >> 23; - - hp = &hash[0]; - if (h >= 32 && h < 64) { - h -= 32; - hp = &hash[1]; - } else if (h >= 64 && h < 96) { - h -= 64; - hp = &hash[2]; - } else if (h >= 96) { - h -= 96; - hp = &hash[3]; - } - *hp |= (1 << h); - - ++count; - } - if_maddr_runlock(ifp); + count = if_foreach_llmaddr(ifp, et_hash_maddr, &hash); for (i = 0; i < 4; ++i) CSR_WRITE_4(sc, ET_MULTI_HASH + (i * 4), hash[i]); From owner-svn-src-all@freebsd.org Mon Oct 21 18:11:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2A26715E12E; Mon, 21 Oct 2019 18:11:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl856Gk0z4d9L; Mon, 21 Oct 2019 18:11:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5B0E127BD6; Mon, 21 Oct 2019 18:11:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBXAl068361; Mon, 21 Oct 2019 18:11:33 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBXrV068360; Mon, 21 Oct 2019 18:11:33 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBXrV068360@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353846 - head/sys/dev/ffec X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/ffec X-SVN-Commit-Revision: 353846 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:34 -0000 Author: glebius Date: Mon Oct 21 18:11:32 2019 New Revision: 353846 URL: https://svnweb.freebsd.org/changeset/base/353846 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/ffec/if_ffec.c Modified: head/sys/dev/ffec/if_ffec.c ============================================================================== --- head/sys/dev/ffec/if_ffec.c Mon Oct 21 18:11:28 2019 (r353845) +++ head/sys/dev/ffec/if_ffec.c Mon Oct 21 18:11:32 2019 (r353846) @@ -974,13 +974,24 @@ ffec_get_hwaddr(struct ffec_softc *sc, uint8_t *hwaddr } } +static u_int +ffec_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint64_t *ghash = arg; + uint32_t crc; + + /* 6 bits from MSB in LE CRC32 are used for hash. */ + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN); + *ghash |= 1LLU << (((uint8_t *)&crc)[3] >> 2); + + return (1); +} + static void ffec_setup_rxfilter(struct ffec_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; uint8_t *eaddr; - uint32_t crc; uint64_t ghash, ihash; FFEC_ASSERT_LOCKED(sc); @@ -994,16 +1005,7 @@ ffec_setup_rxfilter(struct ffec_softc *sc) ghash = 0xffffffffffffffffLLU; else { ghash = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - /* 6 bits from MSB in LE CRC32 are used for hash. */ - crc = ether_crc32_le(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - ghash |= 1LLU << (((uint8_t *)&crc)[3] >> 2); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, ffec_hash_maddr, &ghash); } WR4(sc, FEC_GAUR_REG, (uint32_t)(ghash >> 32)); WR4(sc, FEC_GALR_REG, (uint32_t)ghash); From owner-svn-src-all@freebsd.org Mon Oct 21 18:11:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2094915E15D; Mon, 21 Oct 2019 18:11:39 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8B5kQTz4dKB; Mon, 21 Oct 2019 18:11:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9C44727BDD; Mon, 21 Oct 2019 18:11:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBcMF068411; Mon, 21 Oct 2019 18:11:38 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBcpK068410; Mon, 21 Oct 2019 18:11:38 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBcpK068410@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353847 - head/sys/dev/if_ndis X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/if_ndis X-SVN-Commit-Revision: 353847 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:39 -0000 Author: glebius Date: Mon Oct 21 18:11:38 2019 New Revision: 353847 URL: https://svnweb.freebsd.org/changeset/base/353847 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/if_ndis/if_ndis.c Modified: head/sys/dev/if_ndis/if_ndis.c ============================================================================== --- head/sys/dev/if_ndis/if_ndis.c Mon Oct 21 18:11:32 2019 (r353846) +++ head/sys/dev/if_ndis/if_ndis.c Mon Oct 21 18:11:38 2019 (r353847) @@ -282,6 +282,22 @@ ndisdrv_modevent(mod, cmd, arg) return (error); } +struct mclist_ctx { + uint8_t *mclist; + int mclistsz; +}; + +static u_int +ndis_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct mclist_ctx *ctx = arg; + + if (cnt < ctx->mclistsz) + bcopy(LLADDR(sdl), ctx->mclist + (ETHER_ADDR_LEN * cnt), + ETHER_ADDR_LEN); + return (1); +} + /* * Program the 64-bit multicast hash filter. */ @@ -290,9 +306,8 @@ ndis_setmulti(sc) struct ndis_softc *sc; { struct ifnet *ifp; - struct ifmultiaddr *ifma; - int len, mclistsz, error; - uint8_t *mclist; + struct mclist_ctx ctx; + int len, error; if (!NDIS_INITIALIZED(sc)) @@ -313,40 +328,31 @@ ndis_setmulti(sc) return; } - if (CK_STAILQ_EMPTY(&ifp->if_multiaddrs)) + if (if_llmaddr_count(ifp) == 0) return; - len = sizeof(mclistsz); - ndis_get_info(sc, OID_802_3_MAXIMUM_LIST_SIZE, &mclistsz, &len); + len = sizeof(ctx.mclistsz); + ndis_get_info(sc, OID_802_3_MAXIMUM_LIST_SIZE, &ctx.mclistsz, &len); - mclist = malloc(ETHER_ADDR_LEN * mclistsz, M_TEMP, M_NOWAIT|M_ZERO); + ctx.mclist = malloc(ETHER_ADDR_LEN * ctx.mclistsz, M_TEMP, + M_NOWAIT | M_ZERO); - if (mclist == NULL) { + if (ctx.mclist == NULL) { sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; goto out; } sc->ndis_filter |= NDIS_PACKET_TYPE_MULTICAST; - len = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - mclist + (ETHER_ADDR_LEN * len), ETHER_ADDR_LEN); - len++; - if (len > mclistsz) { - if_maddr_runlock(ifp); - sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; - sc->ndis_filter &= ~NDIS_PACKET_TYPE_MULTICAST; + len = if_foreach_llmaddr(ifp, ndis_copy_maddr, &ctx); + if (len > ctx.mclistsz) { + sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; + sc->ndis_filter &= ~NDIS_PACKET_TYPE_MULTICAST; goto out; - } } - if_maddr_runlock(ifp); len = len * ETHER_ADDR_LEN; - error = ndis_set_info(sc, OID_802_3_MULTICAST_LIST, mclist, &len); + error = ndis_set_info(sc, OID_802_3_MULTICAST_LIST, ctx.mclist, &len); if (error) { device_printf(sc->ndis_dev, "set mclist failed: %d\n", error); sc->ndis_filter |= NDIS_PACKET_TYPE_ALL_MULTICAST; @@ -354,7 +360,7 @@ ndis_setmulti(sc) } out: - free(mclist, M_TEMP); + free(ctx.mclist, M_TEMP); len = sizeof(sc->ndis_filter); error = ndis_set_info(sc, OID_GEN_CURRENT_PACKET_FILTER, From owner-svn-src-all@freebsd.org Mon Oct 21 18:11:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B8EF615E193; Mon, 21 Oct 2019 18:11:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8K0Y01z4dVq; Mon, 21 Oct 2019 18:11:45 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2CF9C27BE3; Mon, 21 Oct 2019 18:11:44 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBhCf069589; Mon, 21 Oct 2019 18:11:43 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBhea069573; Mon, 21 Oct 2019 18:11:43 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBhea069573@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353848 - head/sys/dev/jme X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/jme X-SVN-Commit-Revision: 353848 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:45 -0000 Author: glebius Date: Mon Oct 21 18:11:43 2019 New Revision: 353848 URL: https://svnweb.freebsd.org/changeset/base/353848 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/jme/if_jme.c Modified: head/sys/dev/jme/if_jme.c ============================================================================== --- head/sys/dev/jme/if_jme.c Mon Oct 21 18:11:38 2019 (r353847) +++ head/sys/dev/jme/if_jme.c Mon Oct 21 18:11:43 2019 (r353848) @@ -3236,12 +3236,26 @@ jme_set_vlan(struct jme_softc *sc) CSR_WRITE_4(sc, JME_RXMAC, reg); } +static u_int +jme_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, *mchash = arg; + + crc = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); + + /* Just want the 6 least significant bits. */ + crc &= 0x3f; + + /* Set the corresponding bit in the hash table. */ + mchash[crc >> 5] |= 1 << (crc & 0x1f); + + return (1); +} + static void jme_set_filter(struct jme_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t crc; uint32_t mchash[2]; uint32_t rxcfg; @@ -3276,21 +3290,7 @@ jme_set_filter(struct jme_softc *sc) */ rxcfg |= RXMAC_MULTICAST; bzero(mchash, sizeof(mchash)); - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->jme_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN); - - /* Just want the 6 least significant bits. */ - crc &= 0x3f; - - /* Set the corresponding bit in the hash table. */ - mchash[crc >> 5] |= 1 << (crc & 0x1f); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, jme_hash_maddr, &mchash); CSR_WRITE_4(sc, JME_MAR0, mchash[0]); CSR_WRITE_4(sc, JME_MAR1, mchash[1]); From owner-svn-src-all@freebsd.org Mon Oct 21 18:11:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A43DE15E1C7; Mon, 21 Oct 2019 18:11:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8P3C6lz4dY0; Mon, 21 Oct 2019 18:11:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 404B527BEA; Mon, 21 Oct 2019 18:11:49 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBnJ4070756; Mon, 21 Oct 2019 18:11:49 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBn28070755; Mon, 21 Oct 2019 18:11:49 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBn28070755@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353849 - head/sys/dev/liquidio X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/liquidio X-SVN-Commit-Revision: 353849 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:49 -0000 Author: glebius Date: Mon Oct 21 18:11:48 2019 New Revision: 353849 URL: https://svnweb.freebsd.org/changeset/base/353849 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/liquidio/lio_ioctl.c Modified: head/sys/dev/liquidio/lio_ioctl.c ============================================================================== --- head/sys/dev/liquidio/lio_ioctl.c Mon Oct 21 18:11:43 2019 (r353848) +++ head/sys/dev/liquidio/lio_ioctl.c Mon Oct 21 18:11:48 2019 (r353849) @@ -491,6 +491,22 @@ lio_get_new_flags(struct ifnet *ifp) return (f); } +static u_int +lio_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint64_t *mc = arg; + + if (cnt == LIO_MAX_MULTICAST_ADDR) + return (0); + + mc += cnt; + *mc = 0; + memcpy(((uint8_t *)mc) + 2, LLADDR(sdl), ETHER_ADDR_LEN); + /* no need to swap bytes */ + + return (1); +} + /* @param ifp network device */ static int lio_set_mcast_list(struct ifnet *ifp) @@ -498,9 +514,7 @@ lio_set_mcast_list(struct ifnet *ifp) struct lio *lio = if_getsoftc(ifp); struct octeon_device *oct = lio->oct_dev; struct lio_ctrl_pkt nctrl; - struct ifmultiaddr *ifma; - uint64_t *mc; - int mc_count = 0; + int mc_count; int ret; bzero(&nctrl, sizeof(struct lio_ctrl_pkt)); @@ -514,26 +528,7 @@ lio_set_mcast_list(struct ifnet *ifp) nctrl.cb_fn = lio_ctrl_cmd_completion; /* copy all the addresses into the udd */ - mc = &nctrl.udd[0]; - - /* to protect access to if_multiaddrs */ - if_maddr_rlock(ifp); - - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - *mc = 0; - memcpy(((uint8_t *)mc) + 2, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - ETHER_ADDR_LEN); - /* no need to swap bytes */ - - mc_count++; - if (++mc > &nctrl.udd[LIO_MAX_MULTICAST_ADDR]) - break; - } - - if_maddr_runlock(ifp); + mc_count = if_foreach_llmaddr(ifp, lio_copy_maddr, &nctrl.udd[0]); /* * Apparently, any activity in this call from the kernel has to From owner-svn-src-all@freebsd.org Mon Oct 21 18:11:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC64A15E1F6; Mon, 21 Oct 2019 18:11:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8W0szFz4dfs; Mon, 21 Oct 2019 18:11:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C375427CD0; Mon, 21 Oct 2019 18:11:54 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBssV072315; Mon, 21 Oct 2019 18:11:54 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBscd072314; Mon, 21 Oct 2019 18:11:54 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBscd072314@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353850 - head/sys/dev/malo X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/malo X-SVN-Commit-Revision: 353850 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:55 -0000 Author: glebius Date: Mon Oct 21 18:11:54 2019 New Revision: 353850 URL: https://svnweb.freebsd.org/changeset/base/353850 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/malo/if_malo.c Modified: head/sys/dev/malo/if_malo.c ============================================================================== --- head/sys/dev/malo/if_malo.c Mon Oct 21 18:11:48 2019 (r353849) +++ head/sys/dev/malo/if_malo.c Mon Oct 21 18:11:54 2019 (r353850) @@ -1510,49 +1510,46 @@ malo_init(void *arg) ieee80211_start_all(ic); /* start all vap's */ } +struct malo_copy_maddr_ctx { + uint8_t macs[IEEE80211_ADDR_LEN * MALO_HAL_MCAST_MAX]; + int nmc; +}; + +static u_int +malo_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int nmc) +{ + struct malo_copy_maddr_ctx *ctx = arg; + + if (ctx->nmc == MALO_HAL_MCAST_MAX) + return (0); + + IEEE80211_ADDR_COPY(ctx->macs + (ctx->nmc * IEEE80211_ADDR_LEN), + LLADDR(sdl)); + ctx->nmc++; + + return (1); +} + /* * Set the multicast filter contents into the hardware. */ static void malo_setmcastfilter(struct malo_softc *sc) { + struct malo_copy_maddr_ctx ctx; struct ieee80211com *ic = &sc->malo_ic; struct ieee80211vap *vap; - uint8_t macs[IEEE80211_ADDR_LEN * MALO_HAL_MCAST_MAX]; - uint8_t *mp; - int nmc; - mp = macs; - nmc = 0; if (ic->ic_opmode == IEEE80211_M_MONITOR || ic->ic_allmulti > 0 || ic->ic_promisc > 0) goto all; - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - struct ifnet *ifp; - struct ifmultiaddr *ifma; + ctx.nmc = 0; + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + if_foreach_llmaddr(vap->iv_ifp, malo_copy_maddr, &ctx); - ifp = vap->iv_ifp; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (nmc == MALO_HAL_MCAST_MAX) { - ifp->if_flags |= IFF_ALLMULTI; - if_maddr_runlock(ifp); - goto all; - } - IEEE80211_ADDR_COPY(mp, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - - mp += IEEE80211_ADDR_LEN, nmc++; - } - if_maddr_runlock(ifp); - } - - malo_hal_setmcast(sc->malo_mh, nmc, macs); + malo_hal_setmcast(sc->malo_mh, ctx.nmc, ctx.macs); all: /* From owner-svn-src-all@freebsd.org Mon Oct 21 18:11:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EDF1415E228; Mon, 21 Oct 2019 18:11:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8Z5MFqz4dn0; Mon, 21 Oct 2019 18:11:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8F6F427CF7; Mon, 21 Oct 2019 18:11:58 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIBw2i072365; Mon, 21 Oct 2019 18:11:58 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIBw87072364; Mon, 21 Oct 2019 18:11:58 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211811.x9LIBw87072364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:11:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353851 - head/sys/dev/my X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/my X-SVN-Commit-Revision: 353851 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:11:59 -0000 Author: glebius Date: Mon Oct 21 18:11:58 2019 New Revision: 353851 URL: https://svnweb.freebsd.org/changeset/base/353851 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/my/if_my.c Modified: head/sys/dev/my/if_my.c ============================================================================== --- head/sys/dev/my/if_my.c Mon Oct 21 18:11:54 2019 (r353850) +++ head/sys/dev/my/if_my.c Mon Oct 21 18:11:58 2019 (r353851) @@ -304,7 +304,20 @@ my_phy_writereg(struct my_softc * sc, int reg, int dat return; } +static u_int +my_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *hashes = arg; + int h; + h = ~ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + if (h < 32) + hashes[0] |= (1 << h); + else + hashes[1] |= (1 << (h - 32)); + + return (1); +} /* * Program the 64-bit multicast hash filter. */ @@ -312,11 +325,8 @@ static void my_setmulti(struct my_softc * sc) { struct ifnet *ifp; - int h = 0; u_int32_t hashes[2] = {0, 0}; - struct ifmultiaddr *ifma; u_int32_t rxfilt; - int mcnt = 0; MY_LOCK_ASSERT(sc); @@ -337,28 +347,13 @@ my_setmulti(struct my_softc * sc) CSR_WRITE_4(sc, MY_MAR1, 0); /* now program new ones */ - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ~ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - if (h < 32) - hashes[0] |= (1 << h); - else - hashes[1] |= (1 << (h - 32)); - mcnt++; - } - if_maddr_runlock(ifp); - - if (mcnt) + if (if_foreach_llmaddr(ifp, my_hash_maddr, hashes) > 0) rxfilt |= MY_AM; else rxfilt &= ~MY_AM; CSR_WRITE_4(sc, MY_MAR0, hashes[0]); CSR_WRITE_4(sc, MY_MAR1, hashes[1]); CSR_WRITE_4(sc, MY_TCRRCR, rxfilt); - return; } /* From owner-svn-src-all@freebsd.org Mon Oct 21 18:12:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 025C215E256; Mon, 21 Oct 2019 18:12:05 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8h4FHFz4dvK; Mon, 21 Oct 2019 18:12:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6DDFE27D03; Mon, 21 Oct 2019 18:12:03 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIC37o072419; Mon, 21 Oct 2019 18:12:03 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIC3XM072418; Mon, 21 Oct 2019 18:12:03 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LIC3XM072418@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353852 - head/sys/dev/oce X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/oce X-SVN-Commit-Revision: 353852 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:05 -0000 Author: glebius Date: Mon Oct 21 18:12:02 2019 New Revision: 353852 URL: https://svnweb.freebsd.org/changeset/base/353852 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/oce/oce_hw.c Modified: head/sys/dev/oce/oce_hw.c ============================================================================== --- head/sys/dev/oce/oce_hw.c Mon Oct 21 18:11:58 2019 (r353851) +++ head/sys/dev/oce/oce_hw.c Mon Oct 21 18:12:02 2019 (r353852) @@ -544,7 +544,21 @@ oce_hw_intr_disable(POCE_SOFTC sc) } +static u_int +oce_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct mbx_set_common_iface_multicast *req = arg; + if (req->params.req.num_mac == OCE_MAX_MC_FILTER_SIZE) + return (0); + + bcopy(LLADDR(sdl), &req->params.req.mac[req->params.req.num_mac++], + ETH_ADDR_LEN); + + return (1); +} + + /** * @brief Function for hardware update multicast filter * @param sc software handle to the device @@ -553,7 +567,6 @@ int oce_hw_update_multicast(POCE_SOFTC sc) { struct ifnet *ifp = sc->ifp; - struct ifmultiaddr *ifma; struct mbx_set_common_iface_multicast *req = NULL; OCE_DMA_MEM dma; int rc = 0; @@ -566,29 +579,15 @@ oce_hw_update_multicast(POCE_SOFTC sc) req = OCE_DMAPTR(&dma, struct mbx_set_common_iface_multicast); bzero(req, sizeof(struct mbx_set_common_iface_multicast)); -#if __FreeBSD_version > 800000 - if_maddr_rlock(ifp); -#endif - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (req->params.req.num_mac == OCE_MAX_MC_FILTER_SIZE) { - /*More multicast addresses than our hardware table - So Enable multicast promiscus in our hardware to - accept all multicat packets - */ - req->params.req.promiscuous = 1; - break; - } - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - &req->params.req.mac[req->params.req.num_mac], - ETH_ADDR_LEN); - req->params.req.num_mac = req->params.req.num_mac + 1; + if_foreach_llmaddr(ifp, oce_copy_maddr, req); + if (req->params.req.num_mac == OCE_MAX_MC_FILTER_SIZE) { + /*More multicast addresses than our hardware table + So Enable multicast promiscus in our hardware to + accept all multicat packets + */ + req->params.req.promiscuous = 1; } -#if __FreeBSD_version > 800000 - if_maddr_runlock(ifp); -#endif + req->params.req.if_id = sc->if_id; rc = oce_update_multicast(sc, &dma); oce_dma_free(sc, &dma); From owner-svn-src-all@freebsd.org Mon Oct 21 18:12:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4EDB715E27E; Mon, 21 Oct 2019 18:12:09 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8m6VYpz4f2c; Mon, 21 Oct 2019 18:12:08 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9D28827D09; Mon, 21 Oct 2019 18:12:07 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIC7Iu072466; Mon, 21 Oct 2019 18:12:07 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIC7gl072465; Mon, 21 Oct 2019 18:12:07 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LIC7gl072465@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353853 - head/sys/dev/otus X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/otus X-SVN-Commit-Revision: 353853 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:09 -0000 Author: glebius Date: Mon Oct 21 18:12:07 2019 New Revision: 353853 URL: https://svnweb.freebsd.org/changeset/base/353853 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/otus/if_otus.c Modified: head/sys/dev/otus/if_otus.c ============================================================================== --- head/sys/dev/otus/if_otus.c Mon Oct 21 18:12:02 2019 (r353852) +++ head/sys/dev/otus/if_otus.c Mon Oct 21 18:12:07 2019 (r353853) @@ -2308,63 +2308,63 @@ otus_tx(struct otus_softc *sc, struct ieee80211_node * return 0; } +static u_int +otus_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t val, *hashes = arg; + + val = le32dec(LLADDR(sdl) + 4); + /* Get address byte 5 */ + val = val & 0x0000ff00; + val = val >> 8; + + /* As per below, shift it >> 2 to get only 6 bits */ + val = val >> 2; + if (val < 32) + hashes[0] |= 1 << val; + else + hashes[1] |= 1 << (val - 32); + + return (1); +} + + int otus_set_multi(struct otus_softc *sc) { - uint32_t lo, hi; struct ieee80211com *ic = &sc->sc_ic; + uint32_t hashes[2]; int r; if (ic->ic_allmulti > 0 || ic->ic_promisc > 0 || ic->ic_opmode == IEEE80211_M_MONITOR) { - lo = 0xffffffff; - hi = 0xffffffff; + hashes[0] = 0xffffffff; + hashes[1] = 0xffffffff; } else { struct ieee80211vap *vap; - struct ifnet *ifp; - struct ifmultiaddr *ifma; - lo = hi = 0; - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - ifp = vap->iv_ifp; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - caddr_t dl; - uint32_t val; - - dl = LLADDR((struct sockaddr_dl *) ifma->ifma_addr); - val = le32dec(dl + 4); - /* Get address byte 5 */ - val = val & 0x0000ff00; - val = val >> 8; - - /* As per below, shift it >> 2 to get only 6 bits */ - val = val >> 2; - if (val < 32) - lo |= 1 << val; - else - hi |= 1 << (val - 32); - } - if_maddr_runlock(ifp); - } + hashes[0] = hashes[1] = 0; + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + if_foreach_llmaddr(vap->iv_ifp, otus_hash_maddr, + hashes); } #if 0 /* XXX openbsd code */ while (enm != NULL) { bit = enm->enm_addrlo[5] >> 2; if (bit < 32) - lo |= 1 << bit; + hashes[0] |= 1 << bit; else - hi |= 1 << (bit - 32); + hashes[1] |= 1 << (bit - 32); ETHER_NEXT_MULTI(step, enm); } #endif - hi |= 1U << 31; /* Make sure the broadcast bit is set. */ + hashes[1] |= 1U << 31; /* Make sure the broadcast bit is set. */ OTUS_LOCK(sc); - otus_write(sc, AR_MAC_REG_GROUP_HASH_TBL_L, lo); - otus_write(sc, AR_MAC_REG_GROUP_HASH_TBL_H, hi); + otus_write(sc, AR_MAC_REG_GROUP_HASH_TBL_L, hashes[0]); + otus_write(sc, AR_MAC_REG_GROUP_HASH_TBL_H, hashes[1]); r = otus_write_barrier(sc); /* XXX operating mode? filter? */ OTUS_UNLOCK(sc); From owner-svn-src-all@freebsd.org Mon Oct 21 18:12:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 472D315E2A4; Mon, 21 Oct 2019 18:12:13 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8r5YFpz4f6b; Mon, 21 Oct 2019 18:12:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F56B27D10; Mon, 21 Oct 2019 18:12:12 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICCRT072516; Mon, 21 Oct 2019 18:12:12 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICC5d072515; Mon, 21 Oct 2019 18:12:12 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICC5d072515@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353854 - head/sys/dev/qlnx/qlnxe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/qlnx/qlnxe X-SVN-Commit-Revision: 353854 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:13 -0000 Author: glebius Date: Mon Oct 21 18:12:12 2019 New Revision: 353854 URL: https://svnweb.freebsd.org/changeset/base/353854 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c Modified: head/sys/dev/qlnx/qlnxe/qlnx_os.c ============================================================================== --- head/sys/dev/qlnx/qlnxe/qlnx_os.c Mon Oct 21 18:12:07 2019 (r353853) +++ head/sys/dev/qlnx/qlnxe/qlnx_os.c Mon Oct 21 18:12:12 2019 (r353854) @@ -2644,42 +2644,36 @@ qlnx_hw_set_multi(qlnx_host_t *ha, uint8_t *mta, uint3 } -#define QLNX_MCAST_ADDRS_SIZE (QLNX_MAX_NUM_MULTICAST_ADDRS * ETHER_HDR_LEN) -static int -qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi) +static u_int +qlnx_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt) { - uint8_t mta[QLNX_MCAST_ADDRS_SIZE]; - struct ifmultiaddr *ifma; - int mcnt = 0; - struct ifnet *ifp = ha->ifp; - int ret = 0; + uint8_t *mta = arg; - if (qlnx_vf_device(ha) == 0) + if (mcnt == QLNX_MAX_NUM_MULTICAST_ADDRS) return (0); - if_maddr_rlock(ifp); + bcopy(LLADDR(sdl), &mta[mcnt * ETHER_HDR_LEN], ETHER_HDR_LEN); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { + return (1); +} - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; +static int +qlnx_set_multi(qlnx_host_t *ha, uint32_t add_multi) +{ + uint8_t mta[QLNX_MAX_NUM_MULTICAST_ADDRS * ETHER_HDR_LEN]; + struct ifnet *ifp = ha->ifp; + u_int mcnt; - if (mcnt == QLNX_MAX_NUM_MULTICAST_ADDRS) - break; + if (qlnx_vf_device(ha) == 0) + return (0); - bcopy(LLADDR((struct sockaddr_dl *) ifma->ifma_addr), - &mta[mcnt * ETHER_HDR_LEN], ETHER_HDR_LEN); + mcnt = if_foreach_llmaddr(ifp, qlnx_copy_maddr, mta); - mcnt++; - } - - if_maddr_runlock(ifp); - QLNX_LOCK(ha); qlnx_hw_set_multi(ha, mta, mcnt, add_multi); QLNX_UNLOCK(ha); - return (ret); + return (0); } static int From owner-svn-src-all@freebsd.org Mon Oct 21 18:12:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9BEBC15E2CD; Mon, 21 Oct 2019 18:12:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl8y1brxz4fGW; Mon, 21 Oct 2019 18:12:18 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB89A27D1A; Mon, 21 Oct 2019 18:12:17 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICHlR072567; Mon, 21 Oct 2019 18:12:17 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICHXk072566; Mon, 21 Oct 2019 18:12:17 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICHXk072566@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353855 - head/sys/dev/qlxgb X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/qlxgb X-SVN-Commit-Revision: 353855 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:18 -0000 Author: glebius Date: Mon Oct 21 18:12:17 2019 New Revision: 353855 URL: https://svnweb.freebsd.org/changeset/base/353855 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/qlxgb/qla_os.c Modified: head/sys/dev/qlxgb/qla_os.c ============================================================================== --- head/sys/dev/qlxgb/qla_os.c Mon Oct 21 18:12:12 2019 (r353854) +++ head/sys/dev/qlxgb/qla_os.c Mon Oct 21 18:12:17 2019 (r353855) @@ -763,32 +763,26 @@ qla_init(void *arg) QL_DPRINT2((ha->pci_dev, "%s: exit\n", __func__)); } +static u_int +qla_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt) +{ + uint8_t *mta = arg; + + if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS) + return (0); + bcopy(LLADDR(sdl), &mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN); + + return (1); +} + static void qla_set_multi(qla_host_t *ha, uint32_t add_multi) { uint8_t mta[Q8_MAX_NUM_MULTICAST_ADDRS * Q8_MAC_ADDR_LEN]; - struct ifmultiaddr *ifma; - int mcnt = 0; struct ifnet *ifp = ha->ifp; + int mcnt; - if_maddr_rlock(ifp); - - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS) - break; - - bcopy(LLADDR((struct sockaddr_dl *) ifma->ifma_addr), - &mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN); - - mcnt++; - } - - if_maddr_runlock(ifp); - + mcnt = if_foreach_llmaddr(ifp, qla_copy_maddr, mta); qla_hw_set_multi(ha, mta, mcnt, add_multi); return; From owner-svn-src-all@freebsd.org Mon Oct 21 18:12:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 484EA15E302; Mon, 21 Oct 2019 18:12:22 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl920lntz4fPH; Mon, 21 Oct 2019 18:12:22 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AA76F27D25; Mon, 21 Oct 2019 18:12:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICLJn072617; Mon, 21 Oct 2019 18:12:21 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICLE9072616; Mon, 21 Oct 2019 18:12:21 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICLE9072616@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353856 - head/sys/dev/qlxgbe X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/qlxgbe X-SVN-Commit-Revision: 353856 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:22 -0000 Author: glebius Date: Mon Oct 21 18:12:21 2019 New Revision: 353856 URL: https://svnweb.freebsd.org/changeset/base/353856 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/qlxgbe/ql_os.c Modified: head/sys/dev/qlxgbe/ql_os.c ============================================================================== --- head/sys/dev/qlxgbe/ql_os.c Mon Oct 21 18:12:17 2019 (r353855) +++ head/sys/dev/qlxgbe/ql_os.c Mon Oct 21 18:12:21 2019 (r353856) @@ -977,32 +977,28 @@ qla_init(void *arg) QL_DPRINT2(ha, (ha->pci_dev, "%s: exit\n", __func__)); } +static u_int +qla_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt) +{ + uint8_t *mta = arg; + + if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS) + return (0); + + bcopy(LLADDR(sdl), &mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN); + + return (1); +} + static int qla_set_multi(qla_host_t *ha, uint32_t add_multi) { uint8_t mta[Q8_MAX_NUM_MULTICAST_ADDRS * Q8_MAC_ADDR_LEN]; - struct ifmultiaddr *ifma; int mcnt = 0; struct ifnet *ifp = ha->ifp; int ret = 0; - if_maddr_rlock(ifp); - - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS) - break; - - bcopy(LLADDR((struct sockaddr_dl *) ifma->ifma_addr), - &mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN); - - mcnt++; - } - - if_maddr_runlock(ifp); + mcnt = if_foreach_llmaddr(ifp, qla_copy_maddr, mta); if (QLA_LOCK(ha, __func__, QLA_LOCK_DEFAULT_MS_TIMEOUT, QLA_LOCK_NO_SLEEP) != 0) From owner-svn-src-all@freebsd.org Mon Oct 21 18:12:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9D25215E336; Mon, 21 Oct 2019 18:12:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl9731m6z4fWM; Mon, 21 Oct 2019 18:12:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46B7827D30; Mon, 21 Oct 2019 18:12:27 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICR98072667; Mon, 21 Oct 2019 18:12:27 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICRg7072666; Mon, 21 Oct 2019 18:12:27 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICRg7072666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353857 - head/sys/dev/qlxge X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/qlxge X-SVN-Commit-Revision: 353857 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:27 -0000 Author: glebius Date: Mon Oct 21 18:12:26 2019 New Revision: 353857 URL: https://svnweb.freebsd.org/changeset/base/353857 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/qlxge/qls_os.c Modified: head/sys/dev/qlxge/qls_os.c ============================================================================== --- head/sys/dev/qlxge/qls_os.c Mon Oct 21 18:12:21 2019 (r353856) +++ head/sys/dev/qlxge/qls_os.c Mon Oct 21 18:12:26 2019 (r353857) @@ -835,31 +835,27 @@ qls_init(void *arg) QL_DPRINT2((ha->pci_dev, "%s: exit\n", __func__)); } +static u_int +qls_copy_maddr(void *arg, struct sockaddr_dl *sdl, u_int mcnt) +{ + uint8_t *mta = arg; + + if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS) + return (0); + + bcopy(LLADDR(sdl), &mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN); + + return (1); +} + static void qls_set_multi(qla_host_t *ha, uint32_t add_multi) { uint8_t mta[Q8_MAX_NUM_MULTICAST_ADDRS * Q8_MAC_ADDR_LEN]; - struct ifmultiaddr *ifma; - int mcnt = 0; struct ifnet *ifp = ha->ifp; + int mcnt; - if_maddr_rlock(ifp); - - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (mcnt == Q8_MAX_NUM_MULTICAST_ADDRS) - break; - - bcopy(LLADDR((struct sockaddr_dl *) ifma->ifma_addr), - &mta[mcnt * Q8_MAC_ADDR_LEN], Q8_MAC_ADDR_LEN); - - mcnt++; - } - - if_maddr_runlock(ifp); + mcnt = if_foreach_llmaddr(ifp, qls_copy_maddr, mta); if (QLA_LOCK(ha, __func__, 1) == 0) { qls_hw_set_multi(ha, mta, mcnt, add_multi); From owner-svn-src-all@freebsd.org Mon Oct 21 18:12:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D57515E361; Mon, 21 Oct 2019 18:12:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl9D2bqVz4fdW; Mon, 21 Oct 2019 18:12:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C0DF27D36; Mon, 21 Oct 2019 18:12:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICWR8072715; Mon, 21 Oct 2019 18:12:32 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICWSG072714; Mon, 21 Oct 2019 18:12:32 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICWSG072714@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353858 - head/sys/dev/rtwn X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/rtwn X-SVN-Commit-Revision: 353858 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:32 -0000 Author: glebius Date: Mon Oct 21 18:12:31 2019 New Revision: 353858 URL: https://svnweb.freebsd.org/changeset/base/353858 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/rtwn/if_rtwn_rx.c Modified: head/sys/dev/rtwn/if_rtwn_rx.c ============================================================================== --- head/sys/dev/rtwn/if_rtwn_rx.c Mon Oct 21 18:12:26 2019 (r353857) +++ head/sys/dev/rtwn/if_rtwn_rx.c Mon Oct 21 18:12:31 2019 (r353858) @@ -366,6 +366,18 @@ rtwn_get_multi_pos(const uint8_t maddr[]) return (pos); } +static u_int +rtwm_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t *mfilt = arg; + uint8_t pos; + + pos = rtwn_get_multi_pos(LLADDR(sdl)); + mfilt[pos / 32] |= (1 << (pos % 32)); + + return (1); +} + void rtwn_set_multi(struct rtwn_softc *sc) { @@ -377,28 +389,13 @@ rtwn_set_multi(struct rtwn_softc *sc) /* general structure was copied from ath(4). */ if (ic->ic_allmulti == 0) { struct ieee80211vap *vap; - struct ifnet *ifp; - struct ifmultiaddr *ifma; /* * Merge multicast addresses to form the hardware filter. */ mfilt[0] = mfilt[1] = 0; - TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - ifp = vap->iv_ifp; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - caddr_t dl; - uint8_t pos; - - dl = LLADDR((struct sockaddr_dl *) - ifma->ifma_addr); - pos = rtwn_get_multi_pos(dl); - - mfilt[pos / 32] |= (1 << (pos % 32)); - } - if_maddr_runlock(ifp); - } + TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) + if_foreach_llmaddr(vap->iv_ifp, rtwm_hash_maddr, mfilt); } else mfilt[0] = mfilt[1] = ~0; From owner-svn-src-all@freebsd.org Mon Oct 21 18:12:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4377915E38A; Mon, 21 Oct 2019 18:12:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl9J6CFzz4fm6; Mon, 21 Oct 2019 18:12:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A2E0227D37; Mon, 21 Oct 2019 18:12:36 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICakZ072766; Mon, 21 Oct 2019 18:12:36 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICaS8072765; Mon, 21 Oct 2019 18:12:36 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICaS8072765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353859 - head/sys/dev/tsec X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/tsec X-SVN-Commit-Revision: 353859 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:37 -0000 Author: glebius Date: Mon Oct 21 18:12:36 2019 New Revision: 353859 URL: https://svnweb.freebsd.org/changeset/base/353859 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/tsec/if_tsec.c Modified: head/sys/dev/tsec/if_tsec.c ============================================================================== --- head/sys/dev/tsec/if_tsec.c Mon Oct 21 18:12:31 2019 (r353858) +++ head/sys/dev/tsec/if_tsec.c Mon Oct 21 18:12:36 2019 (r353859) @@ -1886,13 +1886,22 @@ tsec_offload_process_frame(struct tsec_softc *sc, stru m_adj(m, sizeof(struct tsec_rx_fcb)); } +static u_int +tsec_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t h, *hashtable = arg; + + h = (ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 24) & 0xFF; + hashtable[(h >> 5)] |= 1 << (0x1F - (h & 0x1F)); + + return (1); +} + static void tsec_setup_multicast(struct tsec_softc *sc) { uint32_t hashtable[8] = { 0, 0, 0, 0, 0, 0, 0, 0 }; struct ifnet *ifp = sc->tsec_ifp; - struct ifmultiaddr *ifma; - uint32_t h; int i; TSEC_GLOBAL_LOCK_ASSERT(sc); @@ -1904,18 +1913,7 @@ tsec_setup_multicast(struct tsec_softc *sc) return; } - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - h = (ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 24) & 0xFF; - - hashtable[(h >> 5)] |= 1 << (0x1F - (h & 0x1F)); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, tsec_hash_maddr, &hashtable); for (i = 0; i < 8; i++) TSEC_WRITE(sc, TSEC_REG_GADDR(i), hashtable[i]); From owner-svn-src-all@freebsd.org Mon Oct 21 18:12:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A8EA15E3DB; Mon, 21 Oct 2019 18:12:42 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl9Q1nxJz4ft0; Mon, 21 Oct 2019 18:12:41 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDB4C27D38; Mon, 21 Oct 2019 18:12:40 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICe9k072818; Mon, 21 Oct 2019 18:12:40 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICerP072817; Mon, 21 Oct 2019 18:12:40 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICerP072817@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353860 - head/sys/dev/wi X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/wi X-SVN-Commit-Revision: 353860 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:12:42 -0000 Author: glebius Date: Mon Oct 21 18:12:40 2019 New Revision: 353860 URL: https://svnweb.freebsd.org/changeset/base/353860 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/wi/if_wi.c Modified: head/sys/dev/wi/if_wi.c ============================================================================== --- head/sys/dev/wi/if_wi.c Mon Oct 21 18:12:36 2019 (r353859) +++ head/sys/dev/wi/if_wi.c Mon Oct 21 18:12:40 2019 (r353860) @@ -1506,41 +1506,45 @@ finish: CSR_WRITE_2(sc, WI_EVENT_ACK, WI_EV_INFO); } +struct wi_mcast_ctx { + struct wi_mcast mlist; + int mcnt; +}; + +static u_int +wi_copy_mcast(void *arg, struct sockaddr_dl *sdl, u_int count) +{ + struct wi_mcast_ctx *ctx = arg; + + if (ctx->mcnt >= 16) + return (0); + IEEE80211_ADDR_COPY(&ctx->mlist.wi_mcast[ctx->mcnt++], LLADDR(sdl)); + + return (1); +} + static int wi_write_multi(struct wi_softc *sc) { struct ieee80211com *ic = &sc->sc_ic; struct ieee80211vap *vap; - struct wi_mcast mlist; - int n; + struct wi_mcast_ctx ctx; if (ic->ic_allmulti > 0 || ic->ic_promisc > 0) { allmulti: - memset(&mlist, 0, sizeof(mlist)); - return wi_write_rid(sc, WI_RID_MCAST_LIST, &mlist, - sizeof(mlist)); + memset(&ctx.mlist, 0, sizeof(ctx.mlist)); + return wi_write_rid(sc, WI_RID_MCAST_LIST, &ctx.mlist, + sizeof(ctx.mlist)); } - n = 0; + ctx.mcnt = 0; TAILQ_FOREACH(vap, &ic->ic_vaps, iv_next) { - struct ifnet *ifp; - struct ifmultiaddr *ifma; - - ifp = vap->iv_ifp; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - if (n >= 16) - goto allmulti; - IEEE80211_ADDR_COPY(&mlist.wi_mcast[n], - (LLADDR((struct sockaddr_dl *)ifma->ifma_addr))); - n++; - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(vap->iv_ifp, wi_copy_mcast, &ctx); + if (ctx.mcnt >= 16) + goto allmulti; } - return wi_write_rid(sc, WI_RID_MCAST_LIST, &mlist, - IEEE80211_ADDR_LEN * n); + return wi_write_rid(sc, WI_RID_MCAST_LIST, &ctx.mlist, + IEEE80211_ADDR_LEN * ctx.mcnt); } static void From owner-svn-src-all@freebsd.org Mon Oct 21 18:12:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0C9215E437; Mon, 21 Oct 2019 18:12:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xl9l5Mrbz4g8r; Mon, 21 Oct 2019 18:12:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0033627D39; Mon, 21 Oct 2019 18:12:59 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LICwpT072877; Mon, 21 Oct 2019 18:12:58 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LICw1T072876; Mon, 21 Oct 2019 18:12:58 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211812.x9LICw1T072876@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:12:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353861 - head/sys/dev/xilinx X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/dev/xilinx X-SVN-Commit-Revision: 353861 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:00 -0000 Author: glebius Date: Mon Oct 21 18:12:58 2019 New Revision: 353861 URL: https://svnweb.freebsd.org/changeset/base/353861 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/dev/xilinx/if_xae.c Modified: head/sys/dev/xilinx/if_xae.c ============================================================================== --- head/sys/dev/xilinx/if_xae.c Mon Oct 21 18:12:40 2019 (r353860) +++ head/sys/dev/xilinx/if_xae.c Mon Oct 21 18:12:58 2019 (r353861) @@ -514,14 +514,40 @@ xae_media_change(struct ifnet * ifp) return (error); } +static u_int +xae_write_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct xae_softc *sc = arg; + uint32_t reg; + uint8_t *ma; + + if (cnt >= XAE_MULTICAST_TABLE_SIZE) + return (1); + + ma = LLADDR(sdl); + + reg = READ4(sc, XAE_FFC) & 0xffffff00; + reg |= cnt; + WRITE4(sc, XAE_FFC, reg); + + reg = (ma[0]); + reg |= (ma[1] << 8); + reg |= (ma[2] << 16); + reg |= (ma[3] << 24); + WRITE4(sc, XAE_FFV(0), reg); + + reg = ma[4]; + reg |= ma[5] << 8; + WRITE4(sc, XAE_FFV(1), reg); + + return (1); +} + static void xae_setup_rxfilter(struct xae_softc *sc) { - struct ifmultiaddr *ifma; struct ifnet *ifp; uint32_t reg; - uint8_t *ma; - int i; XAE_ASSERT_LOCKED(sc); @@ -539,33 +565,7 @@ xae_setup_rxfilter(struct xae_softc *sc) reg &= ~FFC_PM; WRITE4(sc, XAE_FFC, reg); - if_maddr_rlock(ifp); - - i = 0; - CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (i >= XAE_MULTICAST_TABLE_SIZE) - break; - - ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - - reg = READ4(sc, XAE_FFC) & 0xffffff00; - reg |= i++; - WRITE4(sc, XAE_FFC, reg); - - reg = (ma[0]); - reg |= (ma[1] << 8); - reg |= (ma[2] << 16); - reg |= (ma[3] << 24); - WRITE4(sc, XAE_FFV(0), reg); - - reg = ma[4]; - reg |= ma[5] << 8; - WRITE4(sc, XAE_FFV(1), reg); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, xae_write_maddr, sc); } /* From owner-svn-src-all@freebsd.org Mon Oct 21 18:13:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CF5E15E476; Mon, 21 Oct 2019 18:13:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlB26JK8z4gHB; Mon, 21 Oct 2019 18:13:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A31A627D3A; Mon, 21 Oct 2019 18:13:14 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIDEdm072937; Mon, 21 Oct 2019 18:13:14 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIDE0P072936; Mon, 21 Oct 2019 18:13:14 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211813.x9LIDE0P072936@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:13:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353862 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 353862 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:15 -0000 Author: glebius Date: Mon Oct 21 18:13:14 2019 New Revision: 353862 URL: https://svnweb.freebsd.org/changeset/base/353862 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/arm/allwinner/if_awg.c Modified: head/sys/arm/allwinner/if_awg.c ============================================================================== --- head/sys/arm/allwinner/if_awg.c Mon Oct 21 18:12:58 2019 (r353861) +++ head/sys/arm/allwinner/if_awg.c Mon Oct 21 18:13:14 2019 (r353862) @@ -675,12 +675,25 @@ bitrev32(uint32_t x) return (x >> 16) | (x << 16); } +static u_int +awg_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t crc, hashreg, hashbit, *hash = arg; + + crc = ether_crc32_le(LLADDR(sdl), ETHER_ADDR_LEN) & 0x7f; + crc = bitrev32(~crc) >> 26; + hashreg = (crc >> 5); + hashbit = (crc & 0x1f); + hash[hashreg] |= (1 << hashbit); + + return (1); +} + static void awg_setup_rxfilter(struct awg_softc *sc) { - uint32_t val, crc, hashreg, hashbit, hash[2], machi, maclo; - int mc_count, mcnt, i; - uint8_t *eaddr, *mta; + uint32_t val, hash[2], machi, maclo; + uint8_t *eaddr; if_t ifp; AWG_ASSERT_LOCKED(sc); @@ -689,36 +702,13 @@ awg_setup_rxfilter(struct awg_softc *sc) val = 0; hash[0] = hash[1] = 0; - mc_count = if_multiaddr_count(ifp, -1); - if (if_getflags(ifp) & IFF_PROMISC) val |= DIS_ADDR_FILTER; else if (if_getflags(ifp) & IFF_ALLMULTI) { val |= RX_ALL_MULTICAST; hash[0] = hash[1] = ~0; - } else if (mc_count > 0) { + } else if (if_foreach_llmaddr(ifp, awg_hash_maddr, hash) > 0) val |= HASH_MULTICAST; - - mta = malloc(sizeof(unsigned char) * ETHER_ADDR_LEN * mc_count, - M_DEVBUF, M_NOWAIT); - if (mta == NULL) { - if_printf(ifp, - "failed to allocate temporary multicast list\n"); - return; - } - - if_multiaddr_array(ifp, mta, &mcnt, mc_count); - for (i = 0; i < mcnt; i++) { - crc = ether_crc32_le(mta + (i * ETHER_ADDR_LEN), - ETHER_ADDR_LEN) & 0x7f; - crc = bitrev32(~crc) >> 26; - hashreg = (crc >> 5); - hashbit = (crc & 0x1f); - hash[hashreg] |= (1 << hashbit); - } - - free(mta, M_DEVBUF); - } /* Write our unicast address */ eaddr = IF_LLADDR(ifp); From owner-svn-src-all@freebsd.org Mon Oct 21 18:13:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB35515E4A2; Mon, 21 Oct 2019 18:13:21 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlB84MgFz4gLL; Mon, 21 Oct 2019 18:13:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F44B27D3B; Mon, 21 Oct 2019 18:13:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIDJtU072989; Mon, 21 Oct 2019 18:13:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIDJ0F072988; Mon, 21 Oct 2019 18:13:19 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211813.x9LIDJ0F072988@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:13:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353863 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 353863 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:21 -0000 Author: glebius Date: Mon Oct 21 18:13:19 2019 New Revision: 353863 URL: https://svnweb.freebsd.org/changeset/base/353863 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/arm/allwinner/if_emac.c Modified: head/sys/arm/allwinner/if_emac.c ============================================================================== --- head/sys/arm/allwinner/if_emac.c Mon Oct 21 18:13:14 2019 (r353862) +++ head/sys/arm/allwinner/if_emac.c Mon Oct 21 18:13:19 2019 (r353863) @@ -218,12 +218,22 @@ emac_get_hwaddr(struct emac_softc *sc, uint8_t *hwaddr printf("MAC address: %s\n", ether_sprintf(hwaddr)); } +static u_int +emac_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint32_t h, *hashes = arg; + + h = ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN) >> 26; + hashes[h >> 5] |= 1 << (h & 0x1f); + + return (1); +} + static void emac_set_rx_mode(struct emac_softc *sc) { struct ifnet *ifp; - struct ifmultiaddr *ifma; - uint32_t h, hashes[2]; + uint32_t hashes[2]; uint32_t rcr = 0; EMAC_ASSERT_LOCKED(sc); @@ -241,17 +251,8 @@ emac_set_rx_mode(struct emac_softc *sc) if (ifp->if_flags & IFF_ALLMULTI) { hashes[0] = 0xffffffff; hashes[1] = 0xffffffff; - } else { - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &sc->emac_ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - h = ether_crc32_be(LLADDR((struct sockaddr_dl *) - ifma->ifma_addr), ETHER_ADDR_LEN) >> 26; - hashes[h >> 5] |= 1 << (h & 0x1f); - } - if_maddr_runlock(ifp); - } + } else + if_foreach_llmaddr(ifp, emac_hash_maddr, hashes); rcr |= EMAC_RX_MCO; rcr |= EMAC_RX_MHF; EMAC_WRITE_REG(sc, EMAC_RX_HASH0, hashes[0]); From owner-svn-src-all@freebsd.org Mon Oct 21 18:13:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58D0A15E4D8; Mon, 21 Oct 2019 18:13:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlBF0JFwz3Bq5; Mon, 21 Oct 2019 18:13:25 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B746327D3C; Mon, 21 Oct 2019 18:13:24 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIDOWK073039; Mon, 21 Oct 2019 18:13:24 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIDO1c073038; Mon, 21 Oct 2019 18:13:24 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211813.x9LIDO1c073038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:13:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353864 - head/sys/arm/ralink X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/arm/ralink X-SVN-Commit-Revision: 353864 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:25 -0000 Author: glebius Date: Mon Oct 21 18:13:24 2019 New Revision: 353864 URL: https://svnweb.freebsd.org/changeset/base/353864 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/arm/ralink/if_fv.c Modified: head/sys/arm/ralink/if_fv.c ============================================================================== --- head/sys/arm/ralink/if_fv.c Mon Oct 21 18:13:19 2019 (r353863) +++ head/sys/arm/ralink/if_fv.c Mon Oct 21 18:13:24 2019 (r353864) @@ -200,8 +200,25 @@ DRIVER_MODULE(fvmdio, simplebus, fvmdio_driver, fvmdio DRIVER_MODULE(mdio, fvmdio, mdio_driver, mdio_devclass, 0, 0); #endif -/* setup frame code refer dc code */ +static u_int +fv_set_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + uint16_t *sp = arg; + uint8_t *ma; + int i; + ma = LLADDR(sdl); + i = cnt * 6; + sp[i] = sp[i+1] = (ma[1] << 8 | ma[0]); + i += 2; + sp[i] = sp[i+1] = (ma[3] << 8 | ma[2]); + i += 2; + sp[i] = sp[i+1] = (ma[5] << 8 | ma[4]); + + return (1); +} + +/* setup frame code refer dc code */ static void fv_setfilt(struct fv_softc *sc) { @@ -209,9 +226,7 @@ fv_setfilt(struct fv_softc *sc) struct fv_desc *sframe; int i; struct ifnet *ifp; - struct ifmultiaddr *ifma; uint16_t *sp; - uint8_t *ma; ifp = sc->fv_ifp; @@ -225,20 +240,7 @@ fv_setfilt(struct fv_softc *sc) sframe->fv_addr = sc->fv_rdata.fv_sf_paddr; sframe->fv_devcs = ADCTL_Tx_SETUP | FV_DMASIZE(FV_SFRAME_LEN); - i = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - ma = LLADDR((struct sockaddr_dl *)ifma->ifma_addr); - sp[i] = sp[i+1] = (ma[1] << 8 | ma[0]); - i += 2; - sp[i] = sp[i+1] = (ma[3] << 8 | ma[2]); - i += 2; - sp[i] = sp[i+1] = (ma[5] << 8 | ma[4]); - i += 2; - } - if_maddr_runlock(ifp); + i = if_foreach_llmaddr(ifp, fv_set_maddr, sp) * 6; bcopy(IF_LLADDR(sc->fv_ifp), eaddr, ETHER_ADDR_LEN); sp[90] = sp[91] = eaddr[0]; From owner-svn-src-all@freebsd.org Mon Oct 21 18:13:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D81B815E505; Mon, 21 Oct 2019 18:13:30 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlBL0z6sz3C1c; Mon, 21 Oct 2019 18:13:30 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2ABC327D3D; Mon, 21 Oct 2019 18:13:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIDT6e073089; Mon, 21 Oct 2019 18:13:29 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIDT74073088; Mon, 21 Oct 2019 18:13:29 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211813.x9LIDT74073088@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:13:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353865 - head/sys/arm/ti/cpsw X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/arm/ti/cpsw X-SVN-Commit-Revision: 353865 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:31 -0000 Author: glebius Date: Mon Oct 21 18:13:28 2019 New Revision: 353865 URL: https://svnweb.freebsd.org/changeset/base/353865 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/arm/ti/cpsw/if_cpsw.c Modified: head/sys/arm/ti/cpsw/if_cpsw.c ============================================================================== --- head/sys/arm/ti/cpsw/if_cpsw.c Mon Oct 21 18:13:24 2019 (r353864) +++ head/sys/arm/ti/cpsw/if_cpsw.c Mon Oct 21 18:13:28 2019 (r353865) @@ -2425,12 +2425,27 @@ cpsw_ale_dump_table(struct cpsw_softc *sc) { printf("\n"); } +static u_int +cpswp_set_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct cpswp_softc *sc = arg; + uint32_t portmask; + + if (sc->swsc->dualemac) + portmask = 1 << (sc->unit + 1) | 1 << 0; + else + portmask = 7; + + cpsw_ale_mc_entry_set(sc->swsc, portmask, sc->vlan, LLADDR(sdl)); + + return (1); +} + static int cpswp_ale_update_addresses(struct cpswp_softc *sc, int purge) { uint8_t *mac; uint32_t ale_entry[3], ale_type, portmask; - struct ifmultiaddr *ifma; if (sc->swsc->dualemac) { ale_type = ALE_TYPE_VLAN_ADDR << 28 | sc->vlan << 16; @@ -2445,7 +2460,6 @@ cpswp_ale_update_addresses(struct cpswp_softc *sc, int * For simplicity, keep this entry at table index 0 for port 1 and * at index 2 for port 2 in the ALE. */ - if_addr_rlock(sc->ifp); mac = LLADDR((struct sockaddr_dl *)sc->ifp->if_addr->ifa_addr); ale_entry[0] = mac[2] << 24 | mac[3] << 16 | mac[4] << 8 | mac[5]; ale_entry[1] = ale_type | mac[0] << 8 | mac[1]; /* addr entry + mac */ @@ -2457,7 +2471,6 @@ cpswp_ale_update_addresses(struct cpswp_softc *sc, int mac[3] << 24 | mac[2] << 16 | mac[1] << 8 | mac[0]); cpsw_write_4(sc->swsc, CPSW_PORT_P_SA_LO(sc->unit + 1), mac[5] << 8 | mac[4]); - if_addr_runlock(sc->ifp); /* Keep the broadcast address at table entry 1 (or 3). */ ale_entry[0] = 0xffffffff; /* Lower 32 bits of MAC */ @@ -2472,14 +2485,7 @@ cpswp_ale_update_addresses(struct cpswp_softc *sc, int cpsw_ale_remove_all_mc_entries(sc->swsc); /* Set other multicast addrs desired. */ - if_maddr_rlock(sc->ifp); - CK_STAILQ_FOREACH(ifma, &sc->ifp->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - cpsw_ale_mc_entry_set(sc->swsc, portmask, sc->vlan, - LLADDR((struct sockaddr_dl *)ifma->ifma_addr)); - } - if_maddr_runlock(sc->ifp); + if_foreach_llmaddr(sc->ifp, cpswp_set_maddr, sc); return (0); } From owner-svn-src-all@freebsd.org Mon Oct 21 18:13:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0E67315E533; Mon, 21 Oct 2019 18:13:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlBP6Vn5z3C5D; Mon, 21 Oct 2019 18:13:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B964B27D3E; Mon, 21 Oct 2019 18:13:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIDXoh073137; Mon, 21 Oct 2019 18:13:33 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIDXRk073136; Mon, 21 Oct 2019 18:13:33 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211813.x9LIDXRk073136@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:13:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353866 - head/sys/powerpc/ps3 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/powerpc/ps3 X-SVN-Commit-Revision: 353866 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:34 -0000 Author: glebius Date: Mon Oct 21 18:13:33 2019 New Revision: 353866 URL: https://svnweb.freebsd.org/changeset/base/353866 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/powerpc/ps3/if_glc.c Modified: head/sys/powerpc/ps3/if_glc.c ============================================================================== --- head/sys/powerpc/ps3/if_glc.c Mon Oct 21 18:13:28 2019 (r353865) +++ head/sys/powerpc/ps3/if_glc.c Mon Oct 21 18:13:33 2019 (r353866) @@ -504,12 +504,31 @@ glc_ioctl(struct ifnet *ifp, u_long cmd, caddr_t data) return (err); } +static u_int +glc_add_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct glc_softc *sc = arg; + uint64_t addr; + + /* + * Filter can only hold 32 addresses, so fall back to + * the IFF_ALLMULTI case if we have too many. +1 is for + * broadcast. + */ + if (cnt + 1 == 32) + return (0); + + addr = 0; + memcpy(&((uint8_t *)(&addr))[2], LLADDR(sdl), ETHER_ADDR_LEN); + lv1_net_add_multicast_address(sc->sc_bus, sc->sc_dev, addr, 0); + + return (1); +} + static void glc_set_multicast(struct glc_softc *sc) { struct ifnet *ifp = sc->sc_ifp; - struct ifmultiaddr *inm; - uint64_t addr; int naddrs; /* Clear multicast filter */ @@ -522,30 +541,10 @@ glc_set_multicast(struct glc_softc *sc) if ((ifp->if_flags & IFF_ALLMULTI) != 0) { lv1_net_add_multicast_address(sc->sc_bus, sc->sc_dev, 0, 1); } else { - if_maddr_rlock(ifp); - naddrs = 1; /* Include broadcast */ - CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { - if (inm->ifma_addr->sa_family != AF_LINK) - continue; - addr = 0; - memcpy(&((uint8_t *)(&addr))[2], - LLADDR((struct sockaddr_dl *)inm->ifma_addr), - ETHER_ADDR_LEN); - - lv1_net_add_multicast_address(sc->sc_bus, sc->sc_dev, - addr, 0); - - /* - * Filter can only hold 32 addresses, so fall back to - * the IFF_ALLMULTI case if we have too many. - */ - if (++naddrs >= 32) { - lv1_net_add_multicast_address(sc->sc_bus, - sc->sc_dev, 0, 1); - break; - } - } - if_maddr_runlock(ifp); + naddrs = if_foreach_llmaddr(ifp, glc_add_maddr, sc); + if (naddrs + 1 == 32) + lv1_net_add_multicast_address(sc->sc_bus, + sc->sc_dev, 0, 1); } } From owner-svn-src-all@freebsd.org Mon Oct 21 18:13:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 485E315E563; Mon, 21 Oct 2019 18:13:38 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlBT6sWyz3CBQ; Mon, 21 Oct 2019 18:13:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B386B27D3F; Mon, 21 Oct 2019 18:13:37 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIDbEN073188; Mon, 21 Oct 2019 18:13:37 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIDb4J073187; Mon, 21 Oct 2019 18:13:37 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211813.x9LIDb4J073187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:13:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353867 - head/sys/powerpc/pseries X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/powerpc/pseries X-SVN-Commit-Revision: 353867 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:13:38 -0000 Author: glebius Date: Mon Oct 21 18:13:37 2019 New Revision: 353867 URL: https://svnweb.freebsd.org/changeset/base/353867 Log: Convert to if_foreach_llmaddr() KPI. Modified: head/sys/powerpc/pseries/phyp_llan.c Modified: head/sys/powerpc/pseries/phyp_llan.c ============================================================================== --- head/sys/powerpc/pseries/phyp_llan.c Mon Oct 21 18:13:33 2019 (r353866) +++ head/sys/powerpc/pseries/phyp_llan.c Mon Oct 21 18:13:37 2019 (r353867) @@ -508,28 +508,28 @@ llan_start(struct ifnet *ifp) mtx_unlock(&sc->io_lock); } +static u_int +llan_set_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) +{ + struct llan_softc *sc = arg; + uint64_t macaddr = 0; + + memcpy((uint8_t *)&macaddr + 2, LLADDR(sdl), 6); + phyp_hcall(H_MULTICAST_CTRL, sc->unit, LLAN_ADD_MULTICAST, macaddr); + + return (1); +} + static int llan_set_multicast(struct llan_softc *sc) { struct ifnet *ifp = sc->ifp; - struct ifmultiaddr *inm; - uint64_t macaddr = 0; mtx_assert(&sc->io_lock, MA_OWNED); phyp_hcall(H_MULTICAST_CTRL, sc->unit, LLAN_CLEAR_MULTICAST, 0); - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(inm, &ifp->if_multiaddrs, ifma_link) { - if (inm->ifma_addr->sa_family != AF_LINK) - continue; - - memcpy((uint8_t *)&macaddr + 2, - LLADDR((struct sockaddr_dl *)inm->ifma_addr), 6); - phyp_hcall(H_MULTICAST_CTRL, sc->unit, LLAN_ADD_MULTICAST, - macaddr); - } - if_maddr_runlock(ifp); + if_foreach_llmaddr(ifp, llan_set_maddr, sc); return (0); } From owner-svn-src-all@freebsd.org Mon Oct 21 18:17:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC46015E8BF; Mon, 21 Oct 2019 18:17:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlGS5wc9z3Cbn; Mon, 21 Oct 2019 18:17:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF78227D45; Mon, 21 Oct 2019 18:17:04 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIH4DK073413; Mon, 21 Oct 2019 18:17:04 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIH34m073408; Mon, 21 Oct 2019 18:17:03 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211817.x9LIH34m073408@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:17:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353868 - in head: . sys/net sys/sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head: . sys/net sys/sys X-SVN-Commit-Revision: 353868 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:17:05 -0000 Author: glebius Date: Mon Oct 21 18:17:03 2019 New Revision: 353868 URL: https://svnweb.freebsd.org/changeset/base/353868 Log: Remove obsoleted KPIs that were used to access interface address lists. Modified: head/UPDATING head/sys/net/if.c head/sys/net/if_var.h head/sys/sys/param.h Modified: head/UPDATING ============================================================================== --- head/UPDATING Mon Oct 21 18:13:37 2019 (r353867) +++ head/UPDATING Mon Oct 21 18:17:03 2019 (r353868) @@ -27,6 +27,10 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 13.x IS SLOW: "ln -s 'abort:false,junk:false' /etc/malloc.conf".) 20191021: + KPIs for network drivers to access interface addresses have changed. + Users need to recompile NIC driver modules together with kernel. + +20191021: The net.link.tap.user_open sysctl no longer prevents user opening of already created /dev/tapNN devices. Access is still controlled by node permissions, just like tun devices. The net.link.tap.user_open Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Mon Oct 21 18:13:37 2019 (r353867) +++ head/sys/net/if.c Mon Oct 21 18:17:03 2019 (r353868) @@ -1768,40 +1768,6 @@ if_data_copy(struct ifnet *ifp, struct if_data *ifd) } /* - * Wrapper functions for struct ifnet address list locking macros. These are - * used by kernel modules to avoid encoding programming interface or binary - * interface assumptions that may be violated when kernel-internal locking - * approaches change. - */ -void -if_addr_rlock(struct ifnet *ifp) -{ - - epoch_enter_preempt(net_epoch_preempt, curthread->td_et); -} - -void -if_addr_runlock(struct ifnet *ifp) -{ - - epoch_exit_preempt(net_epoch_preempt, curthread->td_et); -} - -void -if_maddr_rlock(if_t ifp) -{ - - epoch_enter_preempt(net_epoch_preempt, curthread->td_et); -} - -void -if_maddr_runlock(if_t ifp) -{ - - epoch_exit_preempt(net_epoch_preempt, curthread->td_et); -} - -/* * Initialization, destruction and refcounting functions for ifaddrs. */ struct ifaddr * @@ -4403,77 +4369,6 @@ if_input(if_t ifp, struct mbuf* sendmp) (*((struct ifnet *)ifp)->if_input)((struct ifnet *)ifp, sendmp); return (0); -} - -/* XXX */ -#ifndef ETH_ADDR_LEN -#define ETH_ADDR_LEN 6 -#endif - -int -if_setupmultiaddr(if_t ifp, void *mta, int *cnt, int max) -{ - struct ifmultiaddr *ifma; - uint8_t *lmta = (uint8_t *)mta; - int mcnt = 0; - - CK_STAILQ_FOREACH(ifma, &((struct ifnet *)ifp)->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - - if (mcnt == max) - break; - - bcopy(LLADDR((struct sockaddr_dl *)ifma->ifma_addr), - &lmta[mcnt * ETH_ADDR_LEN], ETH_ADDR_LEN); - mcnt++; - } - *cnt = mcnt; - - return (0); -} - -int -if_multiaddr_array(if_t ifp, void *mta, int *cnt, int max) -{ - int error; - - if_maddr_rlock(ifp); - error = if_setupmultiaddr(ifp, mta, cnt, max); - if_maddr_runlock(ifp); - return (error); -} - -int -if_multiaddr_count(if_t ifp, int max) -{ - struct ifmultiaddr *ifma; - int count; - - count = 0; - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &((struct ifnet *)ifp)->if_multiaddrs, ifma_link) { - if (ifma->ifma_addr->sa_family != AF_LINK) - continue; - count++; - if (count == max) - break; - } - if_maddr_runlock(ifp); - return (count); -} - -int -if_multi_apply(struct ifnet *ifp, int (*filter)(void *, struct ifmultiaddr *, int), void *arg) -{ - struct ifmultiaddr *ifma; - int cnt = 0; - - if_maddr_rlock(ifp); - CK_STAILQ_FOREACH(ifma, &ifp->if_multiaddrs, ifma_link) - cnt += filter(arg, ifma, cnt); - if_maddr_runlock(ifp); - return (cnt); } struct mbuf * Modified: head/sys/net/if_var.h ============================================================================== --- head/sys/net/if_var.h Mon Oct 21 18:13:37 2019 (r353867) +++ head/sys/net/if_var.h Mon Oct 21 18:17:03 2019 (r353868) @@ -449,16 +449,6 @@ struct ifnet { #define NET_EPOCH_WAIT() epoch_wait_preempt(net_epoch_preempt) #define NET_EPOCH_ASSERT() MPASS(in_epoch(net_epoch_preempt)) -/* - * Function variations on locking macros intended to be used by loadable - * kernel modules in order to divorce them from the internals of address list - * locking. - */ -void if_addr_rlock(struct ifnet *ifp); /* if_addrhead */ -void if_addr_runlock(struct ifnet *ifp); /* if_addrhead */ -void if_maddr_rlock(if_t ifp); /* if_multiaddrs */ -void if_maddr_runlock(if_t ifp); /* if_multiaddrs */ - #ifdef _KERNEL /* interface link layer address change event */ typedef void (*iflladdr_event_handler_t)(void *, struct ifnet *); @@ -773,12 +763,6 @@ u_int if_foreach_lladdr(if_t, iflladdr_cb_t, void *); u_int if_foreach_llmaddr(if_t, iflladdr_cb_t, void *); u_int if_lladdr_count(if_t); u_int if_llmaddr_count(if_t); -int if_multiaddr_count(if_t ifp, int max); - -/* Obsoleted multicast management functions. */ -int if_setupmultiaddr(if_t ifp, void *mta, int *cnt, int max); -int if_multiaddr_array(if_t ifp, void *mta, int *cnt, int max); -int if_multi_apply(struct ifnet *ifp, int (*filter)(void *, struct ifmultiaddr *, int), void *arg); int if_getamcount(if_t ifp); struct ifaddr * if_getifaddr(if_t ifp); Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Mon Oct 21 18:13:37 2019 (r353867) +++ head/sys/sys/param.h Mon Oct 21 18:17:03 2019 (r353868) @@ -60,7 +60,7 @@ * in the range 5 to 9. */ #undef __FreeBSD_version -#define __FreeBSD_version 1300053 /* Master, propagated to newvers */ +#define __FreeBSD_version 1300054 /* Master, propagated to newvers */ /* * __FreeBSD_kernel__ indicates that this system uses the kernel of FreeBSD, From owner-svn-src-all@freebsd.org Mon Oct 21 18:19:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B0DC15F2D8; Mon, 21 Oct 2019 18:19:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlKK6pt8z3DF6; Mon, 21 Oct 2019 18:19:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE38427D4C; Mon, 21 Oct 2019 18:19:33 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIJXUq073566; Mon, 21 Oct 2019 18:19:33 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIJWad073561; Mon, 21 Oct 2019 18:19:32 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910211819.x9LIJWad073561@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 18:19:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353869 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 353869 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:19:34 -0000 Author: glebius Date: Mon Oct 21 18:19:32 2019 New Revision: 353869 URL: https://svnweb.freebsd.org/changeset/base/353869 Log: Remove epoch tracker from struct thread. It was an ugly crutch to emulate locking semantics for if_addr_rlock() and if_maddr_rlock(). Modified: head/sys/kern/init_main.c head/sys/kern/kern_thread.c head/sys/kern/subr_epoch.c head/sys/sys/epoch.h head/sys/sys/proc.h Modified: head/sys/kern/init_main.c ============================================================================== --- head/sys/kern/init_main.c Mon Oct 21 18:17:03 2019 (r353868) +++ head/sys/kern/init_main.c Mon Oct 21 18:19:32 2019 (r353869) @@ -514,7 +514,6 @@ proc0_init(void *dummy __unused) td->td_pflags = TDP_KTHREAD; td->td_cpuset = cpuset_thread0(); td->td_domain.dr_policy = td->td_cpuset->cs_domain; - epoch_thread_init(td); prison0_init(); p->p_peers = 0; p->p_leader = p; Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Mon Oct 21 18:17:03 2019 (r353868) +++ head/sys/kern/kern_thread.c Mon Oct 21 18:19:32 2019 (r353869) @@ -273,7 +273,6 @@ thread_init(void *mem, int size, int flags) td->td_rlqe = NULL; EVENTHANDLER_DIRECT_INVOKE(thread_init, td); umtx_thread_init(td); - epoch_thread_init(td); td->td_kstack = 0; td->td_sel = NULL; return (0); @@ -293,7 +292,6 @@ thread_fini(void *mem, int size) turnstile_free(td->td_turnstile); sleepq_free(td->td_sleepqueue); umtx_thread_fini(td); - epoch_thread_fini(td); seltdfini(td); } Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Mon Oct 21 18:17:03 2019 (r353868) +++ head/sys/kern/subr_epoch.c Mon Oct 21 18:19:32 2019 (r353869) @@ -842,17 +842,3 @@ epoch_drain_callbacks(epoch_t epoch) PICKUP_GIANT(); } - -void -epoch_thread_init(struct thread *td) -{ - - td->td_et = malloc(sizeof(struct epoch_tracker), M_EPOCH, M_WAITOK); -} - -void -epoch_thread_fini(struct thread *td) -{ - - free(td->td_et, M_EPOCH); -} Modified: head/sys/sys/epoch.h ============================================================================== --- head/sys/sys/epoch.h Mon Oct 21 18:17:03 2019 (r353868) +++ head/sys/sys/epoch.h Mon Oct 21 18:19:32 2019 (r353869) @@ -93,8 +93,5 @@ void epoch_trace_list(struct thread *); void epoch_enter(epoch_t epoch); void epoch_exit(epoch_t epoch); -void epoch_thread_init(struct thread *); -void epoch_thread_fini(struct thread *); - #endif /* _KERNEL */ #endif /* _SYS_EPOCH_H_ */ Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Mon Oct 21 18:17:03 2019 (r353868) +++ head/sys/sys/proc.h Mon Oct 21 18:19:32 2019 (r353869) @@ -365,7 +365,6 @@ struct thread { int td_lastcpu; /* (t) Last cpu we were on. */ int td_oncpu; /* (t) Which cpu we are on. */ void *td_lkpi_task; /* LinuxKPI task struct pointer */ - struct epoch_tracker *td_et; /* (k) compat KPI spare tracker */ int td_pmcpend; #ifdef EPOCH_TRACE SLIST_HEAD(, epoch_tracker) td_epochs; From owner-svn-src-all@freebsd.org Mon Oct 21 18:27:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94B2415F6E8; Mon, 21 Oct 2019 18:27:13 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xlV93PX7z3DtQ; Mon, 21 Oct 2019 18:27:13 +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 3869E27F24; Mon, 21 Oct 2019 18:27:13 +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 x9LIRDJa079674; Mon, 21 Oct 2019 18:27:13 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIRDiV079673; Mon, 21 Oct 2019 18:27:13 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910211827.x9LIRDiV079673@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 21 Oct 2019 18:27:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353870 - vendor/tcsh/6.21.00-83c5be0 X-SVN-Group: vendor X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: vendor/tcsh/6.21.00-83c5be0 X-SVN-Commit-Revision: 353870 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:27:13 -0000 Author: brooks Date: Mon Oct 21 18:27:12 2019 New Revision: 353870 URL: https://svnweb.freebsd.org/changeset/base/353870 Log: Tag import of git 83c5be0. Added: vendor/tcsh/6.21.00-83c5be0/ - copied from r353869, vendor/tcsh/dist/ From owner-svn-src-all@freebsd.org Mon Oct 21 18:40:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43DF115F9B5; Mon, 21 Oct 2019 18:40:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xln014Z8z3FW5; Mon, 21 Oct 2019 18:40:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0531D143; Mon, 21 Oct 2019 18:40:04 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LIe3kP086160; Mon, 21 Oct 2019 18:40:03 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LIe3Gx086159; Mon, 21 Oct 2019 18:40:03 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910211840.x9LIe3Gx086159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Mon, 21 Oct 2019 18:40:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353871 - head X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 353871 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 18:40:04 -0000 Author: emaste Date: Mon Oct 21 18:40:03 2019 New Revision: 353871 URL: https://svnweb.freebsd.org/changeset/base/353871 Log: Additional fix for -DNO_CLEAN build across r353340 and r353381 opensolaris_atomic.S is now only used on i386 with opensolaris_atomic.c used on other platforms. After r353381 it doesn't exist on those platforms so the stale dependency would result in a build error. r353408 addressed this issue for cddl/lib/libzpool, but it persisted with the opensolaris and zfs modules. Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Mon Oct 21 18:27:12 2019 (r353870) +++ head/Makefile.inc1 Mon Oct 21 18:40:03 2019 (r353871) @@ -1620,6 +1620,18 @@ _cleankernobj_fast_depend_hack: .PHONY rm -f ${OBJTOP}/sys/${KERNCONF}/assym.* \ ${OBJTOP}/sys/${KERNCONF}/.depend.assym.*; \ fi +# 20191009 r353340 removal of opensolaris_atomic.S (also r353381) +.if ${MACHINE} != i386 +.for f in opensolaris_atomic +.for m in opensolaris zfs + @if [ -e "${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.o" ] && \ + grep -q ${f}.S "${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.o"; then \ + echo "Removing stale dependencies for opensolaris_atomic"; \ + rm -f ${KRNLOBJDIR}/${KERNCONF}/modules${SRCTOP}/sys/modules/${m}/.depend.${f}.*; \ + fi +.endfor +.endfor +.endif ${WMAKE_TGTS:N_worldtmp:Nbuild${libcompat}} ${.ALLTARGETS:M_*:N_worldtmp}: .MAKE .PHONY From owner-svn-src-all@freebsd.org Mon Oct 21 20:09:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37B2616100C; Mon, 21 Oct 2019 20:09:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xnmS0Wt0z3Klh; Mon, 21 Oct 2019 20:09:44 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E58D7116F; Mon, 21 Oct 2019 20:09:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LK9hoH038987; Mon, 21 Oct 2019 20:09:43 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LK9hDd038985; Mon, 21 Oct 2019 20:09:43 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910212009.x9LK9hDd038985@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 20:09:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353872 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 353872 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 20:09:44 -0000 Author: kevans Date: Mon Oct 21 20:09:43 2019 New Revision: 353872 URL: https://svnweb.freebsd.org/changeset/base/353872 Log: lualoader: don't botch disabling of color When colors are disabled, color.escape{fg,bg} would return the passed in color rather than the proper ANSI sequence for the color. color.escape{fg,bg} would be wrong. Instead return '', as the associated reset* functions will also return ''. This should get rid of the funky '2' and '4' in the kernel selector if you're booting serial. Reported by: npn Modified: head/stand/lua/color.lua head/stand/lua/screen.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Mon Oct 21 18:40:03 2019 (r353871) +++ head/stand/lua/color.lua Mon Oct 21 20:09:43 2019 (r353872) @@ -58,7 +58,7 @@ color.disabled = not color.isEnabled() function color.escapefg(color_value) if color.disabled then - return color_value + return '' end return core.KEYSTR_CSI .. "3" .. color_value .. "m" end @@ -72,7 +72,7 @@ end function color.escapebg(color_value) if color.disabled then - return color_value + return '' end return core.KEYSTR_CSI .. "4" .. color_value .. "m" end Modified: head/stand/lua/screen.lua ============================================================================== --- head/stand/lua/screen.lua Mon Oct 21 18:40:03 2019 (r353871) +++ head/stand/lua/screen.lua Mon Oct 21 20:09:43 2019 (r353872) @@ -47,14 +47,14 @@ end function screen.setforeground(color_value) if color.disabled then - return color_value + return end printc(color.escapefg(color_value)) end function screen.setbackground(color_value) if color.disabled then - return color_value + return end printc(color.escapebg(color_value)) end From owner-svn-src-all@freebsd.org Mon Oct 21 20:17:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1046416132F; Mon, 21 Oct 2019 20:17:32 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xnxR6Vt6z3LL4; Mon, 21 Oct 2019 20:17:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE7A81359; Mon, 21 Oct 2019 20:17:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LKHVP2044762; Mon, 21 Oct 2019 20:17:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LKHVx9044761; Mon, 21 Oct 2019 20:17:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910212017.x9LKHVx9044761@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 20:17:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353873 - head/stand/lua X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/stand/lua X-SVN-Commit-Revision: 353873 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 20:17:32 -0000 Author: kevans Date: Mon Oct 21 20:17:31 2019 New Revision: 353873 URL: https://svnweb.freebsd.org/changeset/base/353873 Log: lualoader: fix setting of loader_color=NO in loader.conf(5) Previously color.disabled would be calculated at color module load time, then never touched again. We can detect serial boots beyond just what we're told by loader.conf(5) so this works out in many cases, but we must re-evaluate the situation after the config is loaded to make sure we're not supposed to be forcing it enabled/disabled. Discovered while trying to test r353872. Modified: head/stand/lua/color.lua Modified: head/stand/lua/color.lua ============================================================================== --- head/stand/lua/color.lua Mon Oct 21 20:09:43 2019 (r353872) +++ head/stand/lua/color.lua Mon Oct 21 20:17:31 2019 (r353873) @@ -29,9 +29,14 @@ -- local core = require("core") +local hook = require("hook") local color = {} +local function recalcDisabled() + color.disabled = not color.isEnabled() +end + -- Module exports color.BLACK = 0 color.RED = 1 @@ -54,8 +59,6 @@ function color.isEnabled() return not core.isSerialBoot() end -color.disabled = not color.isEnabled() - function color.escapefg(color_value) if color.disabled then return '' @@ -112,5 +115,8 @@ function color.highlight(str) -- case the terminal defaults don't match what we're expecting. return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "22m" end + +recalcDisabled() +hook.register("config.loaded", recalcDisabled) return color From owner-svn-src-all@freebsd.org Mon Oct 21 20:28:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E7BA7161864; Mon, 21 Oct 2019 20:28:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xpBG5qkVz3MGX; Mon, 21 Oct 2019 20:28:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A6F63152B; Mon, 21 Oct 2019 20:28:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LKSc4H051484; Mon, 21 Oct 2019 20:28:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LKScQw051483; Mon, 21 Oct 2019 20:28:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910212028.x9LKScQw051483@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Mon, 21 Oct 2019 20:28:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353874 - head/sys/modules/if_tuntap X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/modules/if_tuntap X-SVN-Commit-Revision: 353874 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 20:28:39 -0000 Author: kevans Date: Mon Oct 21 20:28:38 2019 New Revision: 353874 URL: https://svnweb.freebsd.org/changeset/base/353874 Log: if_tuntap: remove if_{tun,tap}.ko -> if_tuntap.ko links These drivers have been merged into a single if_tuntap in 13.0. The compatibility links existed only for the interim and will be MFC'd along with the if_tuntap merge shortly. MFC after: never Modified: head/sys/modules/if_tuntap/Makefile Modified: head/sys/modules/if_tuntap/Makefile ============================================================================== --- head/sys/modules/if_tuntap/Makefile Mon Oct 21 20:17:31 2019 (r353873) +++ head/sys/modules/if_tuntap/Makefile Mon Oct 21 20:28:38 2019 (r353874) @@ -5,31 +5,4 @@ KMOD= if_tuntap SRCS= if_tuntap.c opt_inet.h opt_inet6.h -# Symlink for backwards compatibility with systems installed at 12.0 or older -.if ${MACHINE_CPUARCH} != "powerpc" -SYMLINKS= ${KMOD}.ko ${KMODDIR}/if_tun.ko \ - ${KMOD}.ko ${KMODDIR}/if_tap.ko -.else -# Some PPC systems use msdosfs for /boot, which can't handle links or symlinks -afterinstall: alias alias_debug -alias: .PHONY - ${INSTALL} -T release -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ - ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}/if_tun.ko - ${INSTALL} -T release -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ - ${_INSTALLFLAGS} ${PROG} ${DESTDIR}${KMODDIR}/if_tap.ko -.if defined(DEBUG_FLAGS) && !defined(INSTALL_NODEBUG) && \ - "${MK_KERNEL_SYMBOLS}" != "no" -alias_debug: .PHONY - ${INSTALL} -T debug -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ - ${_INSTALLFLAGS} ${PROG}.debug \ - ${DESTDIR}${KERN_DEBUGDIR}${KMODDIR}/if_tun.ko - ${INSTALL} -T debug -o ${KMODOWN} -g ${KMODGRP} -m ${KMODMODE} \ - ${_INSTALLFLAGS} ${PROG}.debug \ - ${DESTDIR}${KERN_DEBUGDIR}${KMODDIR}/if_tap.ko -.else -alias_debug: .PHONY -.endif -.endif - - .include From owner-svn-src-all@freebsd.org Mon Oct 21 20:31:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9151A161960; Mon, 21 Oct 2019 20:31:01 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: from mail-lj1-x232.google.com (mail-lj1-x232.google.com [IPv6:2a00:1450:4864:20::232]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xpF12tF2z3MSJ; Mon, 21 Oct 2019 20:31:01 +0000 (UTC) (envelope-from pluknet@gmail.com) Received: by mail-lj1-x232.google.com with SMTP id j19so14782142lja.1; Mon, 21 Oct 2019 13:31:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5OQPc7HOoicHxEaOyv5dO1i1bkjasc4q6NgxqiquHFU=; b=gHIpK6C47cG5CDqR+UzVpKVsAFgp/X/t0COVMCSDp3H4DoAMdn+5Y5QH/+4Dv87E0l auehFSFI/Ny8xjDu+hUc6e5O3wUsH73y8ywXkch8QdXTAFlro1N8OkpoBH4feTwjyRPv m7NKBO2B5xJNonrbWfqKcsZVbG/DphV7C8DNymt5lyfbkRykTgUMe5CkkqLJIO/5fPbm L3qc5VYf3VXG1HGe85rB6rAH9InS7Kd4YGLubD6OLQURgroUYqW91IUVsQX2EJZmS9wG SBUhu02VAOiJvmN3C+yari/rreqlmEqjawFCXm8Pm7xMmJ9VERZf+8LS7pySd3ot2jIE xwUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5OQPc7HOoicHxEaOyv5dO1i1bkjasc4q6NgxqiquHFU=; b=CJivc4s2SaFtWgkU45RtF1re18rxg9CS2P6yZSLgc1Q0IZ3sfXwFFyrpMuFPYbuz5/ lGMEIgiI1hVLZ6mD9ID4++cZs/uVqdh2/jFsClGhL0Yvh7MJV23UyLrVXoTNsQX03hCY UJiNZTYjw+5GuoB0oNgX959H+u7R/qk+4FoaF422463tXkVx+lm8fLH/RtU5LBorUMJf rlb3UhPPE66qaj0M1AmyKIAUlSQgsvYCjX+LPHTgz5y7moPlg3zFpH6wuliArCkpEmQF gsErZZA2AuLCGvWOSsDIHzHbthmyXGMFLQ1B+MZTh3Ksx+mGHSzYyAWHL/2vQw1j6rRm HFSw== X-Gm-Message-State: APjAAAUoxiPLWyNM6RZi42EW3EgVsCyJgClsfTLclO8+U5VEiGK7JW7W UhqUM4Q47YepYeWDTq/mQmLqJEnovac9Hv9s1bVdIg== X-Google-Smtp-Source: APXvYqyQA8f1lOyOdOW4/bo4bq3fkxJpbYvE97IG+XuJoB3cAcLy1vWISV46tMKOom8qi+FU+XZeglX2TdXhIbFgZvE= X-Received: by 2002:a2e:b17b:: with SMTP id a27mr16074852ljm.7.1571689859087; Mon, 21 Oct 2019 13:30:59 -0700 (PDT) MIME-Version: 1.0 References: <201910211811.x9LIBhea069573@repo.freebsd.org> In-Reply-To: <201910211811.x9LIBhea069573@repo.freebsd.org> From: Sergey Kandaurov Date: Mon, 21 Oct 2019 23:30:46 +0300 Message-ID: Subject: Re: svn commit: r353848 - head/sys/dev/jme To: Gleb Smirnoff Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 46xpF12tF2z3MSJ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.994,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 20:31:01 -0000 =D0=BF=D0=BD, 21 =D0=BE=D0=BA=D1=82. 2019 =D0=B3. =D0=B2 21:14, Gleb Smirno= ff : > Author: glebius > Date: Mon Oct 21 18:11:43 2019 > New Revision: 353848 > URL: https://svnweb.freebsd.org/changeset/base/353848 > > Log: > Convert to if_foreach_llmaddr() KPI. > > Modified: > head/sys/dev/jme/if_jme.c > > Modified: head/sys/dev/jme/if_jme.c > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > --- head/sys/dev/jme/if_jme.c Mon Oct 21 18:11:38 2019 (r353847) > +++ head/sys/dev/jme/if_jme.c Mon Oct 21 18:11:43 2019 (r353848) > @@ -3236,12 +3236,26 @@ jme_set_vlan(struct jme_softc *sc) > CSR_WRITE_4(sc, JME_RXMAC, reg); > } > > +static u_int > +jme_hash_maddr(void *arg, struct sockaddr_dl *sdl, u_int cnt) > +{ > + uint32_t crc, *mchash =3D arg; > + > + crc =3D ether_crc32_be(LLADDR(sdl), ETHER_ADDR_LEN); > + > + /* Just want the 6 least significant bits. */ > + crc &=3D 0x3f; > + > + /* Set the corresponding bit in the hash table. */ > + mchash[crc >> 5] |=3D 1 << (crc & 0x1f); > + > + return (1); > +} > + > static void > jme_set_filter(struct jme_softc *sc) > { > struct ifnet *ifp; > - struct ifmultiaddr *ifma; > - uint32_t crc; > uint32_t mchash[2]; > uint32_t rxcfg; > > @@ -3276,21 +3290,7 @@ jme_set_filter(struct jme_softc *sc) > */ > rxcfg |=3D RXMAC_MULTICAST; > bzero(mchash, sizeof(mchash)); > - > - if_maddr_rlock(ifp); > - CK_STAILQ_FOREACH(ifma, &sc->jme_ifp->if_multiaddrs, ifma_link) { > - if (ifma->ifma_addr->sa_family !=3D AF_LINK) > - continue; > - crc =3D ether_crc32_be(LLADDR((struct sockaddr_dl *) > - ifma->ifma_addr), ETHER_ADDR_LEN); > - > - /* Just want the 6 least significant bits. */ > - crc &=3D 0x3f; > - > - /* Set the corresponding bit in the hash table. */ > - mchash[crc >> 5] |=3D 1 << (crc & 0x1f); > - } > - if_maddr_runlock(ifp); > + if_foreach_llmaddr(ifp, jme_hash_maddr, &mchash); > Should not be there just =E2=80=9Cmchash=E2=80=9D? You seems to be passing (uint32_t **), also in tsec. > CSR_WRITE_4(sc, JME_MAR0, mchash[0]); > CSR_WRITE_4(sc, JME_MAR1, mchash[1]); > From owner-svn-src-all@freebsd.org Mon Oct 21 20:36:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E581161C8D; Mon, 21 Oct 2019 20:36:46 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xpMf00BSz3Msk; Mon, 21 Oct 2019 20:36:45 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id x9LKaZH0080998 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 21 Oct 2019 13:36:36 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9LKaZdN080997; Mon, 21 Oct 2019 13:36:35 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Mon, 21 Oct 2019 13:36:35 -0700 From: Gleb Smirnoff To: Sergey Kandaurov Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353848 - head/sys/dev/jme Message-ID: <20191021203635.GF4086@FreeBSD.org> References: <201910211811.x9LIBhea069573@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46xpMf00BSz3Msk X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.52 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.52)[-0.518,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 20:36:46 -0000 Sergey, On Mon, Oct 21, 2019 at 11:30:46PM +0300, Sergey Kandaurov wrote: S> > struct ifnet *ifp; S> > - struct ifmultiaddr *ifma; S> > - uint32_t crc; S> > uint32_t mchash[2]; S> > uint32_t rxcfg; S> > S> > @@ -3276,21 +3290,7 @@ jme_set_filter(struct jme_softc *sc) S> > */ S> > rxcfg |= RXMAC_MULTICAST; S> > bzero(mchash, sizeof(mchash)); S> > - S> > - if_maddr_rlock(ifp); S> > - CK_STAILQ_FOREACH(ifma, &sc->jme_ifp->if_multiaddrs, ifma_link) { S> > - if (ifma->ifma_addr->sa_family != AF_LINK) S> > - continue; S> > - crc = ether_crc32_be(LLADDR((struct sockaddr_dl *) S> > - ifma->ifma_addr), ETHER_ADDR_LEN); S> > - S> > - /* Just want the 6 least significant bits. */ S> > - crc &= 0x3f; S> > - S> > - /* Set the corresponding bit in the hash table. */ S> > - mchash[crc >> 5] |= 1 << (crc & 0x1f); S> > - } S> > - if_maddr_runlock(ifp); S> > + if_foreach_llmaddr(ifp, jme_hash_maddr, &mchash); S> > S> S> Should not be there just “mchash”? S> You seems to be passing (uint32_t **), S> also in tsec. mchash and &mchash are the same here. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Mon Oct 21 21:21:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 79D7C1627DC; Mon, 21 Oct 2019 21:21:37 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xqMP2FTCz3PqF; Mon, 21 Oct 2019 21:21:37 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31BD01F86; Mon, 21 Oct 2019 21:21:37 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LLLbix085130; Mon, 21 Oct 2019 21:21:37 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LLLZFj085115; Mon, 21 Oct 2019 21:21:35 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910212121.x9LLLZFj085115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Mon, 21 Oct 2019 21:21:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353875 - head/contrib/tcsh X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/contrib/tcsh X-SVN-Commit-Revision: 353875 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 21:21:37 -0000 Author: brooks Date: Mon Oct 21 21:21:34 2019 New Revision: 353875 URL: https://svnweb.freebsd.org/changeset/base/353875 Log: Update tcsh to git revision 83c5be0 bringing in a number of bug fixes. Reported by: sobomax MFC after: 3 days Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D22099 Modified: head/contrib/tcsh/Fixes head/contrib/tcsh/README.md head/contrib/tcsh/glob.c head/contrib/tcsh/host.defs head/contrib/tcsh/sh.c head/contrib/tcsh/sh.err.c head/contrib/tcsh/sh.h head/contrib/tcsh/sh.hist.c head/contrib/tcsh/sh.lex.c head/contrib/tcsh/tc.const.c head/contrib/tcsh/tc.sig.h head/contrib/tcsh/tcsh.man.new Directory Properties: head/contrib/tcsh/ (props changed) Modified: head/contrib/tcsh/Fixes ============================================================================== --- head/contrib/tcsh/Fixes Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/Fixes Mon Oct 21 21:21:34 2019 (r353875) @@ -1,3 +1,11 @@ + 5. PR/113: Sobomax: avoid infinite loops for -c commands when stdout is + not a tty. + 4. Avoid infinite loops during history loads when merging, print a better + error for errors during history load. + 3. PR/88: Preserve empty arguments in :q + 2. PR/94: Small apple issues (SAVESIGVEC, HOSTTYPE) + 1. PR/81: Fix range matching issue where we were comparing with the + range character instead of the start of range. [l-z]* would match foo 12. V6.21.00 - 20190508 11. Abort history loading on words and lines too long https://bugzilla.redhat.com/show_bug.cgi?id=1598502 Modified: head/contrib/tcsh/README.md ============================================================================== --- head/contrib/tcsh/README.md Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/README.md Mon Oct 21 21:21:34 2019 (r353875) @@ -1,4 +1,4 @@ -# Tcsh +# TCSH *C shell with file name completion and command line editing* @@ -14,10 +14,10 @@ PLEASE file any bug reports, fixes, and code for new f > https://bugs.astron.com/ Comments, questions, etc. (even flames) are welcome via email to -the Tcsh Bugs mailing list: +the tcsh mailing list: -> tcsh-bugs@astron.com -> https://mailman.astron.com/ +> tcsh@astron.com +> https://mailman.astron.com/mailman/listinfo/tcsh [![Build Status][status]][travis] Modified: head/contrib/tcsh/glob.c ============================================================================== --- head/contrib/tcsh/glob.c Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/glob.c Mon Oct 21 21:21:34 2019 (r353875) @@ -100,7 +100,7 @@ static int Lstat (const char *, struct stat *); static int Stat (const char *, struct stat *sb); static Char *Strchr (Char *, int); #ifdef DEBUG -static void qprintf (const Char *); +static void qprintf (const char *, const Char *); #endif #define DOLLAR '$' @@ -256,19 +256,20 @@ Strchr(Char *str, int ch) #ifdef DEBUG static void -qprintf(const Char *s) +qprintf(const char *pre, const Char *s) { const Char *p; - + + xprintf("%s", pre); for (p = s; *p; p++) - printf("%c", *p & 0xff); - printf("\n"); + xprintf("%c", *p & 0xff); + xprintf("\n%s", pre); for (p = s; *p; p++) - printf("%c", *p & M_PROTECT ? '"' : ' '); - printf("\n"); + xprintf("%c", *p & M_PROTECT ? '"' : ' '); + xprintf("\n%s", pre); for (p = s; *p; p++) - printf("%c", *p & M_META ? '_' : ' '); - printf("\n"); + xprintf("%c", *p & M_META ? '_' : ' '); + xprintf("\n"); } #endif /* DEBUG */ @@ -412,7 +413,7 @@ glob(const char *pattern, int flags, int (*errfunc) (c } *bufnext = EOS; #ifdef DEBUG - qprintf(patbuf); + qprintf("patbuf=", patbuf); #endif if ((err = glob1(patbuf, pglob, no_match)) != 0) { @@ -709,7 +710,7 @@ match(const char *name, const Char *pat, const Char *p while (pat < patend || *name) { size_t lwk, pwk; - __Char wc, wk; + __Char wc, wk, wc1; c = *pat; /* Only for M_MASK bits */ if (*name == EOS) @@ -744,18 +745,20 @@ match(const char *name, const Char *pat, const Char *p pat += pwk; pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); } + wc1 = wc; while ((*pat & M_MASK) != M_END) { if ((*pat & M_MASK) == M_RNG) { __Char wc2; pat += pwk; pwk = One_Char_mbtowc(&wc2, pat, MB_LEN_MAX); - if (globcharcoll(wc, wk, 0) <= 0 && + if (globcharcoll(wc1, wk, 0) <= 0 && globcharcoll(wk, wc2, 0) <= 0) ok = 1; } else if (wc == wk) ok = 1; pat += pwk; + wc1 = wc; pwk = One_Char_mbtowc(&wc, pat, MB_LEN_MAX); } pat += pwk; Modified: head/contrib/tcsh/host.defs ============================================================================== --- head/contrib/tcsh/host.defs Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/host.defs Mon Oct 21 21:21:34 2019 (r353875) @@ -854,9 +854,9 @@ enddef : newdef : defined(APPLE) && defined(MACH) comment : OS X vendor : : "apple" -hosttype: defined(i386) : "intel-pc" +hosttype: defined(i386) : "intel-mac" hosttype: defined(ppc) : "powermac" -hosttype: defined(M_amd64) : "amd" +hosttype: defined(M_amd64) : "intel-mac" ostype : : "darwin" machtype: defined(i386) : "i386" machtype: defined(M_amd64) : "x86_64" Modified: head/contrib/tcsh/sh.c ============================================================================== --- head/contrib/tcsh/sh.c Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/sh.c Mon Oct 21 21:21:34 2019 (r353875) @@ -237,6 +237,7 @@ main(int argc, char **argv) int nofile = 0; volatile int nverbose = 0; volatile int rdirs = 0; + volatile int exitcode = 0; int quitit = 0; Char *cp; #ifdef AUTOLOGOUT @@ -1390,6 +1391,12 @@ main(int argc, char **argv) if (targinp) { + /* If this -c command caused an error before, skip processing */ + if (reenter && arginp) { + exitcode = 1; + goto done; + } + arginp = SAVE(targinp); /* * we put the command into a variable @@ -1422,6 +1429,7 @@ main(int argc, char **argv) */ process(setintr); +done: /* * Mop-up. */ @@ -1443,7 +1451,7 @@ main(int argc, char **argv) } record(); exitstat(); - return (0); + return exitcode; } void Modified: head/contrib/tcsh/sh.err.c ============================================================================== --- head/contrib/tcsh/sh.err.c Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/sh.err.c Mon Oct 21 21:21:34 2019 (r353875) @@ -43,6 +43,7 @@ #endif char *seterr = NULL; /* Holds last error if there was one */ +extern int enterhist; #define ERR_FLAGS 0xf0000000 #define ERR_NAME 0x10000000 @@ -630,6 +631,8 @@ stderror(unsigned int id, ...) */ flush();/*FIXRESET*/ haderr = 1; /* Now to diagnostic output */ + if (enterhist) + xprintf("Can't load history: ");/*FIXRESET*/ if (flags & ERR_NAME) xprintf("%s: ", bname);/*FIXRESET*/ if ((flags & ERR_OLD)) { Modified: head/contrib/tcsh/sh.h ============================================================================== --- head/contrib/tcsh/sh.h Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/sh.h Mon Oct 21 21:21:34 2019 (r353875) @@ -682,13 +682,27 @@ EXTERN int OLDSTD IZERO; /* Old standard input (def */ #ifdef SIGSETJMP - typedef struct { sigjmp_buf j; } jmp_buf_t; -# define setexit() sigsetjmp(reslab.j, 1) -# define _reset() siglongjmp(reslab.j, 1) + typedef struct { const char *f; size_t l; sigjmp_buf j; } jmp_buf_t; +# define tcsh_setjmp() sigsetjmp(reslab.j, 1) +# define tcsh_longjmp() siglongjmp(reslab.j, 1) +# define setexit() (reslab.f = __func__, \ + reslab.l = __LINE__, \ + sigsetjmp(reslab.j, 1)) +# define _reset() siglongjmp(reslab.j, 1) #else - typedef struct { jmp_buf j; } jmp_buf_t; -# define setexit() setjmp(reslab.j) -# define _reset() longjmp(reslab.j, 1) + typedef struct { const char *f; size_t l; jmp_buf j; } jmp_buf_t; +# define tcsh_setjmp() setjmp(reslab.j) +# define tcsh_longjmp() longjmp(reslab.j, 1) +#endif + +#define setexit() (reslab.f = __func__, \ + reslab.l = __LINE__, \ + tcsh_setjmp()) +#ifdef SETJMP_DEBUG +# define _reset() xprintf("reset %s %zu\n", reslab.f, reslab.l), \ + flush(), tcsh_longjmp() +#else +# define _reset() tcsh_longjmp() #endif #define getexit(a) (void) ((a) = reslab) Modified: head/contrib/tcsh/sh.hist.c ============================================================================== --- head/contrib/tcsh/sh.hist.c Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/sh.hist.c Mon Oct 21 21:21:34 2019 (r353875) @@ -1281,6 +1281,7 @@ rechist(Char *fname, int ref) } if (merge) { + jmp_buf_t osetexit; if (lock) { #ifndef WINNT_NATIVE char *lockpath = strsave(short2str(fname)); @@ -1290,7 +1291,10 @@ rechist(Char *fname, int ref) cleanup_push(lockpath, dotlock_cleanup); #endif } - loadhist(fname, 1); + getexit(osetexit); + if (setexit()) + loadhist(fname, 1); + resexit(osetexit); } } rs = randsuf(); Modified: head/contrib/tcsh/sh.lex.c ============================================================================== --- head/contrib/tcsh/sh.lex.c Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/sh.lex.c Mon Oct 21 21:21:34 2019 (r353875) @@ -1020,8 +1020,10 @@ domod(Char *cp, Char type) switch (type) { - case 'x': case 'q': + case 'x': + if (*cp == '\0') + return Strsave(STRQNULL); wp = Strsave(cp); for (xp = wp; (c = *xp) != 0; xp++) if ((c != ' ' && c != '\t') || type == 'q') Modified: head/contrib/tcsh/tc.const.c ============================================================================== --- head/contrib/tcsh/tc.const.c Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/tc.const.c Mon Oct 21 21:21:34 2019 (r353875) @@ -253,10 +253,10 @@ Char STRnormal[] = { 'n', 'o', 'r', 'm', 'a', 'l', '\0 Char STRsldtlogout[] = { '/', '.', 'l', 'o', 'g', 'o', 'u', 't', '\0' }; Char STRjobs[] = { 'j', 'o', 'b', 's', '\0' }; Char STRdefprompt[] = { '%', '#', ' ', '\0' }; -Char STRmquestion[] = { '%', 'R', '?' | QUOTE, ' ', '\0' }; +Char STRmquestion[] = { '%', 'R', (Char)('?' | QUOTE), ' ', '\0' }; Char STRKCORRECT[] = { 'C', 'O', 'R', 'R', 'E', 'C', 'T', '>', '%', 'R', ' ', '(', 'y', '|', 'n', '|', 'e', '|', 'a', ')', - '?' | QUOTE, ' ', '\0' }; + (Char)('?' | QUOTE), ' ', '\0' }; Char STRunalias[] = { 'u', 'n', 'a', 'l', 'i', 'a', 's', '\0' }; Char STRalias[] = { 'a', 'l', 'i', 'a', 's', '\0' }; Char STRprecmd[] = { 'p', 'r', 'e', 'c', 'm', 'd', '\0' }; @@ -380,7 +380,7 @@ Char STRlistmaxrows[] = { 'l', 'i', 's', 't', 'm', 'a' Char STRlistmax[] = { 'l', 'i', 's', 't', 'm', 'a', 'x', '\0' }; Char STRlistlinks[] = { 'l', 'i', 's', 't', 'l', 'i', 'n', 'k', 's', '\0' }; Char STRDING[] = { 'D', 'I', 'N', 'G', '!', '\0' }; -Char STRQNULL[] = { '\0' | QUOTE, '\0' }; +Char STRQNULL[] = { (Char)('\0' | QUOTE), '\0' }; Char STRcorrect[] = { 'c', 'o', 'r', 'r', 'e', 'c', 't', '\0' }; Char STRcmd[] = { 'c', 'm', 'd', '\0' }; Char STRall[] = { 'a', 'l', 'l', '\0' }; Modified: head/contrib/tcsh/tc.sig.h ============================================================================== --- head/contrib/tcsh/tc.sig.h Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/tc.sig.h Mon Oct 21 21:21:34 2019 (r353875) @@ -42,7 +42,7 @@ # include #endif /* SYSVREL > 0 */ -#if defined(__APPLE__) || defined(SUNOS4) || defined(DGUX) || defined(hp800) || (SYSVREL > 3 && defined(VFORK)) +#if defined(SUNOS4) || defined(DGUX) || defined(hp800) || (SYSVREL > 3 && defined(VFORK)) # define SAVESIGVEC #endif /* SUNOS4 || DGUX || hp800 || SVR4 & VFORK */ Modified: head/contrib/tcsh/tcsh.man.new ============================================================================== --- head/contrib/tcsh/tcsh.man.new Mon Oct 21 20:28:38 2019 (r353874) +++ head/contrib/tcsh/tcsh.man.new Mon Oct 21 21:21:34 2019 (r353875) @@ -391,7 +391,7 @@ variants; see .Sx FILES . .Ss Editing We first describe -.Sx The command-line editor" +.Sx The command-line editor The .Sx Completion and listing and @@ -402,7 +402,7 @@ Finally, .Sx Editor commands lists and describes the editor commands specific to the shell and their default bindings. -.It Sx The command-line editor (+) +.Ss The command-line editor (+) Command-line input can be edited using key sequences much like those used in .Xr emacs 1 or @@ -684,9 +684,8 @@ If the .Va complete shell variable is set to .Sq enhance , -completion -1) ignores case and 2) considers periods, hyphens and underscores -.Sq ( . , +completion 1) ignores case and 2) considers periods, hyphens and underscores +.Sq ( \&. , .Sq \&- and .Sq _ ) @@ -727,7 +726,7 @@ hyphens or underscores. If the .Va complete shell variable is set to -.Sq enhance , +.Sq Enhance , completion ignores case and differences between a hyphen and an underscore word separator only when the user types a lowercase character or a hyphen. @@ -1093,17 +1092,20 @@ must be bound to a single character for this to work) or one of the following special characters may be typed: .Pp -.Sq ^W +.Bl -tag -width indent -compact +.It ^W Appends the rest of the word under the cursor to the search pattern. -delete (or any character bound to +.It delete +(or any character bound to .Ic backward-delete-char ) Undoes the effect of the last character typed and deletes a character from the search pattern if appropriate. -.Sq ^G +.It ^G If the previous search was successful, aborts the entire search. If not, goes back to the last successful search. -escape +.It escape Ends the search, leaving the current line in the input buffer. +.El .Pp Any other character not bound to .Ic self-insert-command @@ -1664,6 +1666,7 @@ The words of an input line are numbered from 0, the first (usually command) word being 0, the second word (first argument) being 1, etc. The basic word designators are: +.Pp .Bl -tag -width XXXX -offset indent -compact .It Ar 0 The first (command) word @@ -2021,7 +2024,7 @@ cause an error. .Pp Some aliases are referred to by the shell; see .Va Special aliases -.Sx Variable substitution +.Ss Variable substitution The shell maintains a list of variables, each of which has as value a list of zero or more words. The values of shell variables can be displayed and changed with the @@ -2219,7 +2222,7 @@ The following substitutions can not be modified with .Sq \&: modifiers. .Pp -.Bl -tag -width XXXXXXXX -offset indent -compact +.Bl -tag -width XXXXXXXXXX -offset indent -compact .It Ar $?name .It Ar ${?name} Substitutes the string @@ -2238,27 +2241,21 @@ if it is not. Always .Sq 0 in interactive shells. -.It Ar -$#name -${#name} +.It Ar $#name +.It Ar ${#name} Substitutes the number of words in .Va name -.It Ar -$# +.It Ar $# Equivalent to .Sq $#argv (+) -.It Ar -$% -.Va name +.It Ar $%name .It Ar ${%name} Substitutes the number of characters in .Va name (+) .Pp -$% -.Va number -.TP 8 +.It Ar $%number .It Ar ${%number} Substitutes the number of characters in .Va $argv[number] . @@ -2749,7 +2746,7 @@ file to it on standard input. The standard input and standard output of a command may be redirected with the following syntax: .Pp -.Bl -tag -width XXXXXX -offset indent -compact +.Bl -tag -width XXXXXXXXX -offset indent -compact .It Ar < name Open file .Va name @@ -3143,63 +3140,47 @@ They have the same format as before; .Va op may be one of .Pp -.PD 0 -.RS +4 -.TP 8 -.B A +.Bl -tag -width XXX -offset indent -compact +.It Ar A Last file access time, as the number of seconds since the epoch -.TP 8 -.B A: +.It Ar A: Like -.Va A +.Va Ar A , but in timestamp format, e.g., .Sq Fri May 14 16:36:10 1993 -.TP 8 -.B M +.It Ar M Last file modification time -.TP 8 -.B M: +.It Ar M: Like .Va M , but in timestamp format -.TP 8 -.B C +.It Ar C Last inode modification time -.TP 8 -.B C: +.It Ar C: Like .Va C , but in timestamp format -.TP 8 -.B D +.It Ar D Device number -.TP 8 -.B I +.It Ar I Inode number -.TP 8 -.B F +.It Ar F Composite .Va f ile identifier, in the form -.Va device -: +.Va device : .Va inode -.TP 8 -.B L +.It Ar L The name of the file pointed to by a symbolic link -.TP 8 -.B N +.It Ar N Number of (hard) links -.TP 8 -.B P +.It Ar P Permissions, in octal, without leading zero -.TP 8 -.B P: +.It Ar P: Like .Va P , with leading zero -.TP 8 -.B P\fImode +.It Ar P Equivalent to .Sq \-P .Va file @@ -3217,28 +3198,22 @@ if by group only, and .Sq 0 if by neither -.TP 8 -.B P\fImode\fB: -Like \fBP +.It Ar P: +Like +.Ar BP .Va mode , with leading zero -.TP 8 -.B U +.It Ar U Numeric userid -.TP 8 -.B U: +.It Ar U: Username, or the numeric userid if the username is unknown -.TP 8 -.B G +.It Ar G Numeric groupid -.TP 8 -.B G: +.It Ar G: Groupname, or the numeric groupid if the groupname is unknown -.TP 8 -.B Z +.It Ar Z Size, in bytes -.RE -.PD +.El .Pp Only one of these operators may appear in a multiple-operator test, and it must be the last. @@ -3791,45 +3766,24 @@ The next sections of this manual describe all of the a and .Va Special shell variables .Ss "Builtin commands" -.TP 8 -.B %\fIjob +.Bl -tag -width XXXXXXX -offset indent +.It Ar %job A synonym for the .Va fg builtin command. -.TP 8 -.B %\fIjob \fB& +.It Ar %job \&& A synonym for the .Va bg builtin command. -.TP 8 -.B : +.It Ar \&: Does nothing, successfully. .Pp -.B @ -.br -.B @ \fIname\fB = \fIexpr -.br -.B @ -.Va name -[ -.Va index -]\fB = \fIexpr -.br -.B @ \fIname -.Va ++ -|\fB-- -.PD 0 -.TP 8 -.B @ -.Va name -[ -.Va index -] -.Va ++ -|\fB-- +.It Ar @ +.It Ar @ name = expr +.It Ar @ name[index] = expr +.It Ar @ name++|-- +.It Ar @name[index]++|-- The first form prints the values of all shell variables. -.PD -.RS +8 .Pp The second form assigns the value of .Va expr @@ -3875,7 +3829,10 @@ has nothing to do with that described under .Va Expressions .Pp -The fourth and fifth forms increment (`++') or decrement (`\-\-') +The fourth and fifth forms increment ( +.Sq ++ ) +or decrement +.Sq ( -- ) .Va name or its .Va index @@ -3898,14 +3855,7 @@ are optional. Components of .Va expr must be separated by spaces. -.RE -.PD -.TP 8 -.B alias \fR[ -.Va name -[ -.Va wordlist -]] +.It Ar alias[name[wordlist]] Without arguments, prints all aliases. With .Va name @@ -3928,8 +3878,7 @@ or See also the .Va unalias builtin command. -.TP 8 -.B alloc +.It Ar alloc Shows the amount of dynamic memory acquired, broken down into used and free memory. With an argument shows the number of free and used blocks in each size @@ -3939,9 +3888,7 @@ This command's output may vary across system types, because systems other than the VAX may use a different memory allocator. .TP 8 -.B bg \fR[\fB% -.Va job -...] +.It Ar bg[%job...] Puts the specified jobs (or, without arguments, the current job) into the background, continuing each if it is stopped. .Va job @@ -3957,35 +3904,10 @@ as described under .Va Jobs .Pp -.B bindkey \fR[ -.Fl l\fR| -.Fl d\fR| -.Fl e\fR| -.Fl v\fR| -.Fl u\fR] (+) -.br -.Va bindkey -[ -.Fl a\fR] [ -.Fl b\fR] [ -.Fl k\fR] [ -.Fl r\fR] [ -.Fl \-\fR] -.Va key -(+) -.PD 0 -.TP 8 -.Va bindkey -[ -.Fl a\fR] [ -.Fl b\fR] [ -.Fl k\fR] [ -.Fl c\fR| -.Fl s\fR] [ -.Fl \-\fR] -.Va key command -(+) -.\" .B macro can't take too many words, so I used \fB in the previous tags +.It Ar bindkey Oo Fl l Ns | Ns Fl d Ns | Ns Fl e Ns | Ns Fl v Ns | Ns Fl u Oc (+) +.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl r Oc Oo Fl Fl Oc Ar key (+) +.It Ar bindkey Oo Fl a Oc Oo Fl b Oc Oo Fl k Oc Oo Fl c Ns | Ns Fl s Oc Oo Fl Fl Oc Ar key command (+) +.\" .It Ar macro can't take too many words, so I used \fB in the previous tags Without options, the first form lists all bound keys and the editor command to which each is bound, the second form lists the editor command to which .Va key @@ -3995,43 +3917,35 @@ the third form binds the editor command to .Va key Options include: -.PD .Pp -.PD 0 -.RS +8 -.TP 4 -.Fl l +.Bl -tag -width XXX -compact +.It Fl l Lists all editor commands and a short description of each. -.TP 4 -.Fl d +.It Fl d Binds all keys to the standard bindings for the default editor, as per .Va -e and .Va -v below. -.TP 4 -.Fl e +.It Fl e Binds all keys to .Va emacs (1)\-style bindings. Unsets .Va vimode -.TP 4 -.Fl v +.It Fl v Binds all keys to .Va vi (1)\-style bindings. Sets .Va vimode -.TP 4 -.Fl a +.It Fl a Lists or changes key-bindings in the alternative key map. This is the key map used in .Va vimode command mode. -.TP 4 -.Fl b +.It Fl b .Va key is interpreted as a control character written ^ @@ -4059,8 +3973,7 @@ or an extended prefix key written X- (e.g., .Sq X-A ). -.TP 4 -.Fl k +.It Fl k .Va key is interpreted as a symbolic arrow key name, which may be one of `down', @@ -4069,8 +3982,7 @@ is interpreted as a symbolic arrow key name, which may .Sq left or .Sq right -.TP 4 -.Fl r +.It Fl r Removes .Va key 's binding. @@ -4085,13 +3997,11 @@ to (q.v.), it unbinds .Va key completely. -.TP 4 -.Fl c +.It Fl c .Va command is interpreted as a builtin or external command instead of an editor command. -.TP 4 -.Fl s +.It Fl s .Va command is taken as a literal string and treated as terminal input when @@ -4101,15 +4011,14 @@ Bound keys in .Va command are themselves reinterpreted, and this continues for ten levels of interpretation. -.TP 4 -.Fl \- +.It Fl \&- Forces a break from option processing, so the next word is taken as .Va key -even if it begins with '\-'. -.TP 4 -.Fl u \fR(or any invalid option) +even if it begins with '\&-'. +.It Fl u +(or any invalid option) Prints a usage message. -.PD +.El .Pp .Va key may be a single character or a string. @@ -4137,48 +4046,35 @@ can contain backslashed escape sequences (in the style of System V .Va echo (1)) as follows: -.RS +4 -.TP 8 -.PD 0 -.B \ea +.Pp +.Bl -tag -width XXXX -compact -offset indent +.It \ea Bell -.TP 8 -.B \eb +.It \eb Backspace -.TP 8 -.B \ee +.It \ee Escape -.TP 8 -.B \ef +.It \ef Form feed -.TP 8 -.B \en +.It \en Newline -.TP 8 -.B \er +.It \er Carriage return -.TP 8 -.B \et +.It \et Horizontal tab -.TP 8 -.B \ev +.It \ev Vertical tab -.TP 8 -.B \e\fInnn +.It \e\fInnn The ASCII character corresponding to the octal number .Va nnn -.PD -.RE +.El .Pp `\e' nullifies the special meaning of the following character, if it has any, notably .Sq \e and .Sq ^ -.RE -.TP 8 -.B bs2cmd -.Va bs2000-command +.It bs2cmd Va bs2000-command (+) Passes .Va bs2000-command @@ -4186,8 +4082,7 @@ to the BS2000 command interpreter for execution. Only non-interactive commands can be executed, and it is not possible to execute any command that would overlay the image of the current process, like /EXECUTE or /CALL-PROCEDURE. (BS2000 only) -.TP 8 -.B break +.It break Causes execution to resume after the .Va end of the nearest @@ -4199,17 +4094,16 @@ The remaining commands on the current line are executed. Multi-level breaks are thus possible by writing them all on one line. -.TP 8 -.B breaksw +.It breaksw Causes a break from a .Va switch , resuming after the .Va endsw -.TP 8 -.B builtins \fR(+) + +.It builtins \fR(+) Prints the names of all builtin commands. -.TP 8 -.B bye \fR(+) + +.It bye \fR(+) A synonym for the .Va logout builtin command. @@ -4217,13 +4111,13 @@ Available only if the shell was so compiled; see the .Va version shell variable. -.TP 8 -.B case \fIlabel\fB: + +.It case \fIlabel\fB: A label in a .Va switch statement as discussed below. -.TP 8 -.B cd \fR[ + +.It cd \fR[ .Fl p\fR] [ .Fl l\fR] [ .Fl n\fR| @@ -4300,13 +4194,13 @@ and .Va cdtohome shell variables. .RE -.TP 8 -.B chdir + +.It chdir A synonym for the .Va cd builtin command. -.TP 8 -.B complete \fR[ + +.It complete \fR[ .Va command [\fIword\fB/\fIpattern\fB/ .Va list @@ -4350,7 +4244,7 @@ is to be completed, and may be one of the following: .PD 0 .RS +4 .TP 4 -.B c +.It c Current-word completion. .Va pattern is a glob-pattern which must match the beginning of the current word on @@ -4358,25 +4252,25 @@ the command line. .Va pattern is ignored when completing the current word. .TP 4 -.B C +.It C Like .Va c , but includes .Va pattern when completing the current word. .TP 4 -.B n +.It n Next-word completion. .Va pattern is a glob-pattern which must match the beginning of the previous word on the command line. .TP 4 -.B N +.It N Like .Va n , but must match the beginning of the word two before the current word. .TP 4 -.B p +.It p Position-dependent completion. .Va pattern is a numeric range, with the same syntax used to index shell @@ -4387,71 +4281,50 @@ variables, which must include the current word. .Va list , the list of possible completions, may be one of the following: .Pp -.PD 0 -.RS +4 -.TP 8 -.B a +.Bl -tag +.It a Aliases -.TP 8 -.B b +.It b Bindings (editor commands) -.TP 8 -.B c +.It c Commands (builtin or external commands) -.TP 8 -.B C +.It C External commands which begin with the supplied path prefix -.TP 8 -.B d +.It d Directories -.TP 8 -.B D *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Mon Oct 21 23:12:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 416BA16460A; Mon, 21 Oct 2019 23:12:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xsq30xlDz40JM; Mon, 21 Oct 2019 23:12:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03D57322E; Mon, 21 Oct 2019 23:12:15 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9LNCEmf052415; Mon, 21 Oct 2019 23:12:14 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9LNCEbX052414; Mon, 21 Oct 2019 23:12:14 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910212312.x9LNCEbX052414@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 21 Oct 2019 23:12:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353876 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353876 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 21 Oct 2019 23:12:15 -0000 Author: glebius Date: Mon Oct 21 23:12:14 2019 New Revision: 353876 URL: https://svnweb.freebsd.org/changeset/base/353876 Log: Assert that any epoch tracker belongs to the thread stack. Reviewed by: kib Modified: head/sys/kern/subr_epoch.c Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Mon Oct 21 21:21:34 2019 (r353875) +++ head/sys/kern/subr_epoch.c Mon Oct 21 23:12:14 2019 (r353876) @@ -366,9 +366,13 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et struct thread *td; MPASS(cold || epoch != NULL); - INIT_CHECK(epoch); MPASS(epoch->e_flags & EPOCH_PREEMPT); td = curthread; + MPASS((vm_offset_t)et >= td->td_kstack && + (vm_offset_t)et + sizeof(struct epoch_tracker) < + td->td_kstack + td->td_kstack_pages * PAGE_SIZE); + + INIT_CHECK(epoch); #ifdef EPOCH_TRACE epoch_trace_enter(td, epoch, et, file, line); #endif From owner-svn-src-all@freebsd.org Tue Oct 22 00:18:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0237E165F57; Tue, 22 Oct 2019 00:18:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46xvHD67Jxz44Z2; Tue, 22 Oct 2019 00:18:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B16A440B4; Tue, 22 Oct 2019 00:18:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9M0IGhX090845; Tue, 22 Oct 2019 00:18:16 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9M0IGgO090844; Tue, 22 Oct 2019 00:18:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910220018.x9M0IGgO090844@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 22 Oct 2019 00:18:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353877 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353877 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 00:18:17 -0000 Author: kevans Date: Tue Oct 22 00:18:16 2019 New Revision: 353877 URL: https://svnweb.freebsd.org/changeset/base/353877 Log: tuntap(4): properly declare if_tun and if_tap modules Simply adding MODULE_VERSION does not do the trick, because the modules haven't been declared. This should actually fix modfind/kldstat, which r351229 aimed and failed to do. This should make vm-bhyve do the right thing again when using the ports version, rather than the latest version not in ports. MFC after: 3 days Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Mon Oct 21 23:12:14 2019 (r353876) +++ head/sys/net/if_tuntap.c Tue Oct 22 00:18:16 2019 (r353877) @@ -783,9 +783,15 @@ static moduledata_t tuntap_mod = { 0 }; +/* We'll only ever have these two, so no need for a macro. */ +static moduledata_t tun_mod = { "if_tun", NULL, 0 }; +static moduledata_t tap_mod = { "if_tap", NULL, 0 }; + DECLARE_MODULE(if_tuntap, tuntap_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(if_tuntap, 1); +DECLARE_MODULE(if_tun, tun_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(if_tun, 1); +DECLARE_MODULE(if_tap, tap_mod, SI_SUB_PSEUDO, SI_ORDER_ANY); MODULE_VERSION(if_tap, 1); static int From owner-svn-src-all@freebsd.org Tue Oct 22 08:29:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F658154047; Tue, 22 Oct 2019 08:29:00 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-yb1-f175.google.com (mail-yb1-f175.google.com [209.85.219.175]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46y69S1MTNz4TQd; Tue, 22 Oct 2019 08:28:59 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-yb1-f175.google.com with SMTP id z2so4888963ybn.6; Tue, 22 Oct 2019 01:28:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hJl+PtRA18XzIvQvqvbNXkJdcbhldrxutFupXGUIXho=; b=K35zrO/KA9884lRJ2Y682t48FEDPW/BiwpD7ETXohGpiQfCSJ0nBv0GdFrfdzrrJaz KxN4Fqqrer/SNMeoL/6F0fq3z8waobjgX/g0WQ6MqIkFxWrc+mj7VyoFeMscjsslxATS ybUwPnasKNeberzBxWD5b367cZrVwHOL/DoZoMuwCd2WiF4ebcq9YFovcOhbULVheRkv 3hylGqVZfS9Owd72y+HLpG18CzM/W8WvQUJJXNVtyfuNhv2JLPXbrfpjy/pqaXBjXRrL ts5Z7ieQ0Ux5RdqWs1ucpZRt1ktGPk4Y0gMPj1/msFixC1YeqXYgGTS6hGF2Y7sFcJUU Xqag== X-Gm-Message-State: APjAAAV6fwk6H1CmHqEq04Xb5SF0QK5SxMMShsm669Aa3IO3/YwFeDb5 Kt5MoxPJzvy6+Iq4rr71quOwd0+Sgio2NqXYJgzHcFgg X-Google-Smtp-Source: APXvYqyL0xHdxNQgDSTpXb50tenyqsfKXf44npWJKmd2TaQifn/R2bkBrY5z4FC7Kh+E8u0xBRDP01pWMxxA9BiY/K8= X-Received: by 2002:a25:9087:: with SMTP id t7mr1518915ybl.451.1571732938347; Tue, 22 Oct 2019 01:28:58 -0700 (PDT) MIME-Version: 1.0 References: <201910212312.x9LNCEbX052414@repo.freebsd.org> In-Reply-To: <201910212312.x9LNCEbX052414@repo.freebsd.org> From: Li-Wen Hsu Date: Tue, 22 Oct 2019 16:28:45 +0800 Message-ID: Subject: Re: svn commit: r353876 - head/sys/kern To: Gleb Smirnoff Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46y69S1MTNz4TQd X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.995,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 08:29:00 -0000 On Tue, Oct 22, 2019 at 7:12 AM Gleb Smirnoff wrote: > > Author: glebius > Date: Mon Oct 21 23:12:14 2019 > New Revision: 353876 > URL: https://svnweb.freebsd.org/changeset/base/353876 > > Log: > Assert that any epoch tracker belongs to the thread stack. > > Reviewed by: kib > > Modified: > head/sys/kern/subr_epoch.c > > Modified: head/sys/kern/subr_epoch.c > ============================================================================== > --- head/sys/kern/subr_epoch.c Mon Oct 21 21:21:34 2019 (r353875) > +++ head/sys/kern/subr_epoch.c Mon Oct 21 23:12:14 2019 (r353876) > @@ -366,9 +366,13 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et > struct thread *td; > > MPASS(cold || epoch != NULL); > - INIT_CHECK(epoch); > MPASS(epoch->e_flags & EPOCH_PREEMPT); > td = curthread; > + MPASS((vm_offset_t)et >= td->td_kstack && > + (vm_offset_t)et + sizeof(struct epoch_tracker) < > + td->td_kstack + td->td_kstack_pages * PAGE_SIZE); > + > + INIT_CHECK(epoch); > #ifdef EPOCH_TRACE > epoch_trace_enter(td, epoch, et, file, line); > #endif Hello Gleb, RISC-V boot panics with this message: panic: Assertion (vm_offset_t)et >= td->td_kstack && (vm_offset_t)et + sizeof(struct epoch_tracker) < td->td_kstack + td->td_kstack_pages * PAGE_SIZE failed at /workspace/src/sys/kern/subr_epoch.c:373 Full log: https://ci.freebsd.org/job/FreeBSD-head-riscv64-test/12334/console Can you help check this? Thanks, Li-Wen From owner-svn-src-all@freebsd.org Tue Oct 22 08:52:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F01C154920; Tue, 22 Oct 2019 08:52:22 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46y6hP6Z5gz4VkW; Tue, 22 Oct 2019 08:52:21 +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 C4CAF9E48; Tue, 22 Oct 2019 08:52:21 +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 x9M8qLj0098647; Tue, 22 Oct 2019 08:52:21 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9M8qL68098646; Tue, 22 Oct 2019 08:52:21 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910220852.x9M8qL68098646@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 22 Oct 2019 08:52:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353878 - stable/12/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 353878 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 08:52:22 -0000 Author: avg Date: Tue Oct 22 08:52:21 2019 New Revision: 353878 URL: https://svnweb.freebsd.org/changeset/base/353878 Log: MFC r353624: MFV r353623: 10473 zfs(1M) missing cross-reference to zfs-program(1M) Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Tue Oct 22 00:18:16 2019 (r353877) +++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Tue Oct 22 08:52:21 2019 (r353878) @@ -23,17 +23,16 @@ .\" Copyright (c) 2012, Glen Barber .\" Copyright (c) 2012, Bryan Drewery .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. -.\" Copyright (c) 2014, Joyent, Inc. All rights reserved. .\" Copyright (c) 2013, Steven Hartland .\" Copyright (c) 2016 Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2014, Xin LI .\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved. -.\" Copyright 2018 Joyent, Inc. +.\" Copyright 2019 Joyent, Inc. .\" Copyright (c) 2018 Datto Inc. .\" .\" $FreeBSD$ .\" -.Dd February 15, 2018 +.Dd Octover 16, 2019 .Dt ZFS 8 .Os .Sh NAME @@ -3928,6 +3927,7 @@ M F /tank/test/modified .Xr jail 8 , .Xr mount 8 , .Xr umount 8 , +.Xr zfs-program 8 , .Xr zpool 8 .Sh AUTHORS This manual page is a From owner-svn-src-all@freebsd.org Tue Oct 22 08:53:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 67D611549BE; Tue, 22 Oct 2019 08:53:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46y6jH25tYz4Vsb; Tue, 22 Oct 2019 08:53:07 +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 2AF709E5E; Tue, 22 Oct 2019 08:53:07 +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 x9M8r66A098754; Tue, 22 Oct 2019 08:53:06 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9M8r6sl098753; Tue, 22 Oct 2019 08:53:06 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910220853.x9M8r6sl098753@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 22 Oct 2019 08:53:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353879 - stable/11/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 353879 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 08:53:07 -0000 Author: avg Date: Tue Oct 22 08:53:06 2019 New Revision: 353879 URL: https://svnweb.freebsd.org/changeset/base/353879 Log: MFC r353624: MFV r353623: 10473 zfs(1M) missing cross-reference to zfs-program(1M) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Tue Oct 22 08:52:21 2019 (r353878) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Tue Oct 22 08:53:06 2019 (r353879) @@ -23,16 +23,15 @@ .\" Copyright (c) 2012, Glen Barber .\" Copyright (c) 2012, Bryan Drewery .\" Copyright (c) 2013 by Saso Kiselkov. All rights reserved. -.\" Copyright (c) 2014, Joyent, Inc. All rights reserved. .\" Copyright (c) 2013, Steven Hartland .\" Copyright (c) 2016 Nexenta Systems, Inc. All Rights Reserved. .\" Copyright (c) 2014, Xin LI .\" Copyright (c) 2014-2015, The FreeBSD Foundation, All Rights Reserved. -.\" Copyright 2018 Joyent, Inc. +.\" Copyright 2019 Joyent, Inc. .\" .\" $FreeBSD$ .\" -.Dd February 15, 2018 +.Dd Octover 16, 2019 .Dt ZFS 8 .Os .Sh NAME @@ -3917,6 +3916,7 @@ M F /tank/test/modified .Xr jail 8 , .Xr mount 8 , .Xr umount 8 , +.Xr zfs-program 8 , .Xr zpool 8 .Sh AUTHORS This manual page is a From owner-svn-src-all@freebsd.org Tue Oct 22 08:56:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD827154ADD; Tue, 22 Oct 2019 08:56:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46y6nV3y9cz4W2R; Tue, 22 Oct 2019 08:56:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 67A889E62; Tue, 22 Oct 2019 08:56:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9M8uk0b099022; Tue, 22 Oct 2019 08:56:46 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9M8ukMN099021; Tue, 22 Oct 2019 08:56:46 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910220856.x9M8ukMN099021@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 22 Oct 2019 08:56:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353880 - stable/12/sys/i386/include X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/i386/include X-SVN-Commit-Revision: 353880 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 08:56:46 -0000 Author: avg Date: Tue Oct 22 08:56:45 2019 New Revision: 353880 URL: https://svnweb.freebsd.org/changeset/base/353880 Log: MFC r353301: i386: hide more of atomic 64-bit definitions under _KERNEL Modified: stable/12/sys/i386/include/atomic.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/i386/include/atomic.h ============================================================================== --- stable/12/sys/i386/include/atomic.h Tue Oct 22 08:53:06 2019 (r353879) +++ stable/12/sys/i386/include/atomic.h Tue Oct 22 08:56:45 2019 (r353880) @@ -880,6 +880,7 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_testandset_32 atomic_testandset_int #define atomic_testandclear_32 atomic_testandclear_int +#ifdef _KERNEL /* Operations on 64-bit quad words. */ #define atomic_cmpset_acq_64 atomic_cmpset_64 #define atomic_cmpset_rel_64 atomic_cmpset_64 @@ -893,6 +894,7 @@ u_long atomic_swap_long(volatile u_long *p, u_long v); #define atomic_subtract_rel_64 atomic_subtract_64 #define atomic_load_64 atomic_load_acq_64 #define atomic_store_64 atomic_store_rel_64 +#endif /* Operations on pointers. */ #define atomic_set_ptr(p, v) \ From owner-svn-src-all@freebsd.org Tue Oct 22 09:07:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C5E39155456; Tue, 22 Oct 2019 09:07:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46y71J4pB5z4X1P; Tue, 22 Oct 2019 09:07:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 83A22A01E; Tue, 22 Oct 2019 09:07:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9M970wr005163; Tue, 22 Oct 2019 09:07:00 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9M96xma005148; Tue, 22 Oct 2019 09:06:59 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910220906.x9M96xma005148@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 22 Oct 2019 09:06:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353881 - in stable/12/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/common/atomic/i386 X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12/sys/cddl: compat/opensolaris/kern compat/opensolaris/sys contrib/opensolaris/common/atomic/i386 X-SVN-Commit-Revision: 353881 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 09:07:00 -0000 Author: avg Date: Tue Oct 22 09:06:59 2019 New Revision: 353881 URL: https://svnweb.freebsd.org/changeset/base/353881 Log: MFC r353167,r353270: ZFS: add emulation of atomic_swap_64 and atomic_load_64 Modified: stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c stable/12/sys/cddl/compat/opensolaris/sys/atomic.h stable/12/sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c ============================================================================== --- stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Tue Oct 22 08:56:45 2019 (r353880) +++ stable/12/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c Tue Oct 22 09:06:59 2019 (r353881) @@ -71,6 +71,29 @@ atomic_dec_64(volatile uint64_t *target) *target -= 1; mtx_unlock(&atomic_mtx); } + +uint64_t +atomic_swap_64(volatile uint64_t *a, uint64_t value) +{ + uint64_t ret; + + mtx_lock(&atomic_mtx); + ret = *a; + *a = value; + mtx_unlock(&atomic_mtx); + return (ret); +} + +uint64_t +atomic_load_64(volatile uint64_t *a) +{ + uint64_t ret; + + mtx_lock(&atomic_mtx); + ret = *a; + mtx_unlock(&atomic_mtx); + return (ret); +} #endif uint64_t Modified: stable/12/sys/cddl/compat/opensolaris/sys/atomic.h ============================================================================== --- stable/12/sys/cddl/compat/opensolaris/sys/atomic.h Tue Oct 22 08:56:45 2019 (r353880) +++ stable/12/sys/cddl/compat/opensolaris/sys/atomic.h Tue Oct 22 09:06:59 2019 (r353881) @@ -44,6 +44,8 @@ !defined(ARM_HAVE_ATOMIC64) && !defined(I386_HAVE_ATOMIC64) extern void atomic_add_64(volatile uint64_t *target, int64_t delta); extern void atomic_dec_64(volatile uint64_t *target); +extern uint64_t atomic_swap_64(volatile uint64_t *a, uint64_t value); +extern uint64_t atomic_load_64(volatile uint64_t *a); #endif #ifndef __sparc64__ extern uint32_t atomic_cas_32(volatile uint32_t *target, uint32_t cmp, Modified: stable/12/sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S Tue Oct 22 08:56:45 2019 (r353880) +++ stable/12/sys/cddl/contrib/opensolaris/common/atomic/i386/opensolaris_atomic.S Tue Oct 22 09:06:59 2019 (r353881) @@ -126,6 +126,34 @@ ret SET_SIZE(atomic_cas_64) + ENTRY(atomic_swap_64) + pushl %esi + pushl %ebx + movl 12(%esp), %esi + movl 16(%esp), %ebx + movl 20(%esp), %ecx + movl (%esi), %eax + movl 4(%esi), %edx // %edx:%eax = old value +1: + lock + cmpxchg8b (%esi) + jne 1b + popl %ebx + popl %esi + ret + SET_SIZE(atomic_swap_64) + + ENTRY(atomic_load_64) + pushl %esi + movl 8(%esp), %esi + movl %ebx, %eax // make old and new values equal, so that + movl %ecx, %edx // destination is never changed + lock + cmpxchg8b (%esi) + popl %esi + ret + SET_SIZE(atomic_load_64) + ENTRY(membar_producer) lock xorl $0, (%esp) From owner-svn-src-all@freebsd.org Tue Oct 22 14:06:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D78C115BA77; Tue, 22 Oct 2019 14:06:13 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yFfY5MC6z3K3g; Tue, 22 Oct 2019 14:06:13 +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 9710FD6DB; Tue, 22 Oct 2019 14:06:13 +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 x9ME6Dfb082097; Tue, 22 Oct 2019 14:06:13 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ME6Dd5082094; Tue, 22 Oct 2019 14:06:13 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910221406.x9ME6Dd5082094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Oct 2019 14:06:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353882 - in stable/12/sys: conf netinet X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys: conf netinet X-SVN-Commit-Revision: 353882 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 14:06:13 -0000 Author: markj Date: Tue Oct 22 14:06:12 2019 New Revision: 353882 URL: https://svnweb.freebsd.org/changeset/base/353882 Log: MFC r353477: Move SCTP DTrace probe definitions into a .c file. Added: stable/12/sys/netinet/sctp_kdtrace.c - copied unchanged from r353477, head/sys/netinet/sctp_kdtrace.c Deleted: stable/12/sys/netinet/sctp_dtrace_define.h Modified: stable/12/sys/conf/files stable/12/sys/netinet/sctp_pcb.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Tue Oct 22 09:06:59 2019 (r353881) +++ stable/12/sys/conf/files Tue Oct 22 14:06:12 2019 (r353882) @@ -4343,6 +4343,7 @@ netinet/sctp_cc_functions.c optional inet sctp | inet6 netinet/sctp_crc32.c optional inet | inet6 netinet/sctp_indata.c optional inet sctp | inet6 sctp netinet/sctp_input.c optional inet sctp | inet6 sctp +netinet/sctp_kdtrace.c optional inet sctp | inet6 sctp netinet/sctp_output.c optional inet sctp | inet6 sctp netinet/sctp_pcb.c optional inet sctp | inet6 sctp netinet/sctp_peeloff.c optional inet sctp | inet6 sctp Copied: stable/12/sys/netinet/sctp_kdtrace.c (from r353477, head/sys/netinet/sctp_kdtrace.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/netinet/sctp_kdtrace.c Tue Oct 22 14:06:12 2019 (r353882, copy of r353477, head/sys/netinet/sctp_kdtrace.c) @@ -0,0 +1,173 @@ +/*- + * SPDX-License-Identifier: BSD-3-Clause + * + * Copyright (c) 2008-2012, by Randall Stewart. All rights reserved. + * Copyright (c) 2008-2012, by Michael Tuexen. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * a) Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * b) 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. + * + * c) Neither the name of Cisco Systems, Inc. nor the names of its + * contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE 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. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +SDT_PROVIDER_DECLARE(sctp); + +/********************************************************/ +/* Cwnd probe - tracks changes in the congestion window on a netp */ +/********************************************************/ +/* Initial */ +SDT_PROBE_DEFINE5(sctp, cwnd, net, init, + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ + +/* ACK-INCREASE */ +SDT_PROBE_DEFINE5(sctp, cwnd, net, ack, + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ + +/* ACK-INCREASE */ +SDT_PROBE_DEFINE5(sctp, cwnd, net, rttvar, + "uint64_t", /* The Vtag << 32 | localport << 16 | + * remoteport */ + "uint64_t", /* obw | nbw */ + "uint64_t", /* bwrtt | newrtt */ + "uint64_t", /* flight */ + "uint64_t"); /* (cwnd << 32) | point << 16 | retval(0/1) */ + +SDT_PROBE_DEFINE5(sctp, cwnd, net, rttstep, + "uint64_t", /* The Vtag << 32 | localport << 16 | + * remoteport */ + "uint64_t", /* obw | nbw */ + "uint64_t", /* bwrtt | newrtt */ + "uint64_t", /* flight */ + "uint64_t"); /* (cwnd << 32) | point << 16 | retval(0/1) */ + +/* FastRetransmit-DECREASE */ +SDT_PROBE_DEFINE5(sctp, cwnd, net, fr, + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ + +/* TimeOut-DECREASE */ +SDT_PROBE_DEFINE5(sctp, cwnd, net, to, + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ + +/* BurstLimit-DECREASE */ +SDT_PROBE_DEFINE5(sctp, cwnd, net, bl, + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ + +/* ECN-DECREASE */ +SDT_PROBE_DEFINE5(sctp, cwnd, net, ecn, + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ + +/* PacketDrop-DECREASE */ +SDT_PROBE_DEFINE5(sctp, cwnd, net, pd, + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The old value of the cwnd */ + "int"); /* The new value of the cwnd */ + +/********************************************************/ +/* Rwnd probe - tracks changes in the receiver window for an assoc */ +/********************************************************/ +SDT_PROBE_DEFINE4(sctp, rwnd, assoc, val, + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "int", /* The up/down amount */ + "int"); /* The new value of the cwnd */ + +/********************************************************/ +/* flight probe - tracks changes in the flight size on a net or assoc */ +/********************************************************/ +SDT_PROBE_DEFINE5(sctp, flightsize, net, val, + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "uintptr_t", /* The pointer to the struct sctp_nets * + * changing */ + "int", /* The up/down amount */ + "int"); /* The new value of the cwnd */ + +/********************************************************/ +/* The total flight version */ +/********************************************************/ +SDT_PROBE_DEFINE4(sctp, flightsize, assoc, val, + "uint32_t", /* The Vtag for this end */ + "uint32_t", /* The port number of the local side << 16 | + * port number of remote in network byte + * order. */ + "int", /* The up/down amount */ + "int"); /* The new value of the cwnd */ Modified: stable/12/sys/netinet/sctp_pcb.c ============================================================================== --- stable/12/sys/netinet/sctp_pcb.c Tue Oct 22 09:06:59 2019 (r353881) +++ stable/12/sys/netinet/sctp_pcb.c Tue Oct 22 14:06:12 2019 (r353882) @@ -47,7 +47,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include #if defined(INET) || defined(INET6) #include #endif From owner-svn-src-all@freebsd.org Tue Oct 22 14:06:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2FB0415BAE4; Tue, 22 Oct 2019 14:06:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yFg70TVmz3KBB; Tue, 22 Oct 2019 14:06:43 +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 E7366D6DC; Tue, 22 Oct 2019 14:06:42 +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 x9ME6g0g082166; Tue, 22 Oct 2019 14:06:42 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9ME6gKk082165; Tue, 22 Oct 2019 14:06:42 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910221406.x9ME6gKk082165@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Oct 2019 14:06:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353883 - stable/12/sys/netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/netinet6 X-SVN-Commit-Revision: 353883 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 14:06:43 -0000 Author: markj Date: Tue Oct 22 14:06:42 2019 New Revision: 353883 URL: https://svnweb.freebsd.org/changeset/base/353883 Log: MFC r353457: Add a missing include of opt_sctp.h. Modified: stable/12/sys/netinet6/ip6_forward.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet6/ip6_forward.c ============================================================================== --- stable/12/sys/netinet6/ip6_forward.c Tue Oct 22 14:06:12 2019 (r353882) +++ stable/12/sys/netinet6/ip6_forward.c Tue Oct 22 14:06:42 2019 (r353883) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_ipsec.h" #include "opt_ipstealth.h" +#include "opt_sctp.h" #include #include From owner-svn-src-all@freebsd.org Tue Oct 22 14:10:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 058F215BB92; Tue, 22 Oct 2019 14:10:32 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yFlW6Nb6z3KLp; Tue, 22 Oct 2019 14:10:31 +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 BEE06D6E1; Tue, 22 Oct 2019 14:10:31 +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 x9MEAVGD082418; Tue, 22 Oct 2019 14:10:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MEAV6B082417; Tue, 22 Oct 2019 14:10:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910221410.x9MEAV6B082417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Oct 2019 14:10:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353884 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 353884 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 14:10:32 -0000 Author: markj Date: Tue Oct 22 14:10:31 2019 New Revision: 353884 URL: https://svnweb.freebsd.org/changeset/base/353884 Log: MFC r353734: Further constrain the use of per-CPU caches for free pages. PR: 241048 Modified: stable/12/sys/vm/vm_page.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/vm_page.c ============================================================================== --- stable/12/sys/vm/vm_page.c Tue Oct 22 14:06:42 2019 (r353883) +++ stable/12/sys/vm/vm_page.c Tue Oct 22 14:10:31 2019 (r353884) @@ -199,10 +199,12 @@ vm_page_init_cache_zones(void *dummy __unused) vmd = VM_DOMAIN(domain); /* - * Don't allow the page caches to take up more than .25% of - * memory. + * Don't allow the page caches to take up more than .1875% of + * memory. A UMA bucket contains at most 256 free pages, and we + * have two buckets per CPU per free pool. */ - if (vmd->vmd_page_count / 400 < 256 * mp_ncpus * VM_NFREEPOOL) + if (vmd->vmd_page_count / 600 < 2 * 256 * mp_ncpus * + VM_NFREEPOOL) continue; for (pool = 0; pool < VM_NFREEPOOL; pool++) { pgcache = &vmd->vmd_pgcache[pool]; From owner-svn-src-all@freebsd.org Tue Oct 22 14:11:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DB9915BD2C; Tue, 22 Oct 2019 14:11:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yFmW3FvSz3KWZ; Tue, 22 Oct 2019 14:11:23 +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 53332D736; Tue, 22 Oct 2019 14:11:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MEBNR2084928; Tue, 22 Oct 2019 14:11:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MEBNlA084542; Tue, 22 Oct 2019 14:11:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910221411.x9MEBNlA084542@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Oct 2019 14:11:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353885 - in stable/12/sys: modules/pf netpfil/pf X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys: modules/pf netpfil/pf X-SVN-Commit-Revision: 353885 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 14:11:23 -0000 Author: markj Date: Tue Oct 22 14:11:22 2019 New Revision: 353885 URL: https://svnweb.freebsd.org/changeset/base/353885 Log: MFC r353458, r353460: Add a missing include of opt_sctp.h. Modified: stable/12/sys/modules/pf/Makefile stable/12/sys/netpfil/pf/pf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/modules/pf/Makefile ============================================================================== --- stable/12/sys/modules/pf/Makefile Tue Oct 22 14:10:31 2019 (r353884) +++ stable/12/sys/modules/pf/Makefile Tue Oct 22 14:11:22 2019 (r353885) @@ -6,7 +6,7 @@ KMOD= pf SRCS= pf.c pf_if.c pf_lb.c pf_osfp.c pf_ioctl.c pf_norm.c pf_table.c \ pf_ruleset.c in4_cksum.c \ bus_if.h device_if.h \ - opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_global.h + opt_pf.h opt_inet.h opt_inet6.h opt_bpf.h opt_sctp.h opt_global.h .if !defined(KERNBUILDDIR) # pflog can be loaded as a module, have the additional checks turned on Modified: stable/12/sys/netpfil/pf/pf.c ============================================================================== --- stable/12/sys/netpfil/pf/pf.c Tue Oct 22 14:10:31 2019 (r353884) +++ stable/12/sys/netpfil/pf/pf.c Tue Oct 22 14:11:22 2019 (r353885) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include "opt_inet6.h" #include "opt_bpf.h" #include "opt_pf.h" +#include "opt_sctp.h" #include #include @@ -103,6 +104,10 @@ __FBSDID("$FreeBSD$"); #include #endif /* INET6 */ +#ifdef SCTP +#include +#endif + #include #include @@ -5589,7 +5594,7 @@ pf_route(struct mbuf **m, struct pf_rule *r, int dir, } #ifdef SCTP if (m0->m_pkthdr.csum_flags & CSUM_SCTP & ~ifp->if_hwassist) { - sctp_delayed_cksum(m, (uint32_t)(ip->ip_hl << 2)); + sctp_delayed_cksum(m0, (uint32_t)(ip->ip_hl << 2)); m0->m_pkthdr.csum_flags &= ~CSUM_SCTP; } #endif From owner-svn-src-all@freebsd.org Tue Oct 22 14:20:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EE6B815BF03; Tue, 22 Oct 2019 14:20:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yFyZ63Z5z3L5c; Tue, 22 Oct 2019 14:20:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 94AFDD8B4; Tue, 22 Oct 2019 14:20:06 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MEK6Sq088426; Tue, 22 Oct 2019 14:20:06 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MEK60F088425; Tue, 22 Oct 2019 14:20:06 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910221420.x9MEK60F088425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Oct 2019 14:20:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353886 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353886 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 14:20:07 -0000 Author: markj Date: Tue Oct 22 14:20:06 2019 New Revision: 353886 URL: https://svnweb.freebsd.org/changeset/base/353886 Log: Avoid reloading bucket pointers in uma_vm_zone_stats(). The correctness of per-CPU cache accounting in that function is dependent on reading per-CPU pointers exactly once. Ensure that the compiler does not emit multiple loads of those pointers. Reported and tested by: pho Reviewed by: kib MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22081 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Tue Oct 22 14:11:22 2019 (r353885) +++ head/sys/vm/uma_core.c Tue Oct 22 14:20:06 2019 (r353886) @@ -4055,6 +4055,7 @@ uma_vm_zone_stats(struct uma_type_header *uth, uma_zon struct uma_percpu_stat *ups, bool internal) { uma_zone_domain_t zdom; + uma_bucket_t bucket; uma_cache_t cache; int i; @@ -4068,28 +4069,29 @@ uma_vm_zone_stats(struct uma_type_header *uth, uma_zon uth->uth_fails = counter_u64_fetch(z->uz_fails); uth->uth_sleeps = z->uz_sleeps; uth->uth_xdomain = z->uz_xdomain; + /* - * While it is not normally safe to access the cache - * bucket pointers while not on the CPU that owns the - * cache, we only allow the pointers to be exchanged - * without the zone lock held, not invalidated, so - * accept the possible race associated with bucket - * exchange during monitoring. + * While it is not normally safe to access the cache bucket pointers + * while not on the CPU that owns the cache, we only allow the pointers + * to be exchanged without the zone lock held, not invalidated, so + * accept the possible race associated with bucket exchange during + * monitoring. Use atomic_load_ptr() to ensure that the bucket pointers + * are loaded only once. */ for (i = 0; i < mp_maxid + 1; i++) { bzero(&ups[i], sizeof(*ups)); if (internal || CPU_ABSENT(i)) continue; cache = &z->uz_cpu[i]; - if (cache->uc_allocbucket != NULL) - ups[i].ups_cache_free += - cache->uc_allocbucket->ub_cnt; - if (cache->uc_freebucket != NULL) - ups[i].ups_cache_free += - cache->uc_freebucket->ub_cnt; - if (cache->uc_crossbucket != NULL) - ups[i].ups_cache_free += - cache->uc_crossbucket->ub_cnt; + bucket = (uma_bucket_t)atomic_load_ptr(&cache->uc_allocbucket); + if (bucket != NULL) + ups[i].ups_cache_free += bucket->ub_cnt; + bucket = (uma_bucket_t)atomic_load_ptr(&cache->uc_freebucket); + if (bucket != NULL) + ups[i].ups_cache_free += bucket->ub_cnt; + bucket = (uma_bucket_t)atomic_load_ptr(&cache->uc_crossbucket); + if (bucket != NULL) + ups[i].ups_cache_free += bucket->ub_cnt; ups[i].ups_allocs = cache->uc_allocs; ups[i].ups_frees = cache->uc_frees; } From owner-svn-src-all@freebsd.org Tue Oct 22 14:20:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3221B15BF6C; Tue, 22 Oct 2019 14:20:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yFz81LGBz3LDg; Tue, 22 Oct 2019 14:20:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 11389D8C1; Tue, 22 Oct 2019 14:20:36 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MEKaOE088496; Tue, 22 Oct 2019 14:20:36 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MEKaqg088495; Tue, 22 Oct 2019 14:20:36 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910221420.x9MEKaqg088495@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Tue, 22 Oct 2019 14:20:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353887 - head/sys/dev/nctgpio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/nctgpio X-SVN-Commit-Revision: 353887 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 14:20:36 -0000 Author: avg Date: Tue Oct 22 14:20:35 2019 New Revision: 353887 URL: https://svnweb.freebsd.org/changeset/base/353887 Log: nctgpio: improve performance (latency) of operation This change consists of two parts. First, nctgpio now supports hardware access via an I/O port window if it's configured by firmware. For instance, PC Engines firmware v4.10.0.2 does that. This is faster than going through the Super I/O configuration registers. Second, nctgpio now caches values of bits that it controls. For example, the driver does not need to access the hardware to determine if a pin is an output or an input, or a state of an output. Also, the driver makes use of the fact that the hardware preserves an output state of a pin accross a switch to the input mode and back. With this change I am able to use the 1-Wire bus over nctgpio whereas previously the driver introduced too much latency to be compliant with the relatively strict protocol timings. superio0: at port 0x2e-0x2f on isa0 gpio1: at GPIO ldn 0x07 on superio0 pcib0: allocated type 4 (0x220-0x226) for rid 0 of gpio1 gpiobus1: on gpio1 owc0: at pin 4 on gpiobus1 ow0: <1 Wire Bus> on owc0 ow0: romid 28:b2:9e:45:92:10:02:34: no driver ow_temp0: romid 28:b2:9e:45:92:10:02:34 on ow0 MFC after: 4 weeks Modified: head/sys/dev/nctgpio/nctgpio.c Modified: head/sys/dev/nctgpio/nctgpio.c ============================================================================== --- head/sys/dev/nctgpio/nctgpio.c Tue Oct 22 14:20:06 2019 (r353886) +++ head/sys/dev/nctgpio/nctgpio.c Tue Oct 22 14:20:35 2019 (r353887) @@ -69,21 +69,49 @@ #define NCT_LDF_GPIO0_OUTCFG 0xe0 #define NCT_LDF_GPIO1_OUTCFG 0xe1 +/* Direct I/O port access. */ +#define NCT_IO_GSR 0 +#define NCT_IO_IOR 1 +#define NCT_IO_DAT 2 +#define NCT_IO_INV 3 #define NCT_MAX_PIN 15 #define NCT_IS_VALID_PIN(_p) ((_p) >= 0 && (_p) <= NCT_MAX_PIN) -#define NCT_PIN_BIT(_p) (1 << ((_p) % 8)) +#define NCT_PIN_BIT(_p) (1 << ((_p) & 7)) #define NCT_GPIO_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL | \ GPIO_PIN_INVIN | GPIO_PIN_INVOUT) +/* + * Note that the values are important. + * They match actual register offsets. + */ +typedef enum { + REG_IOR = 0, + REG_DAT = 1, + REG_INV = 2, +} reg_t; + struct nct_softc { device_t dev; device_t dev_f; device_t busdev; struct mtx mtx; + struct resource *iores; + int iorid; + int curgrp; + struct { + /* direction, 1: pin is input */ + uint8_t ior[2]; + /* output value */ + uint8_t out[2]; + /* whether out is valid */ + uint8_t out_known[2]; + /* inversion, 1: pin is inverted */ + uint8_t inv[2]; + } cache; struct gpio_pin pins[NCT_MAX_PIN + 1]; }; @@ -113,97 +141,142 @@ struct nuvoton_vendor_device_id { }, }; -/* - * Get the GPIO Input/Output register address - * for a pin. - */ +static void +nct_io_set_group(struct nct_softc *sc, int group) +{ + + GPIO_ASSERT_LOCKED(sc); + if (group != sc->curgrp) { + bus_write_1(sc->iores, NCT_IO_GSR, group); + sc->curgrp = group; + } +} + static uint8_t -nct_ior_addr(uint32_t pin_num) +nct_io_read(struct nct_softc *sc, int group, uint8_t reg) { - uint8_t addr; + nct_io_set_group(sc, group); + return (bus_read_1(sc->iores, reg)); +} - addr = NCT_LD7_GPIO0_IOR; - if (pin_num > 7) - addr = NCT_LD7_GPIO1_IOR; +static void +nct_io_write(struct nct_softc *sc, int group, uint8_t reg, uint8_t val) +{ + nct_io_set_group(sc, group); + return (bus_write_1(sc->iores, reg, val)); +} - return (addr); +static uint8_t +nct_get_ioreg(struct nct_softc *sc, reg_t reg, int group) +{ + uint8_t ioreg; + + if (sc->iores != NULL) + ioreg = NCT_IO_IOR + reg; + else if (group == 0) + ioreg = NCT_LD7_GPIO0_IOR + reg; + else + ioreg = NCT_LD7_GPIO1_IOR + reg; + return (ioreg); } -/* - * Get the GPIO Data register address for a pin. - */ static uint8_t -nct_dat_addr(uint32_t pin_num) +nct_read_reg(struct nct_softc *sc, reg_t reg, int group) { - uint8_t addr; + uint8_t ioreg; + uint8_t val; - addr = NCT_LD7_GPIO0_DAT; - if (pin_num > 7) - addr = NCT_LD7_GPIO1_DAT; + ioreg = nct_get_ioreg(sc, reg, group); + if (sc->iores != NULL) + val = nct_io_read(sc, group, ioreg); + else + val = superio_read(sc->dev, ioreg); - return (addr); + return (val); } -/* - * Get the GPIO Inversion register address - * for a pin. - */ -static uint8_t -nct_inv_addr(uint32_t pin_num) +#define GET_BIT(v, b) (((v) >> (b)) & 1) +static bool +nct_get_pin_reg(struct nct_softc *sc, reg_t reg, uint32_t pin_num) { - uint8_t addr; + uint8_t bit; + uint8_t group; + uint8_t val; - addr = NCT_LD7_GPIO0_INV; - if (pin_num > 7) - addr = NCT_LD7_GPIO1_INV; + KASSERT(NCT_IS_VALID_PIN(pin_num), ("%s: invalid pin number %d", + __func__, pin_num)); - return (addr); + group = pin_num >> 3; + bit = pin_num & 7; + val = nct_read_reg(sc, reg, group); + return (GET_BIT(val, bit)); } -/* - * Get the GPIO Output Configuration/Mode - * register address for a pin. - */ -static uint8_t -nct_outcfg_addr(uint32_t pin_num) +static int +nct_get_pin_cache(struct nct_softc *sc, uint32_t pin_num, uint8_t *cache) { - uint8_t addr; + uint8_t bit; + uint8_t group; + uint8_t val; - addr = NCT_LDF_GPIO0_OUTCFG; - if (pin_num > 7) - addr = NCT_LDF_GPIO1_OUTCFG; + KASSERT(NCT_IS_VALID_PIN(pin_num), ("%s: invalid pin number %d", + __func__, pin_num)); - return (addr); + group = pin_num >> 3; + bit = pin_num & 7; + val = cache[group]; + return (GET_BIT(val, bit)); } -/* - * Set a pin to output mode. - */ static void -nct_set_pin_is_output(struct nct_softc *sc, uint32_t pin_num) +nct_write_reg(struct nct_softc *sc, reg_t reg, int group, uint8_t val) { - uint8_t reg; - uint8_t ior; + uint8_t ioreg; - reg = nct_ior_addr(pin_num); - ior = superio_read(sc->dev, reg); - ior &= ~(NCT_PIN_BIT(pin_num)); - superio_write(sc->dev, reg, ior); + ioreg = nct_get_ioreg(sc, reg, group); + if (sc->iores != NULL) + nct_io_write(sc, group, ioreg, val); + else + superio_write(sc->dev, ioreg, val); } +static void +nct_set_pin_reg(struct nct_softc *sc, reg_t reg, uint32_t pin_num, bool val) +{ + uint8_t *cache; + uint8_t bit; + uint8_t bitval; + uint8_t group; + uint8_t mask; + + KASSERT(NCT_IS_VALID_PIN(pin_num), + ("%s: invalid pin number %d", __func__, pin_num)); + KASSERT(reg == REG_IOR || reg == REG_INV, + ("%s: unsupported register %d", __func__, reg)); + + group = pin_num >> 3; + bit = pin_num & 7; + mask = (uint8_t)1 << bit; + bitval = (uint8_t)val << bit; + + if (reg == REG_IOR) + cache = &sc->cache.ior[group]; + else + cache = &sc->cache.inv[group]; + if ((*cache & mask) == bitval) + return; + *cache &= ~mask; + *cache |= bitval; + nct_write_reg(sc, reg, group, *cache); +} + /* - * Set a pin to input mode. + * Set a pin to input (val is true) or output (val is false) mode. */ static void -nct_set_pin_is_input(struct nct_softc *sc, uint32_t pin_num) +nct_set_pin_input(struct nct_softc *sc, uint32_t pin_num, bool val) { - uint8_t reg; - uint8_t ior; - - reg = nct_ior_addr(pin_num); - ior = superio_read(sc->dev, reg); - ior |= NCT_PIN_BIT(pin_num); - superio_write(sc->dev, reg, ior); + nct_set_pin_reg(sc, REG_IOR, pin_num, val); } /* @@ -212,80 +285,98 @@ nct_set_pin_is_input(struct nct_softc *sc, uint32_t pi static bool nct_pin_is_input(struct nct_softc *sc, uint32_t pin_num) { - uint8_t reg; - uint8_t ior; + return (nct_get_pin_cache(sc, pin_num, sc->cache.ior)); +} - reg = nct_ior_addr(pin_num); - ior = superio_read(sc->dev, reg); +/* + * Set a pin to inverted (val is true) or normal (val is false) mode. + */ +static void +nct_set_pin_inverted(struct nct_softc *sc, uint32_t pin_num, bool val) +{ + nct_set_pin_reg(sc, REG_INV, pin_num, val); +} - return (ior & NCT_PIN_BIT(pin_num)); +static bool +nct_pin_is_inverted(struct nct_softc *sc, uint32_t pin_num) +{ + return (nct_get_pin_cache(sc, pin_num, sc->cache.inv)); } /* * Write a value to an output pin. + * NB: the hardware remembers last output value across switching from + * output mode to input mode and back. + * Writes to a pin in input mode are not allowed here as they cannot + * have any effect and would corrupt the output value cache. */ static void -nct_write_pin(struct nct_softc *sc, uint32_t pin_num, uint8_t data) +nct_write_pin(struct nct_softc *sc, uint32_t pin_num, bool val) { - uint8_t reg; - uint8_t value; + uint8_t bit; + uint8_t group; - reg = nct_dat_addr(pin_num); - value = superio_read(sc->dev, reg); - if (data) - value |= NCT_PIN_BIT(pin_num); + KASSERT(!nct_pin_is_input(sc, pin_num), ("attempt to write input pin")); + group = pin_num >> 3; + bit = pin_num & 7; + if (GET_BIT(sc->cache.out_known[group], bit) && + GET_BIT(sc->cache.out[group], bit) == val) { + /* The pin is already in requested state. */ + return; + } + sc->cache.out_known[group] |= 1 << bit; + if (val) + sc->cache.out[group] |= 1 << bit; else - value &= ~(NCT_PIN_BIT(pin_num)); - - superio_write(sc->dev, reg, value); + sc->cache.out[group] &= ~(1 << bit); + nct_write_reg(sc, REG_DAT, group, sc->cache.out[group]); } +/* + * NB: state of an input pin cannot be cached, of course. + * For an output we can either take the value from the cache if it's valid + * or read the state from the hadrware and cache it. + */ static bool nct_read_pin(struct nct_softc *sc, uint32_t pin_num) { - uint8_t reg; + uint8_t bit; + uint8_t group; + bool val; - reg = nct_dat_addr(pin_num); + if (nct_pin_is_input(sc, pin_num)) + return (nct_get_pin_reg(sc, REG_DAT, pin_num)); - return (superio_read(sc->dev, reg) & NCT_PIN_BIT(pin_num)); -} + group = pin_num >> 3; + bit = pin_num & 7; + if (GET_BIT(sc->cache.out_known[group], bit)) + return (GET_BIT(sc->cache.out[group], bit)); -static void -nct_set_pin_is_inverted(struct nct_softc *sc, uint32_t pin_num) -{ - uint8_t reg; - uint8_t inv; - - reg = nct_inv_addr(pin_num); - inv = superio_read(sc->dev, reg); - inv |= (NCT_PIN_BIT(pin_num)); - superio_write(sc->dev, reg, inv); + val = nct_get_pin_reg(sc, REG_DAT, pin_num); + sc->cache.out_known[group] |= 1 << bit; + if (val) + sc->cache.out[group] |= 1 << bit; + else + sc->cache.out[group] &= ~(1 << bit); + return (val); } -static void -nct_set_pin_not_inverted(struct nct_softc *sc, uint32_t pin_num) +static uint8_t +nct_outcfg_addr(uint32_t pin_num) { - uint8_t reg; - uint8_t inv; - - reg = nct_inv_addr(pin_num); - inv = superio_read(sc->dev, reg); - inv &= ~(NCT_PIN_BIT(pin_num)); - superio_write(sc->dev, reg, inv); + KASSERT(NCT_IS_VALID_PIN(pin_num), ("%s: invalid pin number %d", + __func__, pin_num)); + if ((pin_num >> 3) == 0) + return (NCT_LDF_GPIO0_OUTCFG); + else + return (NCT_LDF_GPIO1_OUTCFG); } -static bool -nct_pin_is_inverted(struct nct_softc *sc, uint32_t pin_num) -{ - uint8_t reg; - uint8_t inv; - - reg = nct_inv_addr(pin_num); - inv = superio_read(sc->dev, reg); - - return (inv & NCT_PIN_BIT(pin_num)); -} - +/* + * NB: PP/OD can be configured only via configuration registers. + * Also, the registers are in a different logical device. + * So, this is a special case. No caching too. + */ static void nct_set_pin_opendrain(struct nct_softc *sc, uint32_t pin_num) { @@ -353,6 +444,9 @@ static int nct_attach(device_t dev) { struct nct_softc *sc; + device_t dev_8; + uint16_t iobase; + int err; int i; sc = device_get_softc(dev); @@ -364,12 +458,67 @@ nct_attach(device_t dev) return (ENXIO); } + /* + * As strange as it may seem, I/O port base is configured in the + * Logical Device 8 which is primarily used for WDT, but also plays + * a role in GPIO configuration. + */ + iobase = 0; + dev_8 = superio_find_dev(device_get_parent(dev), SUPERIO_DEV_WDT, 8); + if (dev_8 != NULL) + iobase = superio_get_iobase(dev_8); + if (iobase != 0 && iobase != 0xffff) { + sc->curgrp = -1; + sc->iorid = 0; + err = bus_set_resource(dev, SYS_RES_IOPORT, sc->iorid, + iobase, 7); + if (err == 0) { + sc->iores = bus_alloc_resource_any(dev, SYS_RES_IOPORT, + &sc->iorid, RF_ACTIVE); + if (sc->iores == NULL) { + device_printf(dev, "can't map i/o space, " + "iobase=0x%04x\n", iobase); + } + } else { + device_printf(dev, + "failed to set io port resource at 0x%x\n", iobase); + } + } + /* Enable gpio0 and gpio1. */ superio_dev_enable(dev, 0x03); GPIO_LOCK_INIT(sc); GPIO_LOCK(sc); + sc->cache.inv[0] = nct_read_reg(sc, REG_INV, 0); + sc->cache.inv[1] = nct_read_reg(sc, REG_INV, 1); + sc->cache.ior[0] = nct_read_reg(sc, REG_IOR, 0); + sc->cache.ior[1] = nct_read_reg(sc, REG_IOR, 1); + + /* + * Caching input values is meaningless as an input can be changed at any + * time by an external agent. But outputs are controlled by this + * driver, so it can cache their state. Also, the hardware remembers + * the output state of a pin when the pin is switched to input mode and + * then back to output mode. So, the cache stays valid. + * The only problem is with pins that are in input mode at the attach + * time. For them the output state is not known until it is set by the + * driver for the first time. + * 'out' and 'out_known' bits form a tri-state output cache: + * |-----+-----------+---------| + * | out | out_known | cache | + * |-----+-----------+---------| + * | X | 0 | invalid | + * | 0 | 1 | 0 | + * | 1 | 1 | 1 | + * |-----+-----------+---------| + */ + sc->cache.out[0] = nct_read_reg(sc, REG_DAT, 0); + sc->cache.out[1] = nct_read_reg(sc, REG_DAT, 1); + sc->cache.out_known[0] = ~sc->cache.ior[0]; + sc->cache.out_known[1] = ~sc->cache.ior[1]; + for (i = 0; i <= NCT_MAX_PIN; i++) { struct gpio_pin *pin; @@ -398,7 +547,6 @@ nct_attach(device_t dev) sc->busdev = gpiobus_attach_bus(dev); if (sc->busdev == NULL) { - GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK_DESTROY(sc); return (ENXIO); } @@ -414,6 +562,8 @@ nct_detach(device_t dev) sc = device_get_softc(dev); gpiobus_detach_bus(dev); + if (sc->iores != NULL) + bus_release_resource(dev, SYS_RES_IOPORT, sc->iorid, sc->iores); GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK_DESTROY(sc); @@ -447,8 +597,11 @@ nct_gpio_pin_set(device_t dev, uint32_t pin_num, uint3 return (EINVAL); sc = device_get_softc(dev); - GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK(sc); + if ((sc->pins[pin_num].gp_flags & GPIO_PIN_OUTPUT) == 0) { + GPIO_UNLOCK(sc); + return (EINVAL); + } nct_write_pin(sc, pin_num, pin_value); GPIO_UNLOCK(sc); @@ -483,6 +636,10 @@ nct_gpio_pin_toggle(device_t dev, uint32_t pin_num) sc = device_get_softc(dev); GPIO_ASSERT_UNLOCKED(sc); GPIO_LOCK(sc); + if ((sc->pins[pin_num].gp_flags & GPIO_PIN_OUTPUT) == 0) { + GPIO_UNLOCK(sc); + return (EINVAL); + } if (nct_read_pin(sc, pin_num)) nct_write_pin(sc, pin_num, 0); else @@ -558,53 +715,41 @@ nct_gpio_pin_setflags(device_t dev, uint32_t pin_num, if ((flags & pin->gp_caps) != flags) return (EINVAL); - GPIO_ASSERT_UNLOCKED(sc); - GPIO_LOCK(sc); - if (flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { - if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) == - (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { - GPIO_UNLOCK(sc); - return (EINVAL); - } - - if (flags & GPIO_PIN_INPUT) - nct_set_pin_is_input(sc, pin_num); - else - nct_set_pin_is_output(sc, pin_num); + if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) == + (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) { + return (EINVAL); } - - if (flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) { - if (flags & GPIO_PIN_INPUT) { - GPIO_UNLOCK(sc); + if ((flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) == + (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) { return (EINVAL); - } + } + if ((flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) == + (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) { + return (EINVAL); + } - if ((flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) == - (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) { - GPIO_UNLOCK(sc); - return (EINVAL); - } - + GPIO_ASSERT_UNLOCKED(sc); + GPIO_LOCK(sc); + if ((flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT)) != 0) { + nct_set_pin_input(sc, pin_num, (flags & GPIO_PIN_INPUT) != 0); + pin->gp_flags &= ~(GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); + pin->gp_flags |= flags & (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT); + } + if ((flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) != 0) { + nct_set_pin_inverted(sc, pin_num, + (flags & GPIO_PIN_INVIN) != 0); + pin->gp_flags &= ~(GPIO_PIN_INVIN | GPIO_PIN_INVOUT); + pin->gp_flags |= flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT); + } + if ((flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL)) != 0) { if (flags & GPIO_PIN_OPENDRAIN) nct_set_pin_opendrain(sc, pin_num); else nct_set_pin_pushpull(sc, pin_num); + pin->gp_flags &= ~(GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL); + pin->gp_flags |= + flags & (GPIO_PIN_OPENDRAIN | GPIO_PIN_PUSHPULL); } - - if (flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) { - if ((flags & (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) != - (GPIO_PIN_INVIN | GPIO_PIN_INVOUT)) { - GPIO_UNLOCK(sc); - return (EINVAL); - } - - if (flags & GPIO_PIN_INVIN) - nct_set_pin_is_inverted(sc, pin_num); - else - nct_set_pin_not_inverted(sc, pin_num); - } - - pin->gp_flags = flags; GPIO_UNLOCK(sc); return (0); From owner-svn-src-all@freebsd.org Tue Oct 22 14:55:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 92A4815CB37; Tue, 22 Oct 2019 14:55:00 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pg1-x536.google.com (mail-pg1-x536.google.com [IPv6:2607:f8b0:4864:20::536]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yGkp6h2Bz3N65; Tue, 22 Oct 2019 14:54:58 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pg1-x536.google.com with SMTP id t3so10091816pga.8; Tue, 22 Oct 2019 07:54:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=n+CZ3y62x65ARvqHZB8K7t9vhrNRrkOUwlwcaNPJtsg=; b=aog64XUqH1oN7FxOfKNg/jayTyCJ7jie/2c8ppbMn3nkRSplZzC/5GPJJubQVVbuVx CryDAnhsJ0zi57HxAQUFa5lEMr3CReNiJvv2FCYKJwWy5ITHu2UJ34ZjeRVST2pBZ08S 5qSGP7KK8QJGLnxOq+fgPA9pHtfFe1tISMZwQqywxcc526E38ResuamtEtQvFFC6kNJj wlQCGJ+gySRzrfnM3uVYFJMKVh/Lq/8deh5soRy/lkpxCDXtOeFgyDUhwbbIx7+qIYbd Kj+9nT7LtAabzwg5sVPiozn+5GK1vobPaO9o11JUlMdXwZBtod0D7t5hKH/2ObcU/bl0 x27g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=n+CZ3y62x65ARvqHZB8K7t9vhrNRrkOUwlwcaNPJtsg=; b=O9X8g18fTbQAxoGh9uJvYUHIFJe63OXkwf9W3FB2E/PVtWyQW2lMBhGp7ydIYQzsEn pg0defUxFEfcAbdp4ETmGnKsUqorGUKUVMJi907O8cmiBQEl9D+j+pYZaCW2cRf30n5a yM9OJvANJzDq4H20uXoPyu0Fcwo3TjCcpEiJw9BMYdpqcyXEsKC/Lgp+bijiHPQWMAVr 6HZ7D7syiMeKvcXehwKtVZhXZOLSG2E5Rv1NPLVz32Sp+gX22VbG9iEBDXlmv51fBnp1 69xWN7szNRELkkg85sBLwcnHq4BZK2Psc7ZcsfZJdNCVPgDCn3qq6qaJL4Fv7Vy7uQMG WPjA== X-Gm-Message-State: APjAAAWZn3WQTg7mw6KVplnUbDJzqVLblLKkTN288yew4xk+pL4E0kzS hVSs9iCASDINwilyfe55TTUlahoZlqo= X-Google-Smtp-Source: APXvYqytO06+rxWzntSoNJrYuh1+g/MeTvJXgizUvMiXQm1N7Y88qD3ktNjx9rIv5qTulQCrISOS+w== X-Received: by 2002:a63:950c:: with SMTP id p12mr4471880pgd.238.1571756096986; Tue, 22 Oct 2019 07:54:56 -0700 (PDT) Received: from [192.168.20.22] (c-73-19-52-228.hsd1.wa.comcast.net. [73.19.52.228]) by smtp.gmail.com with ESMTPSA id p24sm29394018pgc.72.2019.10.22.07.54.56 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Oct 2019 07:54:56 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Enji Cooper Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r353732 - head/sys/net Date: Tue, 22 Oct 2019 07:53:31 -0700 Message-Id: <21F302BD-CF03-4129-B5DD-7DC3BE481152@gmail.com> References: <201910181520.x9IFKOd2094171@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201910181520.x9IFKOd2094171@repo.freebsd.org> To: Gleb Smirnoff X-Mailer: iPhone Mail (17A878) X-Rspamd-Queue-Id: 46yGkp6h2Bz3N65 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=aog64XUq; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::536 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RECEIVED_SPAMHAUS_PBL(0.00)[228.52.19.73.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE(0.00)[ip: (-8.17), ipnet: 2607:f8b0::/32(-2.43), asn: 15169(-2.07), country: US(-0.05)]; IP_SCORE_FREEMAIL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[6.3.5.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 14:55:00 -0000 > On Oct 18, 2019, at 08:20, Gleb Smirnoff wrote: >=20 > =EF=BB=BFAuthor: glebius > Date: Fri Oct 18 15:20:24 2019 > New Revision: 353732 > URL: https://svnweb.freebsd.org/changeset/base/353732 >=20 > Log: > Make rt_getifa_fib() static. Why should it be made static? The answer to this question is missing from th= e commit message. -Enji= From owner-svn-src-all@freebsd.org Tue Oct 22 15:26:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7331815D872; Tue, 22 Oct 2019 15:26:50 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yHRY5Fwjz3Q7j; Tue, 22 Oct 2019 15:26:49 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id x9MFQkLX086227 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 22 Oct 2019 08:26:46 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9MFQkqA086226; Tue, 22 Oct 2019 08:26:46 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Tue, 22 Oct 2019 08:26:46 -0700 From: Gleb Smirnoff To: Enji Cooper Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353732 - head/sys/net Message-ID: <20191022152646.GI4086@FreeBSD.org> References: <201910181520.x9IFKOd2094171@repo.freebsd.org> <21F302BD-CF03-4129-B5DD-7DC3BE481152@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <21F302BD-CF03-4129-B5DD-7DC3BE481152@gmail.com> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46yHRY5Fwjz3Q7j X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.54 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.54)[-0.544,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 15:26:50 -0000 On Tue, Oct 22, 2019 at 07:53:31AM -0700, Enji Cooper wrote: E> > Author: glebius E> > Date: Fri Oct 18 15:20:24 2019 E> > New Revision: 353732 E> > URL: https://svnweb.freebsd.org/changeset/base/353732 E> > E> > Log: E> > Make rt_getifa_fib() static. E> E> Why should it be made static? The answer to this question is missing from the commit message. Because a function used only in a scope of a single file and not intended to be used outside should be made static. -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Tue Oct 22 15:29:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A9B5415D929; Tue, 22 Oct 2019 15:29:15 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yHVM3HZXz3QJ0; Tue, 22 Oct 2019 15:29:15 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id x9MFTDes086245 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 22 Oct 2019 08:29:13 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9MFTDqM086244; Tue, 22 Oct 2019 08:29:13 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Tue, 22 Oct 2019 08:29:13 -0700 From: Gleb Smirnoff To: Li-Wen Hsu , br@freebsd.org Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r353876 - head/sys/kern Message-ID: <20191022152913.GJ4086@FreeBSD.org> References: <201910212312.x9LNCEbX052414@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46yHVM3HZXz3QJ0 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.95 / 15.00]; NEURAL_HAM_MEDIUM(-0.95)[-0.954,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 15:29:15 -0000 Li-Wen, On Tue, Oct 22, 2019 at 04:28:45PM +0800, Li-Wen Hsu wrote: L> > Modified: head/sys/kern/subr_epoch.c L> > ============================================================================== L> > --- head/sys/kern/subr_epoch.c Mon Oct 21 21:21:34 2019 (r353875) L> > +++ head/sys/kern/subr_epoch.c Mon Oct 21 23:12:14 2019 (r353876) L> > @@ -366,9 +366,13 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et L> > struct thread *td; L> > L> > MPASS(cold || epoch != NULL); L> > - INIT_CHECK(epoch); L> > MPASS(epoch->e_flags & EPOCH_PREEMPT); L> > td = curthread; L> > + MPASS((vm_offset_t)et >= td->td_kstack && L> > + (vm_offset_t)et + sizeof(struct epoch_tracker) < L> > + td->td_kstack + td->td_kstack_pages * PAGE_SIZE); L> > + L> > + INIT_CHECK(epoch); L> > #ifdef EPOCH_TRACE L> > epoch_trace_enter(td, epoch, et, file, line); L> > #endif L> L> Hello Gleb, L> L> RISC-V boot panics with this message: L> L> panic: Assertion (vm_offset_t)et >= td->td_kstack && (vm_offset_t)et + L> sizeof(struct epoch_tracker) < td->td_kstack + td->td_kstack_pages * L> PAGE_SIZE failed at /workspace/src/sys/kern/subr_epoch.c:373 L> L> Full log: https://ci.freebsd.org/job/FreeBSD-head-riscv64-test/12334/console L> L> Can you help check this? I need help from RISC-V experts. Can you please meanwhile print out values of et and td->td_kstack? -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Tue Oct 22 15:33:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 866CD15DB3F; Tue, 22 Oct 2019 15:33:58 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46yHbn3qk2z3Qqv; Tue, 22 Oct 2019 15:33:57 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.235]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 9326C260105; Tue, 22 Oct 2019 17:33:48 +0200 (CEST) Subject: Re: svn commit: r353876 - head/sys/kern To: Gleb Smirnoff , Li-Wen Hsu , br@freebsd.org Cc: src-committers , svn-src-all , svn-src-head References: <201910212312.x9LNCEbX052414@repo.freebsd.org> <20191022152913.GJ4086@FreeBSD.org> From: Hans Petter Selasky Message-ID: <55116590-d3ca-00ea-29c6-f32adfcdea9e@selasky.org> Date: Tue, 22 Oct 2019 17:31:27 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.2 MIME-Version: 1.0 In-Reply-To: <20191022152913.GJ4086@FreeBSD.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 46yHbn3qk2z3Qqv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-4.93 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[6]; IP_SCORE(-2.63)[ip: (-9.16), ipnet: 2a01:4f8::/29(-2.15), asn: 24940(-1.82), country: DE(-0.01)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 15:33:58 -0000 On 2019-10-22 17:29, Gleb Smirnoff wrote: > L> > L> panic: Assertion (vm_offset_t)et >= td->td_kstack && (vm_offset_t)et + > L> sizeof(struct epoch_tracker) < td->td_kstack + td->td_kstack_pages * > L> PAGE_SIZE failed at /workspace/src/sys/kern/subr_epoch.c:373 Probably doesn't matter that much, but the last comparison should be less than or equal, instead of only less than, off-by-one, if the element is on top of stack ??? sizeof(struct epoch_tracker) XXX <= XXX td->td_kstack + td->td_kstack_pages --HPS From owner-svn-src-all@freebsd.org Tue Oct 22 15:40:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 921CB15DCA8; Tue, 22 Oct 2019 15:40:41 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: from mail-qk1-x741.google.com (mail-qk1-x741.google.com [IPv6:2607:f8b0:4864:20::741]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yHlY3H9sz3RJl; Tue, 22 Oct 2019 15:40:41 +0000 (UTC) (envelope-from markjdb@gmail.com) Received: by mail-qk1-x741.google.com with SMTP id w2so16663838qkf.2; Tue, 22 Oct 2019 08:40:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=i3VHXEVUeWf/W/lIellzl2O2hyjwBWYQ3Rtd5M48ETI=; b=MJP2olE1FNAKAwS8OSr10uvfWFpTvc5LMT2GRs1Y1qAUH0iQruF9IfVs8N3EZ39eBz Uxvm94HxrtCDT/NyDWdoIdD49vh43LrB0mIix9Gu+EJmm7QfMSC4FC/gYQdruoCQRjqo Au/wPTR7+pU+kuGqtWIoxg0HaL20I5tISOll1nqyTKL4Epr8FBDxSRmiC4pI9q6qkp/r 8v0v9tq3NE1TWgkPr/ZHMq0M4cfS7x3CMGvL0DroGE6zHVJmYPd/KedEdo/CmvewrtHi UrRXUp7AsCOpDrTFX/3fYCMvoL0Vhy8ss6eGYYu0k87vuLZTFJtojnOojfw1q2Qo4cXf HiZw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:date:from:to:cc:subject:message-id :references:mime-version:content-disposition:in-reply-to:user-agent; bh=i3VHXEVUeWf/W/lIellzl2O2hyjwBWYQ3Rtd5M48ETI=; b=MXIYZWgu4w0dFZH8rZQCEC9Pr9LGBVkffCdnLcTsuax8rEIe3TLD7juC5fWenaTPN6 1sagPlRzzBaRQX/9KD7kFo4/7d8JIDnGoOuaKMQAdPQIp1IAV9LVxXE9PChcbc4OPhGj /1J5Zqi1pKc+kac3ict0cVLupqYauag8MQVzoBWDDITlfO7UkyniCHKpLiWZ4FMbZa34 X1Nxm8xriyjiKhdBK8uxWWn9y7U4hSHCLSNVGrHtPJjGGgQZz3XHLVioO1pHWL5ZUBup dPbS85z2f0wMJqiDgliTwUUmQeTwLR4XZPyejuBGeDDefbUox8R0i7uiSOkSMvBTlCUt i26A== X-Gm-Message-State: APjAAAX8EITCvzk4M8LjKZrJOv2oo1TP9SyroJ9utN25MJBZtaqd1sNq niAOSfGZec3aEvKFvQgyK5vyQZmK X-Google-Smtp-Source: APXvYqymhEvJOl9gcqYbUUnPUh+YLcEhCfcIloBs7S2ukH+l9T2Ay1brp0MUevvIhUS2wAkSQvkR7A== X-Received: by 2002:a37:a448:: with SMTP id n69mr3595498qke.325.1571758839613; Tue, 22 Oct 2019 08:40:39 -0700 (PDT) Received: from raichu (toroon0560w-lp130-05-69-158-183-252.dsl.bell.ca. [69.158.183.252]) by smtp.gmail.com with ESMTPSA id a15sm1448541qtp.77.2019.10.22.08.40.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Oct 2019 08:40:38 -0700 (PDT) Sender: Mark Johnston Date: Tue, 22 Oct 2019 11:40:36 -0400 From: Mark Johnston To: Gleb Smirnoff Cc: Li-Wen Hsu , br@freebsd.org, src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r353876 - head/sys/kern Message-ID: <20191022154036.GE540@raichu> References: <201910212312.x9LNCEbX052414@repo.freebsd.org> <20191022152913.GJ4086@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191022152913.GJ4086@FreeBSD.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46yHlY3H9sz3RJl X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.985,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 15:40:41 -0000 On Tue, Oct 22, 2019 at 08:29:13AM -0700, Gleb Smirnoff wrote: > Li-Wen, > > On Tue, Oct 22, 2019 at 04:28:45PM +0800, Li-Wen Hsu wrote: > L> > Modified: head/sys/kern/subr_epoch.c > L> > ============================================================================== > L> > --- head/sys/kern/subr_epoch.c Mon Oct 21 21:21:34 2019 (r353875) > L> > +++ head/sys/kern/subr_epoch.c Mon Oct 21 23:12:14 2019 (r353876) > L> > @@ -366,9 +366,13 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et > L> > struct thread *td; > L> > > L> > MPASS(cold || epoch != NULL); > L> > - INIT_CHECK(epoch); > L> > MPASS(epoch->e_flags & EPOCH_PREEMPT); > L> > td = curthread; > L> > + MPASS((vm_offset_t)et >= td->td_kstack && > L> > + (vm_offset_t)et + sizeof(struct epoch_tracker) < > L> > + td->td_kstack + td->td_kstack_pages * PAGE_SIZE); > L> > + > L> > + INIT_CHECK(epoch); > L> > #ifdef EPOCH_TRACE > L> > epoch_trace_enter(td, epoch, et, file, line); > L> > #endif > L> > L> Hello Gleb, > L> > L> RISC-V boot panics with this message: > L> > L> panic: Assertion (vm_offset_t)et >= td->td_kstack && (vm_offset_t)et + > L> sizeof(struct epoch_tracker) < td->td_kstack + td->td_kstack_pages * > L> PAGE_SIZE failed at /workspace/src/sys/kern/subr_epoch.c:373 > L> > L> Full log: https://ci.freebsd.org/job/FreeBSD-head-riscv64-test/12334/console > L> > L> Can you help check this? > > I need help from RISC-V experts. I suspect the problem is that init_proc0() on several arches does not initialize td_kstack_pages. I will test this patch and commit if it fixes the panic. Note that on arm64 and riscv thread0's kernel stack is statically allocated. diff --git a/sys/arm/arm/machdep.c b/sys/arm/arm/machdep.c index dc0a84404f02..990c3df49328 100644 --- a/sys/arm/arm/machdep.c +++ b/sys/arm/arm/machdep.c @@ -771,6 +771,7 @@ init_proc0(vm_offset_t kstack) { proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; + thread0.td_kstack_pages = kstack_pages; thread0.td_pcb = (struct pcb *) (thread0.td_kstack + kstack_pages * PAGE_SIZE) - 1; thread0.td_pcb->pcb_flags = 0; diff --git a/sys/arm64/arm64/machdep.c b/sys/arm64/arm64/machdep.c index 4356add12aa0..967e1deaa55e 100644 --- a/sys/arm64/arm64/machdep.c +++ b/sys/arm64/arm64/machdep.c @@ -745,6 +745,7 @@ init_proc0(vm_offset_t kstack) proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; + thread0.td_kstack_pages = KSTACK_PAGES; thread0.td_pcb = (struct pcb *)(thread0.td_kstack) - 1; thread0.td_pcb->pcb_fpflags = 0; thread0.td_pcb->pcb_fpusaved = &thread0.td_pcb->pcb_fpustate; diff --git a/sys/riscv/riscv/machdep.c b/sys/riscv/riscv/machdep.c index e01f7e42895d..07113534706e 100644 --- a/sys/riscv/riscv/machdep.c +++ b/sys/riscv/riscv/machdep.c @@ -658,6 +658,7 @@ init_proc0(vm_offset_t kstack) proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; + thread0.td_kstack_pages = KSTACK_PAGES; thread0.td_pcb = (struct pcb *)(thread0.td_kstack) - 1; thread0.td_pcb->pcb_fpflags = 0; thread0.td_frame = &proc0_tf; From owner-svn-src-all@freebsd.org Tue Oct 22 15:51:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 81DE515DFDF; Tue, 22 Oct 2019 15:51:07 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-oi1-f193.google.com (mail-oi1-f193.google.com [209.85.167.193]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yHzZ1hfzz3wyp; Tue, 22 Oct 2019 15:51:05 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-oi1-f193.google.com with SMTP id 83so14637538oii.1; Tue, 22 Oct 2019 08:51:05 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1lAivZ/PejKRaDklOO3ee6kcG8Bv1t1oGUsOe7JVTHo=; b=WRyHtOpva9ygtHv7SyRoYDN5xtmEneB2Xe5aGjNJRt9ncZUONlFVpowiD5msiiLLhh SY12vv6pVVyXRNsOqxaXsj0cmE3tbdv2oAlV2nivSgF/UcHs7Y8r6ILlxHIYP9bm4Y/G jBHPVJU23gfA4sHC/U/QyhRqY3uTIFLnEM91cp5zP5QS2R/yJpoMBRj2r6ZRyz2a902Y MjnGCo6R0QJthkHF+OAF7BpI/ETPR72jdUSMd55XsLsMu/MyVWOXnHNzBSonmxzui0Rq hiNw2ov6KVqwQaZxcSMtBpTO6ylAamkqiCJR1SLgLOjwNDfIE95aOI7AIKeLZQwp1VFM yq1Q== X-Gm-Message-State: APjAAAVPUjdXuR9AnT3jSuqM4849g4c3wmqtYJi3YZrTOHtEmMmYu1xL mthKU55n9SECsTAcr7Vurp1j4KTV0BR/VdkIaxlJfntE X-Google-Smtp-Source: APXvYqwXMu0i06dhEEm3fzhrks5rMElr6c41XXU1q6KQtXj3YX5eTNVBNjrCozfmhKUt5tVNpCE6LZp4OHEH3v/phaE= X-Received: by 2002:a54:480d:: with SMTP id j13mr457227oij.55.1571759464580; Tue, 22 Oct 2019 08:51:04 -0700 (PDT) MIME-Version: 1.0 References: <201910161321.x9GDL2ee021543@repo.freebsd.org> In-Reply-To: <201910161321.x9GDL2ee021543@repo.freebsd.org> From: Alan Somers Date: Tue, 22 Oct 2019 09:50:53 -0600 Message-ID: Subject: Re: svn commit: r353640 - head/sys/kern To: Andrew Turner Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46yHzZ1hfzz3wyp X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.167.193 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-2.06 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.990,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; URI_COUNT_ODD(1.00)[3]; IP_SCORE(-1.07)[ipnet: 209.85.128.0/17(-3.23), asn: 15169(-2.07), country: US(-0.05)]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[193.167.85.209.list.dnswl.org : 127.0.5.0]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[193.167.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+,1:+,2:~]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 15:51:07 -0000 On Wed, Oct 16, 2019 at 7:21 AM Andrew Turner wrote: > Author: andrew > Date: Wed Oct 16 13:21:01 2019 > New Revision: 353640 > URL: https://svnweb.freebsd.org/changeset/base/353640 > > Log: > Stop leaking information from the kernel through timespec > > The timespec struct holds a seconds value in a time_t and a nanoseconds > value in a long. On most architectures these are the same size, however > on 32-bit architectures other than i386 time_t is 8 bytes and long is > 4 bytes. > > Most ABIs will then pad a struct holding an 8 byte and 4 byte value to > 16 bytes with 4 bytes of padding. When copying one of these structs the > compiler is free to copy the padding if it wishes. > > In this case the padding may contain kernel data that is then leaked to > userspace. Fix this by copying the timespec elements rather than the > entire struct. > > This doesn't affect Tier-1 architectures so no SA is expected. > > admbugs: 651 > MFC after: 1 week > Sponsored by: DARPA, AFRL > Good catch. Might I ask how you found it, or who reported it? From owner-svn-src-all@freebsd.org Tue Oct 22 15:59:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B55EF15E48A; Tue, 22 Oct 2019 15:59:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yJ904KlKz3xXW; Tue, 22 Oct 2019 15:59:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 780F2EAA9; Tue, 22 Oct 2019 15:59:16 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MFxGiP047534; Tue, 22 Oct 2019 15:59:16 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MFxG2R047533; Tue, 22 Oct 2019 15:59:16 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910221559.x9MFxG2R047533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 22 Oct 2019 15:59:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353888 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353888 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 15:59:16 -0000 Author: kib Date: Tue Oct 22 15:59:16 2019 New Revision: 353888 URL: https://svnweb.freebsd.org/changeset/base/353888 Log: vm_fault(): extract code to lock the vnode into a helper vn_fault_lock_vnode(). Tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D21883 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Oct 22 14:20:35 2019 (r353887) +++ head/sys/vm/vm_fault.c Tue Oct 22 15:59:16 2019 (r353888) @@ -628,19 +628,62 @@ vm_fault_trap(vm_map_t map, vm_offset_t vaddr, vm_prot return (result); } +static int +vm_fault_lock_vnode(struct faultstate *fs) +{ + struct vnode *vp; + int error, locked; + + if (fs->object->type != OBJT_VNODE) + return (KERN_SUCCESS); + vp = fs->object->handle; + if (vp == fs->vp) + return (KERN_SUCCESS); + + /* + * Perform an unlock in case the desired vnode changed while + * the map was unlocked during a retry. + */ + unlock_vp(fs); + + locked = VOP_ISLOCKED(vp); + if (locked != LK_EXCLUSIVE) + locked = LK_SHARED; + + /* + * We must not sleep acquiring the vnode lock while we have + * the page exclusive busied or the object's + * paging-in-progress count incremented. Otherwise, we could + * deadlock. + */ + error = vget(vp, locked | LK_CANRECURSE | LK_NOWAIT, curthread); + if (error == 0) { + fs->vp = vp; + return (KERN_SUCCESS); + } + + vhold(vp); + release_page(fs); + unlock_and_deallocate(fs); + error = vget(vp, locked | LK_RETRY | LK_CANRECURSE, curthread); + vdrop(vp); + fs->vp = vp; + KASSERT(error == 0, ("vm_fault: vget failed %d", error)); + return (KERN_RESOURCE_SHORTAGE); +} + int vm_fault(vm_map_t map, vm_offset_t vaddr, vm_prot_t fault_type, int fault_flags, vm_page_t *m_hold) { struct faultstate fs; - struct vnode *vp; struct domainset *dset; vm_object_t next_object, retry_object; vm_offset_t e_end, e_start; vm_pindex_t retry_pindex; vm_prot_t prot, retry_prot; - int ahead, alloc_req, behind, cluster_offset, error, era, faultcount; - int locked, nera, oom, result, rv; + int ahead, alloc_req, behind, cluster_offset, era, faultcount; + int nera, oom, result, rv; u_char behavior; boolean_t wired; /* Passed by reference. */ bool dead, hardfault, is_first_object_locked; @@ -1001,41 +1044,11 @@ readrest: */ unlock_map(&fs); - if (fs.object->type == OBJT_VNODE && - (vp = fs.object->handle) != fs.vp) { - /* - * Perform an unlock in case the desired vnode - * changed while the map was unlocked during a - * retry. - */ - unlock_vp(&fs); - - locked = VOP_ISLOCKED(vp); - if (locked != LK_EXCLUSIVE) - locked = LK_SHARED; - - /* - * We must not sleep acquiring the vnode lock - * while we have the page exclusive busied or - * the object's paging-in-progress count - * incremented. Otherwise, we could deadlock. - */ - error = vget(vp, locked | LK_CANRECURSE | - LK_NOWAIT, curthread); - if (error != 0) { - vhold(vp); - release_page(&fs); - unlock_and_deallocate(&fs); - error = vget(vp, locked | LK_RETRY | - LK_CANRECURSE, curthread); - vdrop(vp); - fs.vp = vp; - KASSERT(error == 0, - ("vm_fault: vget failed")); - goto RetryFault; - } - fs.vp = vp; - } + rv = vm_fault_lock_vnode(&fs); + MPASS(rv == KERN_SUCCESS || + rv == KERN_RESOURCE_SHORTAGE); + if (rv == KERN_RESOURCE_SHORTAGE) + goto RetryFault; KASSERT(fs.vp == NULL || !fs.map->system_map, ("vm_fault: vnode-backed object mapped by system map")); From owner-svn-src-all@freebsd.org Tue Oct 22 16:06:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AB7A15E88E; Tue, 22 Oct 2019 16:06:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yJKQ1J14z3y8s; Tue, 22 Oct 2019 16:06:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 109E4EC9C; Tue, 22 Oct 2019 16:06:34 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MG6Xp1053239; Tue, 22 Oct 2019 16:06:33 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MG6XQB053238; Tue, 22 Oct 2019 16:06:33 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910221606.x9MG6XQB053238@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 22 Oct 2019 16:06:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353889 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353889 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:06:34 -0000 Author: glebius Date: Tue Oct 22 16:06:33 2019 New Revision: 353889 URL: https://svnweb.freebsd.org/changeset/base/353889 Log: Execute nd6_dad_timer() in the network epoch, since nd6_dad_duplicated() requires it. Make nd6_dad_starttimer() require network epoch. Two calls out of three happen from nd6_dad_timer(). Enter epoch in the remaining one. Modified: head/sys/netinet6/nd6_nbr.c Modified: head/sys/netinet6/nd6_nbr.c ============================================================================== --- head/sys/netinet6/nd6_nbr.c Tue Oct 22 15:59:16 2019 (r353888) +++ head/sys/netinet6/nd6_nbr.c Tue Oct 22 16:06:33 2019 (r353889) @@ -1192,13 +1192,10 @@ static void nd6_dad_starttimer(struct dadq *dp, int ticks, int send_ns) { - if (send_ns != 0) { - struct epoch_tracker et; + NET_EPOCH_ASSERT(); - NET_EPOCH_ENTER(et); + if (send_ns != 0) nd6_dad_ns_output(dp); - NET_EPOCH_EXIT(et); - } callout_reset(&dp->dad_timer_ch, ticks, (void (*)(void *))nd6_dad_timer, (void *)dp); } @@ -1237,6 +1234,7 @@ nd6_dad_start(struct ifaddr *ifa, int delay) struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; struct dadq *dp; char ip6buf[INET6_ADDRSTRLEN]; + struct epoch_tracker et; KASSERT((ia->ia6_flags & IN6_IFF_TENTATIVE) != 0, ("starting DAD on non-tentative address %p", ifa)); @@ -1298,7 +1296,9 @@ nd6_dad_start(struct ifaddr *ifa, int delay) /* Add this to the dadq and add a reference for the dadq. */ refcount_init(&dp->dad_refcnt, 1); nd6_dad_add(dp); + NET_EPOCH_ENTER(et); nd6_dad_starttimer(dp, delay, 0); + NET_EPOCH_EXIT(et); } /* @@ -1330,9 +1330,11 @@ nd6_dad_timer(struct dadq *dp) struct ifnet *ifp = dp->dad_ifa->ifa_ifp; struct in6_ifaddr *ia = (struct in6_ifaddr *)ifa; char ip6buf[INET6_ADDRSTRLEN]; + struct epoch_tracker et; KASSERT(ia != NULL, ("DAD entry %p with no address", dp)); + NET_EPOCH_ENTER(et); if (ND_IFINFO(ifp)->flags & ND6_IFF_IFDISABLED) { /* Do not need DAD for ifdisabled interface. */ log(LOG_ERR, "nd6_dad_timer: cancel DAD on %s because of " @@ -1429,6 +1431,7 @@ nd6_dad_timer(struct dadq *dp) err: nd6_dad_del(dp); done: + NET_EPOCH_EXIT(et); CURVNET_RESTORE(); } From owner-svn-src-all@freebsd.org Tue Oct 22 16:09:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4824F15EA61; Tue, 22 Oct 2019 16:09:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yJNl1DxJz3yPJ; Tue, 22 Oct 2019 16:09:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AB7DECA5; Tue, 22 Oct 2019 16:09:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MG9Qqe053424; Tue, 22 Oct 2019 16:09:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MG9Q4x053420; Tue, 22 Oct 2019 16:09:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910221609.x9MG9Q4x053420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 22 Oct 2019 16:09:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353890 - in head/sys: sys vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: sys vm X-SVN-Commit-Revision: 353890 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:09:27 -0000 Author: kib Date: Tue Oct 22 16:09:25 2019 New Revision: 353890 URL: https://svnweb.freebsd.org/changeset/base/353890 Log: Add VV_VMSIZEVNLOCK flag. The flag specifies that vm_fault() handler should check the vnode' vm_object size under the vnode lock. It is converted into the object' OBJ_SIZEVNLOCK flag in vnode_pager_alloc(). Tested by: pho Reviewed by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D21883 Modified: head/sys/sys/vnode.h head/sys/vm/vm_fault.c head/sys/vm/vm_object.h head/sys/vm/vnode_pager.c Modified: head/sys/sys/vnode.h ============================================================================== --- head/sys/sys/vnode.h Tue Oct 22 16:06:33 2019 (r353889) +++ head/sys/sys/vnode.h Tue Oct 22 16:09:25 2019 (r353890) @@ -247,6 +247,7 @@ struct xvnode { #define VV_NOSYNC 0x0004 /* unlinked, stop syncing */ #define VV_ETERNALDEV 0x0008 /* device that is never destroyed */ #define VV_CACHEDLABEL 0x0010 /* Vnode has valid cached MAC label */ +#define VV_VMSIZEVNLOCK 0x0020 /* object size check requires vnode lock */ #define VV_COPYONWRITE 0x0040 /* vnode is doing copy-on-write */ #define VV_SYSTEM 0x0080 /* vnode being used by kernel */ #define VV_PROCDEP 0x0100 /* vnode is process dependent */ Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Tue Oct 22 16:06:33 2019 (r353889) +++ head/sys/vm/vm_fault.c Tue Oct 22 16:09:25 2019 (r353890) @@ -887,6 +887,13 @@ RetryFault_oom: */ if (fs.object->type != OBJT_DEFAULT || fs.object == fs.first_object) { + if ((fs.object->flags & OBJ_SIZEVNLOCK) != 0) { + rv = vm_fault_lock_vnode(&fs); + MPASS(rv == KERN_SUCCESS || + rv == KERN_RESOURCE_SHORTAGE); + if (rv == KERN_RESOURCE_SHORTAGE) + goto RetryFault; + } if (fs.pindex >= fs.object->size) { unlock_and_deallocate(&fs); return (KERN_OUT_OF_BOUNDS); Modified: head/sys/vm/vm_object.h ============================================================================== --- head/sys/vm/vm_object.h Tue Oct 22 16:06:33 2019 (r353889) +++ head/sys/vm/vm_object.h Tue Oct 22 16:09:25 2019 (r353890) @@ -186,6 +186,7 @@ struct vm_object { #define OBJ_DEAD 0x0008 /* dead objects (during rundown) */ #define OBJ_NOSPLIT 0x0010 /* dont split this object */ #define OBJ_UMTXDEAD 0x0020 /* umtx pshared was terminated */ +#define OBJ_SIZEVNLOCK 0x0040 /* lock vnode to check obj size */ #define OBJ_PG_DTOR 0x0080 /* dont reset object, leave that for dtor */ #define OBJ_MIGHTBEDIRTY 0x0100 /* object might be dirty, only for vnode */ #define OBJ_TMPFS_NODE 0x0200 /* object belongs to tmpfs VREG node */ Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Tue Oct 22 16:06:33 2019 (r353889) +++ head/sys/vm/vnode_pager.c Tue Oct 22 16:09:25 2019 (r353890) @@ -269,8 +269,12 @@ retry: object->un_pager.vnp.vnp_size = size; object->un_pager.vnp.writemappings = 0; object->domain.dr_policy = vnode_domainset; - object->handle = handle; + if ((vp->v_vflag & VV_VMSIZEVNLOCK) != 0) { + VM_OBJECT_WLOCK(object); + vm_object_set_flag(object, OBJ_SIZEVNLOCK); + VM_OBJECT_WUNLOCK(object); + } VI_LOCK(vp); if (vp->v_object != NULL) { /* From owner-svn-src-all@freebsd.org Tue Oct 22 16:17:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0DA415ED84; Tue, 22 Oct 2019 16:17:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yJZD3ZYKz4034; Tue, 22 Oct 2019 16:17:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F772EE75; Tue, 22 Oct 2019 16:17:40 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MGHeQm059399; Tue, 22 Oct 2019 16:17:40 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MGHd32059393; Tue, 22 Oct 2019 16:17:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910221617.x9MGHd32059393@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 22 Oct 2019 16:17:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353891 - in head/sys/fs: nfs nfsclient X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys/fs: nfs nfsclient X-SVN-Commit-Revision: 353891 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:17:40 -0000 Author: kib Date: Tue Oct 22 16:17:38 2019 New Revision: 353891 URL: https://svnweb.freebsd.org/changeset/base/353891 Log: Fix interface between nfsclient and vnode pager. Make the nfsclient always call vnode_pager_setsize() with the vnode exclusively locked. This ensures that page fault always can find the backing page if the object size check succeeded. Set VV_VMSIZEVNLOCK flag on NFS nodes. The main offender breaking the interface in nfsclient is nfs_loadattrcache(), which is used whenever server responded with updated attributes, which can happen on non-changing operations as well. Also, iod threads only have buffers locked (and even that is LK_KERNPROC), but they still may call nfs_loadattrcache() on RPC response. Instead of immediately calling vnode_pager_setsize() if server response indicated changed file size, but the vnode is not exclusively locked, set a new node flag NVNSETSZSKIP. When the vnode exclusively locked, or when we can temporary upgrade the lock to exclusive, call vnode_pager_setsize(), by providing the nfsclient VOP_LOCK() implementation. Tested by: pho Discussed with: rmacklem Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D21883 Modified: head/sys/fs/nfs/nfsport.h head/sys/fs/nfsclient/nfs_clnode.c head/sys/fs/nfsclient/nfs_clport.c head/sys/fs/nfsclient/nfs_clsubs.c head/sys/fs/nfsclient/nfs_clvnops.c head/sys/fs/nfsclient/nfsnode.h Modified: head/sys/fs/nfs/nfsport.h ============================================================================== --- head/sys/fs/nfs/nfsport.h Tue Oct 22 16:09:25 2019 (r353890) +++ head/sys/fs/nfs/nfsport.h Tue Oct 22 16:17:38 2019 (r353891) @@ -878,6 +878,7 @@ MALLOC_DECLARE(M_NEWNFSDSESSION); int nfscl_loadattrcache(struct vnode **, struct nfsvattr *, void *, void *, int, int); int newnfs_realign(struct mbuf **, int); +bool ncl_pager_setsize(struct vnode *vp, u_quad_t *nsizep); /* * If the port runs on an SMP box that can enforce Atomic ops with low Modified: head/sys/fs/nfsclient/nfs_clnode.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clnode.c Tue Oct 22 16:09:25 2019 (r353890) +++ head/sys/fs/nfsclient/nfs_clnode.c Tue Oct 22 16:17:38 2019 (r353891) @@ -162,6 +162,8 @@ ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize vp->v_type = VDIR; vp->v_vflag |= VV_ROOT; } + + vp->v_vflag |= VV_VMSIZEVNLOCK; np->n_fhp = malloc(sizeof (struct nfsfh) + fhsize, M_NFSFH, M_WAITOK); Modified: head/sys/fs/nfsclient/nfs_clport.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clport.c Tue Oct 22 16:09:25 2019 (r353890) +++ head/sys/fs/nfsclient/nfs_clport.c Tue Oct 22 16:17:38 2019 (r353891) @@ -246,6 +246,8 @@ nfscl_nget(struct mount *mntp, struct vnode *dvp, stru vp->v_type = VDIR; vp->v_vflag |= VV_ROOT; } + + vp->v_vflag |= VV_VMSIZEVNLOCK; np->n_fhp = nfhp; /* @@ -414,10 +416,7 @@ nfscl_loadattrcache(struct vnode **vpp, struct nfsvatt struct nfsnode *np; struct nfsmount *nmp; struct timespec mtime_save; - vm_object_t object; - u_quad_t nsize; int error, force_fid_err; - bool setnsize; error = 0; @@ -565,27 +564,53 @@ out: if (np->n_attrstamp != 0) KDTRACE_NFS_ATTRCACHE_LOAD_DONE(vp, vap, error); #endif + (void)ncl_pager_setsize(vp, NULL); + return (error); +} + +/* + * Call vnode_pager_setsize() if the size of the node changed, as + * recorded in nfsnode vs. v_object, or delay the call if notifying + * the pager is not possible at the moment. + * + * If nsizep is non-NULL, the call is delayed and the new node size is + * provided. Caller should itself call vnode_pager_setsize() if + * function returned true. If nsizep is NULL, function tries to call + * vnode_pager_setsize() itself if needed and possible, and the nfs + * node is unlocked unconditionally, the return value is not useful. + */ +bool +ncl_pager_setsize(struct vnode *vp, u_quad_t *nsizep) +{ + struct nfsnode *np; + vm_object_t object; + struct vattr *vap; + u_quad_t nsize; + bool setnsize; + + np = VTONFS(vp); + NFSASSERTNODE(np); + + vap = &np->n_vattr.na_vattr; nsize = vap->va_size; object = vp->v_object; setnsize = false; - if (object != NULL) { - if (OFF_TO_IDX(nsize + PAGE_MASK) < object->size) { - /* - * When shrinking the size, the call to - * vnode_pager_setsize() cannot be done with - * the mutex held, because we might need to - * wait for a busy page. Delay it until after - * the node is unlocked. - */ + + if (object != NULL && nsize != object->un_pager.vnp.vnp_size) { + if (VOP_ISLOCKED(vp) == LK_EXCLUSIVE) setnsize = true; - } else { + else + np->n_flag |= NVNSETSZSKIP; + } + if (nsizep == NULL) { + NFSUNLOCKNODE(np); + if (setnsize) vnode_pager_setsize(vp, nsize); - } + setnsize = false; + } else { + *nsizep = nsize; } - NFSUNLOCKNODE(np); - if (setnsize) - vnode_pager_setsize(vp, nsize); - return (error); + return (setnsize); } /* Modified: head/sys/fs/nfsclient/nfs_clsubs.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clsubs.c Tue Oct 22 16:09:25 2019 (r353890) +++ head/sys/fs/nfsclient/nfs_clsubs.c Tue Oct 22 16:17:38 2019 (r353891) @@ -185,6 +185,8 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper struct vattr *vap; struct nfsmount *nmp; int timeo, mustflush; + u_quad_t nsize; + bool setnsize; np = VTONFS(vp); vap = &np->n_vattr.na_vattr; @@ -230,6 +232,7 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper return( ENOENT); } nfsstatsv1.attrcache_hits++; + setnsize = false; if (vap->va_size != np->n_size) { if (vap->va_type == VREG) { if (np->n_flag & NMODIFIED) { @@ -240,7 +243,7 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper } else { np->n_size = vap->va_size; } - vnode_pager_setsize(vp, np->n_size); + setnsize = ncl_pager_setsize(vp, &nsize); } else { np->n_size = vap->va_size; } @@ -253,6 +256,8 @@ ncl_getattrcache(struct vnode *vp, struct vattr *vaper vaper->va_mtime = np->n_mtim; } NFSUNLOCKNODE(np); + if (setnsize) + vnode_pager_setsize(vp, nsize); KDTRACE_NFS_ATTRCACHE_GET_HIT(vp, vap); return (0); } Modified: head/sys/fs/nfsclient/nfs_clvnops.c ============================================================================== --- head/sys/fs/nfsclient/nfs_clvnops.c Tue Oct 22 16:09:25 2019 (r353890) +++ head/sys/fs/nfsclient/nfs_clvnops.c Tue Oct 22 16:17:38 2019 (r353891) @@ -142,6 +142,7 @@ static vop_advlock_t nfs_advlock; static vop_advlockasync_t nfs_advlockasync; static vop_getacl_t nfs_getacl; static vop_setacl_t nfs_setacl; +static vop_lock1_t nfs_lock; /* * Global vfs data structures for nfs @@ -160,6 +161,7 @@ static struct vop_vector newnfs_vnodeops_nosig = { .vop_putpages = ncl_putpages, .vop_inactive = ncl_inactive, .vop_link = nfs_link, + .vop_lock1 = nfs_lock, .vop_lookup = nfs_lookup, .vop_mkdir = nfs_mkdir, .vop_mknod = nfs_mknod, @@ -294,6 +296,73 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, nfs_directio_allow_mmap rep->r_mtx * rep->r_mtx : Protects the fields in an nfsreq. */ + +static int +nfs_lock(struct vop_lock1_args *ap) +{ + struct vnode *vp; + struct nfsnode *np; + u_quad_t nsize; + int error, lktype; + bool onfault; + + vp = ap->a_vp; + lktype = ap->a_flags & LK_TYPE_MASK; + error = VOP_LOCK1_APV(&default_vnodeops, ap); + if (error != 0 || vp->v_op != &newnfs_vnodeops) + return (error); + np = VTONFS(vp); + NFSLOCKNODE(np); + if ((np->n_flag & NVNSETSZSKIP) == 0 || (lktype != LK_SHARED && + lktype != LK_EXCLUSIVE && lktype != LK_UPGRADE && + lktype != LK_TRYUPGRADE)) { + NFSUNLOCKNODE(np); + return (0); + } + onfault = (ap->a_flags & LK_EATTR_MASK) == LK_NOWAIT && + (ap->a_flags & LK_INIT_MASK) == LK_CANRECURSE && + (lktype == LK_SHARED || lktype == LK_EXCLUSIVE); + if (onfault && vp->v_vnlock->lk_recurse == 0) { + /* + * Force retry in vm_fault(), to make the lock request + * sleepable, which allows us to piggy-back the + * sleepable call to vnode_pager_setsize(). + */ + NFSUNLOCKNODE(np); + VOP_UNLOCK(vp, 0); + return (EBUSY); + } + if ((ap->a_flags & LK_NOWAIT) != 0 || + (lktype == LK_SHARED && vp->v_vnlock->lk_recurse > 0)) { + NFSUNLOCKNODE(np); + return (0); + } + if (lktype == LK_SHARED) { + NFSUNLOCKNODE(np); + VOP_UNLOCK(vp, 0); + ap->a_flags &= ~(LK_TYPE_MASK | LK_INTERLOCK); + ap->a_flags |= LK_EXCLUSIVE; + error = VOP_LOCK1_APV(&default_vnodeops, ap); + if (error != 0 || vp->v_op != &newnfs_vnodeops) + return (error); + NFSLOCKNODE(np); + if ((np->n_flag & NVNSETSZSKIP) == 0) { + NFSUNLOCKNODE(np); + goto downgrade; + } + } + np->n_flag &= ~NVNSETSZSKIP; + nsize = np->n_size; + NFSUNLOCKNODE(np); + vnode_pager_setsize(vp, nsize); +downgrade: + if (lktype == LK_SHARED) { + ap->a_flags &= ~(LK_TYPE_MASK | LK_INTERLOCK); + ap->a_flags |= LK_DOWNGRADE; + (void)VOP_LOCK1_APV(&default_vnodeops, ap); + } + return (0); +} static int nfs34_access_otw(struct vnode *vp, int wmode, struct thread *td, Modified: head/sys/fs/nfsclient/nfsnode.h ============================================================================== --- head/sys/fs/nfsclient/nfsnode.h Tue Oct 22 16:09:25 2019 (r353890) +++ head/sys/fs/nfsclient/nfsnode.h Tue Oct 22 16:17:38 2019 (r353891) @@ -163,6 +163,7 @@ struct nfsnode { #define NWRITEOPENED 0x00040000 /* Has been opened for writing */ #define NHASBEENLOCKED 0x00080000 /* Has been file locked. */ #define NDSCOMMIT 0x00100000 /* Commit is done via the DS. */ +#define NVNSETSZSKIP 0x00200000 /* Skipped vnode_pager_setsize() */ /* * Convert between nfsnode pointers and vnode pointers From owner-svn-src-all@freebsd.org Tue Oct 22 16:21:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3816E15EE75; Tue, 22 Oct 2019 16:21:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yJfY0pxZz40RK; Tue, 22 Oct 2019 16:21:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 002B1EEC7; Tue, 22 Oct 2019 16:21:25 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MGLOEM062102; Tue, 22 Oct 2019 16:21:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MGLOjW062099; Tue, 22 Oct 2019 16:21:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910221621.x9MGLOjW062099@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 22 Oct 2019 16:21:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353892 - in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs sys vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: cddl/contrib/opensolaris/uts/common/fs/zfs sys vm X-SVN-Commit-Revision: 353892 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:21:25 -0000 Author: kib Date: Tue Oct 22 16:21:24 2019 New Revision: 353892 URL: https://svnweb.freebsd.org/changeset/base/353892 Log: Assert that vnode_pager_setsize() is called with the vnode exclusively locked except for filesystems that set the MNTK_VMSETSIZE_BUG, Set the flag for ZFS. Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D21883 Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/sys/mount.h head/sys/vm/vnode_pager.c Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Oct 22 16:17:38 2019 (r353891) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c Tue Oct 22 16:21:24 2019 (r353892) @@ -1394,6 +1394,7 @@ zfs_domount(vfs_t *vfsp, char *osname) vfsp->mnt_kern_flag |= MNTK_EXTENDED_SHARED; vfsp->mnt_kern_flag |= MNTK_NO_IOPF; /* vn_io_fault can be used */ vfsp->mnt_kern_flag |= MNTK_NOMSYNC; + vfsp->mnt_kern_flag |= MNTK_VMSETSIZE_BUG; /* * The fsid is 64 bits, composed of an 8-bit fs type, which Modified: head/sys/sys/mount.h ============================================================================== --- head/sys/sys/mount.h Tue Oct 22 16:17:38 2019 (r353891) +++ head/sys/sys/mount.h Tue Oct 22 16:21:24 2019 (r353892) @@ -411,6 +411,7 @@ void __mnt_vnode_markerfree_active(struct vno #define MNTK_UNMAPPED_BUFS 0x00002000 #define MNTK_USES_BCACHE 0x00004000 /* FS uses the buffer cache. */ #define MNTK_TEXT_REFS 0x00008000 /* Keep use ref for text */ +#define MNTK_VMSETSIZE_BUG 0x00010000 #define MNTK_NOASYNC 0x00800000 /* disable async */ #define MNTK_UNMOUNT 0x01000000 /* unmount in progress */ #define MNTK_MWAIT 0x02000000 /* waiting for unmount to finish */ Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Tue Oct 22 16:17:38 2019 (r353891) +++ head/sys/vm/vnode_pager.c Tue Oct 22 16:21:24 2019 (r353892) @@ -444,7 +444,16 @@ vnode_pager_setsize(struct vnode *vp, vm_ooffset_t nsi if ((object = vp->v_object) == NULL) return; -/* ASSERT_VOP_ELOCKED(vp, "vnode_pager_setsize and not locked vnode"); */ +#ifdef DEBUG_VFS_LOCKS + { + struct mount *mp; + + mp = vp->v_mount; + if (mp != NULL && (mp->mnt_kern_flag & MNTK_VMSETSIZE_BUG) == 0) + assert_vop_elocked(vp, + "vnode_pager_setsize and not locked vnode"); + } +#endif VM_OBJECT_WLOCK(object); if (object->type == OBJT_DEAD) { VM_OBJECT_WUNLOCK(object); From owner-svn-src-all@freebsd.org Tue Oct 22 16:35:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3280615F212; Tue, 22 Oct 2019 16:35:18 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yJyZ0Hyzz413N; Tue, 22 Oct 2019 16:35:17 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf1-x442.google.com with SMTP id h195so10975379pfe.5; Tue, 22 Oct 2019 09:35:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=LBWVaAZnUfWZzW7If0qTeYULMKgLM6bPt4biAqhQ4WM=; b=p2tStdaui1irzhRezQ/maPMiHxa58jd5d3qpV1ipYWKpwWW59+zwfii72OYy/BXKKC 0EBvr/6NRBgwBemw9dnX91AWSkKLDeqNuBxzLZejPz19txT8bvH/GXIkzUvedRvngrrC eFDmjUILDIJy5Ql/mAd5apPQVHLOrIZjJtnViUSkQ62M7iml6lIjBzV08x0fsx/jAkSV IG8+t0Vjqcx8IrNj+ffA09608DPV3lpCuWe21WE5cNp36uzsP2RmI08JVh6Icua53GJK pmKbTimsgA4GO3dRBEwNdJPpQAtbzUudAUdfwzXlb7YhGpibQ6kP5H3lYEXn4JrU8wbr tCbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=LBWVaAZnUfWZzW7If0qTeYULMKgLM6bPt4biAqhQ4WM=; b=ck1pGlAykaGFkL/3yUBfjb3F0zPT8sGPQ2wwP/OrC44wZzH6siwoj2WBf1kX0MAdUb MR6iwezUpKA5irBpNC2K1gRVJsGJexQDXR/XiX2pfFhCOEsDogLwBGvMaxktDPemsQNw XyZsy8w5kcGq493hUKibodSnSxZao7qnbNJTcGm+NfclqdRNEehzmLrfqnrBgaFlfn26 Xal9aDLdeIQyxXepyDtk675jVDYzX9EkyMXeh4qmI1DXdRzp6M/eeelr8OZOhl5f97Yw CXXA54Yx88ipQdPIipuiFO6TRuOdFep4BJDJi14Og9vz1lFBMONdks9+tj0H6xnebhcS +Trw== X-Gm-Message-State: APjAAAWpScICFCJOobmc5ugW6BE2lRav+S56Iy9R0foLpKQQjuqNaGZk 3aDmOQWc1zx2g34Jrd/UzK53YJ0d X-Google-Smtp-Source: APXvYqyatgwap5YkPwYxKjh0xRFR77/V8+OrRwuBgvtPiUN2bn/p4AtgtCFO4jY9jjUlNib6DpfJGA== X-Received: by 2002:a63:b5b:: with SMTP id a27mr4945273pgl.262.1571762116419; Tue, 22 Oct 2019 09:35:16 -0700 (PDT) Received: from ?IPv6:2607:fb90:8364:7608:20b8:9b0:3e3e:87bc? ([2607:fb90:8364:7608:20b8:9b0:3e3e:87bc]) by smtp.gmail.com with ESMTPSA id p17sm18674270pfn.50.2019.10.22.09.35.15 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Oct 2019 09:35:15 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Enji Cooper Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r353732 - head/sys/net Date: Tue, 22 Oct 2019 09:35:14 -0700 Message-Id: References: <20191022152646.GI4086@FreeBSD.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <20191022152646.GI4086@FreeBSD.org> To: Gleb Smirnoff X-Mailer: iPhone Mail (17A878) X-Rspamd-Queue-Id: 46yJyZ0Hyzz413N X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:35:18 -0000 > On Oct 22, 2019, at 08:26, Gleb Smirnoff wrote: >=20 > =EF=BB=BFOn Tue, Oct 22, 2019 at 07:53:31AM -0700, Enji Cooper wrote: > E> > =EF=BB=BFAuthor: glebius > E> > Date: Fri Oct 18 15:20:24 2019 > E> > New Revision: 353732 > E> > URL: https://svnweb.freebsd.org/changeset/base/353732 > E> >=20 > E> > Log: > E> > Make rt_getifa_fib() static. > E>=20 > E> Why should it be made static? The answer to this question is missing fr= om the commit message. >=20 > Because a function used only in a scope of a single file and not > intended to be used outside should be made static. Gleb, Yep :)! I appreciate your doing this because it limits scopes and calls, all= owing compilers to optimize away unnecessary calls and external symbol linka= ge. My concern is coming back to the time old issue of providing sufficient cont= ext behind commits when making changes. Looking at the code change you made,= I understand what you did... I just lack the context as to why the changes w= as made. This issue is true for the recent KPI rototilling related to interface prope= rty enumeration. If I hadn=E2=80=99t seen your mailing list RFC, I would lac= k all context as to why the changes are being made. Even a quick reference t= o a one page write up on the wiki, a proposal, or release notes would be won= derful moves towards documenting why interface changes are being made. I want to thank you so very much for all of the awesome work you have done a= nd are continuing to do in the network space =E2=80=94 I really appreciate i= t a lot! Again, I just wish the reasoning behind the work was made more appa= rent to onlookers as to why changes are being made. Cheers :)! -Enji= From owner-svn-src-all@freebsd.org Tue Oct 22 16:39:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0324E15F2FA; Tue, 22 Oct 2019 16:39:15 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yK360lX3z41Pr; Tue, 22 Oct 2019 16:39:13 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf1-x435.google.com with SMTP id 205so10991966pfw.2; Tue, 22 Oct 2019 09:39:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=4f58rO93MrajBUtAwKwsIxIFnQpeM3oHsCMWfWv4vws=; b=lSjb7krJApiHjUk10N4bLRF874UHVaiaPyFdenj98dYqlb4MQs27wd4eNa9MSx1bFu cSqcV3AU/BOQL+qv0fdNzBTFtSHweMJAJJNzAya1+VjtC0jUIprsgqnTe3IR/RhXqyCj iq889AdjbRwtueNFI8A4DvGYay26pg78qVCg2vHxf3wB5O+u8nLB+Yq2ykh2/tNe/Rkc Wh+W9QVnSwdWROFIAZZKdGwruIppcfAEJWbg3IE9U1+jJCw1DUXGCSH5XnJQgWErBHid Frkbgdf/d3QxNEXhQ48s+Ce1Kv2RLL5neJJTX7JpDzH16PUppFRDBt0JQyNnUreoCOnQ cD8Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=4f58rO93MrajBUtAwKwsIxIFnQpeM3oHsCMWfWv4vws=; b=jpi29nkv9fRduNsMANc6+pKnq5UzK4Q9+ZwvtVET934eE7em88sgkrO2SF9FTNMHgM ElKERuXTqDkvO3ySGzzBAVsk9dk9glMRZK38Ped/nyEoiibcDKyIGtb+qakwb83+b/DU Jxxap88fp6T7kzwRjJEJd5Lobn2jNT0dIcSbNu4JjU1DkH5vglLMmSnPyaX9aGJf4NS1 OfpQv0zv7yCVna62K8hMHDYWi63nBIFlInJQGZemvV+11bibEQw0mlXqBtq/w9ZJulTi OeC5mX3jGYzLe4HYAsQ+iVrfuJ+Lt9niUX0rGhiEghLGQeHcE57QAadD0SKeWwunYpYZ 8oww== X-Gm-Message-State: APjAAAXKsEUpz3XQ9CkaQ6R9Cj2xDRNSGn3pODEprStpWKv5+A/De/IE XYwV6WkWiW5wmSCssiPBmrBbprkl X-Google-Smtp-Source: APXvYqwrFxn4yk9HIF5NXAkuYd9w50U0+d9XdTIgNraH3bv3POKEYLM5XrNR0jy5K20+uCBrBCHQKA== X-Received: by 2002:a63:d246:: with SMTP id t6mr4816747pgi.5.1571762352132; Tue, 22 Oct 2019 09:39:12 -0700 (PDT) Received: from ?IPv6:2607:fb90:8364:7608:20b8:9b0:3e3e:87bc? ([2607:fb90:8364:7608:20b8:9b0:3e3e:87bc]) by smtp.gmail.com with ESMTPSA id z13sm22270122pfg.172.2019.10.22.09.39.11 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Oct 2019 09:39:11 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Enji Cooper Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r353888 - head/sys/vm Date: Tue, 22 Oct 2019 09:39:09 -0700 Message-Id: <6B3B03C7-FF4A-4A57-853A-00090DA0E6D8@gmail.com> References: <201910221559.x9MFxG2R047533@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201910221559.x9MFxG2R047533@repo.freebsd.org> To: Konstantin Belousov X-Mailer: iPhone Mail (17A878) X-Rspamd-Queue-Id: 46yK360lX3z41Pr X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=lSjb7krJ; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::435 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-9.16), ipnet: 2607:f8b0::/32(-2.43), asn: 15169(-2.07), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[5.3.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:39:15 -0000 > On Oct 22, 2019, at 08:59, Konstantin Belousov wrote: >=20 > =EF=BB=BFAuthor: kib > Date: Tue Oct 22 15:59:16 2019 > New Revision: 353888 > URL: https://svnweb.freebsd.org/changeset/base/353888 >=20 > Log: > vm_fault(): extract code to lock the vnode into a helper vn_fault_lock_vn= ode(). =46rom an external perspective, I ask myself, =E2=80=9CWhat is the purpo= se in extracting the code out?=E2=80=9D The answer to this question is missi= ng from the commit message. Thank you, -Enji= From owner-svn-src-all@freebsd.org Tue Oct 22 16:52:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 892DB15F76A; Tue, 22 Oct 2019 16:52:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yKLx2wL6z42GB; Tue, 22 Oct 2019 16:52:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 48E5DF59C; Tue, 22 Oct 2019 16:52:57 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MGqv3c082613; Tue, 22 Oct 2019 16:52:57 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MGquxu082611; Tue, 22 Oct 2019 16:52:56 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910221652.x9MGquxu082611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Oct 2019 16:52:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353893 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 353893 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 16:52:57 -0000 Author: markj Date: Tue Oct 22 16:52:56 2019 New Revision: 353893 URL: https://svnweb.freebsd.org/changeset/base/353893 Log: Fix thread0 kernel stack initialization on riscv. - td_kstack_pages was not being initialized. - td_kstack is supposed to be the base address of the stack region, not the top. The arm ports seem to have similar problems and will be fixed next. Reported by: Jenkins via lwhsu MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/riscv/riscv/locore.S head/sys/riscv/riscv/machdep.c Modified: head/sys/riscv/riscv/locore.S ============================================================================== --- head/sys/riscv/riscv/locore.S Tue Oct 22 16:21:24 2019 (r353892) +++ head/sys/riscv/riscv/locore.S Tue Oct 22 16:52:56 2019 (r353893) @@ -209,7 +209,7 @@ va: sd t0, 0(sp) /* kern_l1pt */ sd s9, 8(sp) /* kern_phys */ - la t0, initstack_end + la t0, initstack sd t0, 16(sp) /* kern_stack */ li t0, (VM_MAX_KERNEL_ADDRESS - 2 * L2_SIZE) Modified: head/sys/riscv/riscv/machdep.c ============================================================================== --- head/sys/riscv/riscv/machdep.c Tue Oct 22 16:21:24 2019 (r353892) +++ head/sys/riscv/riscv/machdep.c Tue Oct 22 16:52:56 2019 (r353893) @@ -123,7 +123,6 @@ uint32_t boot_hart; /* The hart we booted on. */ cpuset_t all_harts; extern int *end; -extern int *initstack_end; static void cpu_startup(void *dummy) @@ -658,7 +657,9 @@ init_proc0(vm_offset_t kstack) proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; - thread0.td_pcb = (struct pcb *)(thread0.td_kstack) - 1; + thread0.td_kstack_pages = KSTACK_PAGES; + thread0.td_pcb = (struct pcb *)(thread0.td_kstack + + thread0.td_kstack_pages * PAGE_SIZE) - 1; thread0.td_pcb->pcb_fpflags = 0; thread0.td_frame = &proc0_tf; pcpup->pc_curpcb = thread0.td_pcb; From owner-svn-src-all@freebsd.org Tue Oct 22 17:21:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE04C160191 for ; Tue, 22 Oct 2019 17:21:10 +0000 (UTC) (envelope-from www-data@ws05.it.works-gmbh.de) Received: from ws05.it.works-gmbh.de (ws05.it.works-gmbh.de [83.169.18.148]) by mx1.freebsd.org (Postfix) with ESMTP id 46yKzT6YCFz43d7 for ; Tue, 22 Oct 2019 17:21:09 +0000 (UTC) (envelope-from www-data@ws05.it.works-gmbh.de) Received: by ws05.it.works-gmbh.de (Postfix, from userid 33) id 314B8123FED; Tue, 22 Oct 2019 19:14:53 +0200 (CEST) To: svn-src-all@freebsd.org Subject: =?UTF-8?B?IE9ubGluZSBCYW5raW5nIEFsZXJ0?= X-PHP-Originating-Script: 33:new.php From: =?UTF-8?B?QmFuayBvZiBBbWVyaWNh?= MIME-Version: 1.0; Message-Id: <20191022171453.314B8123FED@ws05.it.works-gmbh.de> Date: Tue, 22 Oct 2019 19:14:53 +0200 (CEST) X-Rspamd-Queue-Id: 46yKzT6YCFz43d7 X-Spamd-Bar: ++++++++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of www-data@ws05.it.works-gmbh.de has no SPF policy when checking 83.169.18.148) smtp.mailfrom=www-data@ws05.it.works-gmbh.de X-Spamd-Result: default: False [10.83 / 15.00]; FROM_EXCESS_BASE64(1.50)[]; ENVFROM_SERVICE_ACCT(1.00)[]; SUBJ_EXCESS_BASE64(1.50)[]; HAS_X_POS(0.00)[]; TO_DN_NONE(0.00)[]; CTYPE_MIXED_BOGUS(1.00)[]; FORGED_SENDER(0.30)[onlinebanking@bankofamerica---online.com,www-data@ws05.it.works-gmbh.de]; RCVD_COUNT_ZERO(0.00)[0]; IP_SCORE(1.38)[ipnet: 83.169.16.0/21(4.38), asn: 8972(2.55), country: DE(-0.01)]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:8972, ipnet:83.169.16.0/21, country:DE]; MIME_TRACE(0.00)[0:+,1:~,2:+]; FROM_NEQ_ENVFROM(0.00)[onlinebanking@bankofamerica---online.com,www-data@ws05.it.works-gmbh.de]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; AUTOGEN_PHP_SPAMMY(1.00)[]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(1.00)[1.000,0]; RCPT_COUNT_ONE(0.00)[1]; MANY_INVISIBLE_PARTS(0.05)[1]; DMARC_NA(0.00)[bankofamerica---online.com]; NEURAL_SPAM_LONG(1.00)[1.000,0]; MIME_HTML_ONLY(0.20)[]; R_SPF_NA(0.00)[]; GREYLIST(0.00)[pass,body] X-Spam: Yes Content-Type: text/plain X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 17:21:10 -0000 From owner-svn-src-all@freebsd.org Tue Oct 22 17:21:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1ECAA1601F1; Tue, 22 Oct 2019 17:21:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yKzm00fWz43ns; Tue, 22 Oct 2019 17:21:24 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D903DF982; Tue, 22 Oct 2019 17:21:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MHLNdJ097905; Tue, 22 Oct 2019 17:21:23 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MHLNVI097869; Tue, 22 Oct 2019 17:21:23 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910221721.x9MHLNVI097869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Oct 2019 17:21:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353894 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 353894 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 17:21:24 -0000 Author: markj Date: Tue Oct 22 17:21:23 2019 New Revision: 353894 URL: https://svnweb.freebsd.org/changeset/base/353894 Log: Initialize thread0.td_kstack_pages on arm. Fix style on the line below. Reported by: Jenkins (hardware CI lab) MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Tue Oct 22 16:52:56 2019 (r353893) +++ head/sys/arm/arm/machdep.c Tue Oct 22 17:21:23 2019 (r353894) @@ -771,8 +771,9 @@ init_proc0(vm_offset_t kstack) { proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; - thread0.td_pcb = (struct pcb *) - (thread0.td_kstack + kstack_pages * PAGE_SIZE) - 1; + thread0.td_kstack_pages = kstack_pages; + thread0.td_pcb = (struct pcb *)(thread0.td_kstack + + thread0.td_kstack_pages * PAGE_SIZE) - 1; thread0.td_pcb->pcb_flags = 0; thread0.td_pcb->pcb_vfpcpu = -1; thread0.td_pcb->pcb_vfpstate.fpscr = VFPSCR_DN; From owner-svn-src-all@freebsd.org Tue Oct 22 17:22:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4EDFD160299; Tue, 22 Oct 2019 17:22:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yL0g1QN6z4411; Tue, 22 Oct 2019 17:22:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 144F6FAC5; Tue, 22 Oct 2019 17:22:11 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MHMALH000366; Tue, 22 Oct 2019 17:22:10 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MHMAOd000364; Tue, 22 Oct 2019 17:22:10 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910221722.x9MHMAOd000364@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 22 Oct 2019 17:22:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353895 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 353895 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 17:22:11 -0000 Author: markj Date: Tue Oct 22 17:22:10 2019 New Revision: 353895 URL: https://svnweb.freebsd.org/changeset/base/353895 Log: Apply r353893 to arm64. Reported by: Jenkins (hardware CI lab) MFC after: 1 week Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/arm64/locore.S head/sys/arm64/arm64/machdep.c Modified: head/sys/arm64/arm64/locore.S ============================================================================== --- head/sys/arm64/arm64/locore.S Tue Oct 22 17:21:23 2019 (r353894) +++ head/sys/arm64/arm64/locore.S Tue Oct 22 17:22:10 2019 (r353895) @@ -132,6 +132,7 @@ virtdone: str x1, [x0] /* modulep */ str x26, [x0, 8] /* kern_l1pt */ str x29, [x0, 16] /* kern_delta */ + adr x25, initstack str x25, [x0, 24] /* kern_stack */ str x24, [x0, 32] /* kern_l0pt */ Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Tue Oct 22 17:21:23 2019 (r353894) +++ head/sys/arm64/arm64/machdep.c Tue Oct 22 17:22:10 2019 (r353895) @@ -745,7 +745,9 @@ init_proc0(vm_offset_t kstack) proc_linkup0(&proc0, &thread0); thread0.td_kstack = kstack; - thread0.td_pcb = (struct pcb *)(thread0.td_kstack) - 1; + thread0.td_kstack_pages = KSTACK_PAGES; + thread0.td_pcb = (struct pcb *)(thread0.td_kstack + + thread0.td_kstack_pages * KSTACK_PAGES) - 1; thread0.td_pcb->pcb_fpflags = 0; thread0.td_pcb->pcb_fpusaved = &thread0.td_pcb->pcb_fpustate; thread0.td_pcb->pcb_vfpcpu = UINT_MAX; From owner-svn-src-all@freebsd.org Tue Oct 22 18:02:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 58487160F05; Tue, 22 Oct 2019 18:02:04 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yLth0sdlz45qd; Tue, 22 Oct 2019 18:02:03 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.15.2/8.15.2) with ESMTPS id x9MI21F4087106 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Tue, 22 Oct 2019 11:02:01 -0700 (PDT) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.15.2/8.15.2/Submit) id x9MI21IH087105; Tue, 22 Oct 2019 11:02:01 -0700 (PDT) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Tue, 22 Oct 2019 11:02:01 -0700 From: Gleb Smirnoff To: Mark Johnston Cc: Li-Wen Hsu , br@freebsd.org, src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r353876 - head/sys/kern Message-ID: <20191022180201.GL4086@FreeBSD.org> References: <201910212312.x9LNCEbX052414@repo.freebsd.org> <20191022152913.GJ4086@FreeBSD.org> <20191022154036.GE540@raichu> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191022154036.GE540@raichu> User-Agent: Mutt/1.12.2 (2019-09-21) X-Rspamd-Queue-Id: 46yLth0sdlz45qd X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.95 / 15.00]; NEURAL_HAM_MEDIUM(-0.95)[-0.955,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 18:02:04 -0000 On Tue, Oct 22, 2019 at 11:40:36AM -0400, Mark Johnston wrote: M> > I need help from RISC-V experts. M> M> I suspect the problem is that init_proc0() on several arches does not M> initialize td_kstack_pages. I will test this patch and commit if it M> fixes the panic. M> M> Note that on arm64 and riscv thread0's kernel stack is statically M> allocated. I see you already committed it. Thanks a lot, Mark! -- Gleb Smirnoff From owner-svn-src-all@freebsd.org Tue Oct 22 18:05:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61B4E160FD9; Tue, 22 Oct 2019 18:05:08 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: from mail-ot1-f68.google.com (mail-ot1-f68.google.com [209.85.210.68]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yLyD1mV6z46Jy; Tue, 22 Oct 2019 18:05:07 +0000 (UTC) (envelope-from cse.cem@gmail.com) Received: by mail-ot1-f68.google.com with SMTP id 53so3400860otv.4; Tue, 22 Oct 2019 11:05:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:reply-to :from:date:message-id:subject:to:cc; bh=wnMBDC0NZzsABxMqO+U1/zz9s0ugwLwDFWrJNppFlpE=; b=gLSqcY+Yx405M8gsRDNHcdCPKoi+AXC6ZfNRh0DTGy6xMPV8pZjjWaYdJHDpb14odq 53Gsi1s76Pc2wk7ADiEG7mN4BEP98kYUd2WrsBJlIJqWMkzoN1wMEwUDgxx2GKGlK2QL FOIYhppAye8iA7BJh4ZHAo8Y5PDmA4lGEpOvqZ/GqLs5fFdSnrqEjcINIz4V28sLku42 mXX+rEdub4RKvqSWPaCMbHPH0yVR/BrdQJ1QD2UAr446rn1d8ZhI2X7BaA5WSTGzRDdF UmuKMsueLI+/MX0wBq1wJDm9aq9i9ELmp+7elI2tXeR4cbuBsmK+10suAfmXFTTAToE6 SzNA== X-Gm-Message-State: APjAAAVbCwoZyJOdmv7fnvEVXhWQWBbFfyabmtM1DP4sU1EtLSHUrxSh xtDTZswiPUvxU0eIoJJc5rLSHLmm X-Google-Smtp-Source: APXvYqxksP9p8+AL9cPk3fIb5zdTKtZu1mPvzzDkNsBNjxiVlFA+IvcyZ4q7o5tPnAbBAEXIredO0A== X-Received: by 2002:a9d:3df7:: with SMTP id l110mr3612429otc.245.1571767506224; Tue, 22 Oct 2019 11:05:06 -0700 (PDT) Received: from mail-ot1-f42.google.com (mail-ot1-f42.google.com. [209.85.210.42]) by smtp.gmail.com with ESMTPSA id s194sm4903944oie.19.2019.10.22.11.05.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 22 Oct 2019 11:05:05 -0700 (PDT) Received: by mail-ot1-f42.google.com with SMTP id s22so14999256otr.6; Tue, 22 Oct 2019 11:05:05 -0700 (PDT) X-Received: by 2002:a05:6830:1609:: with SMTP id g9mr3557848otr.175.1571767505426; Tue, 22 Oct 2019 11:05:05 -0700 (PDT) MIME-Version: 1.0 References: <201910161321.x9GDL2ee021543@repo.freebsd.org> In-Reply-To: Reply-To: cem@freebsd.org From: Conrad Meyer Date: Tue, 22 Oct 2019 11:04:54 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r353640 - head/sys/kern To: Alan Somers Cc: Andrew Turner , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46yLyD1mV6z46Jy X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.989,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 18:05:08 -0000 Theoretically the information should be here, but it's still locked: https://admbugs.freebsd.org/show_bug.cgi?id=651 . On Tue, Oct 22, 2019 at 8:51 AM Alan Somers wrote: > > On Wed, Oct 16, 2019 at 7:21 AM Andrew Turner wrote: >> >> Author: andrew >> Date: Wed Oct 16 13:21:01 2019 >> New Revision: 353640 >> URL: https://svnweb.freebsd.org/changeset/base/353640 >> >> Log: >> Stop leaking information from the kernel through timespec >> >> The timespec struct holds a seconds value in a time_t and a nanoseconds >> value in a long. On most architectures these are the same size, however >> on 32-bit architectures other than i386 time_t is 8 bytes and long is >> 4 bytes. >> >> Most ABIs will then pad a struct holding an 8 byte and 4 byte value to >> 16 bytes with 4 bytes of padding. When copying one of these structs the >> compiler is free to copy the padding if it wishes. >> >> In this case the padding may contain kernel data that is then leaked to >> userspace. Fix this by copying the timespec elements rather than the >> entire struct. >> >> This doesn't affect Tier-1 architectures so no SA is expected. >> >> admbugs: 651 >> MFC after: 1 week >> Sponsored by: DARPA, AFRL > > > Good catch. Might I ask how you found it, or who reported it? From owner-svn-src-all@freebsd.org Tue Oct 22 18:05:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F2FF16100A; Tue, 22 Oct 2019 18:05:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yLyN0x8Nz46R5; Tue, 22 Oct 2019 18:05:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 035CF18212; Tue, 22 Oct 2019 18:05:16 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MI5Fnt024098; Tue, 22 Oct 2019 18:05:15 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MI5FQr024097; Tue, 22 Oct 2019 18:05:15 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910221805.x9MI5FQr024097@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Tue, 22 Oct 2019 18:05:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353896 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353896 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 18:05:16 -0000 Author: glebius Date: Tue Oct 22 18:05:15 2019 New Revision: 353896 URL: https://svnweb.freebsd.org/changeset/base/353896 Log: Allow epoch tracker to use the very last byte of the stack. Not sure this will help to avoid panic in this function, since it will also use some stack, but makes code more strict. Submitted by: hselasky Modified: head/sys/kern/subr_epoch.c Modified: head/sys/kern/subr_epoch.c ============================================================================== --- head/sys/kern/subr_epoch.c Tue Oct 22 17:22:10 2019 (r353895) +++ head/sys/kern/subr_epoch.c Tue Oct 22 18:05:15 2019 (r353896) @@ -369,7 +369,7 @@ _epoch_enter_preempt(epoch_t epoch, epoch_tracker_t et MPASS(epoch->e_flags & EPOCH_PREEMPT); td = curthread; MPASS((vm_offset_t)et >= td->td_kstack && - (vm_offset_t)et + sizeof(struct epoch_tracker) < + (vm_offset_t)et + sizeof(struct epoch_tracker) <= td->td_kstack + td->td_kstack_pages * PAGE_SIZE); INIT_CHECK(epoch); From owner-svn-src-all@freebsd.org Tue Oct 22 18:15:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7545F1614BD; Tue, 22 Oct 2019 18:15:55 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-yw1-f67.google.com (mail-yw1-f67.google.com [209.85.161.67]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yMBg2K9vz46v7; Tue, 22 Oct 2019 18:15:55 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-yw1-f67.google.com with SMTP id g77so2497416ywb.10; Tue, 22 Oct 2019 11:15:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=63ntdn9FydyiYraLWhx7qxQ+j3dIVUm94qz2d1/uJpM=; b=kGk9VuMi+2zOiPJovodrn4aQG6/6tGjWHYljIpTdy/TjXNJs7opyi7insJoRnT86R7 4jxo10+3/nWJDCrtabu9SnAcyIYUe1t/psDgjrYntWMgQUvoUoDhozm5V16ydJQfhge6 H0iAizQikyWgt5+0NU8Wa3od0r/ADNI2PhPAWD4YO2/egFxIGIThCqq1UvXaDNc3SWOO eDJ032FVMv6ksBR90lUVcl+0Qdn39kJ04bqX+RRMDneaB/kZxRzl+UrpnYtZknzJH1Vx 2GUThmDIfJuCxbA8e+DVuLXxM2srjOatZLlHSTcfTAEM2THoYwTX1mWAlBV6UoG8NNuI gzPQ== X-Gm-Message-State: APjAAAVo4g3MvWVbrWu8VQGij74DnDJlO6kW7FyoV6v80qbq52RHG0UZ fhtXQqQX8iAclFvVZC5w1y322Lt6S1joINimSG66mW4m X-Google-Smtp-Source: APXvYqz8anG2WBSvkWnJs6WKdd2n2V2P1PBf4b6oor4E1rtTw34gwoalmOCgk1HxiMzUsbhArURCx/k8ZXAxxo93q3g= X-Received: by 2002:a81:7c0b:: with SMTP id x11mr3096387ywc.385.1571768153732; Tue, 22 Oct 2019 11:15:53 -0700 (PDT) MIME-Version: 1.0 References: <201910212312.x9LNCEbX052414@repo.freebsd.org> <20191022152913.GJ4086@FreeBSD.org> <20191022154036.GE540@raichu> <20191022180201.GL4086@FreeBSD.org> In-Reply-To: <20191022180201.GL4086@FreeBSD.org> From: Li-Wen Hsu Date: Wed, 23 Oct 2019 02:15:41 +0800 Message-ID: Subject: Re: svn commit: r353876 - head/sys/kern To: Gleb Smirnoff Cc: Mark Johnston , Ruslan Bukin , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46yMBg2K9vz46v7 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.990,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 18:15:55 -0000 On Wed, Oct 23, 2019 at 2:02 AM Gleb Smirnoff wrote: > > On Tue, Oct 22, 2019 at 11:40:36AM -0400, Mark Johnston wrote: > M> > I need help from RISC-V experts. > M> > M> I suspect the problem is that init_proc0() on several arches does not > M> initialize td_kstack_pages. I will test this patch and commit if it > M> fixes the panic. > M> > M> Note that on arm64 and riscv thread0's kernel stack is statically > M> allocated. > > I see you already committed it. Thanks a lot, Mark! Yeah, thank you! r353893 fixed it and riscv64-test backed to green: https://ci.freebsd.org/job/FreeBSD-head-riscv64-test/12339/ From owner-svn-src-all@freebsd.org Tue Oct 22 18:28:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78AD3161ABA; Tue, 22 Oct 2019 18:28:59 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yMTl2f1Zz47W4; Tue, 22 Oct 2019 18:28:59 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E981185A8; Tue, 22 Oct 2019 18:28:59 +0000 (UTC) (envelope-from luporl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MISx7t035954; Tue, 22 Oct 2019 18:28:59 GMT (envelope-from luporl@FreeBSD.org) Received: (from luporl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MISwK5035952; Tue, 22 Oct 2019 18:28:58 GMT (envelope-from luporl@FreeBSD.org) Message-Id: <201910221828.x9MISwK5035952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: luporl set sender to luporl@FreeBSD.org using -f From: Leandro Lupori Date: Tue, 22 Oct 2019 18:28:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353897 - head/sys/powerpc/ofw X-SVN-Group: head X-SVN-Commit-Author: luporl X-SVN-Commit-Paths: head/sys/powerpc/ofw X-SVN-Commit-Revision: 353897 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 18:28:59 -0000 Author: luporl Date: Tue Oct 22 18:28:58 2019 New Revision: 353897 URL: https://svnweb.freebsd.org/changeset/base/353897 Log: [PPC] Avoid underflows in NUMA domains On POWER8 systems with only one memory domain, the "ibm,associativity" number that corresponds to it is 0, unlike POWER9 systems with two or more domains, in which the minimum value is 1. In POWER8 case, subtracting 1 causes an underflow on the unsigned domain variable and a subsequent index out-of-bounds access. Reviewed by: jhibbits Tested by: bdragon, luporl Modified: head/sys/powerpc/ofw/ofw_machdep.c head/sys/powerpc/ofw/ofw_pcibus.c Modified: head/sys/powerpc/ofw/ofw_machdep.c ============================================================================== --- head/sys/powerpc/ofw/ofw_machdep.c Tue Oct 22 18:05:15 2019 (r353896) +++ head/sys/powerpc/ofw/ofw_machdep.c Tue Oct 22 18:28:58 2019 (r353897) @@ -487,7 +487,7 @@ ofw_numa_mem_regions(struct numa_mem_region *memp, int MPASS(count == 1); OF_getencprop(phandle, "ibm,associativity", associativity, res); - curmemp->mr_domain = associativity[3] - 1; + curmemp->mr_domain = associativity[3]; if (bootverbose) printf("%s %#jx-%#jx domain(%ju)\n", name, (uintmax_t)curmemp->mr_start, Modified: head/sys/powerpc/ofw/ofw_pcibus.c ============================================================================== --- head/sys/powerpc/ofw/ofw_pcibus.c Tue Oct 22 18:05:15 2019 (r353896) +++ head/sys/powerpc/ofw/ofw_pcibus.c Tue Oct 22 18:28:58 2019 (r353897) @@ -403,7 +403,7 @@ ofw_pcibus_parse_associativity(device_t dev, int *doma OF_getencprop(node, "ibm,associativity", associativity, res); - *domain = associativity[3] - 1; + *domain = associativity[3]; if (bootverbose) device_printf(dev, "domain(%d)\n", *domain); return (0); From owner-svn-src-all@freebsd.org Tue Oct 22 18:30:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 309C7161D11; Tue, 22 Oct 2019 18:30:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yMWw0FdJz47k5; Tue, 22 Oct 2019 18:30:52 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E0A96185C8; Tue, 22 Oct 2019 18:30:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MIUpQk038367; Tue, 22 Oct 2019 18:30:51 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MIUpcb038366; Tue, 22 Oct 2019 18:30:51 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910221830.x9MIUpcb038366@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Tue, 22 Oct 2019 18:30:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353898 - head/contrib/blacklist/bin X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/blacklist/bin X-SVN-Commit-Revision: 353898 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 18:30:52 -0000 Author: emaste Date: Tue Oct 22 18:30:51 2019 New Revision: 353898 URL: https://svnweb.freebsd.org/changeset/base/353898 Log: blacklistd: remove reference to NetBSD npfctl Xr pfctl instead. PR: 221069 Submitted by: "fml" MFC after: 3 days Modified: head/contrib/blacklist/bin/blacklistd.8 Modified: head/contrib/blacklist/bin/blacklistd.8 ============================================================================== --- head/contrib/blacklist/bin/blacklistd.8 Tue Oct 22 18:28:58 2019 (r353897) +++ head/contrib/blacklist/bin/blacklistd.8 Tue Oct 22 18:30:51 2019 (r353898) @@ -233,7 +233,7 @@ Socket to receive connection notifications. .Sh SEE ALSO .Xr blacklistd.conf 5 , .Xr blacklistctl 8 , -.Xr npfctl 8 , +.Xr pfctl 8 , .Xr syslogd 8 .Sh HISTORY .Nm From owner-svn-src-all@freebsd.org Tue Oct 22 20:01:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4671E163FA2; Tue, 22 Oct 2019 20:01:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yPXr16Y4z4DSD; Tue, 22 Oct 2019 20:01:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0AF0819718; Tue, 22 Oct 2019 20:01:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MK1lcr092042; Tue, 22 Oct 2019 20:01:47 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MK1lKn092038; Tue, 22 Oct 2019 20:01:47 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910222001.x9MK1lKn092038@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 22 Oct 2019 20:01:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353899 - in head/sys/dev/cxgbe: . tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . tom X-SVN-Commit-Revision: 353899 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 20:01:48 -0000 Author: jhb Date: Tue Oct 22 20:01:47 2019 New Revision: 353899 URL: https://svnweb.freebsd.org/changeset/base/353899 Log: Always allocate the atid table during attach. Previously the table was allocated on first use by TOE and the ratelimit code. The forthcoming NIC KTLS code also uses this table. Allocate it unconditionally during attach to simplify consumers. Reviewed by: np Differential Revision: https://reviews.freebsd.org/D22028 Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_filter.c head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/tom/t4_tom.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Tue Oct 22 18:30:51 2019 (r353898) +++ head/sys/dev/cxgbe/adapter.h Tue Oct 22 20:01:47 2019 (r353899) @@ -1160,8 +1160,6 @@ int vi_full_uninit(struct vi_info *); void vi_sysctls(struct vi_info *); void vi_tick(void *); int rw_via_memwin(struct adapter *, int, uint32_t, uint32_t *, int, int); -int alloc_atid_tab(struct tid_info *, int); -void free_atid_tab(struct tid_info *); int alloc_atid(struct adapter *, void *); void *lookup_atid(struct adapter *, int); void free_atid(struct adapter *, int); Modified: head/sys/dev/cxgbe/t4_filter.c ============================================================================== --- head/sys/dev/cxgbe/t4_filter.c Tue Oct 22 18:30:51 2019 (r353898) +++ head/sys/dev/cxgbe/t4_filter.c Tue Oct 22 20:01:47 2019 (r353899) @@ -891,11 +891,6 @@ set_filter(struct adapter *sc, struct t4_filter *t) if (rc != 0) goto done; } - if (__predict_false(sc->tids.atid_tab == NULL)) { - rc = alloc_atid_tab(&sc->tids, M_NOWAIT); - if (rc != 0) - goto done; - } } else if (separate_hpfilter_region(sc) && t->fs.prio && __predict_false(ti->hpftid_tab == NULL)) { MPASS(ti->nhpftids != 0); Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Oct 22 18:30:51 2019 (r353898) +++ head/sys/dev/cxgbe/t4_main.c Tue Oct 22 20:01:47 2019 (r353899) @@ -626,6 +626,8 @@ static void quiesce_fl(struct adapter *, struct sge_fl static int t4_alloc_irq(struct adapter *, struct irq *, int rid, driver_intr_t *, void *, char *); static int t4_free_irq(struct adapter *, struct irq *); +static void t4_init_atid_table(struct adapter *); +static void t4_free_atid_table(struct adapter *); static void get_regs(struct adapter *, struct t4_regdump *, uint8_t *); static void vi_refresh_stats(struct adapter *, struct vi_info *); static void cxgbe_refresh_stats(struct adapter *, struct port_info *); @@ -1236,6 +1238,7 @@ t4_attach(device_t dev) t4_init_l2t(sc, M_WAITOK); t4_init_smt(sc, M_WAITOK); t4_init_tx_sched(sc); + t4_init_atid_table(sc); #ifdef RATELIMIT t4_init_etid_table(sc); #endif @@ -1540,6 +1543,7 @@ t4_detach_common(device_t dev) t4_free_l2t(sc->l2t); if (sc->smt) t4_free_smt(sc->smt); + t4_free_atid_table(sc); #ifdef RATELIMIT t4_free_etid_table(sc); #endif @@ -1568,7 +1572,6 @@ t4_detach_common(device_t dev) free(sc->tids.ftid_tab, M_CXGBE); free(sc->tids.hpftid_tab, M_CXGBE); free_hftid_hash(&sc->tids); - free(sc->tids.atid_tab, M_CXGBE); free(sc->tids.tid_tab, M_CXGBE); free(sc->tt.tls_rx_ports, M_CXGBE); t4_destroy_dma_tag(sc); @@ -2829,31 +2832,34 @@ rw_via_memwin(struct adapter *sc, int idx, uint32_t ad return (0); } -int -alloc_atid_tab(struct tid_info *t, int flags) +static void +t4_init_atid_table(struct adapter *sc) { + struct tid_info *t; int i; - MPASS(t->natids > 0); + t = &sc->tids; + if (t->natids == 0) + return; + MPASS(t->atid_tab == NULL); t->atid_tab = malloc(t->natids * sizeof(*t->atid_tab), M_CXGBE, - M_ZERO | flags); - if (t->atid_tab == NULL) - return (ENOMEM); + M_ZERO | M_WAITOK); mtx_init(&t->atid_lock, "atid lock", NULL, MTX_DEF); t->afree = t->atid_tab; t->atids_in_use = 0; for (i = 1; i < t->natids; i++) t->atid_tab[i - 1].next = &t->atid_tab[i]; t->atid_tab[t->natids - 1].next = NULL; - - return (0); } -void -free_atid_tab(struct tid_info *t) +static void +t4_free_atid_table(struct adapter *sc) { + struct tid_info *t; + + t = &sc->tids; KASSERT(t->atids_in_use == 0, ("%s: %d atids still in use.", __func__, t->atids_in_use)); Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Tue Oct 22 18:30:51 2019 (r353898) +++ head/sys/dev/cxgbe/tom/t4_tom.c Tue Oct 22 20:01:47 2019 (r353899) @@ -1368,7 +1368,6 @@ free_tid_tabs(struct tid_info *t) { free_tid_tab(t); - free_atid_tab(t); free_stid_tab(t); } @@ -1378,10 +1377,6 @@ alloc_tid_tabs(struct tid_info *t) int rc; rc = alloc_tid_tab(t, M_NOWAIT); - if (rc != 0) - goto failed; - - rc = alloc_atid_tab(t, M_NOWAIT); if (rc != 0) goto failed; From owner-svn-src-all@freebsd.org Tue Oct 22 20:03:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42365164085 for ; Tue, 22 Oct 2019 20:03:02 +0000 (UTC) (envelope-from asfotowelt@web11.webdings-cloud.net) Received: from web11.webdings-cloud.net (web11.webdings-cloud.net [90.146.4.26]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46yPZD5l18z4DdS for ; Tue, 22 Oct 2019 20:03:00 +0000 (UTC) (envelope-from asfotowelt@web11.webdings-cloud.net) Received: from asfotowelt by web11.webdings-cloud.net with local (Exim 4.92) (envelope-from ) id 1iMxp0-0000IK-I5 for svn-src-all@freebsd.org; Tue, 22 Oct 2019 19:19:50 +0200 To: svn-src-all@freebsd.org Subject: =?UTF-8?B?U2VydmljZSBVcGdyYWRlICYgTWFpbnRlbmFuY2UgTm90aWNl?= X-PHP-Script: as-fotowelt.at/new.php for 192.186.145.86 X-PHP-Originating-Script: 1067:new.php From: =?UTF-8?B?QmFuayBvZiBBbWVyaWNh?= MIME-Version: 1.0; Message-Id: Date: Tue, 22 Oct 2019 19:19:50 +0200 X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - web11.webdings-cloud.net X-AntiAbuse: Original Domain - freebsd.org X-AntiAbuse: Originator/Caller UID/GID - [1067 993] / [47 12] X-AntiAbuse: Sender Address Domain - web11.webdings-cloud.net X-Get-Message-Sender-Via: web11.webdings-cloud.net: authenticated_id: asfotowelt/only user confirmed/virtual account not confirmed X-Authenticated-Sender: web11.webdings-cloud.net: asfotowelt X-Source: X-Source-Args: X-Source-Dir: X-Rspamd-Queue-Id: 46yPZD5l18z4DdS X-Spamd-Bar: ++++++++++ Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=none (mx1.freebsd.org: domain of asfotowelt@web11.webdings-cloud.net has no SPF policy when checking 90.146.4.26) smtp.mailfrom=asfotowelt@web11.webdings-cloud.net X-Spamd-Result: default: False [10.43 / 15.00]; IP_SCORE(-0.02)[country: AT(-0.10)]; SUBJ_EXCESS_BASE64(1.50)[]; FROM_EXCESS_BASE64(1.50)[]; HAS_X_SOURCE(0.00)[]; HAS_X_POS(0.00)[]; TO_DN_NONE(0.00)[]; AUTOGEN_PHP_SPAMMY(1.00)[]; CTYPE_MIXED_BOGUS(1.00)[]; FORGED_SENDER(0.30)[BankofAmerica@customerloyalty.accounts.com,asfotowelt@web11.webdings-cloud.net]; HAS_X_ANTIABUSE(0.00)[]; RCVD_TLS_LAST(0.00)[]; R_DKIM_NA(0.00)[]; ASN(0.00)[asn:12605, ipnet:90.146.0.0/17, country:AT]; MIME_TRACE(0.00)[0:+,1:~,2:+]; FROM_NEQ_ENVFROM(0.00)[BankofAmerica@customerloyalty.accounts.com,asfotowelt@web11.webdings-cloud.net]; HAS_X_AS(0.00)[asfotowelt]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[multipart/mixed,text/plain]; DMARC_NA(0.00)[accounts.com]; AUTH_NA(1.00)[]; NEURAL_SPAM_MEDIUM(1.00)[0.999,0]; RCPT_COUNT_ONE(0.00)[1]; MANY_INVISIBLE_PARTS(0.05)[1]; RBL_VIRUSFREE_BOTNET(2.00)[26.4.146.90.bip.virusfree.cz : 127.0.0.2]; NEURAL_SPAM_LONG(1.00)[1.000,0]; HAS_X_GMSV(0.00)[asfotowelt/only user confirmed/virtual account not confirmed]; MIME_HTML_ONLY(0.20)[]; R_SPF_NA(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; GREYLIST(0.00)[pass,body]; HAS_X_PHP_SCRIPT(0.00)[] X-Spam: Yes Content-Type: text/plain X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 20:03:02 -0000 From owner-svn-src-all@freebsd.org Tue Oct 22 20:41:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48005164D89; Tue, 22 Oct 2019 20:41:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yQR71yZKz4G59; Tue, 22 Oct 2019 20:41:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2627419D29; Tue, 22 Oct 2019 20:41:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MKftnH016548; Tue, 22 Oct 2019 20:41:55 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MKfsuC016543; Tue, 22 Oct 2019 20:41:54 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910222041.x9MKfsuC016543@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 22 Oct 2019 20:41:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353900 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 353900 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 20:41:55 -0000 Author: jhb Date: Tue Oct 22 20:41:54 2019 New Revision: 353900 URL: https://svnweb.freebsd.org/changeset/base/353900 Log: Split Chelsio send tags into a generic base tag and a ratelimit tag. NIC KTLS will add a new TLS send tag type in cxgbe(4) that is a distinct tag from a ratelimit tag. To support this, refactor cxgbe_snd_tag to be a simple send tag with a type and convert the existing ratelimit tag to a new cxgbe_rate_tag structure. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D22072 Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/t4_sched.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Tue Oct 22 20:01:47 2019 (r353899) +++ head/sys/dev/cxgbe/adapter.h Tue Oct 22 20:41:54 2019 (r353900) @@ -1155,6 +1155,7 @@ int update_mac_settings(struct ifnet *, int); int adapter_full_init(struct adapter *); int adapter_full_uninit(struct adapter *); uint64_t cxgbe_get_counter(struct ifnet *, ift_counter); +void cxgbe_snd_tag_init(struct cxgbe_snd_tag *, struct ifnet *, int); int vi_full_init(struct vi_info *); int vi_full_uninit(struct vi_info *); void vi_sysctls(struct vi_info *); @@ -1212,7 +1213,7 @@ void t4_register_cpl_handler(int, cpl_handler_t); void t4_register_shared_cpl_handler(int, cpl_handler_t, int); #ifdef RATELIMIT int ethofld_transmit(struct ifnet *, struct mbuf *); -void send_etid_flush_wr(struct cxgbe_snd_tag *); +void send_etid_flush_wr(struct cxgbe_rate_tag *); #endif /* t4_tracer.c */ @@ -1238,13 +1239,13 @@ int sysctl_tc_params(SYSCTL_HANDLER_ARGS); #ifdef RATELIMIT void t4_init_etid_table(struct adapter *); void t4_free_etid_table(struct adapter *); -struct cxgbe_snd_tag *lookup_etid(struct adapter *, int); -int cxgbe_snd_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, +struct cxgbe_rate_tag *lookup_etid(struct adapter *, int); +int cxgbe_rate_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, struct m_snd_tag **); -int cxgbe_snd_tag_modify(struct m_snd_tag *, union if_snd_tag_modify_params *); -int cxgbe_snd_tag_query(struct m_snd_tag *, union if_snd_tag_query_params *); -void cxgbe_snd_tag_free(struct m_snd_tag *); -void cxgbe_snd_tag_free_locked(struct cxgbe_snd_tag *); +int cxgbe_rate_tag_modify(struct m_snd_tag *, union if_snd_tag_modify_params *); +int cxgbe_rate_tag_query(struct m_snd_tag *, union if_snd_tag_query_params *); +void cxgbe_rate_tag_free(struct m_snd_tag *); +void cxgbe_rate_tag_free_locked(struct cxgbe_rate_tag *); void cxgbe_ratelimit_query(struct ifnet *, struct if_ratelimit_query_results *); #endif Modified: head/sys/dev/cxgbe/offload.h ============================================================================== --- head/sys/dev/cxgbe/offload.h Tue Oct 22 20:01:47 2019 (r353899) +++ head/sys/dev/cxgbe/offload.h Tue Oct 22 20:41:54 2019 (r353900) @@ -79,7 +79,7 @@ union aopen_entry { union aopen_entry *next; }; -/* cxgbe_snd_tag flags */ +/* cxgbe_rate_tag flags */ enum { EO_FLOWC_PENDING = (1 << 0), /* flowc needs to be sent */ EO_FLOWC_RPL_PENDING = (1 << 1), /* flowc credits due back */ @@ -89,6 +89,11 @@ enum { struct cxgbe_snd_tag { struct m_snd_tag com; + int type; +}; + +struct cxgbe_rate_tag { + struct cxgbe_snd_tag com; struct adapter *adapter; u_int flags; struct mtx lock; @@ -114,8 +119,14 @@ mst_to_cst(struct m_snd_tag *t) return (__containerof(t, struct cxgbe_snd_tag, com)); } +static inline struct cxgbe_rate_tag * +mst_to_crt(struct m_snd_tag *t) +{ + return ((struct cxgbe_rate_tag *)mst_to_cst(t)); +} + union etid_entry { - struct cxgbe_snd_tag *cst; + struct cxgbe_rate_tag *cst; union etid_entry *next; }; Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Tue Oct 22 20:01:47 2019 (r353899) +++ head/sys/dev/cxgbe/t4_main.c Tue Oct 22 20:41:54 2019 (r353900) @@ -230,6 +230,15 @@ static void cxgbe_init(void *); static int cxgbe_ioctl(struct ifnet *, unsigned long, caddr_t); static int cxgbe_transmit(struct ifnet *, struct mbuf *); static void cxgbe_qflush(struct ifnet *); +#ifdef RATELIMIT +static int cxgbe_snd_tag_alloc(struct ifnet *, union if_snd_tag_alloc_params *, + struct m_snd_tag **); +static int cxgbe_snd_tag_modify(struct m_snd_tag *, + union if_snd_tag_modify_params *); +static int cxgbe_snd_tag_query(struct m_snd_tag *, + union if_snd_tag_query_params *); +static void cxgbe_snd_tag_free(struct m_snd_tag *); +#endif MALLOC_DEFINE(M_CXGBE, "cxgbe", "Chelsio T4/T5 Ethernet driver and services"); @@ -2044,11 +2053,18 @@ cxgbe_transmit(struct ifnet *ifp, struct mbuf *m) struct port_info *pi = vi->pi; struct adapter *sc = pi->adapter; struct sge_txq *txq; +#ifdef RATELIMIT + struct cxgbe_snd_tag *cst; +#endif void *items[1]; int rc; M_ASSERTPKTHDR(m); MPASS(m->m_nextpkt == NULL); /* not quite ready for this yet */ +#ifdef RATELIMIT + if (m->m_pkthdr.csum_flags & CSUM_SND_TAG) + MPASS(m->m_pkthdr.snd_tag->ifp == ifp); +#endif if (__predict_false(pi->link_cfg.link_ok == false)) { m_freem(m); @@ -2063,8 +2079,9 @@ cxgbe_transmit(struct ifnet *ifp, struct mbuf *m) } #ifdef RATELIMIT if (m->m_pkthdr.csum_flags & CSUM_SND_TAG) { - MPASS(m->m_pkthdr.snd_tag->ifp == ifp); - return (ethofld_transmit(ifp, m)); + cst = mst_to_cst(m->m_pkthdr.snd_tag); + if (cst->type == IF_SND_TAG_TYPE_RATE_LIMIT) + return (ethofld_transmit(ifp, m)); } #endif @@ -2221,6 +2238,87 @@ cxgbe_get_counter(struct ifnet *ifp, ift_counter c) return (if_get_counter_default(ifp, c)); } } + +#ifdef RATELIMIT +void +cxgbe_snd_tag_init(struct cxgbe_snd_tag *cst, struct ifnet *ifp, int type) +{ + + m_snd_tag_init(&cst->com, ifp); + cst->type = type; +} + +static int +cxgbe_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, + struct m_snd_tag **pt) +{ + int error; + + switch (params->hdr.type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_RATE_LIMIT: + error = cxgbe_rate_tag_alloc(ifp, params, pt); + break; +#endif + default: + error = EOPNOTSUPP; + } + if (error == 0) + MPASS(mst_to_cst(*pt)->type == params->hdr.type); + return (error); +} + +static int +cxgbe_snd_tag_modify(struct m_snd_tag *mst, + union if_snd_tag_modify_params *params) +{ + struct cxgbe_snd_tag *cst; + + cst = mst_to_cst(mst); + switch (cst->type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_RATE_LIMIT: + return (cxgbe_rate_tag_modify(mst, params)); +#endif + default: + return (EOPNOTSUPP); + } +} + +static int +cxgbe_snd_tag_query(struct m_snd_tag *mst, + union if_snd_tag_query_params *params) +{ + struct cxgbe_snd_tag *cst; + + cst = mst_to_cst(mst); + switch (cst->type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_RATE_LIMIT: + return (cxgbe_rate_tag_query(mst, params)); +#endif + default: + return (EOPNOTSUPP); + } +} + +static void +cxgbe_snd_tag_free(struct m_snd_tag *mst) +{ + struct cxgbe_snd_tag *cst; + + cst = mst_to_cst(mst); + switch (cst->type) { +#ifdef RATELIMIT + case IF_SND_TAG_TYPE_RATE_LIMIT: + cxgbe_rate_tag_free(mst); + return; +#endif + default: + panic("shouldn't get here"); + } +} +#endif /* * The kernel picks a media from the list we had provided but we still validate Modified: head/sys/dev/cxgbe/t4_sched.c ============================================================================== --- head/sys/dev/cxgbe/t4_sched.c Tue Oct 22 20:01:47 2019 (r353899) +++ head/sys/dev/cxgbe/t4_sched.c Tue Oct 22 20:41:54 2019 (r353900) @@ -711,11 +711,11 @@ t4_free_etid_table(struct adapter *sc) } /* etid services */ -static int alloc_etid(struct adapter *, struct cxgbe_snd_tag *); +static int alloc_etid(struct adapter *, struct cxgbe_rate_tag *); static void free_etid(struct adapter *, int); static int -alloc_etid(struct adapter *sc, struct cxgbe_snd_tag *cst) +alloc_etid(struct adapter *sc, struct cxgbe_rate_tag *cst) { struct tid_info *t = &sc->tids; int etid = -1; @@ -733,7 +733,7 @@ alloc_etid(struct adapter *sc, struct cxgbe_snd_tag *c return (etid); } -struct cxgbe_snd_tag * +struct cxgbe_rate_tag * lookup_etid(struct adapter *sc, int etid) { struct tid_info *t = &sc->tids; @@ -755,17 +755,16 @@ free_etid(struct adapter *sc, int etid) } int -cxgbe_snd_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, +cxgbe_rate_tag_alloc(struct ifnet *ifp, union if_snd_tag_alloc_params *params, struct m_snd_tag **pt) { int rc, schedcl; struct vi_info *vi = ifp->if_softc; struct port_info *pi = vi->pi; struct adapter *sc = pi->adapter; - struct cxgbe_snd_tag *cst; + struct cxgbe_rate_tag *cst; - if (params->hdr.type != IF_SND_TAG_TYPE_RATE_LIMIT) - return (ENOTSUP); + MPASS(params->hdr.type == IF_SND_TAG_TYPE_RATE_LIMIT); rc = t4_reserve_cl_rl_kbps(sc, pi->port_id, (params->rate_limit.max_rate * 8ULL / 1000), &schedcl); @@ -789,7 +788,7 @@ failed: mtx_init(&cst->lock, "cst_lock", NULL, MTX_DEF); mbufq_init(&cst->pending_tx, INT_MAX); mbufq_init(&cst->pending_fwack, INT_MAX); - m_snd_tag_init(&cst->com, ifp); + cxgbe_snd_tag_init(&cst->com, ifp, IF_SND_TAG_TYPE_RATE_LIMIT); cst->flags |= EO_FLOWC_PENDING | EO_SND_TAG_REF; cst->adapter = sc; cst->port_id = pi->port_id; @@ -806,7 +805,7 @@ failed: * Queues will be selected later when the connection flowid is available. */ - *pt = &cst->com; + *pt = &cst->com.com; return (0); } @@ -814,11 +813,11 @@ failed: * Change in parameters, no change in ifp. */ int -cxgbe_snd_tag_modify(struct m_snd_tag *mst, +cxgbe_rate_tag_modify(struct m_snd_tag *mst, union if_snd_tag_modify_params *params) { int rc, schedcl; - struct cxgbe_snd_tag *cst = mst_to_cst(mst); + struct cxgbe_rate_tag *cst = mst_to_crt(mst); struct adapter *sc = cst->adapter; /* XXX: is schedcl -1 ok here? */ @@ -840,10 +839,10 @@ cxgbe_snd_tag_modify(struct m_snd_tag *mst, } int -cxgbe_snd_tag_query(struct m_snd_tag *mst, +cxgbe_rate_tag_query(struct m_snd_tag *mst, union if_snd_tag_query_params *params) { - struct cxgbe_snd_tag *cst = mst_to_cst(mst); + struct cxgbe_rate_tag *cst = mst_to_crt(mst); params->rate_limit.max_rate = cst->max_rate; @@ -858,7 +857,7 @@ cxgbe_snd_tag_query(struct m_snd_tag *mst, * Unlocks cst and frees it. */ void -cxgbe_snd_tag_free_locked(struct cxgbe_snd_tag *cst) +cxgbe_rate_tag_free_locked(struct cxgbe_rate_tag *cst) { struct adapter *sc = cst->adapter; @@ -879,9 +878,9 @@ cxgbe_snd_tag_free_locked(struct cxgbe_snd_tag *cst) } void -cxgbe_snd_tag_free(struct m_snd_tag *mst) +cxgbe_rate_tag_free(struct m_snd_tag *mst) { - struct cxgbe_snd_tag *cst = mst_to_cst(mst); + struct cxgbe_rate_tag *cst = mst_to_crt(mst); mtx_lock(&cst->lock); @@ -896,7 +895,7 @@ cxgbe_snd_tag_free(struct m_snd_tag *mst) * credits for the etid otherwise. */ if (cst->tx_credits == cst->tx_total) { - cxgbe_snd_tag_free_locked(cst); + cxgbe_rate_tag_free_locked(cst); return; /* cst is gone. */ } send_etid_flush_wr(cst); Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Tue Oct 22 20:01:47 2019 (r353899) +++ head/sys/dev/cxgbe/t4_sge.c Tue Oct 22 20:41:54 2019 (r353900) @@ -2307,10 +2307,10 @@ set_mbuf_eo_tsclk_tsoff(struct mbuf *m, uint8_t tsclk_ } static inline int -needs_eo(struct mbuf *m) +needs_eo(struct cxgbe_snd_tag *cst) { - return (m->m_pkthdr.csum_flags & CSUM_SND_TAG); + return (cst != NULL && cst->type == IF_SND_TAG_TYPE_RATE_LIMIT); } #endif @@ -2542,6 +2542,9 @@ parse_pkt(struct adapter *sc, struct mbuf **mp) #if defined(INET) || defined(INET6) struct tcphdr *tcp; #endif +#ifdef RATELIMIT + struct cxgbe_snd_tag *cst; +#endif uint16_t eh_type; uint8_t cflags; @@ -2562,6 +2565,12 @@ restart: M_ASSERTPKTHDR(m0); MPASS(m0->m_pkthdr.len > 0); nsegs = count_mbuf_nsegs(m0, 0, &cflags); +#ifdef RATELIMIT + if (m0->m_pkthdr.csum_flags & CSUM_SND_TAG) + cst = mst_to_cst(m0->m_pkthdr.snd_tag); + else + cst = NULL; +#endif if (nsegs > (needs_tso(m0) ? TX_SGL_SEGS_TSO : TX_SGL_SEGS)) { if (defragged++ > 0 || (m = m_defrag(m0, M_NOWAIT)) == NULL) { rc = EFBIG; @@ -2595,16 +2604,17 @@ restart: * checksumming is enabled. needs_l4_csum happens to check for all the * right things. */ - if (__predict_false(needs_eo(m0) && !needs_l4_csum(m0))) { + if (__predict_false(needs_eo(cst) && !needs_l4_csum(m0))) { m_snd_tag_rele(m0->m_pkthdr.snd_tag); m0->m_pkthdr.snd_tag = NULL; m0->m_pkthdr.csum_flags &= ~CSUM_SND_TAG; + cst = NULL; } #endif if (!needs_tso(m0) && #ifdef RATELIMIT - !needs_eo(m0) && + !needs_eo(cst) && #endif !(sc->flags & IS_VF && (needs_l3_csum(m0) || needs_l4_csum(m0)))) return (0); @@ -2666,7 +2676,7 @@ restart: #endif } #ifdef RATELIMIT - if (needs_eo(m0)) { + if (needs_eo(cst)) { u_int immhdrs; /* EO WRs have the headers in the WR and not the GL. */ @@ -5723,7 +5733,7 @@ done: #define ETID_FLOWC_LEN16 (howmany(ETID_FLOWC_LEN, 16)) static int -send_etid_flowc_wr(struct cxgbe_snd_tag *cst, struct port_info *pi, +send_etid_flowc_wr(struct cxgbe_rate_tag *cst, struct port_info *pi, struct vi_info *vi) { struct wrq_cookie cookie; @@ -5769,7 +5779,7 @@ send_etid_flowc_wr(struct cxgbe_snd_tag *cst, struct p #define ETID_FLUSH_LEN16 (howmany(sizeof (struct fw_flowc_wr), 16)) void -send_etid_flush_wr(struct cxgbe_snd_tag *cst) +send_etid_flush_wr(struct cxgbe_rate_tag *cst) { struct fw_flowc_wr *flowc; struct wrq_cookie cookie; @@ -5795,7 +5805,7 @@ send_etid_flush_wr(struct cxgbe_snd_tag *cst) } static void -write_ethofld_wr(struct cxgbe_snd_tag *cst, struct fw_eth_tx_eo_wr *wr, +write_ethofld_wr(struct cxgbe_rate_tag *cst, struct fw_eth_tx_eo_wr *wr, struct mbuf *m0, int compl) { struct cpl_tx_pkt_core *cpl; @@ -5944,7 +5954,7 @@ write_ethofld_wr(struct cxgbe_snd_tag *cst, struct fw_ } static void -ethofld_tx(struct cxgbe_snd_tag *cst) +ethofld_tx(struct cxgbe_rate_tag *cst) { struct mbuf *m; struct wrq_cookie cookie; @@ -5977,7 +5987,7 @@ ethofld_tx(struct cxgbe_snd_tag *cst) cst->tx_credits -= next_credits; cst->tx_nocompl += next_credits; compl = cst->ncompl == 0 || cst->tx_nocompl >= cst->tx_total / 2; - ETHER_BPF_MTAP(cst->com.ifp, m); + ETHER_BPF_MTAP(cst->com.com.ifp, m); write_ethofld_wr(cst, wr, m, compl); commit_wrq_wr(cst->eo_txq, wr, &cookie); if (compl) { @@ -5989,7 +5999,7 @@ ethofld_tx(struct cxgbe_snd_tag *cst) /* * Drop the mbuf's reference on the tag now rather * than waiting until m_freem(). This ensures that - * cxgbe_snd_tag_free gets called when the inp drops + * cxgbe_rate_tag_free gets called when the inp drops * its reference on the tag and there are no more * mbufs in the pending_tx queue and can flush any * pending requests. Otherwise if the last mbuf @@ -5998,7 +6008,7 @@ ethofld_tx(struct cxgbe_snd_tag *cst) */ m->m_pkthdr.snd_tag = NULL; m->m_pkthdr.csum_flags &= ~CSUM_SND_TAG; - m_snd_tag_rele(&cst->com); + m_snd_tag_rele(&cst->com.com); mbufq_enqueue(&cst->pending_fwack, m); } @@ -6007,13 +6017,13 @@ ethofld_tx(struct cxgbe_snd_tag *cst) int ethofld_transmit(struct ifnet *ifp, struct mbuf *m0) { - struct cxgbe_snd_tag *cst; + struct cxgbe_rate_tag *cst; int rc; MPASS(m0->m_nextpkt == NULL); MPASS(m0->m_pkthdr.csum_flags & CSUM_SND_TAG); MPASS(m0->m_pkthdr.snd_tag != NULL); - cst = mst_to_cst(m0->m_pkthdr.snd_tag); + cst = mst_to_crt(m0->m_pkthdr.snd_tag); mtx_lock(&cst->lock); MPASS(cst->flags & EO_SND_TAG_REF); @@ -6052,10 +6062,10 @@ ethofld_transmit(struct ifnet *ifp, struct mbuf *m0) * ethofld_tx() in case we are sending the final mbuf after * the inp was freed. */ - m_snd_tag_ref(&cst->com); + m_snd_tag_ref(&cst->com.com); ethofld_tx(cst); mtx_unlock(&cst->lock); - m_snd_tag_rele(&cst->com); + m_snd_tag_rele(&cst->com.com); return (0); done: @@ -6072,7 +6082,7 @@ ethofld_fw4_ack(struct sge_iq *iq, const struct rss_he const struct cpl_fw4_ack *cpl = (const void *)(rss + 1); struct mbuf *m; u_int etid = G_CPL_FW4_ACK_FLOWID(be32toh(OPCODE_TID(cpl))); - struct cxgbe_snd_tag *cst; + struct cxgbe_rate_tag *cst; uint8_t credits = cpl->credits; cst = lookup_etid(sc, etid); @@ -6104,7 +6114,7 @@ ethofld_fw4_ack(struct sge_iq *iq, const struct rss_he cst->flags &= ~EO_FLUSH_RPL_PENDING; cst->tx_credits += cpl->credits; - cxgbe_snd_tag_free_locked(cst); + cxgbe_rate_tag_free_locked(cst); return (0); /* cst is gone. */ } KASSERT(m != NULL, @@ -6126,12 +6136,12 @@ ethofld_fw4_ack(struct sge_iq *iq, const struct rss_he * As with ethofld_transmit(), hold an extra reference * so that the tag is stable across ethold_tx(). */ - m_snd_tag_ref(&cst->com); + m_snd_tag_ref(&cst->com.com); m = mbufq_first(&cst->pending_tx); if (m != NULL && cst->tx_credits >= mbuf_eo_len16(m)) ethofld_tx(cst); mtx_unlock(&cst->lock); - m_snd_tag_rele(&cst->com); + m_snd_tag_rele(&cst->com.com); } else { /* * There shouldn't be any pending packets if the tag From owner-svn-src-all@freebsd.org Tue Oct 22 21:24:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 90291165B22; Tue, 22 Oct 2019 21:24:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yRNd3G7sz4Hvy; Tue, 22 Oct 2019 21:24:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 535C01A5B9; Tue, 22 Oct 2019 21:24:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MLOn2f043205; Tue, 22 Oct 2019 21:24:49 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MLOnMs043204; Tue, 22 Oct 2019 21:24:49 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910222124.x9MLOnMs043204@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Tue, 22 Oct 2019 21:24:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353901 - stable/12/usr.bin/rpcgen X-SVN-Group: stable-12 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/12/usr.bin/rpcgen X-SVN-Commit-Revision: 353901 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 21:24:49 -0000 Author: brooks Date: Tue Oct 22 21:24:48 2019 New Revision: 353901 URL: https://svnweb.freebsd.org/changeset/base/353901 Log: MFC r353569: rpcgen: make compiler arglist allocation dynamic Limit argmax to an absurdly large value prevent overflow (no overflow possible on FreeBSD due to ARG_MAX). In CheriBSD we exceed the 19 non-NULL arguments in the static array. Add a simple size doubling allocator and increase the default to 32. GC remnants of support for fixed arguments. Reviewed by: archardson (prior version), James Clarke (prior version) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21971 Modified: stable/12/usr.bin/rpcgen/rpc_main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/usr.bin/rpcgen/rpc_main.c ============================================================================== --- stable/12/usr.bin/rpcgen/rpc_main.c Tue Oct 22 20:41:54 2019 (r353900) +++ stable/12/usr.bin/rpcgen/rpc_main.c Tue Oct 22 21:24:48 2019 (r353901) @@ -93,19 +93,13 @@ static int allnc = nitems(allnv); */ static void addarg(const char *); /* add another argument to the list */ static void insarg(int, const char *); /* insert arg at specified location */ -static void clear_args(void); /* clear argument list */ static void checkfiles(const char *, const char *); /* check if out file already exists */ +static char **arglist; +static int argcount = 0; +static int argmax = 0; - -#define ARGLISTLEN 20 -#define FIXEDARGS 0 - -static char *arglist[ARGLISTLEN]; -static int argcount = FIXEDARGS; - - int nonfatalerrors; /* errors */ int inetdflag = 0; /* Support for inetd is disabled by default, use -I */ int pmflag = 0; /* Support for port monitors is disabled by default */ @@ -141,7 +135,6 @@ main(int argc, const char *argv[]) struct commandline cmd; (void) memset((char *)&cmd, 0, sizeof (struct commandline)); - clear_args(); if (!parseargs(argc, argv, &cmd)) usage(); /* @@ -273,16 +266,6 @@ add_warning(void) f_print(fout, " */\n\n"); } -/* clear list of arguments */ -static void -clear_args(void) -{ - int i; - for (i = FIXEDARGS; i < ARGLISTLEN; i++) - arglist[i] = NULL; - argcount = FIXEDARGS; -} - /* prepend C-preprocessor and flags before arguments */ static void prepend_cpp(void) @@ -925,21 +908,40 @@ do_registers(int argc, const char *argv[]) } /* - * Add another argument to the arg list + * Extend the argument list */ static void -addarg(const char *cp) +moreargs(void) { - if (argcount >= ARGLISTLEN) { - warnx("too many defines"); + char **newarglist; + + argmax = argmax == 0 ? 32 : argmax << 1; + if (argmax > INT_MAX / 4) { + warnx("refusing to allocate too many arguments"); crash(); - /*NOTREACHED*/ } + newarglist = realloc(arglist, argmax * sizeof(*arglist)); + if (newarglist == NULL) { + warnx("unable to allocate arglist"); + crash(); + } + free(arglist); + arglist = newarglist; +} + +/* + * Add another argument to the arg list + */ +static void +addarg(const char *cp) +{ + if (argcount >= argmax) + moreargs(); + if (cp != NULL) arglist[argcount++] = xstrdup(cp); else arglist[argcount++] = NULL; - } /* @@ -950,11 +952,8 @@ insarg(int place, const char *cp) { int i; - if (argcount >= ARGLISTLEN) { - warnx("too many defines"); - crash(); - /*NOTREACHED*/ - } + if (argcount >= argmax) + moreargs(); /* Move up existing arguments */ for (i = argcount - 1; i >= place; i--) From owner-svn-src-all@freebsd.org Tue Oct 22 21:46:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 906C31661E0; Tue, 22 Oct 2019 21:46:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yRs82dHWz4JrV; Tue, 22 Oct 2019 21:46:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 37CD41A936; Tue, 22 Oct 2019 21:46:04 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MLk4Ff054801; Tue, 22 Oct 2019 21:46:04 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MLk4BU054800; Tue, 22 Oct 2019 21:46:04 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910222146.x9MLk4BU054800@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Tue, 22 Oct 2019 21:46:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353902 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 353902 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 21:46:04 -0000 Author: kevans Date: Tue Oct 22 21:46:03 2019 New Revision: 353902 URL: https://svnweb.freebsd.org/changeset/base/353902 Log: arm: correct kernelstack allocation size This appears to be a copy-pasto from previous lines that propagated to v6 over the years. Indeed, nothing references kernelstack beyond USPACE_SVC_STACK_TOP and it would be odd if anything did. Noticed by: markj Modified: head/sys/arm/arm/machdep.c Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Tue Oct 22 21:24:48 2019 (r353901) +++ head/sys/arm/arm/machdep.c Tue Oct 22 21:46:03 2019 (r353902) @@ -943,7 +943,7 @@ initarm(struct arm_boot_params *abp) valloc_pages(irqstack, IRQ_STACK_SIZE * MAXCPU); valloc_pages(abtstack, ABT_STACK_SIZE * MAXCPU); valloc_pages(undstack, UND_STACK_SIZE * MAXCPU); - valloc_pages(kernelstack, kstack_pages * MAXCPU); + valloc_pages(kernelstack, kstack_pages); valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); /* @@ -1208,7 +1208,7 @@ initarm(struct arm_boot_params *abp) irqstack = pmap_preboot_get_vpages(IRQ_STACK_SIZE * MAXCPU); abtstack = pmap_preboot_get_vpages(ABT_STACK_SIZE * MAXCPU); undstack = pmap_preboot_get_vpages(UND_STACK_SIZE * MAXCPU ); - kernelstack = pmap_preboot_get_vpages(kstack_pages * MAXCPU); + kernelstack = pmap_preboot_get_vpages(kstack_pages); /* Allocate message buffer. */ msgbufp = (void *)pmap_preboot_get_vpages( From owner-svn-src-all@freebsd.org Tue Oct 22 22:23:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB971166F9D; Tue, 22 Oct 2019 22:23:59 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yShv464Zz4LM6; Tue, 22 Oct 2019 22:23:59 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7020F1B056; Tue, 22 Oct 2019 22:23:59 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MMNxup077930; Tue, 22 Oct 2019 22:23:59 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MMNx6J077929; Tue, 22 Oct 2019 22:23:59 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201910222223.x9MMNx6J077929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Tue, 22 Oct 2019 22:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353903 - head/sbin/fsck_ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sbin/fsck_ffs X-SVN-Commit-Revision: 353903 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 22:23:59 -0000 Author: mckusick Date: Tue Oct 22 22:23:59 2019 New Revision: 353903 URL: https://svnweb.freebsd.org/changeset/base/353903 Log: Replace an uninitialized variable with the correct element from the superblock when doing recovery with journalled soft updates. Reported by: Chuck Silvers MFC after: 3 days Sponsored by: Netflix Modified: head/sbin/fsck_ffs/suj.c Modified: head/sbin/fsck_ffs/suj.c ============================================================================== --- head/sbin/fsck_ffs/suj.c Tue Oct 22 21:46:03 2019 (r353902) +++ head/sbin/fsck_ffs/suj.c Tue Oct 22 22:23:59 2019 (r353903) @@ -1555,7 +1555,7 @@ ino_trunc(ino_t ino, off_t size) /* If we freed everything in this indirect free the indir. */ if (lastlbn > lbn) continue; - blk_free(DIP(ip, di_ib[i]), 0, frags); + blk_free(DIP(ip, di_ib[i]), 0, fs->fs_frag); DIP_SET(ip, di_ib[i], 0); } ino_dirty(ino); From owner-svn-src-all@freebsd.org Tue Oct 22 22:52:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E76831675DF; Tue, 22 Oct 2019 22:52:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yTLF5r5hz4MJ0; Tue, 22 Oct 2019 22:52:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AC36F1B59C; Tue, 22 Oct 2019 22:52:53 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MMqrmM095524; Tue, 22 Oct 2019 22:52:53 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MMqrq6095522; Tue, 22 Oct 2019 22:52:53 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910222252.x9MMqrq6095522@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 22 Oct 2019 22:52:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353904 - head/sys/fs/pseudofs X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/fs/pseudofs X-SVN-Commit-Revision: 353904 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 22:52:54 -0000 Author: mjg Date: Tue Oct 22 22:52:53 2019 New Revision: 353904 URL: https://svnweb.freebsd.org/changeset/base/353904 Log: pseudofs: hashed vncache Vast majority of uses the cache are just checking if there is an entry present on process exit (and evicting it if so). Both checking and eviction process are very expensive and put the lock protecting it high up on the profile during poudriere -j 104. Convert the linked list into a hash. This allows to almost always avoid taking the lock in the first place (and consequently almost removes it from the profile). Note only one lock is preserved as a split did not meaningfully impact contention. Should the cache be used for something it will still run into contention issues. The code needs a rewrite, but should someone want to tidy it up further the following can be done: 1) per-chain locks (or at least an array) 2) hashing by something else than just pid Sponsored by: The FreeBSD Foundation Modified: head/sys/fs/pseudofs/pseudofs_internal.h head/sys/fs/pseudofs/pseudofs_vncache.c Modified: head/sys/fs/pseudofs/pseudofs_internal.h ============================================================================== --- head/sys/fs/pseudofs/pseudofs_internal.h Tue Oct 22 22:23:59 2019 (r353903) +++ head/sys/fs/pseudofs/pseudofs_internal.h Tue Oct 22 22:52:53 2019 (r353904) @@ -45,8 +45,7 @@ struct pfs_vdata { struct pfs_node *pvd_pn; pid_t pvd_pid; struct vnode *pvd_vnode; - struct pfs_vdata*pvd_prev, *pvd_next; - int pvd_dead:1; + SLIST_ENTRY(pfs_vdata) pvd_hash; }; /* Modified: head/sys/fs/pseudofs/pseudofs_vncache.c ============================================================================== --- head/sys/fs/pseudofs/pseudofs_vncache.c Tue Oct 22 22:23:59 2019 (r353903) +++ head/sys/fs/pseudofs/pseudofs_vncache.c Tue Oct 22 22:52:53 2019 (r353904) @@ -50,10 +50,9 @@ __FBSDID("$FreeBSD$"); static MALLOC_DEFINE(M_PFSVNCACHE, "pfs_vncache", "pseudofs vnode cache"); static struct mtx pfs_vncache_mutex; -static struct pfs_vdata *pfs_vncache; static eventhandler_tag pfs_exit_tag; static void pfs_exit(void *arg, struct proc *p); -static void pfs_purge_locked(struct pfs_node *pn, bool force); +static void pfs_purge_all(void); static SYSCTL_NODE(_vfs_pfs, OID_AUTO, vncache, CTLFLAG_RW, 0, "pseudofs vnode cache"); @@ -80,6 +79,10 @@ SYSCTL_INT(_vfs_pfs_vncache, OID_AUTO, misses, CTLFLAG extern struct vop_vector pfs_vnodeops; /* XXX -> .h file */ +static SLIST_HEAD(pfs_vncache_head, pfs_vdata) *pfs_vncache_hashtbl; +static u_long pfs_vncache_hash; +#define PFS_VNCACHE_HASH(pid) (&pfs_vncache_hashtbl[(pid) & pfs_vncache_hash]) + /* * Initialize vnode cache */ @@ -88,6 +91,7 @@ pfs_vncache_load(void) { mtx_init(&pfs_vncache_mutex, "pfs_vncache", NULL, MTX_DEF); + pfs_vncache_hashtbl = hashinit(maxproc / 4, M_PFSVNCACHE, &pfs_vncache_hash); pfs_exit_tag = EVENTHANDLER_REGISTER(process_exit, pfs_exit, NULL, EVENTHANDLER_PRI_ANY); } @@ -100,9 +104,7 @@ pfs_vncache_unload(void) { EVENTHANDLER_DEREGISTER(process_exit, pfs_exit_tag); - mtx_lock(&pfs_vncache_mutex); - pfs_purge_locked(NULL, true); - mtx_unlock(&pfs_vncache_mutex); + pfs_purge_all(); KASSERT(pfs_vncache_entries == 0, ("%d vncache entries remaining", pfs_vncache_entries)); mtx_destroy(&pfs_vncache_mutex); @@ -115,17 +117,20 @@ int pfs_vncache_alloc(struct mount *mp, struct vnode **vpp, struct pfs_node *pn, pid_t pid) { + struct pfs_vncache_head *hash; struct pfs_vdata *pvd, *pvd2; struct vnode *vp; int error; /* * See if the vnode is in the cache. - * XXX linear search is not very efficient. */ + hash = PFS_VNCACHE_HASH(pid); + if (SLIST_EMPTY(hash)) + goto alloc; retry: mtx_lock(&pfs_vncache_mutex); - for (pvd = pfs_vncache; pvd; pvd = pvd->pvd_next) { + SLIST_FOREACH(pvd, hash, pvd_hash) { if (pvd->pvd_pn == pn && pvd->pvd_pid == pid && pvd->pvd_vnode->v_mount == mp) { vp = pvd->pvd_vnode; @@ -150,10 +155,9 @@ retry: } } mtx_unlock(&pfs_vncache_mutex); - +alloc: /* nope, get a new one */ pvd = malloc(sizeof *pvd, M_PFSVNCACHE, M_WAITOK); - pvd->pvd_next = pvd->pvd_prev = NULL; error = getnewvnode("pseudofs", mp, &pfs_vnodeops, vpp); if (error) { free(pvd, M_PFSVNCACHE); @@ -208,7 +212,7 @@ retry2: * going to insert into the cache. Recheck after * pfs_vncache_mutex is reacquired. */ - for (pvd2 = pfs_vncache; pvd2; pvd2 = pvd2->pvd_next) { + SLIST_FOREACH(pvd2, hash, pvd_hash) { if (pvd2->pvd_pn == pn && pvd2->pvd_pid == pid && pvd2->pvd_vnode->v_mount == mp) { vp = pvd2->pvd_vnode; @@ -228,11 +232,7 @@ retry2: ++pfs_vncache_misses; if (++pfs_vncache_entries > pfs_vncache_maxentries) pfs_vncache_maxentries = pfs_vncache_entries; - pvd->pvd_prev = NULL; - pvd->pvd_next = pfs_vncache; - if (pvd->pvd_next) - pvd->pvd_next->pvd_prev = pvd; - pfs_vncache = pvd; + SLIST_INSERT_HEAD(hash, pvd, pvd_hash); mtx_unlock(&pfs_vncache_mutex); return (0); } @@ -243,19 +243,17 @@ retry2: int pfs_vncache_free(struct vnode *vp) { - struct pfs_vdata *pvd; + struct pfs_vdata *pvd, *pvd2; mtx_lock(&pfs_vncache_mutex); pvd = (struct pfs_vdata *)vp->v_data; KASSERT(pvd != NULL, ("pfs_vncache_free(): no vnode data\n")); - if (pvd->pvd_next) - pvd->pvd_next->pvd_prev = pvd->pvd_prev; - if (pvd->pvd_prev) { - pvd->pvd_prev->pvd_next = pvd->pvd_next; + SLIST_FOREACH(pvd2, PFS_VNCACHE_HASH(pvd->pvd_pid), pvd_hash) { + if (pvd2 != pvd) + continue; + SLIST_REMOVE(PFS_VNCACHE_HASH(pvd->pvd_pid), pvd, pfs_vdata, pvd_hash); --pfs_vncache_entries; - } else if (pfs_vncache == pvd) { - pfs_vncache = pvd->pvd_next; - --pfs_vncache_entries; + break; } mtx_unlock(&pfs_vncache_mutex); @@ -267,6 +265,15 @@ pfs_vncache_free(struct vnode *vp) /* * Purge the cache of dead entries * + * The code is not very efficient and this perhaps can be addressed without + * a complete rewrite. Previous iteration was walking a linked list from + * scratch every time. This code only walks the relevant hash chain (if pid + * is provided), but still resorts to scanning the entire cache at least twice + * if a specific component is to be removed which is slower. This can be + * augmented with resizing the hash. + * + * Explanation of the previous state: + * * This is extremely inefficient due to the fact that vgone() not only * indirectly modifies the vnode cache, but may also sleep. We can * neither hold pfs_vncache_mutex across a vgone() call, nor make any @@ -277,39 +284,51 @@ pfs_vncache_free(struct vnode *vp) * The only way to improve this situation is to change the data structure * used to implement the cache. */ + static void -pfs_purge_locked(struct pfs_node *pn, bool force) +pfs_purge_one(struct vnode *vnp) { + + VOP_LOCK(vnp, LK_EXCLUSIVE); + vgone(vnp); + VOP_UNLOCK(vnp, 0); + vdrop(vnp); +} + +void +pfs_purge(struct pfs_node *pn) +{ struct pfs_vdata *pvd; struct vnode *vnp; + u_long i, removed; - mtx_assert(&pfs_vncache_mutex, MA_OWNED); - pvd = pfs_vncache; - while (pvd != NULL) { - if (force || pvd->pvd_dead || - (pn != NULL && pvd->pvd_pn == pn)) { + mtx_lock(&pfs_vncache_mutex); +restart: + removed = 0; + for (i = 0; i < pfs_vncache_hash; i++) { +restart_chain: + SLIST_FOREACH(pvd, &pfs_vncache_hashtbl[i], pvd_hash) { + if (pn != NULL && pvd->pvd_pn != pn) + continue; vnp = pvd->pvd_vnode; vhold(vnp); mtx_unlock(&pfs_vncache_mutex); - VOP_LOCK(vnp, LK_EXCLUSIVE); - vgone(vnp); - VOP_UNLOCK(vnp, 0); + pfs_purge_one(vnp); + removed++; mtx_lock(&pfs_vncache_mutex); - vdrop(vnp); - pvd = pfs_vncache; - } else { - pvd = pvd->pvd_next; + goto restart_chain; } } + if (removed > 0) + goto restart; + mtx_unlock(&pfs_vncache_mutex); } -void -pfs_purge(struct pfs_node *pn) +static void +pfs_purge_all(void) { - mtx_lock(&pfs_vncache_mutex); - pfs_purge_locked(pn, false); - mtx_unlock(&pfs_vncache_mutex); + pfs_purge(NULL); } /* @@ -318,16 +337,25 @@ pfs_purge(struct pfs_node *pn) static void pfs_exit(void *arg, struct proc *p) { + struct pfs_vncache_head *hash; struct pfs_vdata *pvd; - int dead; + struct vnode *vnp; + int pid; - if (pfs_vncache == NULL) + pid = p->p_pid; + hash = PFS_VNCACHE_HASH(pid); + if (SLIST_EMPTY(hash)) return; +restart: mtx_lock(&pfs_vncache_mutex); - for (pvd = pfs_vncache, dead = 0; pvd != NULL; pvd = pvd->pvd_next) - if (pvd->pvd_pid == p->p_pid) - dead = pvd->pvd_dead = 1; - if (dead) - pfs_purge_locked(NULL, false); + SLIST_FOREACH(pvd, hash, pvd_hash) { + if (pvd->pvd_pid != pid) + continue; + vnp = pvd->pvd_vnode; + vhold(vnp); + mtx_unlock(&pfs_vncache_mutex); + pfs_purge_one(vnp); + goto restart; + } mtx_unlock(&pfs_vncache_mutex); } From owner-svn-src-all@freebsd.org Tue Oct 22 22:54:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA7D5167670; Tue, 22 Oct 2019 22:54:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yTNL43rNz4MR1; Tue, 22 Oct 2019 22:54:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B98A1B59E; Tue, 22 Oct 2019 22:54:42 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MMsgCA095645; Tue, 22 Oct 2019 22:54:42 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MMsgo8095644; Tue, 22 Oct 2019 22:54:42 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910222254.x9MMsgo8095644@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 22 Oct 2019 22:54:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353905 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 353905 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 22:54:42 -0000 Author: mjg Date: Tue Oct 22 22:54:41 2019 New Revision: 353905 URL: https://svnweb.freebsd.org/changeset/base/353905 Log: amd64 pmap: fixup invlgen lookup for fictitious mappings Similarly to r353438, use dummy entry. Reported and tested by: Neel Chauhan Sponsored by: The FreeBSD Foundation Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Oct 22 22:52:53 2019 (r353904) +++ head/sys/amd64/amd64/pmap.c Tue Oct 22 22:54:41 2019 (r353905) @@ -951,8 +951,16 @@ SYSCTL_LONG(_vm_pmap, OID_AUTO, invl_wait_slow, CTLFLA static u_long * pmap_delayed_invl_genp(vm_page_t m) { + vm_paddr_t pa; + u_long *gen; - return (&pa_to_pmdp(VM_PAGE_TO_PHYS(m))->pv_invl_gen); + pa = VM_PAGE_TO_PHYS(m); + if (__predict_false((pa) > pmap_last_pa)) + gen = &pv_dummy_large.pv_invl_gen; + else + gen = &(pa_to_pmdp(pa)->pv_invl_gen); + + return (gen); } #else static u_long * From owner-svn-src-all@freebsd.org Tue Oct 22 22:55:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 37373167730; Tue, 22 Oct 2019 22:55:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yTPb0GqXz4MZH; Tue, 22 Oct 2019 22:55:47 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E1AD01B59F; Tue, 22 Oct 2019 22:55:46 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9MMtk7d095774; Tue, 22 Oct 2019 22:55:46 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9MMtkJr095773; Tue, 22 Oct 2019 22:55:46 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910222255.x9MMtkJr095773@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Tue, 22 Oct 2019 22:55:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353906 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 353906 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 22 Oct 2019 22:55:47 -0000 Author: mjg Date: Tue Oct 22 22:55:46 2019 New Revision: 353906 URL: https://svnweb.freebsd.org/changeset/base/353906 Log: amd64 pmap: conditionalize per-superpage locks on NUMA Instead of superpages use. The current code employs superpage-wide locking regardless and the better locking granularity is welcome with NUMA enabled even when superpage support is not used. Requested by: alc Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21982 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Tue Oct 22 22:54:41 2019 (r353905) +++ head/sys/amd64/amd64/pmap.c Tue Oct 22 22:55:46 2019 (r353906) @@ -322,7 +322,7 @@ pmap_pku_mask_bit(pmap_t pmap) ("address %lx beyond the last segment", (pa))); \ (pa) >> PDRSHIFT; \ }) -#if VM_NRESERVLEVEL > 0 +#ifdef NUMA #define pa_to_pmdp(pa) (&pv_table[pa_index(pa)]) #define pa_to_pvh(pa) (&(pa_to_pmdp(pa)->pv_page)) #define PHYS_TO_PV_LIST_LOCK(pa) ({ \ @@ -422,7 +422,7 @@ static int pmap_initialized; */ static TAILQ_HEAD(pch, pv_chunk) pv_chunks = TAILQ_HEAD_INITIALIZER(pv_chunks); static struct mtx __exclusive_cache_line pv_chunks_mutex; -#if VM_NRESERVLEVEL > 0 +#ifdef NUMA struct pmap_large_md_page { struct rwlock pv_lock; struct md_page pv_page; @@ -947,7 +947,7 @@ SYSCTL_LONG(_vm_pmap, OID_AUTO, invl_wait_slow, CTLFLA "Number of slow invalidation waits for lockless DI"); #endif -#if VM_NRESERVLEVEL > 0 +#ifdef NUMA static u_long * pmap_delayed_invl_genp(vm_page_t m) { @@ -1850,7 +1850,7 @@ pmap_page_init(vm_page_t m) m->md.pat_mode = PAT_WRITE_BACK; } -#if VM_NRESERVLEVEL > 0 +#ifdef NUMA static void pmap_init_pv_table(void) { From owner-svn-src-all@freebsd.org Wed Oct 23 00:05:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A63F168F7B; Wed, 23 Oct 2019 00:05:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yVy21Jdpz4RHC; Wed, 23 Oct 2019 00:05:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0C55B1C224; Wed, 23 Oct 2019 00:05:30 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N05T8T038683; Wed, 23 Oct 2019 00:05:29 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N05TlT038682; Wed, 23 Oct 2019 00:05:29 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201910230005.x9N05TlT038682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Wed, 23 Oct 2019 00:05:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353907 - head X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 353907 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 00:05:30 -0000 Author: jkim Date: Wed Oct 23 00:05:29 2019 New Revision: 353907 URL: https://svnweb.freebsd.org/changeset/base/353907 Log: Belatedly remove stale debug symbols after r339270. Reported by: danfe MFC after: 3 days Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Tue Oct 22 22:55:46 2019 (r353906) +++ head/ObsoleteFiles.inc Wed Oct 23 00:05:29 2019 (r353907) @@ -872,6 +872,16 @@ OLD_FILES+=usr/include/openssl/kssl.h OLD_FILES+=usr/include/openssl/pqueue.h OLD_FILES+=usr/include/openssl/ssl23.h OLD_FILES+=usr/include/openssl/ui_compat.h +OLD_FILES+=usr/lib/debug/usr/lib/engines/lib4758cca.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libaep.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libatalla.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libcapi.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libchil.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libcswift.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libgost.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libnuron.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libsureware.so.debug +OLD_FILES+=usr/lib/debug/usr/lib/engines/libubsec.so.debug OLD_FILES+=usr/share/openssl/man/man1/dss1.1.gz OLD_FILES+=usr/share/openssl/man/man1/md2.1.gz OLD_FILES+=usr/share/openssl/man/man1/md4.1.gz From owner-svn-src-all@freebsd.org Wed Oct 23 00:31:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A5BB216994D; Wed, 23 Oct 2019 00:31:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yWWr3wZFz4SDd; Wed, 23 Oct 2019 00:31:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A1CC1C5FE; Wed, 23 Oct 2019 00:31:20 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N0VKHg052176; Wed, 23 Oct 2019 00:31:20 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N0VKh9052175; Wed, 23 Oct 2019 00:31:20 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910230031.x9N0VKh9052175@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Wed, 23 Oct 2019 00:31:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353908 - head/sys/powerpc/booke X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: head/sys/powerpc/booke X-SVN-Commit-Revision: 353908 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 00:31:20 -0000 Author: jhibbits Date: Wed Oct 23 00:31:19 2019 New Revision: 353908 URL: https://svnweb.freebsd.org/changeset/base/353908 Log: powerpc/booke: Fix Book-E boot post-minidump r353489 added minidump support for powerpc64, but it added a dependency on the dump_avail array. Leaving it uninitialized caused breakage in late boot. Initialize dump_avail, even though the 64-bit booke pmap doesn't yet support minidumps, but will in the future. Modified: head/sys/powerpc/booke/pmap.c Modified: head/sys/powerpc/booke/pmap.c ============================================================================== --- head/sys/powerpc/booke/pmap.c Wed Oct 23 00:05:29 2019 (r353907) +++ head/sys/powerpc/booke/pmap.c Wed Oct 23 00:31:19 2019 (r353908) @@ -1787,6 +1787,8 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o hwphyssz - physsz; physsz = hwphyssz; phys_avail_count++; + dump_avail[j] = phys_avail[j]; + dump_avail[j + 1] = phys_avail[j + 1]; } break; } @@ -1796,6 +1798,8 @@ mmu_booke_bootstrap(mmu_t mmu, vm_offset_t start, vm_o availmem_regions[i].mr_size; phys_avail_count++; physsz += availmem_regions[i].mr_size; + dump_avail[j] = phys_avail[j]; + dump_avail[j + 1] = phys_avail[j + 1]; } physmem = btoc(physsz); From owner-svn-src-all@freebsd.org Wed Oct 23 01:11:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 207CA16A2D2; Wed, 23 Oct 2019 01:11:26 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yXQ603Qqz4TXJ; Wed, 23 Oct 2019 01:11:26 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D97361CD0E; Wed, 23 Oct 2019 01:11:25 +0000 (UTC) (envelope-from grog@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N1BPbP078020; Wed, 23 Oct 2019 01:11:25 GMT (envelope-from grog@FreeBSD.org) Received: (from grog@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N1BPZt078019; Wed, 23 Oct 2019 01:11:25 GMT (envelope-from grog@FreeBSD.org) Message-Id: <201910230111.x9N1BPZt078019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: grog set sender to grog@FreeBSD.org using -f From: Greg Lehey Date: Wed, 23 Oct 2019 01:11:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353909 - head/usr.bin/calendar/calendars X-SVN-Group: head X-SVN-Commit-Author: grog X-SVN-Commit-Paths: head/usr.bin/calendar/calendars X-SVN-Commit-Revision: 353909 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 01:11:26 -0000 Author: grog Date: Wed Oct 23 01:11:25 2019 New Revision: 353909 URL: https://svnweb.freebsd.org/changeset/base/353909 Log: Correct spelling, apply appropriate respect. Modified: head/usr.bin/calendar/calendars/calendar.holiday Modified: head/usr.bin/calendar/calendars/calendar.holiday ============================================================================== --- head/usr.bin/calendar/calendars/calendar.holiday Wed Oct 23 00:31:19 2019 (r353908) +++ head/usr.bin/calendar/calendars/calendar.holiday Wed Oct 23 01:11:25 2019 (r353909) @@ -447,7 +447,7 @@ 10/20 Kenyatta Day in Kenya 10/21 Armed Forces Day in Honduras 10/21 Revolution Days (2 days) in Somalia -10/23 Chulalongkron's Day in Thailand +10/23 King Chulalongkorn Day in Thailand 10/24 Independence Day in Zambia 10/24 United Nations Day 10/25 Taiwan Restoration Day in Taiwan From owner-svn-src-all@freebsd.org Wed Oct 23 01:50:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F22D916AAED; Wed, 23 Oct 2019 01:50:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yYHP5mtnz4VjB; Wed, 23 Oct 2019 01:50:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AB0051D404; Wed, 23 Oct 2019 01:50:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N1of02098354; Wed, 23 Oct 2019 01:50:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N1ofHZ098353; Wed, 23 Oct 2019 01:50:41 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910230150.x9N1ofHZ098353@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 23 Oct 2019 01:50:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353911 - head/lib/libcasper X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libcasper X-SVN-Commit-Revision: 353911 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 01:50:42 -0000 Author: kevans Date: Wed Oct 23 01:50:41 2019 New Revision: 353911 URL: https://svnweb.freebsd.org/changeset/base/353911 Log: libcasper/services: include to hook tests to build Note that the cap_sysctl tests are currently failing and need some attention. Modified: head/lib/libcasper/Makefile Modified: head/lib/libcasper/Makefile ============================================================================== --- head/lib/libcasper/Makefile Wed Oct 23 01:29:09 2019 (r353910) +++ head/lib/libcasper/Makefile Wed Oct 23 01:50:41 2019 (r353911) @@ -1,5 +1,7 @@ # $FreeBSD$ +.include + SUBDIR= libcasper SUBDIR+= services From owner-svn-src-all@freebsd.org Wed Oct 23 02:15:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2695316B65F; Wed, 23 Oct 2019 02:15:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yYqm0FtHz4WpB; Wed, 23 Oct 2019 02:15:16 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E09541D947; Wed, 23 Oct 2019 02:15:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N2FFlL015870; Wed, 23 Oct 2019 02:15:15 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N2FFq8015869; Wed, 23 Oct 2019 02:15:15 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910230215.x9N2FFq8015869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 23 Oct 2019 02:15:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353912 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353912 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 02:15:16 -0000 Author: kevans Date: Wed Oct 23 02:15:15 2019 New Revision: 353912 URL: https://svnweb.freebsd.org/changeset/base/353912 Log: tuntap(4): Fix NOINET build after r353741 Shuffle headers around to more appropriate #ifdef OPTION blocks (INET vs. INET6) -- double checked LINT-{NOINET,NOINET6,NOIP}, all seem good. Reported by: cem Modified: head/sys/net/if_tuntap.c Modified: head/sys/net/if_tuntap.c ============================================================================== --- head/sys/net/if_tuntap.c Wed Oct 23 01:50:41 2019 (r353911) +++ head/sys/net/if_tuntap.c Wed Oct 23 02:15:15 2019 (r353912) @@ -88,14 +88,16 @@ #include #include #include -#ifdef INET #include +#ifdef INET #include +#endif +#ifdef INET6 #include #include +#endif #include #include -#endif #include #include #include From owner-svn-src-all@freebsd.org Wed Oct 23 03:23:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2526C16CB15; Wed, 23 Oct 2019 03:23:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ybLC09bFz4ZXh; Wed, 23 Oct 2019 03:23:15 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCF9D1E60B; Wed, 23 Oct 2019 03:23:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N3NEk7057995; Wed, 23 Oct 2019 03:23:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N3NEH6057994; Wed, 23 Oct 2019 03:23:14 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910230323.x9N3NEH6057994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Wed, 23 Oct 2019 03:23:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353914 - head/lib/libcasper/services/cap_sysctl X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libcasper/services/cap_sysctl X-SVN-Commit-Revision: 353914 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 03:23:15 -0000 Author: kevans Date: Wed Oct 23 03:23:14 2019 New Revision: 353914 URL: https://svnweb.freebsd.org/changeset/base/353914 Log: cap_sysctl: correct typo from r347534-ish operation & ~limit where limit is a bool is clearly not what was intended, given the line prior. Correct it to use the calculated mask for validation. The cap_sysctl tests should now be functional again. Modified: head/lib/libcasper/services/cap_sysctl/cap_sysctl.c Modified: head/lib/libcasper/services/cap_sysctl/cap_sysctl.c ============================================================================== --- head/lib/libcasper/services/cap_sysctl/cap_sysctl.c Wed Oct 23 03:15:27 2019 (r353913) +++ head/lib/libcasper/services/cap_sysctl/cap_sysctl.c Wed Oct 23 03:23:14 2019 (r353914) @@ -316,7 +316,7 @@ sysctl_valid(const nvlist_t *nvl, bool limit) */ mask = limit ? (CAP_SYSCTL_RDWR | CAP_SYSCTL_RECURSIVE) : CAP_SYSCTL_RDWR; - if ((operation & ~limit) != 0 || + if ((operation & ~mask) != 0 || (operation & CAP_SYSCTL_RDWR) == 0) return (EINVAL); /* Only one 'operation' can be present. */ From owner-svn-src-all@freebsd.org Wed Oct 23 03:25:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A45316CBDB; Wed, 23 Oct 2019 03:25:35 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ybNv1XWNz4Zht; Wed, 23 Oct 2019 03:25:35 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 17B1E1E613; Wed, 23 Oct 2019 03:25:35 +0000 (UTC) (envelope-from gordon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N3PZBv058160; Wed, 23 Oct 2019 03:25:35 GMT (envelope-from gordon@FreeBSD.org) Received: (from gordon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N3PXue058150; Wed, 23 Oct 2019 03:25:33 GMT (envelope-from gordon@FreeBSD.org) Message-Id: <201910230325.x9N3PXue058150@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gordon set sender to gordon@FreeBSD.org using -f From: Gordon Tetlow Date: Wed, 23 Oct 2019 03:25:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r353915 - in releng: 11.2 11.2/contrib/tzdata 11.2/sys/conf 11.3 11.3/contrib/tzdata 11.3/sys/conf 12.0 12.0/contrib/tzdata 12.0/sys/conf X-SVN-Group: releng X-SVN-Commit-Author: gordon X-SVN-Commit-Paths: in releng: 11.2 11.2/contrib/tzdata 11.2/sys/conf 11.3 11.3/contrib/tzdata 11.3/sys/conf 12.0 12.0/contrib/tzdata 12.0/sys/conf X-SVN-Commit-Revision: 353915 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 03:25:35 -0000 Author: gordon Date: Wed Oct 23 03:25:32 2019 New Revision: 353915 URL: https://svnweb.freebsd.org/changeset/base/353915 Log: Import tzdata 2019c. Approved by: so Security: FreeBSD-EN-19:18.tzdata Modified: releng/11.2/UPDATING releng/11.2/contrib/tzdata/NEWS releng/11.2/contrib/tzdata/asia releng/11.2/contrib/tzdata/australasia releng/11.2/contrib/tzdata/backzone releng/11.2/contrib/tzdata/europe releng/11.2/contrib/tzdata/leap-seconds.list releng/11.2/contrib/tzdata/leapseconds releng/11.2/contrib/tzdata/leapseconds.awk releng/11.2/contrib/tzdata/northamerica releng/11.2/contrib/tzdata/southamerica releng/11.2/contrib/tzdata/theory.html releng/11.2/contrib/tzdata/version releng/11.2/sys/conf/newvers.sh releng/11.3/UPDATING releng/11.3/contrib/tzdata/NEWS releng/11.3/contrib/tzdata/asia releng/11.3/contrib/tzdata/australasia releng/11.3/contrib/tzdata/backzone releng/11.3/contrib/tzdata/europe releng/11.3/contrib/tzdata/leap-seconds.list releng/11.3/contrib/tzdata/leapseconds releng/11.3/contrib/tzdata/leapseconds.awk releng/11.3/contrib/tzdata/northamerica releng/11.3/contrib/tzdata/southamerica releng/11.3/contrib/tzdata/theory.html releng/11.3/contrib/tzdata/version releng/11.3/sys/conf/newvers.sh releng/12.0/UPDATING releng/12.0/contrib/tzdata/NEWS releng/12.0/contrib/tzdata/asia releng/12.0/contrib/tzdata/australasia releng/12.0/contrib/tzdata/backzone releng/12.0/contrib/tzdata/europe releng/12.0/contrib/tzdata/leap-seconds.list releng/12.0/contrib/tzdata/leapseconds releng/12.0/contrib/tzdata/leapseconds.awk releng/12.0/contrib/tzdata/northamerica releng/12.0/contrib/tzdata/southamerica releng/12.0/contrib/tzdata/theory.html releng/12.0/contrib/tzdata/version releng/12.0/sys/conf/newvers.sh Modified: releng/11.2/UPDATING ============================================================================== --- releng/11.2/UPDATING Wed Oct 23 03:23:14 2019 (r353914) +++ releng/11.2/UPDATING Wed Oct 23 03:25:32 2019 (r353915) @@ -16,6 +16,10 @@ from older versions of FreeBSD, try WITHOUT_CLANG and the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20191023 p15 FreeBSD-EN-19:18.tzdata + + Import tzdata 2019c. [EN-19:18.tzdata] + 20190820 p14 FreeBSD-SA-19:22.mbuf FreeBSD-SA-19:23.midi FreeBSD-SA-19:24.mqueuefs Modified: releng/11.2/contrib/tzdata/NEWS ============================================================================== --- releng/11.2/contrib/tzdata/NEWS Wed Oct 23 03:23:14 2019 (r353914) +++ releng/11.2/contrib/tzdata/NEWS Wed Oct 23 03:25:32 2019 (r353915) @@ -1,5 +1,80 @@ News for the tz database +Release 2019c - 2019-09-11 08:59:48 -0700 + + Briefly: + Fiji observes DST from 2019-11-10 to 2020-01-12. + Norfolk Island starts observing Australian-style DST. + + Changes to future timestamps + + Fiji's next DST transitions will be 2019-11-10 and 2020-01-12 + instead of 2019-11-03 and 2020-01-19. (Thanks to Raymond Kumar.) + Adjust future guesses accordingly. + + Norfolk Island will observe Australian-style DST starting in + spring 2019. The first transition is on 2019-10-06. (Thanks to + Kyle Czech and Michael Deckers.) + + Changes to past timestamps + + Many corrections to time in Turkey from 1940 through 1985. + (Thanks to Oya Vulaş via Alois Treindl, and to Kıvanç Yazan.) + + The Norfolk Island 1975-03-02 transition was at 02:00 standard + time, not 02:00 DST. (Thanks to Michael Deckers.) + + South Korea observed DST from 1948 through 1951. Although this + info was supposed to appear in release 2014j, a typo inadvertently + suppressed the change. (Thanks to Alois Treindl.) + + Detroit observed DST in 1967 and 1968 following the US DST rules, + except that its 1967 DST began on June 14 at 00:01. (Thanks to + Alois Treindl for pointing out that the old data entries were + probably wrong.) + + Fix several errors in pre-1970 transitions in Perry County, IN. + (Thanks to Alois Triendl for pointing out the 1967/9 errors.) + + Edmonton did not observe DST in 1967 or 1969. In 1946 Vancouver + ended DST on 09-29 not 10-13, and Vienna ended DST on 10-07 not + 10-06. In 1945 Königsberg (now Kaliningrad) switched from +01/+02 + to +02/+03 on 04-10 not 01-01, and its +02/+03 is abbreviated + EET/EEST, not CET/CEST. (Thanks to Alois Triendl.) In 1946 + Königsberg switched to +03 on 04-07 not 01-01. + + In 1946 Louisville switched from CST to CDT on 04-28 at 00:01, not + 01-01 at 00:00. (Thanks to Alois Treindl and Michael Deckers.) + Also, it switched from CST to CDT on 1950-04-30, not 1947-04-27. + + The 1892-05-01 transition in Brussels was at 00:17:30, not at noon. + (Thanks to Michael Deckers.) + + Changes to past time zone abbreviations and DST flags + + Hong Kong Winter Time, observed from 1941-10-01 to 1941-12-25, + is now flagged as DST and is abbreviated HKWT not HKT. + + Changes to code + + leapseconds.awk now relies only on its input data, rather than + also relying on its comments. (Inspired by code from Dennis + Ferguson and Chris Woodbury.) + + The code now defends against CRLFs in leap-seconds.list. + (Thanks to Brian Inglis and Chris Woodbury.) + + Changes to documentation and commentary + + theory.html discusses leap seconds. (Thanks to Steve Summit.) + + Nashville's newspapers dueled about the time of day in the 1950s. + (Thanks to John Seigenthaler.) + + Liechtenstein observed Swiss DST in 1941/2. + (Thanks to Alois Treindl.) + + Release 2019b - 2019-07-01 00:09:53 -0700 Briefly: Modified: releng/11.2/contrib/tzdata/asia ============================================================================== --- releng/11.2/contrib/tzdata/asia Wed Oct 23 03:23:14 2019 (r353914) +++ releng/11.2/contrib/tzdata/asia Wed Oct 23 03:25:32 2019 (r353915) @@ -8,7 +8,7 @@ # tz@iana.org for general use in the future). For more, please see # the file CONTRIBUTING in the tz distribution. -# From Paul Eggert (2018-06-19): +# From Paul Eggert (2019-07-11): # # Unless otherwise specified, the source for data through 1990 is: # Thomas G. Shanks and Rique Pottenger, The International Atlas (6th edition), @@ -47,13 +47,13 @@ # 7:00 WIB west Indonesia (Waktu Indonesia Barat) # 8:00 WITA central Indonesia (Waktu Indonesia Tengah) # 8:00 CST China -# 8:00 PST PDT* Philippine Standard Time +# 8:00 HKT HKST Hong Kong (HKWT* for Winter Time in late 1941) +# 8:00 PST PDT* Philippines # 8:30 KST KDT Korea when at +0830 # 9:00 WIT east Indonesia (Waktu Indonesia Timur) # 9:00 JST JDT Japan # 9:00 KST KDT Korea when at +09 -# 9:30 ACST Australian Central Standard Time -# *I invented the abbreviation PDT; see "Philippines" below. +# *I invented the abbreviations HKWT and PDT; see below. # Otherwise, these tables typically use numeric abbreviations like +03 # and +0330 for integer hour and minute UT offsets. Although earlier # editions invented alphabetic time zone abbreviations for every @@ -653,6 +653,15 @@ Zone Asia/Urumqi 5:50:20 - LMT 1928 # * 1941-09-30, Hong Kong Daily Press, Winter Time Warning. # https://i.imgur.com/dge4kFJ.png +# From Paul Eggert (2019-07-11): +# "Hong Kong winter time" is considered to be daylight saving. +# "Hong Kong had adopted daylight saving on June 15 as a wartime measure, +# clocks moving forward one hour until October 1, when they would be put back +# by just half an hour for 'Hong Kong Winter time', so that daylight saving +# operated year round." -- Low Z. The longest day: when wartime Hong Kong +# introduced daylight saving. South China Morning Post. 2019-06-28. +# https://www.scmp.com/magazines/post-magazine/short-reads/article/3016281/longest-day-when-wartime-hong-kong-introduced + # From P Chan (2018-12-31): # * According to the Hong Kong Daylight-Saving Regulations, 1941, the # 1941 spring-forward transition was at 03:00. @@ -754,7 +763,7 @@ Rule HK 1979 only - Oct 21 3:30 0 - Zone Asia/Hong_Kong 7:36:42 - LMT 1904 Oct 30 0:36:42 8:00 - HKT 1941 Jun 15 3:00 8:00 1:00 HKST 1941 Oct 1 4:00 - 8:30 - HKT 1941 Dec 25 + 8:00 0:30 HKWT 1941 Dec 25 9:00 - JST 1945 Nov 18 2:00 8:00 HK HK%sT @@ -2419,7 +2428,7 @@ Rule ROK 1987 1988 - Oct Sun>=8 3:00 0 S Zone Asia/Seoul 8:27:52 - LMT 1908 Apr 1 8:30 - KST 1912 Jan 1 9:00 - JST 1945 Sep 8 - 9:00 - KST 1954 Mar 21 + 9:00 ROK K%sT 1954 Mar 21 8:30 ROK K%sT 1961 Aug 10 9:00 ROK K%sT Zone Asia/Pyongyang 8:23:00 - LMT 1908 Apr 1 @@ -3604,7 +3613,7 @@ Zone Asia/Tashkent 4:37:11 - LMT 1924 May 2 # and in South Vietnam in particular (after 1954): # To 07:00 on 1911-05-01. # To 08:00 on 1942-12-31 at 23:00. -# To 09:00 in 1945-03-14 at 23:00. +# To 09:00 on 1945-03-14 at 23:00. # To 07:00 on 1945-09-02 in Vietnam. # To 08:00 on 1947-04-01 in French-controlled Indochina. # To 07:00 on 1955-07-01 in South Vietnam. Modified: releng/11.2/contrib/tzdata/australasia ============================================================================== --- releng/11.2/contrib/tzdata/australasia Wed Oct 23 03:23:14 2019 (r353914) +++ releng/11.2/contrib/tzdata/australasia Wed Oct 23 03:25:32 2019 (r353915) @@ -367,13 +367,18 @@ Zone Indian/Cocos 6:27:40 - LMT 1900 # From Raymond Kumar (2018-07-13): # http://www.fijitimes.com/government-approves-2018-daylight-saving/ # ... The daylight saving period will end at 3am on Sunday January 13, 2019. -# -# From Paul Eggert (2018-07-15): -# For now, guess DST from 02:00 the first Sunday in November to 03:00 -# the first Sunday on or after January 13. January transitions reportedly + +# From Paul Eggert (2019-08-06): +# Today Raymond Kumar reported the Government of Fiji Gazette Supplement No. 27 +# (2019-08-02) said that Fiji observes DST "commencing at 2.00 am on +# Sunday, 10 November 2019 and ending at 3.00 am on Sunday, 12 January 2020." +# For now, guess DST from 02:00 the second Sunday in November to 03:00 +# the first Sunday on or after January 12. January transitions reportedly # depend on when school terms start. Although the guess is ad hoc, it matches -# transitions since late 2014 and seems more likely to match future -# practice than guessing no DST. +# transitions planned this year and seems more likely to match future practice +# than guessing no DST. +# From Michael Deckers (2019-08-06): +# https://www.laws.gov.fj/LawsAsMade/downloadfile/848 # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Fiji 1998 1999 - Nov Sun>=1 2:00 1:00 - @@ -384,8 +389,9 @@ Rule Fiji 2010 2013 - Oct Sun>=21 2:00 1:00 - Rule Fiji 2011 only - Mar Sun>=1 3:00 0 - Rule Fiji 2012 2013 - Jan Sun>=18 3:00 0 - Rule Fiji 2014 only - Jan Sun>=18 2:00 0 - -Rule Fiji 2014 max - Nov Sun>=1 2:00 1:00 - -Rule Fiji 2015 max - Jan Sun>=13 3:00 0 - +Rule Fiji 2014 2018 - Nov Sun>=1 2:00 1:00 - +Rule Fiji 2015 max - Jan Sun>=12 3:00 0 - +Rule Fiji 2019 max - Nov Sun>=8 2:00 1:00 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Fiji 11:55:44 - LMT 1915 Oct 26 # Suva 12:00 Fiji +12/+13 @@ -604,10 +610,11 @@ Zone Pacific/Niue -11:19:40 - LMT 1901 # Alofi # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Pacific/Norfolk 11:11:52 - LMT 1901 # Kingston 11:12 - +1112 1951 - 11:30 - +1130 1974 Oct 27 02:00 - 11:30 1:00 +1230 1975 Mar 2 02:00 - 11:30 - +1130 2015 Oct 4 02:00 - 11:00 - +11 + 11:30 - +1130 1974 Oct 27 02:00s + 11:30 1:00 +1230 1975 Mar 2 02:00s + 11:30 - +1130 2015 Oct 4 02:00s + 11:00 - +11 2019 Jul + 11:00 AN +11/+12 # Palau (Belau) # Zone NAME STDOFF RULES FORMAT [UNTIL] @@ -1875,12 +1882,21 @@ Zone Pacific/Wallis 12:15:20 - LMT 1901 # ... at 12.30 am (by legal time in New South Wales) on 4 October 2015. # http://www.norfolkisland.gov.nf/nia/MediaRelease/Media%20Release%20Norfolk%20Island%20Standard%20Time%20Change.pdf -# From Paul Eggert (2015-09-23): +# From Paul Eggert (2019-08-28): # Transitions before 2015 are from timeanddate.com, which consulted # the Norfolk Island Museum and the Australian Bureau of Meteorology's # Norfolk Island station, and found no record of Norfolk observing DST # other than in 1974/5. See: # https://www.timeanddate.com/time/australia/norfolk-island.html +# However, disagree with timeanddate about the 1975-03-02 transition; +# timeanddate has 02:00 but 02:00s corresponds to what the NSW law said +# (thanks to Michael Deckers). + +# Norfolk started observing Australian DST in spring 2019. +# From Kyle Czech (2019-08-13): +# https://www.legislation.gov.au/Details/F2018L01702 +# From Michael Deckers (2019-08-14): +# https://www.legislation.gov.au/Details/F2019C00010 # Palau # See commentary for Micronesia. Modified: releng/11.2/contrib/tzdata/backzone ============================================================================== --- releng/11.2/contrib/tzdata/backzone Wed Oct 23 03:23:14 2019 (r353914) +++ releng/11.2/contrib/tzdata/backzone Wed Oct 23 03:25:32 2019 (r353915) @@ -507,19 +507,35 @@ Zone Asia/Muscat 3:54:24 - LMT 1920 #Zone Asia/Panaji [not enough info to complete] # Cambodia -# From Paul Eggert (2014-10-11): -# See Asia/Ho_Chi_Minh for the source for most of this data. Also, guess -# (1) Cambodia reverted to UT +07 on 1945-09-02, when Vietnam did, and -# (2) they also reverted to +07 on 1953-11-09, the date of independence. -# These guesses are probably wrong but they're better than guessing no -# transitions there. + +# From an adoptive daughter of the late Cambodian ruler Prince Sihanouk, +# via Alois Treindl (2019-08-08): +# +# King Sihanouk said that, during the Japanese occupation, starting with +# what historians refer to as "le coup de force du 9 mars 1945", Cambodia, +# like the entire French Indochina, used Tokyo time zone. After Japan +# surrendered, 2 September 1945, Cambodia fell under French rule again and +# adopted Hanoi time zone again. +# +# However, on 7 January 1946, Sihanouk and Tioulong managed to obtain a +# status of "internal autonomy" from the government of Charles de Gaulle. +# Although many fields remained under the administration of the French +# (customs, taxes, justice, defence, foreign affairs, etc.), the Cambodian +# administration was responsible for religious matters and traditional +# celebrations, which included our calendar and time. The time zone was GMT +# + 7 and _no_ DST was applied. +# +# After Sihanouk and Tioulong achieved full independence, on 9 November 1953, +# GMT + 7 was maintained. + +# From Paul Eggert (2019-08-26): +# See Asia/Ho_Chi_Minh for the source for most of rest of this data. + Zone Asia/Phnom_Penh 6:59:40 - LMT 1906 Jul 1 7:06:30 - PLMT 1911 May 1 7:00 - +07 1942 Dec 31 23:00 8:00 - +08 1945 Mar 14 23:00 9:00 - +09 1945 Sep 2 - 7:00 - +07 1947 Apr 1 - 8:00 - +08 1953 Nov 9 7:00 - +07 # Israel @@ -646,7 +662,7 @@ Zone Europe/Tiraspol 1:58:32 - LMT 1880 # Liechtenstein Zone Europe/Vaduz 0:38:04 - LMT 1894 Jun - 1:00 - CET 1981 + 1:00 Swiss CE%sT 1981 1:00 EU CE%sT # Croatia Modified: releng/11.2/contrib/tzdata/europe ============================================================================== --- releng/11.2/contrib/tzdata/europe Wed Oct 23 03:23:14 2019 (r353914) +++ releng/11.2/contrib/tzdata/europe Wed Oct 23 03:25:32 2019 (r353915) @@ -821,11 +821,16 @@ Zone Europe/Andorra 0:06:04 - LMT 1901 # Shanks & Pottenger give 02:00, the BEV 00:00. Go with the BEV, # and guess 02:00 for 1945-04-12. +# From Alois Triendl (2019-07-22): +# In 1946 the end of DST was on Monday, 7 October 1946, at 3:00 am. +# Shanks had this right. Source: Die Weltpresse, 5. Oktober 1946, page 5. + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER/S Rule Austria 1920 only - Apr 5 2:00s 1:00 S Rule Austria 1920 only - Sep 13 2:00s 0 - Rule Austria 1946 only - Apr 14 2:00s 1:00 S -Rule Austria 1946 1948 - Oct Sun>=1 2:00s 0 - +Rule Austria 1946 only - Oct 7 2:00s 0 - +Rule Austria 1947 1948 - Oct Sun>=1 2:00s 0 - Rule Austria 1947 only - Apr 6 2:00s 1:00 S Rule Austria 1948 only - Apr 18 2:00s 1:00 S Rule Austria 1980 only - Apr 6 0:00 1:00 S @@ -875,15 +880,35 @@ Zone Europe/Minsk 1:50:16 - LMT 1880 # Belgium # -# From Paul Eggert (1997-07-02): +# From Michael Deckers (2019-08-25): +# The exposition in the web page +# https://www.bestor.be/wiki/index.php/Voyager_dans_le_temps._L%E2%80%99introduction_de_la_norme_de_Greenwich_en_Belgique +# gives several contemporary sources from which one can conclude that +# the switch in Europe/Brussels on 1892-05-01 was from 00:17:30 to 00:00:00. +# +# From Paul Eggert (2019-08-28): +# This quote helps explain the late-1914 situation: +# In early November 1914, the Germans imposed the time zone used in central +# Europe and forced the inhabitants to set their watches and public clocks +# sixty minutes ahead. Many were reluctant to accept "German time" and +# continued to use "Belgian time" among themselves. Reflecting the spirit of +# resistance that arose in the population, a song made fun of this change.... +# The song ended: +# Putting your clock forward +# Will but hasten the happy hour +# When we kick out the Boches! +# See: Pluvinage G. Brussels on German time. Cahiers Bruxellois - +# Brusselse Cahiers. 2014;XLVI(1E):15-38. +# https://www.cairn.info/revue-cahiers-bruxellois-2014-1E-page-15.htm +# +# Entries from 1914 through 1917 are taken from "De tijd in België" +# . # Entries from 1918 through 1991 are taken from: # Annuaire de L'Observatoire Royal de Belgique, # Avenue Circulaire, 3, B-1180 BRUXELLES, CLVIIe année, 1991 # (Imprimerie HAYEZ, s.p.r.l., Rue Fin, 4, 1080 BRUXELLES, MCMXC), # pp 8-9. -# LMT before 1892 was 0:17:30, according to the official journal of Belgium: -# Moniteur Belge, Samedi 30 Avril 1892, N.121. -# Thanks to Pascal Delmoitie for these references. +# Thanks to Pascal Delmoitie for the 1918/1991 references. # The 1918 rules are listed for completeness; they apply to unoccupied Belgium. # Assume Brussels switched to WET in 1918 when the armistice took effect. # @@ -928,7 +953,7 @@ Rule Belgium 1946 only - May 19 2:00s 1:00 S Rule Belgium 1946 only - Oct 7 2:00s 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Brussels 0:17:30 - LMT 1880 - 0:17:30 - BMT 1892 May 1 12:00 # Brussels MT + 0:17:30 - BMT 1892 May 1 00:17:30 0:00 - WET 1914 Nov 8 1:00 - CET 1916 May 1 0:00 1:00 C-Eur CE%sT 1918 Nov 11 11:00u @@ -1627,6 +1652,13 @@ Zone Atlantic/Reykjavik -1:28 - LMT 1908 # advanced to sixty minutes later starting at hour two on 1944-04-02; ... # Starting at hour three on the date 1944-09-17 standard time will be resumed. # +# From Alois Triendl (2019-07-02): +# I spent 6 Euros to buy two archive copies of Il Messaggero, a Roman paper, +# for 1 and 2 April 1944. The edition of 2 April has this note: "Tonight at 2 +# am, put forward the clock by one hour. Remember that in the night between +# today and Monday the 'ora legale' will come in force again." That makes it +# clear that in Rome the change was on Monday, 3 April 1944 at 2 am. +# # From Paul Eggert (2016-10-27): # Go with INRiM for DST rules, except as corrected by Inglis for 1944 # for the Kingdom of Italy. This is consistent with Renzo Baldini. @@ -1774,15 +1806,10 @@ Zone Europe/Riga 1:36:34 - LMT 1880 # From Paul Eggert (2013-09-09): # Shanks & Pottenger say Vaduz is like Zurich. -# From Alois Treindl (2013-09-18): -# http://www.eliechtensteinensia.li/LIJ/1978/1938-1978/1941.pdf -# ... confirms on p. 6 that Liechtenstein followed Switzerland in 1941 and 1942. -# I ... translate only the last two paragraphs: -# ... during second world war, in the years 1941 and 1942, Liechtenstein -# introduced daylight saving time, adapting to Switzerland. From 1943 on -# central European time was in force throughout the year. -# From a report of the duke's government to the high council, -# regarding the introduction of a time law, of 31 May 1977. +# From Alois Treindl (2019-07-04): +# I was able to access the online archive of the Vaduz paper Vaterland ... +# I could confirm from the paper that Liechtenstein did in fact follow +# the same DST in 1941 and 1942 as Switzerland did. Link Europe/Zurich Europe/Vaduz @@ -2490,6 +2517,12 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # Europe/Kaliningrad covers... # 39 RU-KGD Kaliningrad Oblast +# From Paul Eggert (2019-07-25): +# Although Shanks lists 1945-01-01 as the date for transition from +# +01/+02 to +02/+03, more likely this is a placeholder. Guess that +# the transition occurred at 1945-04-10 00:00, which is about when +# Königsberg surrendered to Soviet troops. (Thanks to Alois Triendl.) + # From Paul Eggert (2016-03-18): # The 1989 transition is from USSR act No. 227 (1989-03-14). @@ -2506,8 +2539,8 @@ Zone Europe/Bucharest 1:44:24 - LMT 1891 Oct # Moscow on 1991-11-03, switched to Moscow-1 on 1992-01-19. Zone Europe/Kaliningrad 1:22:00 - LMT 1893 Apr - 1:00 C-Eur CE%sT 1945 - 2:00 Poland CE%sT 1946 + 1:00 C-Eur CE%sT 1945 Apr 10 + 2:00 Poland EE%sT 1946 Apr 7 3:00 Russia MSK/MSD 1989 Mar 26 2:00s 2:00 Russia EE%sT 2011 Mar 27 2:00s 3:00 - +03 2014 Oct 26 2:00s @@ -3650,20 +3683,75 @@ Zone Europe/Zurich 0:34:08 - LMT 1853 Jul 16 # See abo # Turkey +# From Alois Treindl (2019-08-12): +# http://www.astrolojidergisi.com/yazsaati.htm has researched the time zone +# history of Turkey, based on newspaper archives and official documents. +# From Paul Eggert (2019-08-28): +# That source (Oya Vulaş, "Türkiye'de Yaz Saati Uygulamaları") +# is used for 1940/1972, where it seems more reliable than our other +# sources. + +# From Kıvanç Yazan (2019-08-12): +# http://www.resmigazete.gov.tr/arsiv/14539.pdf#page=24 +# 1973-06-03 01:00 -> 02:00, 1973-11-04 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/14829.pdf#page=1 +# 1974-03-31 02:00 -> 03:00, 1974-11-03 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/15161.pdf#page=1 +# 1975-03-22 02:00 -> 03:00, 1975-11-02 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/15535_1.pdf#page=1 +# 1976-03-21 02:00 -> 03:00, 1976-10-31 02:00 -> 01:00 +# +# http://www.resmigazete.gov.tr/arsiv/15778.pdf#page=5 +# 1977-04-03 02:00 -> 03:00, 1977-10-16 02:00 -> 01:00, +# 1978-04-02 02:00 -> 03:00 (not applied, see below) +# 1978-10-15 02:00 -> 01:00 (not applied, see below) +# 1979-04-01 02:00 -> 03:00 (not applied, see below) +# 1979-10-14 02:00 -> 01:00 (not applied, see below) +# +# http://www.resmigazete.gov.tr/arsiv/16245.pdf#page=17 +# This cancels the previous decision, and repeats it only for 1978. +# 1978-04-02 02:00 -> 03:00, 1978-10-15 02:00 -> 01:00 +# (not applied due to standard TZ change below) +# +# http://www.resmigazete.gov.tr/arsiv/16331.pdf#page=3 +# This decision changes the default longitude for Turkish time zone from 30 +# degrees East to 45 degrees East. This means a standard TZ change, from +2 +# to +3. This is published & applied on 1978-06-29. At that time, Turkey was +# already on summer time (already on 45E). Hence, this new law just meant an +# "continuous summer time". Note that this was reversed in a few years. +# +# http://www.resmigazete.gov.tr/arsiv/18119_1.pdf#page=1 +# 1983-07-31 02:00 -> 03:00 (note that this jumps TZ to +4) +# 1983-10-02 02:00 -> 01:00 (back to +3) +# +# http://www.resmigazete.gov.tr/arsiv/18561.pdf (page 1 and 34) +# At this time, Turkey is still on +3 with no spring-forward on early +# 1984. This decision is published on 10/31/1984. Page 1 declares +# the decision of reverting the "default longitude change". So the +# standard time should go back to +3 (30E). And page 34 explains when +# that will happen: 1984-11-01 02:00 -> 01:00. You can think of this +# as "end of continuous summer time, change of standard time zone". +# +# http://www.resmigazete.gov.tr/arsiv/18713.pdf#page=1 +# 1985-04-20 01:00 -> 02:00, 1985-09-28 02:00 -> 01:00 + # From Kıvanç Yazan (2016-09-25): # 1) For 1986-2006, DST started at 01:00 local and ended at 02:00 local, with # no exceptions. # 2) 1994's lastSun was overridden with Mar 20 ... # Here are official papers: -# http://www.resmigazete.gov.tr/arsiv/19032.pdf - page 2 for 1986 -# http://www.resmigazete.gov.tr/arsiv/19400.pdf - page 4 for 1987 -# http://www.resmigazete.gov.tr/arsiv/19752.pdf - page 15 for 1988 -# http://www.resmigazete.gov.tr/arsiv/20102.pdf - page 6 for 1989 -# http://www.resmigazete.gov.tr/arsiv/20464.pdf - page 1 for 1990 - 1992 -# http://www.resmigazete.gov.tr/arsiv/21531.pdf - page 15 for 1993 - 1995 -# http://www.resmigazete.gov.tr/arsiv/21879.pdf - page 1 for overriding 1994 -# http://www.resmigazete.gov.tr/arsiv/22588.pdf - page 1 for 1996, 1997 -# http://www.resmigazete.gov.tr/arsiv/23286.pdf - page 10 for 1998 - 2000 +# http://www.resmigazete.gov.tr/arsiv/19032.pdf#page=2 for 1986 +# http://www.resmigazete.gov.tr/arsiv/19400.pdf#page=4 for 1987 +# http://www.resmigazete.gov.tr/arsiv/19752.pdf#page=15 for 1988 +# http://www.resmigazete.gov.tr/arsiv/20102.pdf#page=6 for 1989 +# http://www.resmigazete.gov.tr/arsiv/20464.pdf#page=1 for 1990 - 1992 +# http://www.resmigazete.gov.tr/arsiv/21531.pdf#page=15 for 1993 - 1995 +# http://www.resmigazete.gov.tr/arsiv/21879.pdf#page=1 for overriding 1994 +# http://www.resmigazete.gov.tr/arsiv/22588.pdf#page=1 for 1996, 1997 +# http://www.resmigazete.gov.tr/arsiv/23286.pdf#page=10 for 1998 - 2000 # http://www.resmigazete.gov.tr/eskiler/2001/03/20010324.htm#2 - for 2001 # http://www.resmigazete.gov.tr/eskiler/2002/03/20020316.htm#2 - for 2002-2006 # From Paul Eggert (2016-09-25): @@ -3747,46 +3835,36 @@ Rule Turkey 1922 only - Oct 8 0:00 0 - Rule Turkey 1924 only - May 13 0:00 1:00 S Rule Turkey 1924 1925 - Oct 1 0:00 0 - Rule Turkey 1925 only - May 1 0:00 1:00 S -Rule Turkey 1940 only - Jun 30 0:00 1:00 S -Rule Turkey 1940 only - Oct 5 0:00 0 - +Rule Turkey 1940 only - Jul 1 0:00 1:00 S +Rule Turkey 1940 only - Oct 6 0:00 0 - Rule Turkey 1940 only - Dec 1 0:00 1:00 S Rule Turkey 1941 only - Sep 21 0:00 0 - Rule Turkey 1942 only - Apr 1 0:00 1:00 S -# Whitman omits the next two transition and gives 1945 Oct 1; -# go with Shanks & Pottenger. -Rule Turkey 1942 only - Nov 1 0:00 0 - -Rule Turkey 1945 only - Apr 2 0:00 1:00 S Rule Turkey 1945 only - Oct 8 0:00 0 - Rule Turkey 1946 only - Jun 1 0:00 1:00 S Rule Turkey 1946 only - Oct 1 0:00 0 - Rule Turkey 1947 1948 - Apr Sun>=16 0:00 1:00 S -Rule Turkey 1947 1950 - Oct Sun>=2 0:00 0 - +Rule Turkey 1947 1951 - Oct Sun>=2 0:00 0 - Rule Turkey 1949 only - Apr 10 0:00 1:00 S -Rule Turkey 1950 only - Apr 19 0:00 1:00 S +Rule Turkey 1950 only - Apr 16 0:00 1:00 S Rule Turkey 1951 only - Apr 22 0:00 1:00 S -Rule Turkey 1951 only - Oct 8 0:00 0 - +# DST for 15 months; unusual but we'll let it pass. Rule Turkey 1962 only - Jul 15 0:00 1:00 S -Rule Turkey 1962 only - Oct 8 0:00 0 - +Rule Turkey 1963 only - Oct 30 0:00 0 - Rule Turkey 1964 only - May 15 0:00 1:00 S Rule Turkey 1964 only - Oct 1 0:00 0 - -Rule Turkey 1970 1972 - May Sun>=2 0:00 1:00 S -Rule Turkey 1970 1972 - Oct Sun>=2 0:00 0 - Rule Turkey 1973 only - Jun 3 1:00 1:00 S -Rule Turkey 1973 only - Nov 4 3:00 0 - +Rule Turkey 1973 1976 - Oct Sun>=31 2:00 0 - Rule Turkey 1974 only - Mar 31 2:00 1:00 S -Rule Turkey 1974 only - Nov 3 5:00 0 - -Rule Turkey 1975 only - Mar 30 0:00 1:00 S -Rule Turkey 1975 1976 - Oct lastSun 0:00 0 - -Rule Turkey 1976 only - Jun 1 0:00 1:00 S -Rule Turkey 1977 1978 - Apr Sun>=1 0:00 1:00 S -Rule Turkey 1977 only - Oct 16 0:00 0 - -Rule Turkey 1979 1980 - Apr Sun>=1 3:00 1:00 S -Rule Turkey 1979 1982 - Oct Mon>=11 0:00 0 - -Rule Turkey 1981 1982 - Mar lastSun 3:00 1:00 S -Rule Turkey 1983 only - Jul 31 0:00 1:00 S -Rule Turkey 1983 only - Oct 2 0:00 0 - -Rule Turkey 1985 only - Apr 20 0:00 1:00 S -Rule Turkey 1985 only - Sep 28 0:00 0 - +Rule Turkey 1975 only - Mar 22 2:00 1:00 S +Rule Turkey 1976 only - Mar 21 2:00 1:00 S +Rule Turkey 1977 1978 - Apr Sun>=1 2:00 1:00 S +Rule Turkey 1977 1978 - Oct Sun>=15 2:00 0 - +Rule Turkey 1978 only - Jun 29 0:00 0 - +Rule Turkey 1983 only - Jul 31 2:00 1:00 S +Rule Turkey 1983 only - Oct 2 2:00 0 - +Rule Turkey 1985 only - Apr 20 1:00s 1:00 S +Rule Turkey 1985 only - Sep 28 1:00s 0 - Rule Turkey 1986 1993 - Mar lastSun 1:00s 1:00 S Rule Turkey 1986 1995 - Sep lastSun 1:00s 0 - Rule Turkey 1994 only - Mar 20 1:00s 1:00 S @@ -3795,8 +3873,8 @@ Rule Turkey 1996 2006 - Oct lastSun 1:00s 0 - # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone Europe/Istanbul 1:55:52 - LMT 1880 1:56:56 - IMT 1910 Oct # Istanbul Mean Time? - 2:00 Turkey EE%sT 1978 Oct 15 - 3:00 Turkey +03/+04 1985 Apr 20 + 2:00 Turkey EE%sT 1978 Jun 29 + 3:00 Turkey +03/+04 1984 Nov 1 2:00 2:00 Turkey EE%sT 2007 2:00 EU EE%sT 2011 Mar 27 1:00u 2:00 - EET 2011 Mar 28 1:00u Modified: releng/11.2/contrib/tzdata/leap-seconds.list ============================================================================== --- releng/11.2/contrib/tzdata/leap-seconds.list Wed Oct 23 03:23:14 2019 (r353914) +++ releng/11.2/contrib/tzdata/leap-seconds.list Wed Oct 23 03:25:32 2019 (r353915) @@ -204,10 +204,10 @@ # current -- the update time stamp, the data and the name of the file # will not change. # -# Updated through IERS Bulletin C57 -# File expires on: 28 December 2019 +# Updated through IERS Bulletin C58 +# File expires on: 28 June 2020 # -#@ 3786480000 +#@ 3802291200 # 2272060800 10 # 1 Jan 1972 2287785600 11 # 1 Jul 1972 @@ -252,4 +252,4 @@ # the hash line is also ignored in the # computation. # -#h 83c68138 d3650221 07dbbbcd 11fcc859 ced1106a +#h f28827d2 f263b6c3 ec0f19eb a3e0dbf0 97f3fa30 Modified: releng/11.2/contrib/tzdata/leapseconds ============================================================================== --- releng/11.2/contrib/tzdata/leapseconds Wed Oct 23 03:23:14 2019 (r353914) +++ releng/11.2/contrib/tzdata/leapseconds Wed Oct 23 03:25:32 2019 (r353915) @@ -3,36 +3,39 @@ # This file is in the public domain. # This file is generated automatically from the data in the public-domain -# leap-seconds.list file, which can be copied from +# NIST format leap-seconds.list file, which can be copied from # -# or -# or . +# or . # For more about leap-seconds.list, please see # The NTP Timescale and Leap Seconds # . -# The International Earth Rotation and Reference Systems Service +# The rules for leap seconds are specified in Annex 1 (Time scales) of: +# Standard-frequency and time-signal emissions. +# International Telecommunication Union - Radiocommunication Sector +# (ITU-R) Recommendation TF.460-6 (02/2002) +# . +# The International Earth Rotation and Reference Systems Service (IERS) # periodically uses leap seconds to keep UTC to within 0.9 s of UT1 -# (which measures the true angular orientation of the earth in space) +# (a proxy for Earth's angle in space as measured by astronomers) # and publishes leap second data in a copyrighted file # . # See: Levine J. Coordinated Universal Time and the leap second. # URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995 # . -# There were no leap seconds before 1972, because the official mechanism -# accounting for the discrepancy between atomic time and the earth's rotation -# did not exist. The first ("1 Jan 1972") data line in leap-seconds.list +# There were no leap seconds before 1972, as no official mechanism +# accounted for the discrepancy between atomic time (TAI) and the earth's +# rotation. The first ("1 Jan 1972") data line in leap-seconds.list # does not denote a leap second; it denotes the start of the current definition # of UTC. -# The correction (+ or -) is made at the given time, so lines -# will typically look like: -# Leap YEAR MON DAY 23:59:60 + R/S -# or -# Leap YEAR MON DAY 23:59:59 - R/S - -# If the leap second is Rolling (R) the given time is local time (unused here). +# All leap-seconds are Stationary (S) at the given UTC time. +# The correction (+ or -) is made at the given time, so in the unlikely +# event of a negative leap second, a line would look like this: +# Leap YEAR MON DAY 23:59:59 - S +# Typical lines look like this: +# Leap YEAR MON DAY 23:59:60 + S Leap 1972 Jun 30 23:59:60 + S Leap 1972 Dec 31 23:59:60 + S Leap 1973 Dec 31 23:59:60 + S @@ -62,8 +65,8 @@ Leap 2015 Jun 30 23:59:60 + S Leap 2016 Dec 31 23:59:60 + S # POSIX timestamps for the data in this file: -#updated 1467936000 -#expires 1577491200 +#updated 1467936000 (2016-07-08 00:00:00 UTC) +#expires 1593302400 (2020-06-28 00:00:00 UTC) -# Updated through IERS Bulletin C57 -# File expires on: 28 December 2019 +# Updated through IERS Bulletin C58 +# File expires on: 28 June 2020 Modified: releng/11.2/contrib/tzdata/leapseconds.awk ============================================================================== --- releng/11.2/contrib/tzdata/leapseconds.awk Wed Oct 23 03:23:14 2019 (r353914) +++ releng/11.2/contrib/tzdata/leapseconds.awk Wed Oct 23 03:25:32 2019 (r353915) @@ -1,43 +1,59 @@ -# Generate the 'leapseconds' file from 'leap-seconds.list'. +# Generate zic format 'leapseconds' from NIST format 'leap-seconds.list'. # This file is in the public domain. +# This program uses awk arithmetic. POSIX requires awk to support +# exact integer arithmetic only through 10**10, which means for NTP +# timestamps this program works only to the year 2216, which is the +# year 1900 plus 10**10 seconds. However, in practice +# POSIX-conforming awk implementations invariably use IEEE-754 double +# and so support exact integers through 2**53. By the year 2216, +# POSIX will almost surely require at least 2**53 for awk, so for NTP +# timestamps this program should be good until the year 285,428,681 +# (the year 1900 plus 2**53 seconds). By then leap seconds will be +# long obsolete, as the Earth will likely slow down so much that +# there will be more than 25 hours per day and so some other scheme +# will be needed. + BEGIN { print "# Allowance for leap seconds added to each time zone file." print "" print "# This file is in the public domain." print "" print "# This file is generated automatically from the data in the public-domain" - print "# leap-seconds.list file, which can be copied from" + print "# NIST format leap-seconds.list file, which can be copied from" print "# " - print "# or " - print "# or ." + print "# or ." print "# For more about leap-seconds.list, please see" print "# The NTP Timescale and Leap Seconds" print "# ." print "" - print "# The International Earth Rotation and Reference Systems Service" + print "# The rules for leap seconds are specified in Annex 1 (Time scales) of:" + print "# Standard-frequency and time-signal emissions." + print "# International Telecommunication Union - Radiocommunication Sector" + print "# (ITU-R) Recommendation TF.460-6 (02/2002)" + print "# ." + print "# The International Earth Rotation and Reference Systems Service (IERS)" print "# periodically uses leap seconds to keep UTC to within 0.9 s of UT1" - print "# (which measures the true angular orientation of the earth in space)" + print "# (a proxy for Earth's angle in space as measured by astronomers)" print "# and publishes leap second data in a copyrighted file" print "# ." print "# See: Levine J. Coordinated Universal Time and the leap second." print "# URSI Radio Sci Bull. 2016;89(4):30-6. doi:10.23919/URSIRSB.2016.7909995" print "# ." print "" - print "# There were no leap seconds before 1972, because the official mechanism" - print "# accounting for the discrepancy between atomic time and the earth's rotation" - print "# did not exist. The first (\"1 Jan 1972\") data line in leap-seconds.list" + print "# There were no leap seconds before 1972, as no official mechanism" + print "# accounted for the discrepancy between atomic time (TAI) and the earth's" + print "# rotation. The first (\"1 Jan 1972\") data line in leap-seconds.list" print "# does not denote a leap second; it denotes the start of the current definition" - print"# of UTC." + print "# of UTC." print "" - print "# The correction (+ or -) is made at the given time, so lines" - print "# will typically look like:" - print "# Leap YEAR MON DAY 23:59:60 + R/S" - print "# or" - print "# Leap YEAR MON DAY 23:59:59 - R/S" - print "" - print "# If the leap second is Rolling (R) the given time is local time (unused here)." + print "# All leap-seconds are Stationary (S) at the given UTC time." + print "# The correction (+ or -) is made at the given time, so in the unlikely" + print "# event of a negative leap second, a line would look like this:" + print "# Leap YEAR MON DAY 23:59:59 - S" + print "# Typical lines look like this:" + print "# Leap YEAR MON DAY 23:59:60 + S" monthabbr[ 1] = "Jan" monthabbr[ 2] = "Feb" @@ -51,45 +67,34 @@ BEGIN { monthabbr[10] = "Oct" monthabbr[11] = "Nov" monthabbr[12] = "Dec" - for (i in monthabbr) { - monthnum[monthabbr[i]] = i - monthlen[i] = 31 - } - monthlen[2] = 28 - monthlen[4] = monthlen[6] = monthlen[9] = monthlen[11] = 30 + + # Strip trailing CR, in case the input has CRLF form a la NIST. + RS = "\r?\n" + + sstamp_init() } -/^#\tUpdated through/ || /^#\tFile expires on:/ { +/^#[ \t]*[Uu]pdated through/ || /^#[ \t]*[Ff]ile expires on/ { last_lines = last_lines $0 "\n" } /^#[$][ \t]/ { updated = $2 } /^#[@][ \t]/ { expires = $2 } -/^#/ { next } +/^[ \t]*#/ { next } { NTP_timestamp = $1 TAI_minus_UTC = $2 - hash_mark = $3 - one = $4 - month = $5 - year = $6 if (old_TAI_minus_UTC) { if (old_TAI_minus_UTC < TAI_minus_UTC) { sign = "23:59:60\t+" } else { sign = "23:59:59\t-" } - m = monthnum[month] - 1 - if (m == 0) { - year--; - m = 12 - } - month = monthabbr[m] - day = monthlen[m] - day += m == 2 && year % 4 == 0 && (year % 100 != 0 || year % 400 == 0) - printf "Leap\t%s\t%s\t%s\t%s\tS\n", year, month, day, sign + sstamp_to_ymdhMs(NTP_timestamp - 1, ss_NTP) + printf "Leap\t%d\t%s\t%d\t%s\tS\n", \ + ss_year, monthabbr[ss_month], ss_mday, sign } old_TAI_minus_UTC = TAI_minus_UTC } @@ -102,7 +107,117 @@ END { print "" print "# POSIX timestamps for the data in this file:" - printf "#updated %s\n", updated - epoch_minus_NTP - printf "#expires %s\n", expires - epoch_minus_NTP + sstamp_to_ymdhMs(updated, ss_NTP) + printf "#updated %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \ + updated - epoch_minus_NTP, \ + ss_year, ss_month, ss_mday, ss_hour, ss_min, ss_sec + sstamp_to_ymdhMs(expires, ss_NTP) + printf "#expires %d (%.4d-%.2d-%.2d %.2d:%.2d:%.2d UTC)\n", \ + expires - epoch_minus_NTP, \ + ss_year, ss_month, ss_mday, ss_hour, ss_min, ss_sec + printf "\n%s", last_lines +} + +# sstamp_to_ymdhMs - convert seconds timestamp to date and time +# +# Call as: +# +# sstamp_to_ymdhMs(sstamp, epoch_days) +# +# where: +# +# sstamp - is the seconds timestamp. +# epoch_days - is the timestamp epoch in Gregorian days since 1600-03-01. +# ss_NTP is appropriate for an NTP sstamp. +# +# Both arguments should be nonnegative integers. +# On return, the following variables are set based on sstamp: +# +# ss_year - Gregorian calendar year +# ss_month - month of the year (1-January to 12-December) +# ss_mday - day of the month (1-31) +# ss_hour - hour (0-23) +# ss_min - minute (0-59) +# ss_sec - second (0-59) +# ss_wday - day of week (0-Sunday to 6-Saturday) +# +# The function sstamp_init should be called prior to using sstamp_to_ymdhMs. + +function sstamp_init() +{ + # Days in month N, where March is month 0 and January month 10. + ss_mon_days[ 0] = 31 + ss_mon_days[ 1] = 30 + ss_mon_days[ 2] = 31 + ss_mon_days[ 3] = 30 + ss_mon_days[ 4] = 31 + ss_mon_days[ 5] = 31 + ss_mon_days[ 6] = 30 + ss_mon_days[ 7] = 31 + ss_mon_days[ 8] = 30 + ss_mon_days[ 9] = 31 + ss_mon_days[10] = 31 + + # Counts of days in a Gregorian year, quad-year, century, and quad-century. + ss_year_days = 365 + ss_quadyear_days = ss_year_days * 4 + 1 + ss_century_days = ss_quadyear_days * 25 - 1 + ss_quadcentury_days = ss_century_days * 4 + 1 + + # Standard day epochs, suitable for epoch_days. + # ss_MJD = 94493 + # ss_POSIX = 135080 + ss_NTP = 109513 +} + +function sstamp_to_ymdhMs(sstamp, epoch_days, \ + quadcentury, century, quadyear, year, month, day) +{ + ss_hour = int(sstamp / 3600) % 24 + ss_min = int(sstamp / 60) % 60 + ss_sec = sstamp % 60 + + # Start with a count of days since 1600-03-01 Gregorian. + day = epoch_days + int(sstamp / (24 * 60 * 60)) + + # Compute a year-month-day date with days of the month numbered + # 0-30, months (March-February) numbered 0-11, and years that start + # start March 1 and end after the last day of February. A quad-year + # starts on March 1 of a year evenly divisible by 4 and ends after + # the last day of February 4 years later. A century starts on and + # ends before March 1 in years evenly divisible by 100. + # A quad-century starts on and ends before March 1 in years divisible + # by 400. While the number of days in a quad-century is a constant, + # the number of days in each other time period can vary by 1. + # Any variation is in the last day of the time period (there might + # or might not be a February 29) where it is easy to deal with. + + quadcentury = int(day / ss_quadcentury_days) + day -= quadcentury * ss_quadcentury_days + ss_wday = (day + 3) % 7 + century = int(day / ss_century_days) + century -= century == 4 + day -= century * ss_century_days + quadyear = int(day / ss_quadyear_days) + day -= quadyear * ss_quadyear_days + year = int(day / ss_year_days) + year -= year == 4 + day -= year * ss_year_days + for (month = 0; month < 11; month++) { + if (day < ss_mon_days[month]) + break + day -= ss_mon_days[month] + } + + # Convert the date to a conventional day of month (1-31), + # month (1-12, January-December) and Gregorian year. + ss_mday = day + 1 + if (month <= 9) { + ss_month = month + 3 + } else { + ss_month = month - 9 + year++ + } + ss_year = 1600 + quadcentury * 400 + century * 100 + quadyear * 4 + year } Modified: releng/11.2/contrib/tzdata/northamerica ============================================================================== --- releng/11.2/contrib/tzdata/northamerica Wed Oct 23 03:23:14 2019 (r353914) +++ releng/11.2/contrib/tzdata/northamerica Wed Oct 23 03:25:32 2019 (r353915) @@ -406,6 +406,31 @@ Zone America/New_York -4:56:02 - LMT 1883 Nov 18 12:03 # From Paul Eggert (2015-12-25): # Assume this practice predates 1970, so Fort Pierre can use America/Chicago. +# From Paul Eggert (2015-04-06): +# In 1950s Nashville a public clock had dueling faces, one for conservatives +# and the other for liberals; the two sides didn't agree about the time of day. +# I haven't found a photo of this clock, nor have I tracked down the TIME +# magazine report cited below, but here's the story as told by the late +# American journalist John Seigenthaler, who was there: +# +# "The two [newspaper] owners held strongly contrasting political and +# ideological views. Evans was a New South liberal, Stahlman an Old South +# conservative, and their two papers frequently clashed editorially, often on +# the same day.... In the 1950s as the state legislature was grappling with +# the question of whether to approve daylight saving time for the entire state, +# TIME magazine reported: +# +# "'The Nashville Banner and The Nashville Tennessean rarely agree on anything +# but the time of day - and last week they couldn't agree on that.' +# +# "It was all too true. The clock on the front of the building had two faces - +# The Tennessean side of the building facing west, the other, east. When it +# was high noon Banner time, it was 11 a.m. Tennessean time." +# +# Seigenthaler J. For 100 years, Tennessean had it covered. +# The Tennessean 2007-05-11, republished 2015-04-06. +# https://www.tennessean.com/story/insider/extras/2015/04/06/archives-seigenthaler-for-100-years-the-tennessean-had-it-covered/25348545/ + # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER Rule Chicago 1920 only - Jun 13 2:00 1:00 D Rule Chicago 1920 1921 - Oct lastSun 2:00 0 S @@ -945,21 +970,21 @@ Zone America/Indiana/Vincennes -5:50:07 - LMT 1883 Nov -5:00 US E%sT # # Perry County, Indiana, switched from eastern to central time in April 2006. +# From Alois Triendl (2019-07-09): +# The Indianapolis News, Friday 27 October 1967 states that Perry County +# returned to CST. It went again to EST on 27 April 1969, as documented by the +# Indianapolis star of Saturday 26 April. # Rule NAME FROM TO TYPE IN ON AT SAVE LETTER -Rule Perry 1946 only - Apr lastSun 2:00 1:00 D -Rule Perry 1946 only - Sep lastSun 2:00 0 S -Rule Perry 1953 1954 - Apr lastSun 2:00 1:00 D -Rule Perry 1953 1959 - Sep lastSun 2:00 0 S Rule Perry 1955 only - May 1 0:00 1:00 D +Rule Perry 1955 1960 - Sep lastSun 2:00 0 S Rule Perry 1956 1963 - Apr lastSun 2:00 1:00 D -Rule Perry 1960 only - Oct lastSun 2:00 0 S -Rule Perry 1961 only - Sep lastSun 2:00 0 S -Rule Perry 1962 1963 - Oct lastSun 2:00 0 S +Rule Perry 1961 1963 - Oct lastSun 2:00 0 S # Zone NAME STDOFF RULES FORMAT [UNTIL] Zone America/Indiana/Tell_City -5:47:03 - LMT 1883 Nov 18 12:12:57 -6:00 US C%sT 1946 -6:00 Perry C%sT 1964 Apr 26 2:00 - -5:00 - EST 1969 + -5:00 - EST 1967 Oct 29 2:00 + -6:00 US C%sT 1969 Apr 27 2:00 -5:00 US E%sT 1971 -5:00 - EST 2006 Apr 2 2:00 -6:00 US C%sT @@ -1035,16 +1060,27 @@ Zone America/Indiana/Vevay -5:40:16 - LMT 1883 Nov 18 # clear how this matched civil time in Louisville, so for now continue # to assume Louisville switched at noon new local time, like New York. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Oct 23 07:36:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 868E7172511; Wed, 23 Oct 2019 07:36:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yhyM30TQz3JTG; Wed, 23 Oct 2019 07:36:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 473702133F; Wed, 23 Oct 2019 07:36:27 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N7aRUZ005045; Wed, 23 Oct 2019 07:36:27 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N7aREw005044; Wed, 23 Oct 2019 07:36:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910230736.x9N7aREw005044@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 23 Oct 2019 07:36:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353916 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353916 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 07:36:27 -0000 Author: kib Date: Wed Oct 23 07:36:26 2019 New Revision: 353916 URL: https://svnweb.freebsd.org/changeset/base/353916 Log: Assert that vm_fault_lock_vnode() returns locked saved vnode. Reviewed by: alc, markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D22113 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Wed Oct 23 03:25:32 2019 (r353915) +++ head/sys/vm/vm_fault.c Wed Oct 23 07:36:26 2019 (r353916) @@ -637,8 +637,10 @@ vm_fault_lock_vnode(struct faultstate *fs) if (fs->object->type != OBJT_VNODE) return (KERN_SUCCESS); vp = fs->object->handle; - if (vp == fs->vp) + if (vp == fs->vp) { + ASSERT_VOP_LOCKED(vp, "saved vnode is not locked"); return (KERN_SUCCESS); + } /* * Perform an unlock in case the desired vnode changed while From owner-svn-src-all@freebsd.org Wed Oct 23 09:54:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB72B1755BB; Wed, 23 Oct 2019 09:54:12 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ym1J5tbWz3QgZ; Wed, 23 Oct 2019 09:54:12 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD36C22CB1; Wed, 23 Oct 2019 09:54:12 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N9sCJS087738; Wed, 23 Oct 2019 09:54:12 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N9sCcH087737; Wed, 23 Oct 2019 09:54:12 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910230954.x9N9sCcH087737@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 23 Oct 2019 09:54:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353917 - head/sys/dev/extres/regulator X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/extres/regulator X-SVN-Commit-Revision: 353917 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 09:54:13 -0000 Author: manu Date: Wed Oct 23 09:54:12 2019 New Revision: 353917 URL: https://svnweb.freebsd.org/changeset/base/353917 Log: regulator: Add a regnode_method_init This is a default init method for regulator that don't really need one. MFC after: 1 week Modified: head/sys/dev/extres/regulator/regulator.c Modified: head/sys/dev/extres/regulator/regulator.c ============================================================================== --- head/sys/dev/extres/regulator/regulator.c Wed Oct 23 07:36:26 2019 (r353916) +++ head/sys/dev/extres/regulator/regulator.c Wed Oct 23 09:54:12 2019 (r353917) @@ -65,6 +65,7 @@ typedef TAILQ_HEAD(regnode_list, regnode) regnode_list typedef TAILQ_HEAD(regulator_list, regulator) regulator_list_t; /* Default regulator methods. */ +static int regnode_method_init(struct regnode *regnode); static int regnode_method_enable(struct regnode *regnode, bool enable, int *udelay); static int regnode_method_status(struct regnode *regnode, int *status); @@ -77,6 +78,7 @@ static void regulator_shutdown(void *dummy); * Regulator controller methods. */ static regnode_method_t regnode_methods[] = { + REGNODEMETHOD(regnode_init, regnode_method_init), REGNODEMETHOD(regnode_enable, regnode_method_enable), REGNODEMETHOD(regnode_status, regnode_method_status), REGNODEMETHOD(regnode_set_voltage, regnode_method_set_voltage), @@ -212,6 +214,13 @@ regnode_uvolt_sysctl(SYSCTL_HANDLER_ARGS) * Default regulator methods for base class. * */ +static int +regnode_method_init(struct regnode *regnode) +{ + + return (0); +} + static int regnode_method_enable(struct regnode *regnode, bool enable, int *udelay) { From owner-svn-src-all@freebsd.org Wed Oct 23 09:54:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BE67175636; Wed, 23 Oct 2019 09:54:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ym226YBrz3QpY; Wed, 23 Oct 2019 09:54:50 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C48AB22CB2; Wed, 23 Oct 2019 09:54:50 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N9so7C087809; Wed, 23 Oct 2019 09:54:50 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N9sot0087808; Wed, 23 Oct 2019 09:54:50 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910230954.x9N9sot0087808@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 23 Oct 2019 09:54:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353918 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 353918 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 09:54:51 -0000 Author: manu Date: Wed Oct 23 09:54:50 2019 New Revision: 353918 URL: https://svnweb.freebsd.org/changeset/base/353918 Log: axp81x: Use the default regnode_init method MFC after: 1 week Modified: head/sys/arm/allwinner/axp81x.c Modified: head/sys/arm/allwinner/axp81x.c ============================================================================== --- head/sys/arm/allwinner/axp81x.c Wed Oct 23 09:54:12 2019 (r353917) +++ head/sys/arm/allwinner/axp81x.c Wed Oct 23 09:54:50 2019 (r353918) @@ -747,12 +747,6 @@ axp8xx_write(device_t dev, uint8_t reg, uint8_t val) } static int -axp8xx_regnode_init(struct regnode *regnode) -{ - return (0); -} - -static int axp8xx_regnode_enable(struct regnode *regnode, bool enable, int *udelay) { struct axp8xx_reg_sc *sc; @@ -869,7 +863,6 @@ axp8xx_regnode_get_voltage(struct regnode *regnode, in static regnode_method_t axp8xx_regnode_methods[] = { /* Regulator interface */ - REGNODEMETHOD(regnode_init, axp8xx_regnode_init), REGNODEMETHOD(regnode_enable, axp8xx_regnode_enable), REGNODEMETHOD(regnode_set_voltage, axp8xx_regnode_set_voltage), REGNODEMETHOD(regnode_get_voltage, axp8xx_regnode_get_voltage), From owner-svn-src-all@freebsd.org Wed Oct 23 09:56:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 646141756E2; Wed, 23 Oct 2019 09:56:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ym4Q210mz3Qys; Wed, 23 Oct 2019 09:56:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 24CDF22CB3; Wed, 23 Oct 2019 09:56:54 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9N9urld087981; Wed, 23 Oct 2019 09:56:53 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9N9urvZ087980; Wed, 23 Oct 2019 09:56:53 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910230956.x9N9urvZ087980@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Wed, 23 Oct 2019 09:56:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353919 - head/sys/dev/extres/regulator X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/extres/regulator X-SVN-Commit-Revision: 353919 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 09:56:54 -0000 Author: manu Date: Wed Oct 23 09:56:53 2019 New Revision: 353919 URL: https://svnweb.freebsd.org/changeset/base/353919 Log: regulator: Add a regnode_set_constraint function This method check that boot_on or always_on is set to 1 and if it is it will try to enable the regulator. The binding docs aren't clear on what to do but Linux enable the regulator if any of those properties is set so we want to do the same. The function first check the status to see if the regulator is already enabled it then get the voltage to check if it is in a acceptable range and then enables it. This will be either called from the regnode_init method (if it's needed by the platform) or by a SYSINIT at SI_SUB_LAST Reviewed by: mmel MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22106 Modified: head/sys/dev/extres/regulator/regulator.c head/sys/dev/extres/regulator/regulator.h Modified: head/sys/dev/extres/regulator/regulator.c ============================================================================== --- head/sys/dev/extres/regulator/regulator.c Wed Oct 23 09:54:50 2019 (r353918) +++ head/sys/dev/extres/regulator/regulator.c Wed Oct 23 09:56:53 2019 (r353919) @@ -72,6 +72,7 @@ static int regnode_method_status(struct regnode *regno static int regnode_method_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt, int *udelay); static int regnode_method_get_voltage(struct regnode *regnode, int *uvolt); +static void regulator_constraint(void *dummy); static void regulator_shutdown(void *dummy); /* @@ -154,9 +155,27 @@ SX_SYSINIT(regulator_topology, ®node_topo_lock, "Re #define REGNODE_XLOCK(_sc) sx_xlock(&((_sc)->lock)) #define REGNODE_UNLOCK(_sc) sx_unlock(&((_sc)->lock)) +SYSINIT(regulator_constraint, SI_SUB_LAST, SI_ORDER_ANY, regulator_constraint, + NULL); SYSINIT(regulator_shutdown, SI_SUB_LAST, SI_ORDER_ANY, regulator_shutdown, NULL); +static void +regulator_constraint(void *dummy) +{ + struct regnode *entry; + int rv; + + REG_TOPO_SLOCK(); + TAILQ_FOREACH(entry, ®node_list, reglist_link) { + rv = regnode_set_constraint(entry); + if (rv != 0 && bootverbose) + printf("regulator: setting constraint on %s failed (%d)\n", + entry->name, rv); + } + REG_TOPO_UNLOCK(); +} + /* * Disable unused regulator * We run this function at SI_SUB_LAST which mean that every driver that needs @@ -778,6 +797,56 @@ regnode_set_voltage_checked(struct regnode *regnode, s regnode_delay(udelay); REGNODE_UNLOCK(regnode); return (rv); +} + +int +regnode_set_constraint(struct regnode *regnode) +{ + int status, rv, uvolt; + + if (regnode->std_param.boot_on != true && + regnode->std_param.always_on != true) + return (0); + + rv = regnode_status(regnode, &status); + if (rv != 0) { + if (bootverbose) + printf("Cannot get regulator status for %s\n", + regnode_get_name(regnode)); + return (rv); + } + + if (status == REGULATOR_STATUS_ENABLED) + return (0); + + rv = regnode_get_voltage(regnode, &uvolt); + if (rv != 0) { + if (bootverbose) + printf("Cannot get regulator voltage for %s\n", + regnode_get_name(regnode)); + return (rv); + } + + if (uvolt < regnode->std_param.min_uvolt || + uvolt > regnode->std_param.max_uvolt) { + if (bootverbose) + printf("Regulator %s current voltage %d is not in the" + " acceptable range : %d<->%d\n", + regnode_get_name(regnode), + uvolt, regnode->std_param.min_uvolt, + regnode->std_param.max_uvolt); + return (ERANGE); + } + + rv = regnode_enable(regnode); + if (rv != 0) { + if (bootverbose) + printf("Cannot enable regulator %s\n", + regnode_get_name(regnode)); + return (rv); + } + + return (0); } #ifdef FDT Modified: head/sys/dev/extres/regulator/regulator.h ============================================================================== --- head/sys/dev/extres/regulator/regulator.h Wed Oct 23 09:54:50 2019 (r353918) +++ head/sys/dev/extres/regulator/regulator.h Wed Oct 23 09:56:53 2019 (r353919) @@ -116,6 +116,7 @@ int regnode_stop(struct regnode *regnode, int depth); int regnode_status(struct regnode *regnode, int *status); int regnode_get_voltage(struct regnode *regnode, int *uvolt); int regnode_set_voltage(struct regnode *regnode, int min_uvolt, int max_uvolt); +int regnode_set_constraint(struct regnode *regnode); #ifdef FDT phandle_t regnode_get_ofw_node(struct regnode *regnode); #endif From owner-svn-src-all@freebsd.org Wed Oct 23 12:18:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3A98150831; Wed, 23 Oct 2019 12:18:13 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail104.syd.optusnet.com.au (mail104.syd.optusnet.com.au [211.29.132.246]) by mx1.freebsd.org (Postfix) with ESMTP id 46yqCS127Dz43DV; Wed, 23 Oct 2019 12:18:11 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail104.syd.optusnet.com.au (Postfix) with ESMTPS id 9972343E6DE; Wed, 23 Oct 2019 23:18:07 +1100 (AEDT) Date: Wed, 23 Oct 2019 23:18:06 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Alan Somers cc: Andrew Turner , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r353640 - head/sys/kern In-Reply-To: Message-ID: <20191023210546.L892@besplex.bde.org> References: <201910161321.x9GDL2ee021543@repo.freebsd.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=P6RKvmIu c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=4zIc5qUCshN3e9hYGH4A:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 46yqCS127Dz43DV X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of brde@optusnet.com.au designates 211.29.132.246 as permitted sender) smtp.mailfrom=brde@optusnet.com.au X-Spamd-Result: default: False [-2.30 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_COUNT_TWO(0.00)[2]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:211.29.132.0/23]; FREEMAIL_FROM(0.00)[optusnet.com.au]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; DMARC_NA(0.00)[optusnet.com.au]; IP_SCORE_FREEMAIL(0.00)[]; RCPT_COUNT_FIVE(0.00)[5]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; IP_SCORE(0.00)[ip: (-6.93), ipnet: 211.28.0.0/14(-3.22), asn: 4804(-2.38), country: AU(0.01)]; TO_DN_ALL(0.00)[]; RCVD_NO_TLS_LAST(0.10)[]; RCVD_IN_DNSWL_LOW(-0.10)[246.132.29.211.list.dnswl.org : 127.0.5.1]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[optusnet.com.au]; ASN(0.00)[asn:4804, ipnet:211.28.0.0/14, country:AU]; MIME_TRACE(0.00)[0:+]; FROM_EQ_ENVFROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 12:18:13 -0000 On Tue, 22 Oct 2019, Alan Somers wrote: > On Wed, Oct 16, 2019 at 7:21 AM Andrew Turner wrote: > >> Author: andrew >> Date: Wed Oct 16 13:21:01 2019 >> New Revision: 353640 >> URL: https://svnweb.freebsd.org/changeset/base/353640 >> >> Log: >> Stop leaking information from the kernel through timespec >> >> The timespec struct holds a seconds value in a time_t and a nanoseconds >> value in a long. On most architectures these are the same size, however >> on 32-bit architectures other than i386 time_t is 8 bytes and long is >> 4 bytes. >> >> Most ABIs will then pad a struct holding an 8 byte and 4 byte value to >> 16 bytes with 4 bytes of padding. When copying one of these structs the >> compiler is free to copy the padding if it wishes. I doubt that most ABIs pad the struct in that case. Pure 32-bit arches don't have any 64-bit memory or register operations, so they use 32-bit longs and don't pessimize structs with 64-bit types in them using padding. If there are any such ABIs, then there are thousands if not millions more places to fix. Every place where a timespec is written must be checked. E.g., gettimeofday() reduces to microtime(). The implementation of microtime() happens to fill the timeval fields separately. That always leaks kernel context if struct timeval has padding and nothing else zeros the padding. And for gettimeofday() it is especially clear that nothing else zeros the padding. sys_gettimeofday() allocates a timeval on the kernel stack; microtime() initializes its fields separately leaving any padding untouched; copyout() then copies out kernel context. This commit attempts to fix the different problem that if lower levels like microtime() were pessimized to initialize the padding, then callers would have to be careful to preserve this by not using struct assignments for copying structs. This is not easy to do. bcopy() and copyout() should preserve memory, but there are no guarantees if the struct is accessed in other ways. The fix in this commit can easily not work on arches that have the problem: bzero(&tv); /* padding now all 0 */ tv.tv_sec = another_tv_sec; /* * Padding now indeterminate (C99 6.2.6.1p6). It is reasonable * for the implementation to use the padding on ABIs that have it, * 64-bit stores of registers with uncleared kernel context gives * gives the context leak. */ tv.tv_nsec = another_tv_nsec; I don't see anything in C99 that requires padding to remain unchanged even with no stores in the program. This problem affects more than time_t's. It affects all padding. I next checked the simplest itimer call. sys_getitimer() doesn't handle the problem, of course: it allocates a struct itimerval aitimerval the kernel stack; kern_getitimer() allocates a struct timeval ctv on the kernel stack; ctv is initialized 1 field at a time in most cases so its padding remains uninitialized; aitv is inititialized using a struct assignment in most cases so it has the problem that this commit attempts to fix. This is just another bug in 64-bit time_t's, especially on 32-bit arches. Instead of 32-bit time_t's which work until 2038 or 2106, we have subtle security holes now. Bruce From owner-svn-src-all@freebsd.org Wed Oct 23 12:52:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AF81151B91; Wed, 23 Oct 2019 12:52:29 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from fry.fubar.geek.nz (fry.fubar.geek.nz [139.59.165.16]) by mx1.freebsd.org (Postfix) with ESMTP id 46yqz13KzFz454K; Wed, 23 Oct 2019 12:52:29 +0000 (UTC) (envelope-from andrew@freebsd.org) Received: from [IPv6:2001:630:212:2a8:bc33:6e81:8b9:7f62] (unknown [IPv6:2001:630:212:2a8:bc33:6e81:8b9:7f62]) by fry.fubar.geek.nz (Postfix) with ESMTPSA id 75FF94ECB4; Wed, 23 Oct 2019 12:52:22 +0000 (UTC) From: Andrew Turner Message-Id: <1F97D894-2D71-45BB-AEA1-70CC1BA1D155@freebsd.org> Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r353640 - head/sys/kern Date: Wed, 23 Oct 2019 13:52:22 +0100 In-Reply-To: Cc: src-committers , svn-src-all , svn-src-head To: Alan Somers References: <201910161321.x9GDL2ee021543@repo.freebsd.org> X-Mailer: Apple Mail (2.3445.104.11) X-Rspamd-Queue-Id: 46yqz13KzFz454K X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.993,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 12:52:29 -0000 > On 22 Oct 2019, at 16:50, Alan Somers > wrote: >=20 > On Wed, Oct 16, 2019 at 7:21 AM Andrew Turner > wrote: > Author: andrew > Date: Wed Oct 16 13:21:01 2019 > New Revision: 353640 > URL: https://svnweb.freebsd.org/changeset/base/353640 = >=20 > Log: > Stop leaking information from the kernel through timespec >=20 > The timespec struct holds a seconds value in a time_t and a = nanoseconds > value in a long. On most architectures these are the same size, = however > on 32-bit architectures other than i386 time_t is 8 bytes and long = is > 4 bytes. >=20 > Most ABIs will then pad a struct holding an 8 byte and 4 byte value = to > 16 bytes with 4 bytes of padding. When copying one of these structs = the > compiler is free to copy the padding if it wishes. >=20 > In this case the padding may contain kernel data that is then leaked = to > userspace. Fix this by copying the timespec elements rather than the > entire struct. >=20 > This doesn't affect Tier-1 architectures so no SA is expected. >=20 > admbugs: 651 > MFC after: 1 week > Sponsored by: DARPA, AFRL >=20 > Good catch. Might I ask how you found it, or who reported it?=20 I found it via one of the tests. It uses memcmp to check the struct = returned was identical to what it expected. On closer inspection I found = the difference was in the padding. Andrew=20 From owner-svn-src-all@freebsd.org Wed Oct 23 13:21:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96A681526DF; Wed, 23 Oct 2019 13:21:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yrcD3Y74z46mK; Wed, 23 Oct 2019 13:21:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E7E1250E0; Wed, 23 Oct 2019 13:21:16 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NDLGeq009181; Wed, 23 Oct 2019 13:21:16 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NDLGRe009167; Wed, 23 Oct 2019 13:21:16 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910231321.x9NDLGRe009167@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Wed, 23 Oct 2019 13:21:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353920 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 353920 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 13:21:16 -0000 Author: andrew Date: Wed Oct 23 13:21:15 2019 New Revision: 353920 URL: https://svnweb.freebsd.org/changeset/base/353920 Log: Stop enabling interrupts when reentering kdb on arm64 When we raise a data abort from the kernel we need to enable interrupts, however we shouldn't be doing this when in the kernel debugger. In this case interrupts can lead to a further panic as they don't expect to be run from such a context. MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/trap.c Modified: head/sys/arm64/arm64/trap.c ============================================================================== --- head/sys/arm64/arm64/trap.c Wed Oct 23 09:56:53 2019 (r353919) +++ head/sys/arm64/arm64/trap.c Wed Oct 23 13:21:15 2019 (r353920) @@ -179,6 +179,8 @@ data_abort(struct thread *td, struct trapframe *frame, if (lower) map = &p->p_vmspace->vm_map; else { + intr_enable(); + /* The top bit tells us which range to use */ if (far >= VM_MAXUSER_ADDRESS) { map = kernel_map; @@ -316,7 +318,6 @@ do_el1h_sync(struct thread *td, struct trapframe *fram case EXCP_INSN_ABORT: case EXCP_DATA_ABORT: far = READ_SPECIALREG(far_el1); - intr_enable(); data_abort(td, frame, esr, far, 0, exception == EXCP_INSN_ABORT); break; From owner-svn-src-all@freebsd.org Wed Oct 23 13:37:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3872152B75; Wed, 23 Oct 2019 13:37:52 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 46yrzM4dmjz47hF; Wed, 23 Oct 2019 13:37:51 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x9NDbhUO021432 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 23 Oct 2019 16:37:46 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x9NDbhUO021432 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x9NDbfWl021431; Wed, 23 Oct 2019 16:37:41 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 23 Oct 2019 16:37:41 +0300 From: Konstantin Belousov To: Bruce Evans Cc: Alan Somers , Andrew Turner , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r353640 - head/sys/kern Message-ID: <20191023133741.GT73312@kib.kiev.ua> References: <201910161321.x9GDL2ee021543@repo.freebsd.org> <20191023210546.L892@besplex.bde.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191023210546.L892@besplex.bde.org> User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 46yrzM4dmjz47hF X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=fail reason="No valid SPF, No valid DKIM" header.from=gmail.com (policy=none); spf=softfail (mx1.freebsd.org: 2001:470:d5e7:1::1 is neither permitted nor denied by domain of kostikbel@gmail.com) smtp.mailfrom=kostikbel@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; FREEMAIL_FROM(0.00)[gmail.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; HAS_XAW(0.00)[]; R_SPF_SOFTFAIL(0.00)[~all]; RCPT_COUNT_FIVE(0.00)[6]; IP_SCORE_FREEMAIL(0.00)[]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; IP_SCORE(0.00)[ip: (-2.78), ipnet: 2001:470::/32(-4.60), asn: 6939(-3.45), country: US(-0.05)]; FREEMAIL_TO(0.00)[optusnet.com.au]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:6939, ipnet:2001:470::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; FREEMAIL_ENVFROM(0.00)[gmail.com]; DMARC_POLICY_SOFTFAIL(0.10)[gmail.com : No valid SPF, No valid DKIM,none] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 13:37:52 -0000 On Wed, Oct 23, 2019 at 11:18:06PM +1100, Bruce Evans wrote: > On Tue, 22 Oct 2019, Alan Somers wrote: > > > On Wed, Oct 16, 2019 at 7:21 AM Andrew Turner wrote: > > > >> Author: andrew > >> Date: Wed Oct 16 13:21:01 2019 > >> New Revision: 353640 > >> URL: https://svnweb.freebsd.org/changeset/base/353640 > >> > >> Log: > >> Stop leaking information from the kernel through timespec > >> > >> The timespec struct holds a seconds value in a time_t and a nanoseconds > >> value in a long. On most architectures these are the same size, however > >> on 32-bit architectures other than i386 time_t is 8 bytes and long is > >> 4 bytes. > >> > >> Most ABIs will then pad a struct holding an 8 byte and 4 byte value to > >> 16 bytes with 4 bytes of padding. When copying one of these structs the > >> compiler is free to copy the padding if it wishes. > > I doubt that most ABIs pad the struct in that case. Pure 32-bit arches > don't have any 64-bit memory or register operations, so they use 32-bit > longs and don't pessimize structs with 64-bit types in them using padding. > > If there are any such ABIs, then there are thousands if not millions more > places to fix. Every place where a timespec is written must be checked. 32bit ARM requires 8-byte alignment for 64bit integers AFAIR. Also I believe that this is the only such 32bit architecture supported by FreeBSD. > > E.g., gettimeofday() reduces to microtime(). The implementation of > microtime() happens to fill the timeval fields separately. That always > leaks kernel context if struct timeval has padding and nothing else > zeros the padding. And for gettimeofday() it is especially clear that > nothing else zeros the padding. sys_gettimeofday() allocates a timeval > on the kernel stack; microtime() initializes its fields separately > leaving any padding untouched; copyout() then copies out kernel context. > > This commit attempts to fix the different problem that if lower levels > like microtime() were pessimized to initialize the padding, then callers > would have to be careful to preserve this by not using struct > assignments for copying structs. This is not easy to do. bcopy() and > copyout() should preserve memory, but there are no guarantees if the > struct is accessed in other ways. The fix in this commit can easily > not work on arches that have the problem: > > bzero(&tv); /* padding now all 0 */ > tv.tv_sec = another_tv_sec; > /* > * Padding now indeterminate (C99 6.2.6.1p6). It is reasonable > * for the implementation to use the padding on ABIs that have it, > * 64-bit stores of registers with uncleared kernel context gives > * gives the context leak. > */ > tv.tv_nsec = another_tv_nsec; > > I don't see anything in C99 that requires padding to remain unchanged > even with no stores in the program. > > This problem affects more than time_t's. It affects all padding. > > I next checked the simplest itimer call. sys_getitimer() doesn't > handle the problem, of course: it allocates a struct itimerval > aitimerval the kernel stack; kern_getitimer() allocates a struct timeval > ctv on the kernel stack; ctv is initialized 1 field at a time in most > cases so its padding remains uninitialized; aitv is inititialized using > a struct assignment in most cases so it has the problem that this > commit attempts to fix. > > This is just another bug in 64-bit time_t's, especially on 32-bit arches. > Instead of 32-bit time_t's which work until 2038 or 2106, we have subtle > security holes now. > > Bruce From owner-svn-src-all@freebsd.org Wed Oct 23 13:40:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BD31A152C20; Wed, 23 Oct 2019 13:40:39 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ys2b4h8Vz47yq; Wed, 23 Oct 2019 13:40:39 +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 84F922544C; Wed, 23 Oct 2019 13:40:39 +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 x9NDedDN020186; Wed, 23 Oct 2019 13:40:39 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NDednB020185; Wed, 23 Oct 2019 13:40:39 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910231340.x9NDednB020185@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 23 Oct 2019 13:40:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353921 - stable/12/sys/amd64/amd64 X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/amd64/amd64 X-SVN-Commit-Revision: 353921 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 13:40:39 -0000 Author: markj Date: Wed Oct 23 13:40:39 2019 New Revision: 353921 URL: https://svnweb.freebsd.org/changeset/base/353921 Log: MFC r352622: Set NX in mappings created by pmap_kenter() and pmap_kenter_attr(). Modified: stable/12/sys/amd64/amd64/pmap.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Wed Oct 23 13:21:15 2019 (r353920) +++ stable/12/sys/amd64/amd64/pmap.c Wed Oct 23 13:40:39 2019 (r353921) @@ -3135,7 +3135,7 @@ pmap_kenter(vm_offset_t va, vm_paddr_t pa) pt_entry_t *pte; pte = vtopte(va); - pte_store(pte, pa | X86_PG_RW | X86_PG_V | pg_g); + pte_store(pte, pa | X86_PG_RW | X86_PG_V | pg_g | pg_nx); } static __inline void @@ -3146,7 +3146,7 @@ pmap_kenter_attr(vm_offset_t va, vm_paddr_t pa, int mo pte = vtopte(va); cache_bits = pmap_cache_bits(kernel_pmap, mode, 0); - pte_store(pte, pa | X86_PG_RW | X86_PG_V | pg_g | cache_bits); + pte_store(pte, pa | X86_PG_RW | X86_PG_V | pg_g | pg_nx | cache_bits); } /* From owner-svn-src-all@freebsd.org Wed Oct 23 13:41:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 804D6152DF2; Wed, 23 Oct 2019 13:41:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ys3W2sBQz489G; Wed, 23 Oct 2019 13:41:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4548F254AA; Wed, 23 Oct 2019 13:41:27 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NDfR2q022508; Wed, 23 Oct 2019 13:41:27 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NDfRvt022507; Wed, 23 Oct 2019 13:41:27 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910231341.x9NDfRvt022507@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 23 Oct 2019 13:41:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353922 - stable/12/sys/powerpc/aim X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/powerpc/aim X-SVN-Commit-Revision: 353922 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 13:41:27 -0000 Author: markj Date: Wed Oct 23 13:41:26 2019 New Revision: 353922 URL: https://svnweb.freebsd.org/changeset/base/353922 Log: MFC r353650: Clear PGA_WRITEABLE in moea_pvo_remove(). Modified: stable/12/sys/powerpc/aim/mmu_oea.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/powerpc/aim/mmu_oea.c ============================================================================== --- stable/12/sys/powerpc/aim/mmu_oea.c Wed Oct 23 13:40:39 2019 (r353921) +++ stable/12/sys/powerpc/aim/mmu_oea.c Wed Oct 23 13:41:26 2019 (r353922) @@ -2120,23 +2120,26 @@ moea_pvo_remove(struct pvo_entry *pvo, int pteidx) pvo->pvo_pmap->pm_stats.wired_count--; /* + * Remove this PVO from the PV and pmap lists. + */ + LIST_REMOVE(pvo, pvo_vlink); + RB_REMOVE(pvo_tree, &pvo->pvo_pmap->pmap_pvo, pvo); + + /* * Save the REF/CHG bits into their cache if the page is managed. + * Clear PGA_WRITEABLE if all mappings of the page have been removed. */ if ((pvo->pvo_vaddr & PVO_MANAGED) == PVO_MANAGED) { - struct vm_page *pg; + struct vm_page *pg; pg = PHYS_TO_VM_PAGE(pvo->pvo_pte.pte.pte_lo & PTE_RPGN); if (pg != NULL) { moea_attr_save(pg, pvo->pvo_pte.pte.pte_lo & (PTE_REF | PTE_CHG)); + if (LIST_EMPTY(&pg->md.mdpg_pvoh)) + vm_page_aflag_clear(pg, PGA_WRITEABLE); } } - - /* - * Remove this PVO from the PV and pmap lists. - */ - LIST_REMOVE(pvo, pvo_vlink); - RB_REMOVE(pvo_tree, &pvo->pvo_pmap->pmap_pvo, pvo); /* * Remove this from the overflow list and return it to the pool From owner-svn-src-all@freebsd.org Wed Oct 23 13:41:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 926B3152E86; Wed, 23 Oct 2019 13:41:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ys3s3HNKz48KB; Wed, 23 Oct 2019 13:41:45 +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 54486254C2; Wed, 23 Oct 2019 13:41:45 +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 x9NDfjGR023200; Wed, 23 Oct 2019 13:41:45 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NDfieY023198; Wed, 23 Oct 2019 13:41:44 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910231341.x9NDfieY023198@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 23 Oct 2019 13:41:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353923 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 353923 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 13:41:45 -0000 Author: markj Date: Wed Oct 23 13:41:44 2019 New Revision: 353923 URL: https://svnweb.freebsd.org/changeset/base/353923 Log: MFC r353671: Use KOBJMETHOD_END in the kernel linker. Modified: stable/12/sys/kern/link_elf.c stable/12/sys/kern/link_elf_obj.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/link_elf.c ============================================================================== --- stable/12/sys/kern/link_elf.c Wed Oct 23 13:41:26 2019 (r353922) +++ stable/12/sys/kern/link_elf.c Wed Oct 23 13:41:44 2019 (r353923) @@ -179,7 +179,7 @@ static kobj_method_t link_elf_methods[] = { KOBJMETHOD(linker_ctf_get, link_elf_ctf_get), KOBJMETHOD(linker_symtab_get, link_elf_symtab_get), KOBJMETHOD(linker_strtab_get, link_elf_strtab_get), - { 0, 0 } + KOBJMETHOD_END }; static struct linker_class link_elf_class = { Modified: stable/12/sys/kern/link_elf_obj.c ============================================================================== --- stable/12/sys/kern/link_elf_obj.c Wed Oct 23 13:41:26 2019 (r353922) +++ stable/12/sys/kern/link_elf_obj.c Wed Oct 23 13:41:44 2019 (r353923) @@ -163,7 +163,7 @@ static kobj_method_t link_elf_methods[] = { KOBJMETHOD(linker_ctf_get, link_elf_ctf_get), KOBJMETHOD(linker_symtab_get, link_elf_symtab_get), KOBJMETHOD(linker_strtab_get, link_elf_strtab_get), - { 0, 0 } + KOBJMETHOD_END }; static struct linker_class link_elf_class = { From owner-svn-src-all@freebsd.org Wed Oct 23 13:41:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CDCC7152F4B; Wed, 23 Oct 2019 13:41:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ys4751D6z48SF; Wed, 23 Oct 2019 13:41:59 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8FDF4254D2; Wed, 23 Oct 2019 13:41:59 +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 x9NDfxR1023257; Wed, 23 Oct 2019 13:41:59 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NDfxOM023255; Wed, 23 Oct 2019 13:41:59 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910231341.x9NDfxOM023255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 23 Oct 2019 13:41:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353924 - in stable/12/sys: amd64/amd64 kern X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in stable/12/sys: amd64/amd64 kern X-SVN-Commit-Revision: 353924 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 13:41:59 -0000 Author: markj Date: Wed Oct 23 13:41:58 2019 New Revision: 353924 URL: https://svnweb.freebsd.org/changeset/base/353924 Log: MFC r352623: Use elf_relocaddr() when handling R_X86_64_RELATIVE relocations. Modified: stable/12/sys/amd64/amd64/elf_machdep.c stable/12/sys/kern/link_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/elf_machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/elf_machdep.c Wed Oct 23 13:41:44 2019 (r353923) +++ stable/12/sys/amd64/amd64/elf_machdep.c Wed Oct 23 13:41:58 2019 (r353924) @@ -268,7 +268,6 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas */ printf("kldload: unexpected R_COPY relocation\n"); return (-1); - break; case R_X86_64_GLOB_DAT: /* S */ case R_X86_64_JMP_SLOT: /* XXX need addend + offset */ @@ -280,7 +279,7 @@ elf_reloc_internal(linker_file_t lf, Elf_Addr relocbas break; case R_X86_64_RELATIVE: /* B + A */ - addr = relocbase + addend; + addr = elf_relocaddr(lf, relocbase + addend); val = addr; if (*where != val) *where = val; Modified: stable/12/sys/kern/link_elf.c ============================================================================== --- stable/12/sys/kern/link_elf.c Wed Oct 23 13:41:44 2019 (r353923) +++ stable/12/sys/kern/link_elf.c Wed Oct 23 13:41:58 2019 (r353924) @@ -1163,6 +1163,9 @@ elf_relocaddr(linker_file_t lf, Elf_Addr x) { elf_file_t ef; + KASSERT(lf->ops->cls == (kobj_class_t)&link_elf_class, + ("elf_relocaddr: unexpected linker file %p", lf)); + ef = (elf_file_t)lf; if (x >= ef->pcpu_start && x < ef->pcpu_stop) return ((x - ef->pcpu_start) + ef->pcpu_base); From owner-svn-src-all@freebsd.org Wed Oct 23 14:15:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B126B153D5C; Wed, 23 Oct 2019 14:15:17 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yspY4Dg6z4BH4; Wed, 23 Oct 2019 14:15:17 +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 74EB825B4D; Wed, 23 Oct 2019 14:15:17 +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 x9NEFHNX043456; Wed, 23 Oct 2019 14:15:17 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NEFHI6043455; Wed, 23 Oct 2019 14:15:17 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910231415.x9NEFHI6043455@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 23 Oct 2019 14:15:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353925 - stable/12/sys/dev/vt X-SVN-Group: stable-12 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/12/sys/dev/vt X-SVN-Commit-Revision: 353925 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 14:15:17 -0000 Author: emaste Date: Wed Oct 23 14:15:16 2019 New Revision: 353925 URL: https://svnweb.freebsd.org/changeset/base/353925 Log: MFC r353680: vt: remove comment that is not true since r259680 r259680 added support to vt(4) for printing double-width characters. Remove the comment that claims no support. Sponsored by: The FreeBSD Foundation Modified: stable/12/sys/dev/vt/vt_font.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/vt/vt_font.c ============================================================================== --- stable/12/sys/dev/vt/vt_font.c Wed Oct 23 13:41:58 2019 (r353924) +++ stable/12/sys/dev/vt/vt_font.c Wed Oct 23 14:15:16 2019 (r353925) @@ -92,11 +92,6 @@ vtfont_lookup(const struct vt_font *vf, term_char_t c) unsigned int normal_map; unsigned int bold_map; - /* - * No support for printing right hand sides for CJK fullwidth - * characters. Simply print a space and assume that the left - * hand side describes the entire character. - */ src = TCHAR_CHARACTER(c); if (TCHAR_FORMAT(c) & TF_CJK_RIGHT) { normal_map = VFNT_MAP_NORMAL_RIGHT; From owner-svn-src-all@freebsd.org Wed Oct 23 14:16:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7082A153DFE; Wed, 23 Oct 2019 14:16:35 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ysr32MC6z4BPf; Wed, 23 Oct 2019 14:16:35 +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 3424325B4F; Wed, 23 Oct 2019 14:16:35 +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 x9NEGZT2043563; Wed, 23 Oct 2019 14:16:35 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NEGZQ8043562; Wed, 23 Oct 2019 14:16:35 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910231416.x9NEGZQ8043562@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 23 Oct 2019 14:16:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353926 - stable/11/sys/dev/vt X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/dev/vt X-SVN-Commit-Revision: 353926 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 14:16:35 -0000 Author: emaste Date: Wed Oct 23 14:16:34 2019 New Revision: 353926 URL: https://svnweb.freebsd.org/changeset/base/353926 Log: MFC r353680: vt: remove comment that is not true since r259680 r259680 added support to vt(4) for printing double-width characters. Remove comment that claims no support. Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/dev/vt/vt_font.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/vt/vt_font.c ============================================================================== --- stable/11/sys/dev/vt/vt_font.c Wed Oct 23 14:15:16 2019 (r353925) +++ stable/11/sys/dev/vt/vt_font.c Wed Oct 23 14:16:34 2019 (r353926) @@ -90,11 +90,6 @@ vtfont_lookup(const struct vt_font *vf, term_char_t c) unsigned int normal_map; unsigned int bold_map; - /* - * No support for printing right hand sides for CJK fullwidth - * characters. Simply print a space and assume that the left - * hand side describes the entire character. - */ src = TCHAR_CHARACTER(c); if (TCHAR_FORMAT(c) & TF_CJK_RIGHT) { normal_map = VFNT_MAP_NORMAL_RIGHT; From owner-svn-src-all@freebsd.org Wed Oct 23 14:33:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0BE211543F3; Wed, 23 Oct 2019 14:33: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ytCx6WBqz4CKX; Wed, 23 Oct 2019 14:33:49 +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 C42F725ECE; Wed, 23 Oct 2019 14:33:49 +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 x9NEXnYL055126; Wed, 23 Oct 2019 14:33:49 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NEXnTH055125; Wed, 23 Oct 2019 14:33:49 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910231433.x9NEXnTH055125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 23 Oct 2019 14:33:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353927 - stable/11/sys/dev/usb/net X-SVN-Group: stable-11 X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: stable/11/sys/dev/usb/net X-SVN-Commit-Revision: 353927 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 14:33:50 -0000 Author: emaste Date: Wed Oct 23 14:33:49 2019 New Revision: 353927 URL: https://svnweb.freebsd.org/changeset/base/353927 Log: MFC r333095: if_smsc: fix reset check In smsc_phy_init function, when the driver was trying to reset PHY, it didn't poll for the correct bit (BMCR_RESET) to be cleared. Instead, it anded it with MII_BMCR (which is 0), so it just exited the loop. This issue was fixed in Linux in commit d94609200069. Submitted by: Arshan Khanifar Sponsored by: The FreeBSD Foundation Modified: stable/11/sys/dev/usb/net/if_smsc.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/usb/net/if_smsc.c ============================================================================== --- stable/11/sys/dev/usb/net/if_smsc.c Wed Oct 23 14:16:34 2019 (r353926) +++ stable/11/sys/dev/usb/net/if_smsc.c Wed Oct 23 14:33:49 2019 (r353927) @@ -1304,7 +1304,7 @@ smsc_phy_init(struct smsc_softc *sc) do { uether_pause(&sc->sc_ue, hz / 100); bmcr = smsc_miibus_readreg(sc->sc_ue.ue_dev, sc->sc_phyno, MII_BMCR); - } while ((bmcr & MII_BMCR) && ((ticks - start_ticks) < max_ticks)); + } while ((bmcr & BMCR_RESET) && ((ticks - start_ticks) < max_ticks)); if (((usb_ticks_t)(ticks - start_ticks)) >= max_ticks) { smsc_err_printf(sc, "PHY reset timed-out"); From owner-svn-src-all@freebsd.org Wed Oct 23 15:51:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D282B156855; Wed, 23 Oct 2019 15:51:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yvxV568Cz4HQ8; Wed, 23 Oct 2019 15:51:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 927B426BE1; Wed, 23 Oct 2019 15:51:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NFpQ5a000471; Wed, 23 Oct 2019 15:51:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NFpQbd000470; Wed, 23 Oct 2019 15:51:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910231551.x9NFpQbd000470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 23 Oct 2019 15:51:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353928 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353928 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 15:51:26 -0000 Author: kib Date: Wed Oct 23 15:51:26 2019 New Revision: 353928 URL: https://svnweb.freebsd.org/changeset/base/353928 Log: vn_printf(): Decode VI_TEXT_REF. Sponsored by: The FreeBSD Foundation MFC after: 3 days Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Oct 23 14:33:49 2019 (r353927) +++ head/sys/kern/vfs_subr.c Wed Oct 23 15:51:26 2019 (r353928) @@ -3832,8 +3832,10 @@ vn_printf(struct vnode *vp, const char *fmt, ...) strlcat(buf, "|VI_DOINGINACT", sizeof(buf)); if (vp->v_iflag & VI_OWEINACT) strlcat(buf, "|VI_OWEINACT", sizeof(buf)); + if (vp->v_iflag & VI_TEXT_REF) + strlcat(buf, "|VI_TEXT_REF", sizeof(buf)); flags = vp->v_iflag & ~(VI_MOUNT | VI_DOOMED | VI_FREE | - VI_ACTIVE | VI_DOINGINACT | VI_OWEINACT); + VI_ACTIVE | VI_DOINGINACT | VI_OWEINACT | VI_TEXT_REF); if (flags != 0) { snprintf(buf2, sizeof(buf2), "|VI(0x%lx)", flags); strlcat(buf, buf2, sizeof(buf)); From owner-svn-src-all@freebsd.org Wed Oct 23 16:05:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6448156E22; Wed, 23 Oct 2019 16:05:54 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ywGB2rSWz4J9x; Wed, 23 Oct 2019 16:05:54 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4555B26F24; Wed, 23 Oct 2019 16:05:54 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NG5sZu009252; Wed, 23 Oct 2019 16:05:54 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NG5qgi009243; Wed, 23 Oct 2019 16:05:52 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910231605.x9NG5qgi009243@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 23 Oct 2019 16:05:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353929 - head/lib/msun/amd64 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/lib/msun/amd64 X-SVN-Commit-Revision: 353929 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:05:54 -0000 Author: cem Date: Wed Oct 23 16:05:52 2019 New Revision: 353929 URL: https://svnweb.freebsd.org/changeset/base/353929 Log: libm: Add missing END() directives for amd64 routines No functional change. Related to D22122. Reviewed by: emaste, kib (earlier version both) Modified: head/lib/msun/amd64/e_remainder.S head/lib/msun/amd64/e_remainderf.S head/lib/msun/amd64/e_remainderl.S head/lib/msun/amd64/e_sqrtl.S head/lib/msun/amd64/s_llrintl.S head/lib/msun/amd64/s_logbl.S head/lib/msun/amd64/s_lrintl.S head/lib/msun/amd64/s_remquol.S head/lib/msun/amd64/s_rintl.S Modified: head/lib/msun/amd64/e_remainder.S ============================================================================== --- head/lib/msun/amd64/e_remainder.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/e_remainder.S Wed Oct 23 16:05:52 2019 (r353929) @@ -51,5 +51,6 @@ ENTRY(remainder) movsd -8(%rsp),%xmm0 fstp %st ret +END(remainder) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/e_remainderf.S ============================================================================== --- head/lib/msun/amd64/e_remainderf.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/e_remainderf.S Wed Oct 23 16:05:52 2019 (r353929) @@ -21,5 +21,6 @@ ENTRY(remainderf) movss -4(%rsp),%xmm0 fstp %st ret +END(remainderf) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/e_remainderl.S ============================================================================== --- head/lib/msun/amd64/e_remainderl.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/e_remainderl.S Wed Oct 23 16:05:52 2019 (r353929) @@ -46,5 +46,6 @@ ENTRY(remainderl) jne 1b fstp %st(1) ret +END(remainderl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/e_sqrtl.S ============================================================================== --- head/lib/msun/amd64/e_sqrtl.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/e_sqrtl.S Wed Oct 23 16:05:52 2019 (r353929) @@ -31,5 +31,6 @@ ENTRY(sqrtl) fldt 8(%rsp) fsqrt ret +END(sqrtl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/s_llrintl.S ============================================================================== --- head/lib/msun/amd64/s_llrintl.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/s_llrintl.S Wed Oct 23 16:05:52 2019 (r353929) @@ -33,5 +33,6 @@ ENTRY(llrintl) fistpll (%rsp) popq %rax ret +END(llrintl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/s_logbl.S ============================================================================== --- head/lib/msun/amd64/s_logbl.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/s_logbl.S Wed Oct 23 16:05:52 2019 (r353929) @@ -41,5 +41,6 @@ ENTRY(logbl) fxtract fstp %st ret +END(logbl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/s_lrintl.S ============================================================================== --- head/lib/msun/amd64/s_lrintl.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/s_lrintl.S Wed Oct 23 16:05:52 2019 (r353929) @@ -33,5 +33,6 @@ ENTRY(lrintl) fistpll (%rsp) popq %rax ret +END(lrintl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/s_remquol.S ============================================================================== --- head/lib/msun/amd64/s_remquol.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/s_remquol.S Wed Oct 23 16:05:52 2019 (r353929) @@ -60,5 +60,6 @@ ENTRY(remquol) /* Store the quotient and return. */ movl %eax,(%rdi) ret +END(remquol) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/amd64/s_rintl.S ============================================================================== --- head/lib/msun/amd64/s_rintl.S Wed Oct 23 15:51:26 2019 (r353928) +++ head/lib/msun/amd64/s_rintl.S Wed Oct 23 16:05:52 2019 (r353929) @@ -41,5 +41,6 @@ ENTRY(rintl) fldt 8(%rsp) frndint ret +END(rintl) .section .note.GNU-stack,"",%progbits From owner-svn-src-all@freebsd.org Wed Oct 23 16:06:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3ADC7156EF6; Wed, 23 Oct 2019 16:06:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ywHD0fqKz4JKx; Wed, 23 Oct 2019 16:06:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EF5AE26F27; Wed, 23 Oct 2019 16:06:47 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NG6lrn009337; Wed, 23 Oct 2019 16:06:47 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NG6lBH009336; Wed, 23 Oct 2019 16:06:47 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910231606.x9NG6lBH009336@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Wed, 23 Oct 2019 16:06:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353930 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 353930 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:06:48 -0000 Author: kib Date: Wed Oct 23 16:06:47 2019 New Revision: 353930 URL: https://svnweb.freebsd.org/changeset/base/353930 Log: Fix undefined behavior. Create a sequence point by ending a full expression for call to vspace() and use of the globals which are modified by vspace(). Reported and reviewed by: imp Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D22126 Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Wed Oct 23 16:05:52 2019 (r353929) +++ head/sys/kern/vfs_subr.c Wed Oct 23 16:06:47 2019 (r353930) @@ -1273,7 +1273,7 @@ vnlru_proc(void) { struct mount *mp, *nmp; unsigned long onumvnodes; - int done, force, trigger, usevnodes; + int done, force, trigger, usevnodes, vsp; bool reclaim_nc_src; EVENTHANDLER_REGISTER(shutdown_pre_sync, kproc_shutdown, vnlruproc, @@ -1301,7 +1301,8 @@ vnlru_proc(void) force = 1; vstir = 0; } - if (vspace() >= vlowat && force == 0) { + vsp = vspace(); + if (vsp >= vlowat && force == 0) { vnlruproc_sig = 0; wakeup(&vnlruproc_sig); msleep(vnlruproc, &vnode_free_list_mtx, @@ -1368,7 +1369,8 @@ vnlru_proc(void) * After becoming active to expand above low water, keep * active until above high water. */ - force = vspace() < vhiwat; + vsp = vspace(); + force = vsp < vhiwat; } } @@ -1447,8 +1449,10 @@ vtryrecycle(struct vnode *vp) static void vcheckspace(void) { + int vsp; - if (vspace() < vlowat && vnlruproc_sig == 0) { + vsp = vspace(); + if (vsp < vlowat && vnlruproc_sig == 0) { vnlruproc_sig = 1; wakeup(vnlruproc); } From owner-svn-src-all@freebsd.org Wed Oct 23 16:24:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FD4815757A; Wed, 23 Oct 2019 16:24:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46ywgN00y2z4KF2; Wed, 23 Oct 2019 16:24:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 41B556AF; Wed, 23 Oct 2019 16:24:15 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r353907 - head To: Jung-uk Kim , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910230005.x9N05TlT038682@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Wed, 23 Oct 2019 09:24:10 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <201910230005.x9N05TlT038682@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:24:16 -0000 On 10/22/19 5:05 PM, Jung-uk Kim wrote: > Author: jkim > Date: Wed Oct 23 00:05:29 2019 > New Revision: 353907 > URL: https://svnweb.freebsd.org/changeset/base/353907 > > Log: > Belatedly remove stale debug symbols after r339270. > > Reported by: danfe > MFC after: 3 days I still feel like these explicit entries shouldn't be needed since the original .so files are marked as OLD_LIBS and we add .debug entries for OLD_LIBS automatically. -- John Baldwin From owner-svn-src-all@freebsd.org Wed Oct 23 16:41:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FC811579A3; Wed, 23 Oct 2019 16:41:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yx3J3Fn0z4L6P; Wed, 23 Oct 2019 16:41:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 53F16275FE; Wed, 23 Oct 2019 16:41:32 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NGfWen031408; Wed, 23 Oct 2019 16:41:32 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NGfWeU031407; Wed, 23 Oct 2019 16:41:32 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910231641.x9NGfWeU031407@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 23 Oct 2019 16:41:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353931 - head/sys/riscv/include X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/riscv/include X-SVN-Commit-Revision: 353931 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:41:32 -0000 Author: jhb Date: Wed Oct 23 16:41:31 2019 New Revision: 353931 URL: https://svnweb.freebsd.org/changeset/base/353931 Log: Fix atomic_*cmpset32 on riscv64 with clang. The lr.w instruction used to read the value from memory sign-extends the value read from memory. GCC sign-extends the 32-bit comparison value passed in whereas clang currently does not. As a result, if the value being compared has the MSB set, the comparison fails for matching 32-bit values when compiled with clang. Use a cast to explicitly sign-extend the unsigned comparison value. This works with both GCC and clang. There is commentary in the RISC-V spec that suggests that GCC's approach is more correct, but it is not clear if the commentary in the RISC-V spec is binding. Reviewed by: mhorne Obtained from: Axiado MFC after: 2 weeks Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D22084 Modified: head/sys/riscv/include/atomic.h Modified: head/sys/riscv/include/atomic.h ============================================================================== --- head/sys/riscv/include/atomic.h Wed Oct 23 16:06:47 2019 (r353930) +++ head/sys/riscv/include/atomic.h Wed Oct 23 16:41:31 2019 (r353931) @@ -182,7 +182,7 @@ atomic_cmpset_32(volatile uint32_t *p, uint32_t cmpval "bnez %1, 0b\n" "1:" : "=&r" (tmp), "=&r" (res), "+A" (*p) - : "rJ" (cmpval), "rJ" (newval) + : "rJ" ((long)(int32_t)cmpval), "rJ" (newval) : "memory"); return (!res); @@ -207,7 +207,7 @@ atomic_fcmpset_32(volatile uint32_t *p, uint32_t *cmpv "sw %0, %3\n" /* Save old value */ "2:" : "=&r" (tmp), "=&r" (res), "+A" (*p), "+A" (*cmpval) - : "rJ" (*cmpval), "rJ" (newval) + : "rJ" ((long)(int32_t)*cmpval), "rJ" (newval) : "memory"); return (!res); From owner-svn-src-all@freebsd.org Wed Oct 23 16:43:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ACF76157BC1; Wed, 23 Oct 2019 16:43:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yx603mSkz4LP5; Wed, 23 Oct 2019 16:43:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6495727661; Wed, 23 Oct 2019 16:43:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NGhqXp033033; Wed, 23 Oct 2019 16:43:52 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NGhqU4033032; Wed, 23 Oct 2019 16:43:52 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910231643.x9NGhqU4033032@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Wed, 23 Oct 2019 16:43:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353932 - head X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 353932 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:43:52 -0000 Author: jhb Date: Wed Oct 23 16:43:51 2019 New Revision: 353932 URL: https://svnweb.freebsd.org/changeset/base/353932 Log: Strip "sf" suffix when generating a target triple. This fixes the target triple used when compiling riscv64sf with clang. Discussed with: mhorne MFC after: 2 weeks Sponsored by: DARPA Modified: head/Makefile.inc1 Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Wed Oct 23 16:41:31 2019 (r353931) +++ head/Makefile.inc1 Wed Oct 23 16:43:51 2019 (r353932) @@ -129,9 +129,9 @@ TARGET_ABI= gnueabi .endif .endif MACHINE_ABI?= unknown -MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd13.0 +MACHINE_TRIPLE?=${MACHINE_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${MACHINE_ABI}-freebsd13.0 TARGET_ABI?= unknown -TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/:C/hf$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd13.0 +TARGET_TRIPLE?= ${TARGET_ARCH:S/amd64/x86_64/:C/[hs]f$//:S/mipsn32/mips64/}-${TARGET_ABI}-freebsd13.0 KNOWN_ARCHES?= aarch64/arm64 \ amd64 \ arm \ From owner-svn-src-all@freebsd.org Wed Oct 23 16:48:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5337F157D71; Wed, 23 Oct 2019 16:48:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yxC62JRfz4LfP; Wed, 23 Oct 2019 16:48:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 31F642766A; Wed, 23 Oct 2019 16:48:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NGmI72033323; Wed, 23 Oct 2019 16:48:18 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NGmH10033319; Wed, 23 Oct 2019 16:48:17 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231648.x9NGmH10033319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 16:48:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353933 - in head: share/man/man5 tools/build/options X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head: share/man/man5 tools/build/options X-SVN-Commit-Revision: 353933 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:48:18 -0000 Author: dim Date: Wed Oct 23 16:48:17 2019 New Revision: 353933 URL: https://svnweb.freebsd.org/changeset/base/353933 Log: Slightly expand description of WITH_SHARED_TOOLCHAIN, add a corresponding WITHOUT_SHARED_TOOLCHAIN description, and regenerate src.conf(5). MFC after: 3 days Added: head/tools/build/options/WITHOUT_SHARED_TOOLCHAIN (contents, props changed) Modified: head/share/man/man5/src.conf.5 head/tools/build/options/WITH_SHARED_TOOLCHAIN Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Oct 23 16:43:51 2019 (r353932) +++ head/share/man/man5/src.conf.5 Wed Oct 23 16:48:17 2019 (r353933) @@ -1,6 +1,6 @@ .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman. .\" $FreeBSD$ -.Dd October 1, 2019 +.Dd October 23, 2019 .Dt SRC.CONF 5 .Os .Sh NAME @@ -197,7 +197,7 @@ as part of the normal system build. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_BINUTILS_BOOTSTRAP Set to not build binutils (as, ld, and objdump) as part of the bootstrap process. @@ -213,7 +213,7 @@ Set build binutils (as, ld, and objdump) as part of the bootstrap process. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_BLACKLIST Set this if you do not want to build .Xr blacklistd 8 @@ -268,7 +268,7 @@ and .Pa crtend.o . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and riscv/riscv64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_BSD_GREP Install BSD-licensed grep as '[ef]grep' instead of GNU grep. .It Va WITHOUT_BSNMP @@ -301,6 +301,9 @@ When set, it enforces these options: .It .Va WITHOUT_CASPER .El +.It Va WITHOUT_CAROOT +Set to not add the trusted certificates from the Mozilla NSS bundle to +base. .It Va WITHOUT_CASPER Set to not build Casper program and related libraries. .It Va WITH_CCACHE_BUILD @@ -410,7 +413,7 @@ is set explicitly) Set to build the Clang C/C++ compiler during the normal phase of the build. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_CLANG_BOOTSTRAP Set to not build the Clang C/C++ compiler during the bootstrap phase of the build. @@ -418,7 +421,7 @@ To be able to build the system, either gcc or clang bo enabled unless an alternate compiler is provided via XCC. .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_CLANG_BOOTSTRAP Set to build the Clang C/C++ compiler during the bootstrap phase of the build. .Pp @@ -438,7 +441,7 @@ Set to build the ARCMigrate, Rewriter and StaticAnalyz Clang C/C++ compiler. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_CLANG_IS_CC Set to install the GCC compiler as .Pa /usr/bin/cc , @@ -447,7 +450,7 @@ and .Pa /usr/bin/cpp . .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_CLANG_IS_CC Set to install the Clang C/C++ compiler as .Pa /usr/bin/cc , @@ -519,13 +522,13 @@ Set to not build .Xr cxgbetool 8 .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe and riscv/riscv64. +arm/arm, arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_CXGBETOOL Set to build .Xr cxgbetool 8 .Pp This is a default setting on -amd64/amd64, arm64/aarch64, i386/i386, powerpc/powerpc64 and sparc64/sparc64. +amd64/amd64, arm64/aarch64, i386/i386 and sparc64/sparc64. .It Va WITHOUT_CXX Set to not build .Xr c++ 1 @@ -680,7 +683,7 @@ and .Xr efivar 8 . .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_EFI Set to build .Xr efivar 3 @@ -751,7 +754,7 @@ amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarc Set to build and install gcc and g++. .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_GCC_BOOTSTRAP Set to not build gcc and g++ as part of the bootstrap process. You must enable either gcc or clang bootstrap to be able to build the system, @@ -764,7 +767,7 @@ amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarc Set to build gcc and g++ as part of the bootstrap process. .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_GCOV Set to not build the .Xr gcov 1 @@ -780,7 +783,7 @@ Set to build .Xr gdb 1 . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_GDB_LIBEXEC Set to install .Xr gdb 1 @@ -801,7 +804,7 @@ to be used as a fallback for if a newer version is not installed. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and riscv/riscv64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_GNUCXX Do not build the GNU C++ stack (g++, libstdc++). This is the default on platforms where clang is the system compiler. @@ -813,7 +816,7 @@ Build the GNU C++ stack (g++, libstdc++). This is the default on platforms where gcc is the system compiler. .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_GNU_DIFF Set to not build GNU .Xr diff 1 @@ -841,7 +844,7 @@ Set to build and install and dependent tests. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and sparc64/sparc64. .It Va WITHOUT_GPIO Set to not build .Xr gpioctl 8 @@ -857,7 +860,7 @@ Set to build the GPL'd version of the device tree comp instead of the BSD licensed one. .Pp This is a default setting on -mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITHOUT_GSSAPI Set to not build libgssapi. .It Va WITHOUT_HAST @@ -874,7 +877,7 @@ Set to build and install httpd Set to not build or install HyperV utilities. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +arm/arm, arm/armv6, arm/armv7, arm64/aarch64, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_HYPERV Set to build or install HyperV utilities. .Pp @@ -1056,12 +1059,12 @@ riscv/riscv64 and sparc64/sparc64. Set to build LLVM's lld linker. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLDB Set to not build the LLDB debugger. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +arm/arm, arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_LLDB Set to build the LLDB debugger. .Pp @@ -1074,7 +1077,7 @@ To be able to build the system, either Binutils or LLD enabled unless an alternate linker is provided via XLD. .Pp This is a default setting on -arm/arm, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +arm/arm, arm/armv6, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_LLD_BOOTSTRAP Set to build the LLD linker during the bootstrap phase of the build, and use it during buildworld and buildkernel. @@ -1085,7 +1088,7 @@ amd64/amd64, arm/armv7, arm64/aarch64 and i386/i386. Set to use GNU binutils ld as the system linker, instead of LLVM's LLD. .Pp This is a default setting on -arm/arm, arm/armv6, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +arm/arm, arm/armv6, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_LLD_IS_LD Set to use LLVM's LLD as the system linker, instead of GNU binutils ld. .Pp @@ -1104,17 +1107,17 @@ Set to build the tool. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_LIBUNWIND Set to use GCC's stack unwinder (instead of LLVM's libunwind). .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +arm/arm, arm/armv6, arm/armv7 and sparc64/sparc64. .It Va WITH_LLVM_LIBUNWIND Set to use LLVM's libunwind stack unwinder (instead of GCC's unwinder). .Pp This is a default setting on -amd64/amd64, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64. +amd64/amd64, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_AARCH64 Set to not build LLVM target support for AArch64. The @@ -1130,7 +1133,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_ALL Set to only build the required LLVM target support. This option is preferred to specific target support options. @@ -1167,7 +1170,7 @@ This option is always applied to the bootstrap compile LLVM is used. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_ARM Set to not build LLVM target support for ARM. The @@ -1183,7 +1186,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LLVM_TARGET_BPF Set to build LLVM target support for BPF. The @@ -1204,7 +1207,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_POWERPC Set to not build LLVM target support for PowerPC. The @@ -1220,7 +1223,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LLVM_TARGET_RISCV Set to build LLVM target support for RISC-V. The @@ -1241,7 +1244,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LLVM_TARGET_X86 Set to not build LLVM target support for X86. The @@ -1257,7 +1260,7 @@ The option should be used rather than this in most cases. .Pp This is a default setting on -amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +amd64/amd64, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LOADER_EFI_SECUREBOOT Enable building .Xr loader 8 @@ -1273,32 +1276,32 @@ endian mode. Disable inclusion of GELI crypto support in the boot chain binaries. .Pp This is a default setting on -powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +sparc64/sparc64. .It Va WITH_LOADER_GELI Set to build GELI bootloader support. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LOADER_LUA Set to not build LUA bindings for the boot loader. .Pp This is a default setting on -powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +sparc64/sparc64. .It Va WITH_LOADER_LUA Set to build LUA bindings for the boot loader. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITHOUT_LOADER_OFW Disable building of openfirmware bootloader components. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and riscv/riscv64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LOADER_OFW Set to build openfirmware bootloader components. .Pp This is a default setting on -powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe and sparc64/sparc64. +sparc64/sparc64. .It Va WITHOUT_LOADER_UBOOT Disable building of ubldr. .Pp @@ -1308,7 +1311,7 @@ amd64/amd64, arm64/aarch64, i386/i386, riscv/riscv64 a Set to build ubldr. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpc64 and powerpc/powerpcspe. +arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_LOADER_VERBOSE Set to build with extra verbose debugging in the loader. May explode already nearly too large loader over the limit. @@ -1317,10 +1320,10 @@ Use with care. .It Va WITH_LOADER_VERIEXEC Enable building .Xr loader 8 -with support for verifcation similar to Verified Exec. +with support for verification similar to Verified Exec. .Pp -It depends on -.Va WITH_BEARSSL +Depends on +.Va WITH_BEARSSL . When set, these options are also in effect: .Pp .Bl -inset -compact @@ -1329,6 +1332,14 @@ When set, these options are also in effect: .Va WITHOUT_LOADER_EFI_SECUREBOOT is set explicitly) .El +.It Va WITH_LOADER_VERIEXEC_PASS_MANIFEST +Enable building +.Xr loader 8 +with support to pass a verified manifest to the kernel. +The kernel has to be built with a module to parse the manifest. +.Pp +Depends on +.Va WITH_LOADER_VERIEXEC . .It Va WITHOUT_LOADER_ZFS Set to not build ZFS file system boot loader support. .It Va WITHOUT_LOCALES @@ -1460,13 +1471,13 @@ Set to not build .Xr mlx5tool 8 .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe and riscv/riscv64. +arm/arm, arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf and mips/mips64hf. .It Va WITH_MLX5TOOL Set to build .Xr mlx5tool 8 .Pp This is a default setting on -amd64/amd64, arm64/aarch64, i386/i386, powerpc/powerpc64 and sparc64/sparc64. +amd64/amd64, arm64/aarch64, i386/i386 and sparc64/sparc64. .It Va WITHOUT_NDIS Set to not build programs and libraries related to NDIS emulation support. @@ -1531,13 +1542,13 @@ and related programs. Set to not build nvme related tools and kernel modules. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +arm/arm, arm/armv6, arm/armv7, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_NVME Set to build nvme related tools and kernel modules. .Pp This is a default setting on -amd64/amd64, arm64/aarch64, i386/i386 and powerpc/powerpc64. +amd64/amd64, arm64/aarch64 and i386/i386. .It Va WITH_OFED Set to build the .Dq "OpenFabrics Enterprise Distribution" @@ -1552,12 +1563,12 @@ Enable building openldap support for kerberos. Set to not build LLVM's OpenMP runtime. .Pp This is a default setting on -arm/arm, arm/armv6, arm/armv7, arm64/aarch64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf, powerpc/powerpc, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +arm/arm, arm/armv6, arm/armv7, arm64/aarch64, riscv/riscv64, mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mips/mipsn32, mips/mipselhf, mips/mipshf, mips/mips64elhf, mips/mips64hf and sparc64/sparc64. .It Va WITH_OPENMP Set to build LLVM's OpenMP runtime. .Pp This is a default setting on -amd64/amd64, i386/i386 and powerpc/powerpc64. +amd64/amd64 and i386/i386. .It Va WITHOUT_OPENSSH Set to not build OpenSSH. .It Va WITHOUT_OPENSSL @@ -1641,7 +1652,7 @@ Set to build profiled libraries for use with .Xr gprof 8 . .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, mips/mipsel, mips/mips, mips/mipsn32, mips/mipselhf, mips/mipshf, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64, mips/mipsel, mips/mips, mips/mipsn32, mips/mipselhf, mips/mipshf and sparc64/sparc64. .It Va WITHOUT_QUOTAS Set to not build .Xr quota 1 @@ -1700,7 +1711,7 @@ Set to not build the .Bx 4.4 legacy docs. .It Va WITH_SHARED_TOOLCHAIN -Set to build the toolchain binaries shared. +Set to build the toolchain binaries as dynamically linked executables. The set includes .Xr cc 1 , .Xr make 1 @@ -1731,7 +1742,7 @@ mips/mipsel, mips/mips, mips/mips64el, mips/mips64, mi Set to build world with propolice stack smashing protection. .Pp This is a default setting on -amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, powerpc/powerpc, powerpc/powerpc64, powerpc/powerpcspe, riscv/riscv64 and sparc64/sparc64. +amd64/amd64, arm/arm, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and sparc64/sparc64. .It Va WITH_STAGING Enable staging of files to a stage tree. This can be best thought of as auto-install to @@ -1762,6 +1773,10 @@ Enable staging of man pages to stage tree. Enable staging of PROGs to stage tree. .It Va WITH_STALE_STAGED Check staged files are not stale. +.It Va WITHOUT_STATS +Set to neither build nor install +.Lb libstats +and dependent binaries. .It Va WITH_SVN Set to install .Xr svnlite 1 @@ -1948,8 +1963,8 @@ which loads the contents of verified manifests into th for use by .Xr mac_veriexec 4 .Pp -It depends on -.Va WITH_BEARSSL +Depends on +.Va WITH_BEARSSL . .It Va WITHOUT_VI Set to not build and install vi, view, ex and related programs. .It Va WITHOUT_VT Added: head/tools/build/options/WITHOUT_SHARED_TOOLCHAIN ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tools/build/options/WITHOUT_SHARED_TOOLCHAIN Wed Oct 23 16:48:17 2019 (r353933) @@ -0,0 +1,6 @@ +.\" $FreeBSD$ +Set to build the toolchain binaries as statically linked executables. +The set includes +.Xr cc 1 , +.Xr make 1 +and necessary utilities like assembler, linker and library archive manager. Modified: head/tools/build/options/WITH_SHARED_TOOLCHAIN ============================================================================== --- head/tools/build/options/WITH_SHARED_TOOLCHAIN Wed Oct 23 16:43:51 2019 (r353932) +++ head/tools/build/options/WITH_SHARED_TOOLCHAIN Wed Oct 23 16:48:17 2019 (r353933) @@ -1,5 +1,5 @@ .\" $FreeBSD$ -Set to build the toolchain binaries shared. +Set to build the toolchain binaries as dynamically linked executables. The set includes .Xr cc 1 , .Xr make 1 From owner-svn-src-all@freebsd.org Wed Oct 23 16:48:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A5BE157D93; Wed, 23 Oct 2019 16:48:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yxCC2fvHz4Lm2; Wed, 23 Oct 2019 16:48:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 383F72766B; Wed, 23 Oct 2019 16:48:23 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NGmNvv033373; Wed, 23 Oct 2019 16:48:23 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NGmNma033372; Wed, 23 Oct 2019 16:48:23 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910231648.x9NGmNma033372@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 23 Oct 2019 16:48:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353934 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353934 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:48:23 -0000 Author: cem Date: Wed Oct 23 16:48:22 2019 New Revision: 353934 URL: https://svnweb.freebsd.org/changeset/base/353934 Log: Prevent a panic when a driver provides bogus debugnet parameters This is just a bandaid; we should fix the driver(s) too. Introduced in r353685. PR: 241403 X-MFC-With: r353685 Reported by: np and others Modified: head/sys/net/debugnet.c Modified: head/sys/net/debugnet.c ============================================================================== --- head/sys/net/debugnet.c Wed Oct 23 16:48:17 2019 (r353933) +++ head/sys/net/debugnet.c Wed Oct 23 16:48:22 2019 (r353934) @@ -826,6 +826,15 @@ debugnet_any_ifnet_update(struct ifnet *ifp) nmbuf = ncl * (4 + nrxr); ncl *= nrxr; + /* + * Bandaid for drivers that (incorrectly) advertise LinkUp before their + * dn_init method is available. + */ + if (nmbuf == 0 || ncl == 0 || clsize == 0) { + printf("%s: Bad dn_init result from %s (ifp %p), ignoring.\n", + __func__, if_name(ifp), ifp); + return; + } dn_maybe_reinit_mbufs(nmbuf, ncl, clsize); } From owner-svn-src-all@freebsd.org Wed Oct 23 16:53:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 290E315803E; Wed, 23 Oct 2019 16:53:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yxKG0LL8z4MB9; Wed, 23 Oct 2019 16:53:38 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E3CD027830; Wed, 23 Oct 2019 16:53:37 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NGrbmT038862; Wed, 23 Oct 2019 16:53:37 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NGrbiO038861; Wed, 23 Oct 2019 16:53:37 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910231653.x9NGrbiO038861@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 23 Oct 2019 16:53:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353935 - head/sys/dev/ksyms X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/ksyms X-SVN-Commit-Revision: 353935 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:53:38 -0000 Author: markj Date: Wed Oct 23 16:53:37 2019 New Revision: 353935 URL: https://svnweb.freebsd.org/changeset/base/353935 Log: Set OBJ_NOSPLIT on the ksyms(4) VM object. The object does not provide anonymous memory. Reported by: kib Reviewed by: kib MFC after: 3 days Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22123 Modified: head/sys/dev/ksyms/ksyms.c Modified: head/sys/dev/ksyms/ksyms.c ============================================================================== --- head/sys/dev/ksyms/ksyms.c Wed Oct 23 16:48:22 2019 (r353934) +++ head/sys/dev/ksyms/ksyms.c Wed Oct 23 16:53:37 2019 (r353935) @@ -404,6 +404,7 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus { struct tsizes ts; struct ksyms_softc *sc; + vm_object_t object; vm_size_t elfsz; int error, try; @@ -441,8 +442,10 @@ ksyms_open(struct cdev *dev, int flags, int fmt __unus ksyms_size_calc(&ts); elfsz = sizeof(struct ksyms_hdr) + ts.ts_symsz + ts.ts_strsz; - sc->sc_obj = vm_object_allocate(OBJT_DEFAULT, + object = vm_object_allocate(OBJT_DEFAULT, OFF_TO_IDX(round_page(elfsz))); + vm_object_set_flag(object, OBJ_NOSPLIT); + sc->sc_obj = object; sc->sc_objsz = elfsz; error = ksyms_snapshot(sc, &ts); From owner-svn-src-all@freebsd.org Wed Oct 23 16:57:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 935631582B2; Wed, 23 Oct 2019 16:57:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yxPN32myz4MSp; Wed, 23 Oct 2019 16:57:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4C2242783A; Wed, 23 Oct 2019 16:57:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NGvCi2039112; Wed, 23 Oct 2019 16:57:12 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NGvCMD039111; Wed, 23 Oct 2019 16:57:12 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231657.x9NGvCMD039111@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 16:57:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353936 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch X-SVN-Commit-Revision: 353936 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 16:57:12 -0000 Author: dim Date: Wed Oct 23 16:57:11 2019 New Revision: 353936 URL: https://svnweb.freebsd.org/changeset/base/353936 Log: Bump clang's default target CPU for the i386 architecture (aka "x86") to i686, as per the discussion on the freebsd-arch mailing list. Earlier in r352030, I had already bumped it to i586, to work around missing atomic 64 bit functions for the i386 architecture. Relnotes: yes Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/X86.cpp Modified: head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/X86.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/X86.cpp Wed Oct 23 16:53:37 2019 (r353935) +++ head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/X86.cpp Wed Oct 23 16:57:11 2019 (r353936) @@ -93,10 +93,11 @@ const char *x86::getX86TargetCPU(const ArgList &Args, return "x86-64"; switch (Triple.getOS()) { + case llvm::Triple::FreeBSD: + return "i686"; case llvm::Triple::NetBSD: case llvm::Triple::OpenBSD: - return "i486"; - case llvm::Triple::FreeBSD: + return "i486"; case llvm::Triple::Haiku: return "i586"; default: From owner-svn-src-all@freebsd.org Wed Oct 23 17:02:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0417F158564; Wed, 23 Oct 2019 17:02:46 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yxWn6J5Lz4Mrj; Wed, 23 Oct 2019 17:02:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC42127A09; Wed, 23 Oct 2019 17:02:45 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NH2jVI045131; Wed, 23 Oct 2019 17:02:45 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NH2jQv045130; Wed, 23 Oct 2019 17:02:45 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231702.x9NH2jQv045130@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:02:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353937 - in head/share: man/man5 mk X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/share: man/man5 mk X-SVN-Commit-Revision: 353937 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:02:46 -0000 Author: dim Date: Wed Oct 23 17:02:45 2019 New Revision: 353937 URL: https://svnweb.freebsd.org/changeset/base/353937 Log: Build toolchain components as dynamically linked executables by default Summary: Historically, we have built toolchain components such as cc, ld, etc as statically linked executables. One of the reasons being that you could sometimes save yourself from botched upgrades, by e.g. recompiling a "known good" libc and reinstalling it. In this day and age, we have boot environments, virtual machine snapshots, cloud backups, and other much more reliable methods to restore systems to working order. So I think the time is ripe to flip this default, and link the toolchain components dynamically, just like almost all other executables on FreeBSD. Maybe at some point they can even become PIE executables by default! :) Reviewed by: kib MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D22061 Modified: head/share/man/man5/src.conf.5 head/share/mk/src.opts.mk Modified: head/share/man/man5/src.conf.5 ============================================================================== --- head/share/man/man5/src.conf.5 Wed Oct 23 16:57:11 2019 (r353936) +++ head/share/man/man5/src.conf.5 Wed Oct 23 17:02:45 2019 (r353937) @@ -1710,8 +1710,8 @@ as a set-user-ID root program. Set to not build the .Bx 4.4 legacy docs. -.It Va WITH_SHARED_TOOLCHAIN -Set to build the toolchain binaries as dynamically linked executables. +.It Va WITHOUT_SHARED_TOOLCHAIN +Set to build the toolchain binaries as statically linked executables. The set includes .Xr cc 1 , .Xr make 1 Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Wed Oct 23 16:57:11 2019 (r353936) +++ head/share/mk/src.opts.mk Wed Oct 23 17:02:45 2019 (r353937) @@ -166,6 +166,7 @@ __DEFAULT_YES_OPTIONS = \ SENDMAIL \ SERVICESDB \ SETUID_LOGIN \ + SHARED_TOOLCHAIN \ SHAREDOCS \ SOURCELESS \ SOURCELESS_HOST \ @@ -210,7 +211,6 @@ __DEFAULT_NO_OPTIONS = \ OPENLDAP \ REPRODUCIBLE_BUILD \ RPCBIND_WARMSTART_SUPPORT \ - SHARED_TOOLCHAIN \ SORT_THREADS \ SVN \ ZONEINFO_LEAPSECONDS_SUPPORT \ From owner-svn-src-all@freebsd.org Wed Oct 23 17:20:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 707A2158BCB; Wed, 23 Oct 2019 17:20:21 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yxw52MW1z4NX4; Wed, 23 Oct 2019 17:20:21 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 33CA427BED; Wed, 23 Oct 2019 17:20:21 +0000 (UTC) (envelope-from rstone@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NHKLV2051560; Wed, 23 Oct 2019 17:20:21 GMT (envelope-from rstone@FreeBSD.org) Received: (from rstone@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHKLFd051559; Wed, 23 Oct 2019 17:20:21 GMT (envelope-from rstone@FreeBSD.org) Message-Id: <201910231720.x9NHKLFd051559@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rstone set sender to rstone@FreeBSD.org using -f From: Ryan Stone Date: Wed, 23 Oct 2019 17:20:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353938 - head/sys/compat/linuxkpi/common/src X-SVN-Group: head X-SVN-Commit-Author: rstone X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/src X-SVN-Commit-Revision: 353938 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:20:21 -0000 Author: rstone Date: Wed Oct 23 17:20:20 2019 New Revision: 353938 URL: https://svnweb.freebsd.org/changeset/base/353938 Log: Add missing M_NOWAIT flag The LinuxKPI linux_dma code calls PCTRIE_INSERT with a mutex held, but does not set M_NOWAIT when allocating nodes, leading to a potential panic. All of this code can handle an allocation failure here, so prefer an allocation failure to sleeping on memory. Also fix a related case where NOWAIT/WAITOK was not specified. In this case it's not clear whether sleeping is allowed so be conservative and assume not. There are a lot of other paths in this code that can fail due to a lack of memory anyway. Differential Revision: https://reviews.freebsd.org/D22127 Reviewed by: imp Sponsored by: Dell EMC Isilon MFC After: 1 week Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c Modified: head/sys/compat/linuxkpi/common/src/linux_pci.c ============================================================================== --- head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Oct 23 17:02:45 2019 (r353937) +++ head/sys/compat/linuxkpi/common/src/linux_pci.c Wed Oct 23 17:20:20 2019 (r353938) @@ -500,7 +500,7 @@ static void * linux_dma_trie_alloc(struct pctrie *ptree) { - return (uma_zalloc(linux_dma_trie_zone, 0)); + return (uma_zalloc(linux_dma_trie_zone, M_NOWAIT)); } static void @@ -569,7 +569,10 @@ linux_dma_map_phys(struct device *dev, vm_paddr_t phys if (bus_dma_id_mapped(priv->dmat, phys, len)) return (phys); - obj = uma_zalloc(linux_dma_obj_zone, 0); + obj = uma_zalloc(linux_dma_obj_zone, M_NOWAIT); + if (obj == NULL) { + return (0); + } DMA_PRIV_LOCK(priv); if (bus_dmamap_create(priv->dmat, 0, &obj->dmamap) != 0) { From owner-svn-src-all@freebsd.org Wed Oct 23 17:28:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D2B9158E45; Wed, 23 Oct 2019 17:28:36 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yy5c0jmQz4Nxh; Wed, 23 Oct 2019 17:28:36 +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 ECC5027DA5; Wed, 23 Oct 2019 17:28:35 +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 x9NHSZF1057156; Wed, 23 Oct 2019 17:28:35 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHSZmr057155; Wed, 23 Oct 2019 17:28:35 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910231728.x9NHSZmr057155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Wed, 23 Oct 2019 17:28:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r353939 - stable/11/usr.bin/rpcgen X-SVN-Group: stable-11 X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: stable/11/usr.bin/rpcgen X-SVN-Commit-Revision: 353939 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:28:36 -0000 Author: brooks Date: Wed Oct 23 17:28:35 2019 New Revision: 353939 URL: https://svnweb.freebsd.org/changeset/base/353939 Log: MFC r353569: rpcgen: make compiler arglist allocation dynamic Limit argmax to an absurdly large value prevent overflow (no overflow possible on FreeBSD due to ARG_MAX). In CheriBSD we exceed the 19 non-NULL arguments in the static array. Add a simple size doubling allocator and increase the default to 32. GC remnants of support for fixed arguments. Reviewed by: archardson (prior version), James Clarke (prior version) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21971 Modified: stable/11/usr.bin/rpcgen/rpc_main.c Directory Properties: stable/11/ (props changed) Modified: stable/11/usr.bin/rpcgen/rpc_main.c ============================================================================== --- stable/11/usr.bin/rpcgen/rpc_main.c Wed Oct 23 17:20:20 2019 (r353938) +++ stable/11/usr.bin/rpcgen/rpc_main.c Wed Oct 23 17:28:35 2019 (r353939) @@ -93,19 +93,13 @@ static int allnc = nitems(allnv); */ static void addarg(const char *); /* add another argument to the list */ static void insarg(int, const char *); /* insert arg at specified location */ -static void clear_args(void); /* clear argument list */ static void checkfiles(const char *, const char *); /* check if out file already exists */ +static char **arglist; +static int argcount = 0; +static int argmax = 0; - -#define ARGLISTLEN 20 -#define FIXEDARGS 0 - -static char *arglist[ARGLISTLEN]; -static int argcount = FIXEDARGS; - - int nonfatalerrors; /* errors */ int inetdflag = 0; /* Support for inetd is disabled by default, use -I */ int pmflag = 0; /* Support for port monitors is disabled by default */ @@ -141,7 +135,6 @@ main(int argc, const char *argv[]) struct commandline cmd; (void) memset((char *)&cmd, 0, sizeof (struct commandline)); - clear_args(); if (!parseargs(argc, argv, &cmd)) usage(); /* @@ -273,16 +266,6 @@ add_warning(void) f_print(fout, " */\n\n"); } -/* clear list of arguments */ -static void -clear_args(void) -{ - int i; - for (i = FIXEDARGS; i < ARGLISTLEN; i++) - arglist[i] = NULL; - argcount = FIXEDARGS; -} - /* prepend C-preprocessor and flags before arguments */ static void prepend_cpp(void) @@ -921,21 +904,40 @@ do_registers(int argc, const char *argv[]) } /* - * Add another argument to the arg list + * Extend the argument list */ static void -addarg(const char *cp) +moreargs(void) { - if (argcount >= ARGLISTLEN) { - warnx("too many defines"); + char **newarglist; + + argmax = argmax == 0 ? 32 : argmax << 1; + if (argmax > INT_MAX / 4) { + warnx("refusing to allocate too many arguments"); crash(); - /*NOTREACHED*/ } + newarglist = realloc(arglist, argmax * sizeof(*arglist)); + if (newarglist == NULL) { + warnx("unable to allocate arglist"); + crash(); + } + free(arglist); + arglist = newarglist; +} + +/* + * Add another argument to the arg list + */ +static void +addarg(const char *cp) +{ + if (argcount >= argmax) + moreargs(); + if (cp != NULL) arglist[argcount++] = xstrdup(cp); else arglist[argcount++] = NULL; - } /* @@ -946,11 +948,8 @@ insarg(int place, const char *cp) { int i; - if (argcount >= ARGLISTLEN) { - warnx("too many defines"); - crash(); - /*NOTREACHED*/ - } + if (argcount >= argmax) + moreargs(); /* Move up existing arguments */ for (i = argcount - 1; i >= place; i--) From owner-svn-src-all@freebsd.org Wed Oct 23 17:51:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 56FA11599F0; Wed, 23 Oct 2019 17:51:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yycP1fxMz4S4j; Wed, 23 Oct 2019 17:51:49 +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 1B040340; Wed, 23 Oct 2019 17:51:49 +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 x9NHpnI6075701; Wed, 23 Oct 2019 17:51:49 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHpjoC075676; Wed, 23 Oct 2019 17:51:45 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231751.x9NHpjoC075676@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:51:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353940 - in vendor/llvm/dist: include/llvm include/llvm-c include/llvm-c/Transforms include/llvm/ADT include/llvm/Analysis include/llvm/Analysis/Utils include/llvm/BinaryFormat include... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/llvm/dist: include/llvm include/llvm-c include/llvm-c/Transforms include/llvm/ADT include/llvm/Analysis include/llvm/Analysis/Utils include/llvm/BinaryFormat include/llvm/BinaryFormat/ELFRel... X-SVN-Commit-Revision: 353940 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:51:49 -0000 Author: dim Date: Wed Oct 23 17:51:42 2019 New Revision: 353940 URL: https://svnweb.freebsd.org/changeset/base/353940 Log: Vendor import of stripped llvm trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/llvm/trunk@375505 Added: vendor/llvm/dist/include/llvm/ADT/DirectedGraph.h vendor/llvm/dist/include/llvm/Analysis/DDG.h vendor/llvm/dist/include/llvm/Analysis/DependenceGraphBuilder.h vendor/llvm/dist/include/llvm/Analysis/LoopCacheAnalysis.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/GISelKnownBits.h vendor/llvm/dist/include/llvm/CodeGen/LiveRangeCalc.h vendor/llvm/dist/include/llvm/CodeGen/MachineLoopUtils.h vendor/llvm/dist/include/llvm/CodeGen/ModuloSchedule.h vendor/llvm/dist/include/llvm/DebugInfo/GSYM/FileWriter.h vendor/llvm/dist/include/llvm/DebugInfo/GSYM/GsymCreator.h vendor/llvm/dist/include/llvm/DebugInfo/GSYM/GsymReader.h vendor/llvm/dist/include/llvm/DebugInfo/GSYM/Header.h vendor/llvm/dist/include/llvm/DebugInfo/GSYM/LineTable.h vendor/llvm/dist/include/llvm/ExecutionEngine/JITLink/MachO_arm64.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/SpeculateAnalyses.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/Speculation.h vendor/llvm/dist/include/llvm/IR/FixedMetadataKinds.def vendor/llvm/dist/include/llvm/MC/MCRegister.h vendor/llvm/dist/include/llvm/MCA/CodeEmitter.h vendor/llvm/dist/include/llvm/Object/TapiFile.h vendor/llvm/dist/include/llvm/Object/TapiUniversal.h vendor/llvm/dist/include/llvm/ObjectYAML/yaml2obj.h vendor/llvm/dist/include/llvm/Remarks/BitstreamRemarkContainer.h vendor/llvm/dist/include/llvm/Remarks/BitstreamRemarkParser.h vendor/llvm/dist/include/llvm/Remarks/BitstreamRemarkSerializer.h vendor/llvm/dist/include/llvm/Remarks/YAMLRemarkSerializer.h vendor/llvm/dist/include/llvm/Support/Alignment.h vendor/llvm/dist/include/llvm/Support/Automaton.h vendor/llvm/dist/include/llvm/Support/FileCollector.h vendor/llvm/dist/include/llvm/Support/TypeSize.h vendor/llvm/dist/include/llvm/TableGen/Automaton.td vendor/llvm/dist/include/llvm/Target/GlobalISel/Combine.td vendor/llvm/dist/include/llvm/TextAPI/MachO/Platform.h vendor/llvm/dist/include/llvm/TextAPI/MachO/Target.h vendor/llvm/dist/include/llvm/Transforms/Instrumentation/SanitizerCoverage.h vendor/llvm/dist/include/llvm/Transforms/Scalar/LowerConstantIntrinsics.h vendor/llvm/dist/include/llvm/Transforms/Utils/MisExpect.h vendor/llvm/dist/lib/Analysis/DDG.cpp vendor/llvm/dist/lib/Analysis/DependenceGraphBuilder.cpp vendor/llvm/dist/lib/Analysis/LoopCacheAnalysis.cpp vendor/llvm/dist/lib/Analysis/VFABIDemangling.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/GISelKnownBits.cpp vendor/llvm/dist/lib/CodeGen/MIRNamerPass.cpp vendor/llvm/dist/lib/CodeGen/MIRVRegNamerUtils.cpp vendor/llvm/dist/lib/CodeGen/MIRVRegNamerUtils.h vendor/llvm/dist/lib/CodeGen/MachineLoopUtils.cpp vendor/llvm/dist/lib/CodeGen/ModuloSchedule.cpp vendor/llvm/dist/lib/DebugInfo/GSYM/FileWriter.cpp vendor/llvm/dist/lib/DebugInfo/GSYM/GsymCreator.cpp vendor/llvm/dist/lib/DebugInfo/GSYM/GsymReader.cpp vendor/llvm/dist/lib/DebugInfo/GSYM/Header.cpp vendor/llvm/dist/lib/DebugInfo/GSYM/LineTable.cpp vendor/llvm/dist/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.cpp vendor/llvm/dist/lib/ExecutionEngine/JITLink/MachOLinkGraphBuilder.h vendor/llvm/dist/lib/ExecutionEngine/JITLink/MachO_arm64.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/SpeculateAnalyses.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/Speculation.cpp vendor/llvm/dist/lib/MCA/CodeEmitter.cpp vendor/llvm/dist/lib/Object/TapiFile.cpp vendor/llvm/dist/lib/Object/TapiUniversal.cpp vendor/llvm/dist/lib/ObjectYAML/COFFEmitter.cpp vendor/llvm/dist/lib/ObjectYAML/ELFEmitter.cpp vendor/llvm/dist/lib/ObjectYAML/MachOEmitter.cpp vendor/llvm/dist/lib/ObjectYAML/MinidumpEmitter.cpp vendor/llvm/dist/lib/ObjectYAML/WasmEmitter.cpp vendor/llvm/dist/lib/ObjectYAML/yaml2obj.cpp vendor/llvm/dist/lib/Remarks/BitstreamRemarkParser.cpp vendor/llvm/dist/lib/Remarks/BitstreamRemarkParser.h vendor/llvm/dist/lib/Remarks/BitstreamRemarkSerializer.cpp vendor/llvm/dist/lib/Remarks/RemarkSerializer.cpp vendor/llvm/dist/lib/Support/ABIBreak.cpp vendor/llvm/dist/lib/Support/FileCheckImpl.h vendor/llvm/dist/lib/Support/FileCollector.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64Combine.td vendor/llvm/dist/lib/Target/AArch64/AArch64StackOffset.h vendor/llvm/dist/lib/Target/AArch64/AArch64StackTaggingPreRA.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUPrintfRuntimeBinding.cpp vendor/llvm/dist/lib/Target/ARM/MVETailPredication.cpp vendor/llvm/dist/lib/Target/ARM/MVEVPTBlockPass.cpp vendor/llvm/dist/lib/Target/Mips/MipsPfmCounters.td vendor/llvm/dist/lib/Target/RISCV/RISCVCallLowering.cpp vendor/llvm/dist/lib/Target/RISCV/RISCVCallLowering.h vendor/llvm/dist/lib/Target/RISCV/RISCVInstructionSelector.cpp vendor/llvm/dist/lib/Target/RISCV/RISCVLegalizerInfo.cpp vendor/llvm/dist/lib/Target/RISCV/RISCVLegalizerInfo.h vendor/llvm/dist/lib/Target/RISCV/RISCVRegisterBankInfo.cpp vendor/llvm/dist/lib/Target/RISCV/RISCVRegisterBankInfo.h vendor/llvm/dist/lib/Target/RISCV/RISCVRegisterBanks.td vendor/llvm/dist/lib/Target/SystemZ/SystemZScheduleZ15.td vendor/llvm/dist/lib/Target/X86/X86AvoidTrailingCall.cpp vendor/llvm/dist/lib/TextAPI/MachO/Platform.cpp vendor/llvm/dist/lib/TextAPI/MachO/Target.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/ValueProfileCollector.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/ValueProfileCollector.h vendor/llvm/dist/lib/Transforms/Instrumentation/ValueProfilePlugins.inc vendor/llvm/dist/lib/Transforms/Scalar/LowerConstantIntrinsics.cpp vendor/llvm/dist/lib/Transforms/Utils/MisExpect.cpp vendor/llvm/dist/tools/llvm-ifs/ vendor/llvm/dist/tools/llvm-ifs/CMakeLists.txt vendor/llvm/dist/tools/llvm-ifs/LLVMBuild.txt vendor/llvm/dist/tools/llvm-ifs/llvm-ifs.cpp vendor/llvm/dist/tools/llvm-objcopy/CommonOpts.td vendor/llvm/dist/tools/llvm-objcopy/ELF/ELFConfig.cpp vendor/llvm/dist/tools/llvm-objcopy/ELF/ELFConfig.h vendor/llvm/dist/tools/llvm-objcopy/MachO/MachOLayoutBuilder.cpp vendor/llvm/dist/tools/llvm-objcopy/MachO/MachOLayoutBuilder.h vendor/llvm/dist/tools/llvm-reduce/ vendor/llvm/dist/tools/llvm-reduce/CMakeLists.txt vendor/llvm/dist/tools/llvm-reduce/DeltaManager.h vendor/llvm/dist/tools/llvm-reduce/LLVMBuild.txt vendor/llvm/dist/tools/llvm-reduce/TestRunner.cpp vendor/llvm/dist/tools/llvm-reduce/TestRunner.h vendor/llvm/dist/tools/llvm-reduce/deltas/ vendor/llvm/dist/tools/llvm-reduce/deltas/Delta.cpp vendor/llvm/dist/tools/llvm-reduce/deltas/Delta.h vendor/llvm/dist/tools/llvm-reduce/deltas/ReduceArguments.cpp vendor/llvm/dist/tools/llvm-reduce/deltas/ReduceArguments.h vendor/llvm/dist/tools/llvm-reduce/deltas/ReduceBasicBlocks.cpp vendor/llvm/dist/tools/llvm-reduce/deltas/ReduceBasicBlocks.h vendor/llvm/dist/tools/llvm-reduce/deltas/ReduceFunctions.cpp vendor/llvm/dist/tools/llvm-reduce/deltas/ReduceFunctions.h vendor/llvm/dist/tools/llvm-reduce/deltas/ReduceGlobalVars.cpp vendor/llvm/dist/tools/llvm-reduce/deltas/ReduceGlobalVars.h vendor/llvm/dist/tools/llvm-reduce/deltas/ReduceInstructions.cpp vendor/llvm/dist/tools/llvm-reduce/deltas/ReduceInstructions.h vendor/llvm/dist/tools/llvm-reduce/deltas/ReduceMetadata.cpp vendor/llvm/dist/tools/llvm-reduce/deltas/ReduceMetadata.h vendor/llvm/dist/tools/llvm-reduce/llvm-reduce.cpp vendor/llvm/dist/tools/vfabi-demangle-fuzzer/ vendor/llvm/dist/tools/vfabi-demangle-fuzzer/CMakeLists.txt vendor/llvm/dist/tools/vfabi-demangle-fuzzer/vfabi-demangler-fuzzer.cpp vendor/llvm/dist/utils/TableGen/DFAEmitter.cpp vendor/llvm/dist/utils/TableGen/DFAEmitter.h vendor/llvm/dist/utils/TableGen/GICombinerEmitter.cpp vendor/llvm/dist/utils/TableGen/GlobalISel/ vendor/llvm/dist/utils/TableGen/GlobalISel/CMakeLists.txt vendor/llvm/dist/utils/TableGen/GlobalISel/CodeExpander.cpp vendor/llvm/dist/utils/TableGen/GlobalISel/CodeExpander.h vendor/llvm/dist/utils/TableGen/GlobalISel/CodeExpansions.h vendor/llvm/dist/utils/add_argument_names.py (contents, props changed) vendor/llvm/dist/utils/llvm-locstats/ vendor/llvm/dist/utils/llvm-locstats/CMakeLists.txt vendor/llvm/dist/utils/llvm-locstats/llvm-locstats.py (contents, props changed) Deleted: vendor/llvm/dist/include/llvm/ADT/VariadicFunction.h vendor/llvm/dist/include/llvm/Support/JamCRC.h vendor/llvm/dist/include/llvm/Support/MutexGuard.h vendor/llvm/dist/include/llvm/Support/ScalableSize.h vendor/llvm/dist/include/llvm/Support/UniqueLock.h vendor/llvm/dist/lib/CodeGen/LiveRangeCalc.h vendor/llvm/dist/lib/ExecutionEngine/JITLink/MachOAtomGraphBuilder.cpp vendor/llvm/dist/lib/ExecutionEngine/JITLink/MachOAtomGraphBuilder.h vendor/llvm/dist/lib/Support/JamCRC.cpp vendor/llvm/dist/lib/Support/Mutex.cpp vendor/llvm/dist/lib/Support/Unix/Mutex.inc vendor/llvm/dist/lib/Support/Unix/RWMutex.inc vendor/llvm/dist/lib/Support/Windows/Mutex.inc vendor/llvm/dist/lib/Support/Windows/RWMutex.inc vendor/llvm/dist/lib/Target/SystemZ/SystemZExpandPseudo.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZScheduleArch13.td Modified: vendor/llvm/dist/include/llvm-c/Core.h vendor/llvm/dist/include/llvm-c/DebugInfo.h vendor/llvm/dist/include/llvm-c/Remarks.h vendor/llvm/dist/include/llvm-c/Transforms/IPO.h vendor/llvm/dist/include/llvm-c/Transforms/Scalar.h vendor/llvm/dist/include/llvm-c/lto.h vendor/llvm/dist/include/llvm/ADT/APFloat.h vendor/llvm/dist/include/llvm/ADT/APInt.h vendor/llvm/dist/include/llvm/ADT/Any.h vendor/llvm/dist/include/llvm/ADT/ArrayRef.h vendor/llvm/dist/include/llvm/ADT/DenseMap.h vendor/llvm/dist/include/llvm/ADT/DenseMapInfo.h vendor/llvm/dist/include/llvm/ADT/Hashing.h vendor/llvm/dist/include/llvm/ADT/IntervalMap.h vendor/llvm/dist/include/llvm/ADT/PointerIntPair.h vendor/llvm/dist/include/llvm/ADT/PointerUnion.h vendor/llvm/dist/include/llvm/ADT/STLExtras.h vendor/llvm/dist/include/llvm/ADT/SmallBitVector.h vendor/llvm/dist/include/llvm/ADT/Statistic.h vendor/llvm/dist/include/llvm/ADT/StringExtras.h vendor/llvm/dist/include/llvm/ADT/StringMap.h vendor/llvm/dist/include/llvm/ADT/StringRef.h vendor/llvm/dist/include/llvm/ADT/StringSet.h vendor/llvm/dist/include/llvm/ADT/TinyPtrVector.h vendor/llvm/dist/include/llvm/ADT/iterator_range.h vendor/llvm/dist/include/llvm/Analysis/AliasAnalysis.h vendor/llvm/dist/include/llvm/Analysis/AliasSetTracker.h vendor/llvm/dist/include/llvm/Analysis/AssumptionCache.h vendor/llvm/dist/include/llvm/Analysis/CFG.h vendor/llvm/dist/include/llvm/Analysis/CFLAndersAliasAnalysis.h vendor/llvm/dist/include/llvm/Analysis/CFLSteensAliasAnalysis.h vendor/llvm/dist/include/llvm/Analysis/CGSCCPassManager.h vendor/llvm/dist/include/llvm/Analysis/CaptureTracking.h vendor/llvm/dist/include/llvm/Analysis/DOTGraphTraitsPass.h vendor/llvm/dist/include/llvm/Analysis/DivergenceAnalysis.h vendor/llvm/dist/include/llvm/Analysis/GlobalsModRef.h vendor/llvm/dist/include/llvm/Analysis/InstructionSimplify.h vendor/llvm/dist/include/llvm/Analysis/LazyCallGraph.h vendor/llvm/dist/include/llvm/Analysis/LegacyDivergenceAnalysis.h vendor/llvm/dist/include/llvm/Analysis/Loads.h vendor/llvm/dist/include/llvm/Analysis/LoopAnalysisManager.h vendor/llvm/dist/include/llvm/Analysis/LoopInfo.h vendor/llvm/dist/include/llvm/Analysis/LoopInfoImpl.h vendor/llvm/dist/include/llvm/Analysis/MemoryBuiltins.h vendor/llvm/dist/include/llvm/Analysis/MemoryDependenceAnalysis.h vendor/llvm/dist/include/llvm/Analysis/MemorySSA.h vendor/llvm/dist/include/llvm/Analysis/MemorySSAUpdater.h vendor/llvm/dist/include/llvm/Analysis/MustExecute.h vendor/llvm/dist/include/llvm/Analysis/Passes.h vendor/llvm/dist/include/llvm/Analysis/ProfileSummaryInfo.h vendor/llvm/dist/include/llvm/Analysis/RegionInfoImpl.h vendor/llvm/dist/include/llvm/Analysis/ScalarEvolution.h vendor/llvm/dist/include/llvm/Analysis/ScalarEvolutionExpander.h vendor/llvm/dist/include/llvm/Analysis/TargetLibraryInfo.h vendor/llvm/dist/include/llvm/Analysis/TargetTransformInfo.h vendor/llvm/dist/include/llvm/Analysis/TargetTransformInfoImpl.h vendor/llvm/dist/include/llvm/Analysis/TypeMetadataUtils.h vendor/llvm/dist/include/llvm/Analysis/Utils/Local.h vendor/llvm/dist/include/llvm/Analysis/ValueTracking.h vendor/llvm/dist/include/llvm/Analysis/VectorUtils.h vendor/llvm/dist/include/llvm/BinaryFormat/Dwarf.def vendor/llvm/dist/include/llvm/BinaryFormat/Dwarf.h vendor/llvm/dist/include/llvm/BinaryFormat/ELF.h vendor/llvm/dist/include/llvm/BinaryFormat/ELFRelocs/AArch64.def vendor/llvm/dist/include/llvm/BinaryFormat/MachO.h vendor/llvm/dist/include/llvm/BinaryFormat/Magic.h vendor/llvm/dist/include/llvm/BinaryFormat/Minidump.h vendor/llvm/dist/include/llvm/BinaryFormat/MinidumpConstants.def vendor/llvm/dist/include/llvm/BinaryFormat/Wasm.h vendor/llvm/dist/include/llvm/BinaryFormat/XCOFF.h vendor/llvm/dist/include/llvm/Bitcode/BitcodeAnalyzer.h vendor/llvm/dist/include/llvm/Bitcode/LLVMBitCodes.h vendor/llvm/dist/include/llvm/Bitstream/BitCodes.h vendor/llvm/dist/include/llvm/Bitstream/BitstreamReader.h vendor/llvm/dist/include/llvm/CodeGen/AccelTable.h vendor/llvm/dist/include/llvm/CodeGen/AsmPrinter.h vendor/llvm/dist/include/llvm/CodeGen/BasicTTIImpl.h vendor/llvm/dist/include/llvm/CodeGen/CallingConvLower.h vendor/llvm/dist/include/llvm/CodeGen/DFAPacketizer.h vendor/llvm/dist/include/llvm/CodeGen/DIE.h vendor/llvm/dist/include/llvm/CodeGen/FastISel.h vendor/llvm/dist/include/llvm/CodeGen/FunctionLoweringInfo.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/CallLowering.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/CombinerHelper.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/CombinerInfo.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/ConstantFoldingMIRBuilder.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/IRTranslator.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/InstructionSelector.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/InstructionSelectorImpl.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/LegalizationArtifactCombiner.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/LegalizerHelper.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/LegalizerInfo.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/MIPatternMatch.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/MachineIRBuilder.h vendor/llvm/dist/include/llvm/CodeGen/GlobalISel/Utils.h vendor/llvm/dist/include/llvm/CodeGen/ISDOpcodes.h vendor/llvm/dist/include/llvm/CodeGen/LiveInterval.h vendor/llvm/dist/include/llvm/CodeGen/LiveIntervals.h vendor/llvm/dist/include/llvm/CodeGen/LiveRegUnits.h vendor/llvm/dist/include/llvm/CodeGen/MIRYamlMapping.h vendor/llvm/dist/include/llvm/CodeGen/MachineBasicBlock.h vendor/llvm/dist/include/llvm/CodeGen/MachineCombinerPattern.h vendor/llvm/dist/include/llvm/CodeGen/MachineDominators.h vendor/llvm/dist/include/llvm/CodeGen/MachineFrameInfo.h vendor/llvm/dist/include/llvm/CodeGen/MachineFunction.h vendor/llvm/dist/include/llvm/CodeGen/MachineInstr.h vendor/llvm/dist/include/llvm/CodeGen/MachineInstrBuilder.h vendor/llvm/dist/include/llvm/CodeGen/MachineMemOperand.h vendor/llvm/dist/include/llvm/CodeGen/MachineModuleInfo.h vendor/llvm/dist/include/llvm/CodeGen/MachineOperand.h vendor/llvm/dist/include/llvm/CodeGen/MachinePipeliner.h vendor/llvm/dist/include/llvm/CodeGen/MachinePostDominators.h vendor/llvm/dist/include/llvm/CodeGen/MachineRegionInfo.h vendor/llvm/dist/include/llvm/CodeGen/MachineRegisterInfo.h vendor/llvm/dist/include/llvm/CodeGen/MachineScheduler.h vendor/llvm/dist/include/llvm/CodeGen/PBQP/Math.h vendor/llvm/dist/include/llvm/CodeGen/Passes.h vendor/llvm/dist/include/llvm/CodeGen/Register.h vendor/llvm/dist/include/llvm/CodeGen/RegisterClassInfo.h vendor/llvm/dist/include/llvm/CodeGen/RegisterPressure.h vendor/llvm/dist/include/llvm/CodeGen/RegisterScavenging.h vendor/llvm/dist/include/llvm/CodeGen/ScheduleDAGInstrs.h vendor/llvm/dist/include/llvm/CodeGen/SelectionDAG.h vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGISel.h vendor/llvm/dist/include/llvm/CodeGen/SelectionDAGNodes.h vendor/llvm/dist/include/llvm/CodeGen/StackProtector.h vendor/llvm/dist/include/llvm/CodeGen/SwitchLoweringUtils.h vendor/llvm/dist/include/llvm/CodeGen/TargetCallingConv.h vendor/llvm/dist/include/llvm/CodeGen/TargetFrameLowering.h vendor/llvm/dist/include/llvm/CodeGen/TargetInstrInfo.h vendor/llvm/dist/include/llvm/CodeGen/TargetLowering.h vendor/llvm/dist/include/llvm/CodeGen/TargetLoweringObjectFileImpl.h vendor/llvm/dist/include/llvm/CodeGen/TargetPassConfig.h vendor/llvm/dist/include/llvm/CodeGen/TargetRegisterInfo.h vendor/llvm/dist/include/llvm/CodeGen/TargetSubtargetInfo.h vendor/llvm/dist/include/llvm/CodeGen/ValueTypes.h vendor/llvm/dist/include/llvm/CodeGen/ValueTypes.td vendor/llvm/dist/include/llvm/CodeGen/VirtRegMap.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/CVTypeVisitor.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/CodeViewRecordIO.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/CodeViewRegisters.def vendor/llvm/dist/include/llvm/DebugInfo/CodeView/EnumTables.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/SymbolDeserializer.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/SymbolRecord.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/TypeDeserializer.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/TypeRecordMapping.h vendor/llvm/dist/include/llvm/DebugInfo/CodeView/TypeVisitorCallbackPipeline.h vendor/llvm/dist/include/llvm/DebugInfo/DIContext.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFAbbreviationDeclaration.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFAcceleratorTable.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFAttribute.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFContext.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFDataExtractor.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFDebugAddr.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFDebugArangeSet.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFDebugAranges.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFDebugLine.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFDebugLoc.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFDebugPubTable.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFDebugRangeList.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFDebugRnglists.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFDie.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFExpression.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFFormValue.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFListTable.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFObject.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFTypeUnit.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFUnit.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFUnitIndex.h vendor/llvm/dist/include/llvm/DebugInfo/DWARF/DWARFVerifier.h vendor/llvm/dist/include/llvm/DebugInfo/GSYM/FileEntry.h vendor/llvm/dist/include/llvm/DebugInfo/GSYM/FunctionInfo.h vendor/llvm/dist/include/llvm/DebugInfo/GSYM/InlineInfo.h vendor/llvm/dist/include/llvm/DebugInfo/GSYM/LineEntry.h vendor/llvm/dist/include/llvm/DebugInfo/GSYM/Range.h vendor/llvm/dist/include/llvm/DebugInfo/GSYM/StringTable.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/GenericError.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/Native/SymbolCache.h vendor/llvm/dist/include/llvm/DebugInfo/PDB/PDBSymbol.h vendor/llvm/dist/include/llvm/DebugInfo/Symbolize/Symbolize.h vendor/llvm/dist/include/llvm/Demangle/Demangle.h vendor/llvm/dist/include/llvm/Demangle/DemangleConfig.h vendor/llvm/dist/include/llvm/Demangle/ItaniumDemangle.h vendor/llvm/dist/include/llvm/Demangle/MicrosoftDemangle.h vendor/llvm/dist/include/llvm/Demangle/MicrosoftDemangleNodes.h vendor/llvm/dist/include/llvm/ExecutionEngine/JITLink/EHFrameSupport.h vendor/llvm/dist/include/llvm/ExecutionEngine/JITLink/JITLink.h vendor/llvm/dist/include/llvm/ExecutionEngine/JITLink/JITLinkMemoryManager.h vendor/llvm/dist/include/llvm/ExecutionEngine/JITLink/MachO_x86_64.h vendor/llvm/dist/include/llvm/ExecutionEngine/JITSymbol.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/CompileOnDemandLayer.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/Core.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/ExecutionUtils.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/IRTransformLayer.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/LLJIT.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/LambdaResolver.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/LazyEmittingLayer.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/LazyReexports.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/Legacy.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/ObjectLinkingLayer.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/OrcRemoteTargetClient.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/RPCSerialization.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/RPCUtils.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/RemoteObjectLayer.h vendor/llvm/dist/include/llvm/ExecutionEngine/Orc/ThreadSafeModule.h vendor/llvm/dist/include/llvm/ExecutionEngine/RuntimeDyld.h vendor/llvm/dist/include/llvm/IR/Attributes.h vendor/llvm/dist/include/llvm/IR/AutoUpgrade.h vendor/llvm/dist/include/llvm/IR/BasicBlock.h vendor/llvm/dist/include/llvm/IR/CallSite.h vendor/llvm/dist/include/llvm/IR/CallingConv.h vendor/llvm/dist/include/llvm/IR/Constant.h vendor/llvm/dist/include/llvm/IR/ConstantRange.h vendor/llvm/dist/include/llvm/IR/DataLayout.h vendor/llvm/dist/include/llvm/IR/DebugInfoFlags.def vendor/llvm/dist/include/llvm/IR/DebugInfoMetadata.h vendor/llvm/dist/include/llvm/IR/DerivedTypes.h vendor/llvm/dist/include/llvm/IR/DiagnosticInfo.h vendor/llvm/dist/include/llvm/IR/Function.h vendor/llvm/dist/include/llvm/IR/GlobalAlias.h vendor/llvm/dist/include/llvm/IR/GlobalIFunc.h vendor/llvm/dist/include/llvm/IR/GlobalIndirectSymbol.h vendor/llvm/dist/include/llvm/IR/GlobalObject.h vendor/llvm/dist/include/llvm/IR/GlobalVariable.h vendor/llvm/dist/include/llvm/IR/IRBuilder.h vendor/llvm/dist/include/llvm/IR/InlineAsm.h vendor/llvm/dist/include/llvm/IR/InstrTypes.h vendor/llvm/dist/include/llvm/IR/Instruction.h vendor/llvm/dist/include/llvm/IR/Instructions.h vendor/llvm/dist/include/llvm/IR/IntrinsicInst.h vendor/llvm/dist/include/llvm/IR/Intrinsics.h vendor/llvm/dist/include/llvm/IR/Intrinsics.td vendor/llvm/dist/include/llvm/IR/IntrinsicsAArch64.td vendor/llvm/dist/include/llvm/IR/IntrinsicsAMDGPU.td vendor/llvm/dist/include/llvm/IR/IntrinsicsARM.td vendor/llvm/dist/include/llvm/IR/IntrinsicsBPF.td vendor/llvm/dist/include/llvm/IR/IntrinsicsMips.td vendor/llvm/dist/include/llvm/IR/IntrinsicsNVVM.td vendor/llvm/dist/include/llvm/IR/IntrinsicsWebAssembly.td vendor/llvm/dist/include/llvm/IR/IntrinsicsX86.td vendor/llvm/dist/include/llvm/IR/LLVMContext.h vendor/llvm/dist/include/llvm/IR/MDBuilder.h vendor/llvm/dist/include/llvm/IR/Metadata.h vendor/llvm/dist/include/llvm/IR/Module.h vendor/llvm/dist/include/llvm/IR/ModuleSummaryIndex.h vendor/llvm/dist/include/llvm/IR/ModuleSummaryIndexYAML.h vendor/llvm/dist/include/llvm/IR/Operator.h vendor/llvm/dist/include/llvm/IR/PassManager.h vendor/llvm/dist/include/llvm/IR/PassManagerInternal.h vendor/llvm/dist/include/llvm/IR/PatternMatch.h vendor/llvm/dist/include/llvm/IR/RemarkStreamer.h vendor/llvm/dist/include/llvm/IR/Type.h vendor/llvm/dist/include/llvm/IR/User.h vendor/llvm/dist/include/llvm/IR/Value.h vendor/llvm/dist/include/llvm/IR/ValueMap.h vendor/llvm/dist/include/llvm/InitializePasses.h vendor/llvm/dist/include/llvm/LTO/Config.h vendor/llvm/dist/include/llvm/LTO/LTO.h vendor/llvm/dist/include/llvm/LTO/legacy/LTOCodeGenerator.h vendor/llvm/dist/include/llvm/LinkAllPasses.h vendor/llvm/dist/include/llvm/MC/MCAsmInfo.h vendor/llvm/dist/include/llvm/MC/MCAsmInfoXCOFF.h vendor/llvm/dist/include/llvm/MC/MCAsmMacro.h vendor/llvm/dist/include/llvm/MC/MCContext.h vendor/llvm/dist/include/llvm/MC/MCDirectives.h vendor/llvm/dist/include/llvm/MC/MCDwarf.h vendor/llvm/dist/include/llvm/MC/MCExpr.h vendor/llvm/dist/include/llvm/MC/MCFixup.h vendor/llvm/dist/include/llvm/MC/MCFragment.h vendor/llvm/dist/include/llvm/MC/MCInstPrinter.h vendor/llvm/dist/include/llvm/MC/MCInstrAnalysis.h vendor/llvm/dist/include/llvm/MC/MCInstrDesc.h vendor/llvm/dist/include/llvm/MC/MCLinkerOptimizationHint.h vendor/llvm/dist/include/llvm/MC/MCRegisterInfo.h vendor/llvm/dist/include/llvm/MC/MCSection.h vendor/llvm/dist/include/llvm/MC/MCSectionXCOFF.h vendor/llvm/dist/include/llvm/MC/MCStreamer.h vendor/llvm/dist/include/llvm/MC/MCSubtargetInfo.h vendor/llvm/dist/include/llvm/MC/MCSymbolWasm.h vendor/llvm/dist/include/llvm/MC/MCSymbolXCOFF.h vendor/llvm/dist/include/llvm/MC/MCWasmObjectWriter.h vendor/llvm/dist/include/llvm/MC/MCXCOFFStreamer.h vendor/llvm/dist/include/llvm/MC/StringTableBuilder.h vendor/llvm/dist/include/llvm/MC/SubtargetFeature.h vendor/llvm/dist/include/llvm/MCA/Context.h vendor/llvm/dist/include/llvm/MCA/HardwareUnits/LSUnit.h vendor/llvm/dist/include/llvm/MCA/HardwareUnits/RegisterFile.h vendor/llvm/dist/include/llvm/MCA/HardwareUnits/ResourceManager.h vendor/llvm/dist/include/llvm/MCA/HardwareUnits/RetireControlUnit.h vendor/llvm/dist/include/llvm/MCA/HardwareUnits/Scheduler.h vendor/llvm/dist/include/llvm/MCA/Instruction.h vendor/llvm/dist/include/llvm/MCA/SourceMgr.h vendor/llvm/dist/include/llvm/MCA/Stages/RetireStage.h vendor/llvm/dist/include/llvm/Object/Archive.h vendor/llvm/dist/include/llvm/Object/Binary.h vendor/llvm/dist/include/llvm/Object/COFF.h vendor/llvm/dist/include/llvm/Object/ELF.h vendor/llvm/dist/include/llvm/Object/ELFObjectFile.h vendor/llvm/dist/include/llvm/Object/ELFTypes.h vendor/llvm/dist/include/llvm/Object/MachO.h vendor/llvm/dist/include/llvm/Object/MachOUniversal.h vendor/llvm/dist/include/llvm/Object/Minidump.h vendor/llvm/dist/include/llvm/Object/ObjectFile.h vendor/llvm/dist/include/llvm/Object/StackMapParser.h vendor/llvm/dist/include/llvm/Object/WindowsResource.h vendor/llvm/dist/include/llvm/Object/XCOFFObjectFile.h vendor/llvm/dist/include/llvm/ObjectYAML/DWARFYAML.h vendor/llvm/dist/include/llvm/ObjectYAML/ELFYAML.h vendor/llvm/dist/include/llvm/ObjectYAML/MachOYAML.h vendor/llvm/dist/include/llvm/ObjectYAML/MinidumpYAML.h vendor/llvm/dist/include/llvm/ObjectYAML/WasmYAML.h vendor/llvm/dist/include/llvm/Pass.h vendor/llvm/dist/include/llvm/Passes/PassBuilder.h vendor/llvm/dist/include/llvm/ProfileData/Coverage/CoverageMapping.h vendor/llvm/dist/include/llvm/ProfileData/Coverage/CoverageMappingWriter.h vendor/llvm/dist/include/llvm/ProfileData/InstrProf.h vendor/llvm/dist/include/llvm/ProfileData/InstrProfReader.h vendor/llvm/dist/include/llvm/ProfileData/SampleProf.h vendor/llvm/dist/include/llvm/ProfileData/SampleProfReader.h vendor/llvm/dist/include/llvm/ProfileData/SampleProfWriter.h vendor/llvm/dist/include/llvm/Remarks/Remark.h vendor/llvm/dist/include/llvm/Remarks/RemarkFormat.h vendor/llvm/dist/include/llvm/Remarks/RemarkParser.h vendor/llvm/dist/include/llvm/Remarks/RemarkSerializer.h vendor/llvm/dist/include/llvm/Remarks/RemarkStringTable.h vendor/llvm/dist/include/llvm/Support/AArch64TargetParser.def vendor/llvm/dist/include/llvm/Support/AArch64TargetParser.h vendor/llvm/dist/include/llvm/Support/ARMTargetParser.def vendor/llvm/dist/include/llvm/Support/ARMTargetParser.h vendor/llvm/dist/include/llvm/Support/AlignOf.h vendor/llvm/dist/include/llvm/Support/Allocator.h vendor/llvm/dist/include/llvm/Support/BinaryStreamArray.h vendor/llvm/dist/include/llvm/Support/BinaryStreamReader.h vendor/llvm/dist/include/llvm/Support/CRC.h vendor/llvm/dist/include/llvm/Support/CommandLine.h vendor/llvm/dist/include/llvm/Support/Compiler.h vendor/llvm/dist/include/llvm/Support/DataExtractor.h vendor/llvm/dist/include/llvm/Support/Endian.h vendor/llvm/dist/include/llvm/Support/Error.h vendor/llvm/dist/include/llvm/Support/FileCheck.h vendor/llvm/dist/include/llvm/Support/FileSystem.h vendor/llvm/dist/include/llvm/Support/FileUtilities.h vendor/llvm/dist/include/llvm/Support/Format.h vendor/llvm/dist/include/llvm/Support/GenericDomTree.h vendor/llvm/dist/include/llvm/Support/GenericDomTreeConstruction.h vendor/llvm/dist/include/llvm/Support/GlobPattern.h vendor/llvm/dist/include/llvm/Support/Host.h vendor/llvm/dist/include/llvm/Support/MachineValueType.h vendor/llvm/dist/include/llvm/Support/MathExtras.h vendor/llvm/dist/include/llvm/Support/Mutex.h vendor/llvm/dist/include/llvm/Support/OnDiskHashTable.h vendor/llvm/dist/include/llvm/Support/Parallel.h vendor/llvm/dist/include/llvm/Support/RWMutex.h vendor/llvm/dist/include/llvm/Support/Regex.h vendor/llvm/dist/include/llvm/Support/Registry.h vendor/llvm/dist/include/llvm/Support/SHA1.h vendor/llvm/dist/include/llvm/Support/Signals.h vendor/llvm/dist/include/llvm/Support/SwapByteOrder.h vendor/llvm/dist/include/llvm/Support/TargetOpcodes.def vendor/llvm/dist/include/llvm/Support/TargetRegistry.h vendor/llvm/dist/include/llvm/Support/TimeProfiler.h vendor/llvm/dist/include/llvm/Support/TrailingObjects.h vendor/llvm/dist/include/llvm/Support/UnicodeCharRanges.h vendor/llvm/dist/include/llvm/Support/VirtualFileSystem.h vendor/llvm/dist/include/llvm/Support/Win64EH.h vendor/llvm/dist/include/llvm/Support/X86TargetParser.def vendor/llvm/dist/include/llvm/Support/YAMLTraits.h vendor/llvm/dist/include/llvm/Support/circular_raw_ostream.h vendor/llvm/dist/include/llvm/Support/raw_ostream.h vendor/llvm/dist/include/llvm/Support/type_traits.h vendor/llvm/dist/include/llvm/TableGen/Error.h vendor/llvm/dist/include/llvm/TableGen/Record.h vendor/llvm/dist/include/llvm/Target/GenericOpcodes.td vendor/llvm/dist/include/llvm/Target/GlobalISel/SelectionDAGCompat.td vendor/llvm/dist/include/llvm/Target/Target.td vendor/llvm/dist/include/llvm/Target/TargetCallingConv.td vendor/llvm/dist/include/llvm/Target/TargetItinerary.td vendor/llvm/dist/include/llvm/Target/TargetLoweringObjectFile.h vendor/llvm/dist/include/llvm/Target/TargetMachine.h vendor/llvm/dist/include/llvm/Target/TargetSchedule.td vendor/llvm/dist/include/llvm/Target/TargetSelectionDAG.td vendor/llvm/dist/include/llvm/TextAPI/MachO/Architecture.h vendor/llvm/dist/include/llvm/TextAPI/MachO/ArchitectureSet.h vendor/llvm/dist/include/llvm/TextAPI/MachO/InterfaceFile.h vendor/llvm/dist/include/llvm/TextAPI/MachO/Symbol.h vendor/llvm/dist/include/llvm/TextAPI/MachO/TextAPIReader.h vendor/llvm/dist/include/llvm/Transforms/IPO/Attributor.h vendor/llvm/dist/include/llvm/Transforms/IPO/GlobalDCE.h vendor/llvm/dist/include/llvm/Transforms/IPO/HotColdSplitting.h vendor/llvm/dist/include/llvm/Transforms/IPO/LowerTypeTests.h vendor/llvm/dist/include/llvm/Transforms/IPO/WholeProgramDevirt.h vendor/llvm/dist/include/llvm/Transforms/Instrumentation.h vendor/llvm/dist/include/llvm/Transforms/Instrumentation/InstrProfiling.h vendor/llvm/dist/include/llvm/Transforms/Instrumentation/MemorySanitizer.h vendor/llvm/dist/include/llvm/Transforms/Instrumentation/ThreadSanitizer.h vendor/llvm/dist/include/llvm/Transforms/Scalar.h vendor/llvm/dist/include/llvm/Transforms/Scalar/CallSiteSplitting.h vendor/llvm/dist/include/llvm/Transforms/Scalar/ConstantHoisting.h vendor/llvm/dist/include/llvm/Transforms/Scalar/Float2Int.h vendor/llvm/dist/include/llvm/Transforms/Scalar/GVN.h vendor/llvm/dist/include/llvm/Transforms/Scalar/GVNExpression.h vendor/llvm/dist/include/llvm/Transforms/Scalar/LoopPassManager.h vendor/llvm/dist/include/llvm/Transforms/Scalar/LoopUnrollPass.h vendor/llvm/dist/include/llvm/Transforms/Scalar/MergedLoadStoreMotion.h vendor/llvm/dist/include/llvm/Transforms/Scalar/Reassociate.h vendor/llvm/dist/include/llvm/Transforms/Scalar/SCCP.h vendor/llvm/dist/include/llvm/Transforms/Utils/BasicBlockUtils.h vendor/llvm/dist/include/llvm/Transforms/Utils/BuildLibCalls.h vendor/llvm/dist/include/llvm/Transforms/Utils/BypassSlowDivision.h vendor/llvm/dist/include/llvm/Transforms/Utils/CodeExtractor.h vendor/llvm/dist/include/llvm/Transforms/Utils/Local.h vendor/llvm/dist/include/llvm/Transforms/Utils/LoopUtils.h vendor/llvm/dist/include/llvm/Transforms/Utils/PredicateInfo.h vendor/llvm/dist/include/llvm/Transforms/Utils/SimplifyLibCalls.h vendor/llvm/dist/include/llvm/Transforms/Utils/UnrollLoop.h vendor/llvm/dist/include/llvm/Transforms/Utils/ValueMapper.h vendor/llvm/dist/include/llvm/Transforms/Vectorize/LoopVectorizationLegality.h vendor/llvm/dist/include/llvm/Transforms/Vectorize/LoopVectorize.h vendor/llvm/dist/include/llvm/Transforms/Vectorize/SLPVectorizer.h vendor/llvm/dist/include/llvm/XRay/FDRRecordProducer.h vendor/llvm/dist/include/llvm/XRay/FDRRecords.h vendor/llvm/dist/include/llvm/XRay/FileHeaderReader.h vendor/llvm/dist/include/llvm/module.modulemap vendor/llvm/dist/lib/Analysis/AliasAnalysis.cpp vendor/llvm/dist/lib/Analysis/AliasSetTracker.cpp vendor/llvm/dist/lib/Analysis/Analysis.cpp vendor/llvm/dist/lib/Analysis/AssumptionCache.cpp vendor/llvm/dist/lib/Analysis/BasicAliasAnalysis.cpp vendor/llvm/dist/lib/Analysis/BranchProbabilityInfo.cpp vendor/llvm/dist/lib/Analysis/CFG.cpp vendor/llvm/dist/lib/Analysis/CFGPrinter.cpp vendor/llvm/dist/lib/Analysis/CFLAndersAliasAnalysis.cpp vendor/llvm/dist/lib/Analysis/CFLSteensAliasAnalysis.cpp vendor/llvm/dist/lib/Analysis/CallGraph.cpp vendor/llvm/dist/lib/Analysis/CaptureTracking.cpp vendor/llvm/dist/lib/Analysis/ConstantFolding.cpp vendor/llvm/dist/lib/Analysis/DependenceAnalysis.cpp vendor/llvm/dist/lib/Analysis/DivergenceAnalysis.cpp vendor/llvm/dist/lib/Analysis/GlobalsModRef.cpp vendor/llvm/dist/lib/Analysis/IVDescriptors.cpp vendor/llvm/dist/lib/Analysis/IndirectCallPromotionAnalysis.cpp vendor/llvm/dist/lib/Analysis/InlineCost.cpp vendor/llvm/dist/lib/Analysis/InstructionSimplify.cpp vendor/llvm/dist/lib/Analysis/LazyBranchProbabilityInfo.cpp vendor/llvm/dist/lib/Analysis/LazyCallGraph.cpp vendor/llvm/dist/lib/Analysis/LazyValueInfo.cpp vendor/llvm/dist/lib/Analysis/LegacyDivergenceAnalysis.cpp vendor/llvm/dist/lib/Analysis/Lint.cpp vendor/llvm/dist/lib/Analysis/Loads.cpp vendor/llvm/dist/lib/Analysis/LoopAccessAnalysis.cpp vendor/llvm/dist/lib/Analysis/LoopAnalysisManager.cpp vendor/llvm/dist/lib/Analysis/LoopInfo.cpp vendor/llvm/dist/lib/Analysis/LoopUnrollAnalyzer.cpp vendor/llvm/dist/lib/Analysis/MemDerefPrinter.cpp vendor/llvm/dist/lib/Analysis/MemoryBuiltins.cpp vendor/llvm/dist/lib/Analysis/MemoryDependenceAnalysis.cpp vendor/llvm/dist/lib/Analysis/MemorySSA.cpp vendor/llvm/dist/lib/Analysis/MemorySSAUpdater.cpp vendor/llvm/dist/lib/Analysis/ModuleSummaryAnalysis.cpp vendor/llvm/dist/lib/Analysis/MustExecute.cpp vendor/llvm/dist/lib/Analysis/OptimizationRemarkEmitter.cpp vendor/llvm/dist/lib/Analysis/OrderedInstructions.cpp vendor/llvm/dist/lib/Analysis/ProfileSummaryInfo.cpp vendor/llvm/dist/lib/Analysis/ScalarEvolution.cpp vendor/llvm/dist/lib/Analysis/ScalarEvolutionExpander.cpp vendor/llvm/dist/lib/Analysis/StackSafetyAnalysis.cpp vendor/llvm/dist/lib/Analysis/SyncDependenceAnalysis.cpp vendor/llvm/dist/lib/Analysis/TargetLibraryInfo.cpp vendor/llvm/dist/lib/Analysis/TargetTransformInfo.cpp vendor/llvm/dist/lib/Analysis/TypeMetadataUtils.cpp vendor/llvm/dist/lib/Analysis/ValueTracking.cpp vendor/llvm/dist/lib/Analysis/VectorUtils.cpp vendor/llvm/dist/lib/AsmParser/LLLexer.cpp vendor/llvm/dist/lib/AsmParser/LLParser.cpp vendor/llvm/dist/lib/AsmParser/LLParser.h vendor/llvm/dist/lib/AsmParser/LLToken.h vendor/llvm/dist/lib/AsmParser/Parser.cpp vendor/llvm/dist/lib/BinaryFormat/Dwarf.cpp vendor/llvm/dist/lib/BinaryFormat/Magic.cpp vendor/llvm/dist/lib/Bitcode/Reader/BitcodeAnalyzer.cpp vendor/llvm/dist/lib/Bitcode/Reader/BitcodeReader.cpp vendor/llvm/dist/lib/Bitcode/Reader/MetadataLoader.cpp vendor/llvm/dist/lib/Bitcode/Writer/BitWriter.cpp vendor/llvm/dist/lib/Bitcode/Writer/BitcodeWriter.cpp vendor/llvm/dist/lib/CodeGen/AggressiveAntiDepBreaker.cpp vendor/llvm/dist/lib/CodeGen/Analysis.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/AsmPrinter.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/AsmPrinterInlineAsm.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/ByteStreamer.h vendor/llvm/dist/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/CodeViewDebug.h vendor/llvm/dist/lib/CodeGen/AsmPrinter/DbgEntityHistoryCalculator.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/DebugLocStream.h vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfCompileUnit.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfDebug.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfDebug.h vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfExpression.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfExpression.h vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfFile.h vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfUnit.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/DwarfUnit.h vendor/llvm/dist/lib/CodeGen/AsmPrinter/EHStreamer.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/ErlangGCPrinter.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/OcamlGCPrinter.cpp vendor/llvm/dist/lib/CodeGen/AsmPrinter/WinException.cpp vendor/llvm/dist/lib/CodeGen/AtomicExpandPass.cpp vendor/llvm/dist/lib/CodeGen/BranchFolding.cpp vendor/llvm/dist/lib/CodeGen/BranchRelaxation.cpp vendor/llvm/dist/lib/CodeGen/BreakFalseDeps.cpp vendor/llvm/dist/lib/CodeGen/CalcSpillWeights.cpp vendor/llvm/dist/lib/CodeGen/CallingConvLower.cpp vendor/llvm/dist/lib/CodeGen/CodeGen.cpp vendor/llvm/dist/lib/CodeGen/CodeGenPrepare.cpp vendor/llvm/dist/lib/CodeGen/CriticalAntiDepBreaker.cpp vendor/llvm/dist/lib/CodeGen/DFAPacketizer.cpp vendor/llvm/dist/lib/CodeGen/DeadMachineInstructionElim.cpp vendor/llvm/dist/lib/CodeGen/DetectDeadLanes.cpp vendor/llvm/dist/lib/CodeGen/EarlyIfConversion.cpp vendor/llvm/dist/lib/CodeGen/ExecutionDomainFix.cpp vendor/llvm/dist/lib/CodeGen/ExpandMemCmp.cpp vendor/llvm/dist/lib/CodeGen/ExpandPostRAPseudos.cpp vendor/llvm/dist/lib/CodeGen/GCMetadata.cpp vendor/llvm/dist/lib/CodeGen/GCRootLowering.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/CSEInfo.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/CSEMIRBuilder.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/CallLowering.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/Combiner.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/CombinerHelper.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/IRTranslator.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/InstructionSelect.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/InstructionSelector.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/Legalizer.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/LegalizerHelper.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/LegalizerInfo.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/Localizer.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/MachineIRBuilder.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/RegBankSelect.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/RegisterBank.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/RegisterBankInfo.cpp vendor/llvm/dist/lib/CodeGen/GlobalISel/Utils.cpp vendor/llvm/dist/lib/CodeGen/GlobalMerge.cpp vendor/llvm/dist/lib/CodeGen/HardwareLoops.cpp vendor/llvm/dist/lib/CodeGen/IfConversion.cpp vendor/llvm/dist/lib/CodeGen/ImplicitNullChecks.cpp vendor/llvm/dist/lib/CodeGen/InlineSpiller.cpp vendor/llvm/dist/lib/CodeGen/InterleavedLoadCombinePass.cpp vendor/llvm/dist/lib/CodeGen/LLVMTargetMachine.cpp vendor/llvm/dist/lib/CodeGen/LazyMachineBlockFrequencyInfo.cpp vendor/llvm/dist/lib/CodeGen/LexicalScopes.cpp vendor/llvm/dist/lib/CodeGen/LiveDebugValues.cpp vendor/llvm/dist/lib/CodeGen/LiveDebugVariables.cpp vendor/llvm/dist/lib/CodeGen/LiveInterval.cpp vendor/llvm/dist/lib/CodeGen/LiveIntervals.cpp vendor/llvm/dist/lib/CodeGen/LivePhysRegs.cpp vendor/llvm/dist/lib/CodeGen/LiveRangeCalc.cpp vendor/llvm/dist/lib/CodeGen/LiveRangeEdit.cpp vendor/llvm/dist/lib/CodeGen/LiveRangeShrink.cpp vendor/llvm/dist/lib/CodeGen/LiveRegMatrix.cpp vendor/llvm/dist/lib/CodeGen/LiveRegUnits.cpp vendor/llvm/dist/lib/CodeGen/LiveStacks.cpp vendor/llvm/dist/lib/CodeGen/LiveVariables.cpp vendor/llvm/dist/lib/CodeGen/LocalStackSlotAllocation.cpp vendor/llvm/dist/lib/CodeGen/LowerEmuTLS.cpp vendor/llvm/dist/lib/CodeGen/MIRCanonicalizerPass.cpp vendor/llvm/dist/lib/CodeGen/MIRParser/MILexer.cpp vendor/llvm/dist/lib/CodeGen/MIRParser/MILexer.h vendor/llvm/dist/lib/CodeGen/MIRParser/MIParser.cpp vendor/llvm/dist/lib/CodeGen/MIRParser/MIRParser.cpp vendor/llvm/dist/lib/CodeGen/MIRPrinter.cpp vendor/llvm/dist/lib/CodeGen/MachineBasicBlock.cpp vendor/llvm/dist/lib/CodeGen/MachineBlockPlacement.cpp vendor/llvm/dist/lib/CodeGen/MachineCSE.cpp vendor/llvm/dist/lib/CodeGen/MachineCombiner.cpp vendor/llvm/dist/lib/CodeGen/MachineCopyPropagation.cpp vendor/llvm/dist/lib/CodeGen/MachineDominators.cpp vendor/llvm/dist/lib/CodeGen/MachineFrameInfo.cpp vendor/llvm/dist/lib/CodeGen/MachineFunction.cpp vendor/llvm/dist/lib/CodeGen/MachineFunctionPass.cpp vendor/llvm/dist/lib/CodeGen/MachineInstr.cpp vendor/llvm/dist/lib/CodeGen/MachineInstrBundle.cpp vendor/llvm/dist/lib/CodeGen/MachineLICM.cpp vendor/llvm/dist/lib/CodeGen/MachineModuleInfo.cpp vendor/llvm/dist/lib/CodeGen/MachineOperand.cpp vendor/llvm/dist/lib/CodeGen/MachineOptimizationRemarkEmitter.cpp vendor/llvm/dist/lib/CodeGen/MachineOutliner.cpp vendor/llvm/dist/lib/CodeGen/MachinePipeliner.cpp vendor/llvm/dist/lib/CodeGen/MachinePostDominators.cpp vendor/llvm/dist/lib/CodeGen/MachineRegisterInfo.cpp vendor/llvm/dist/lib/CodeGen/MachineSSAUpdater.cpp vendor/llvm/dist/lib/CodeGen/MachineScheduler.cpp vendor/llvm/dist/lib/CodeGen/MachineSink.cpp vendor/llvm/dist/lib/CodeGen/MachineTraceMetrics.cpp vendor/llvm/dist/lib/CodeGen/MachineVerifier.cpp vendor/llvm/dist/lib/CodeGen/MacroFusion.cpp vendor/llvm/dist/lib/CodeGen/OptimizePHIs.cpp vendor/llvm/dist/lib/CodeGen/PHIElimination.cpp vendor/llvm/dist/lib/CodeGen/PatchableFunction.cpp vendor/llvm/dist/lib/CodeGen/PeepholeOptimizer.cpp vendor/llvm/dist/lib/CodeGen/PreISelIntrinsicLowering.cpp vendor/llvm/dist/lib/CodeGen/ProcessImplicitDefs.cpp vendor/llvm/dist/lib/CodeGen/PrologEpilogInserter.cpp vendor/llvm/dist/lib/CodeGen/PseudoSourceValue.cpp vendor/llvm/dist/lib/CodeGen/ReachingDefAnalysis.cpp vendor/llvm/dist/lib/CodeGen/RegAllocBase.cpp vendor/llvm/dist/lib/CodeGen/RegAllocFast.cpp vendor/llvm/dist/lib/CodeGen/RegAllocGreedy.cpp vendor/llvm/dist/lib/CodeGen/RegAllocPBQP.cpp vendor/llvm/dist/lib/CodeGen/RegUsageInfoCollector.cpp vendor/llvm/dist/lib/CodeGen/RegUsageInfoPropagate.cpp vendor/llvm/dist/lib/CodeGen/RegisterCoalescer.cpp vendor/llvm/dist/lib/CodeGen/RegisterPressure.cpp vendor/llvm/dist/lib/CodeGen/RegisterScavenging.cpp vendor/llvm/dist/lib/CodeGen/RenameIndependentSubregs.cpp vendor/llvm/dist/lib/CodeGen/SafeStack.cpp vendor/llvm/dist/lib/CodeGen/ScalarizeMaskedMemIntrin.cpp vendor/llvm/dist/lib/CodeGen/ScheduleDAGInstrs.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/DAGCombiner.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/FastISel.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/FunctionLoweringInfo.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/InstrEmitter.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeDAG.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeFloatTypes.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeTypes.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeTypes.h vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeTypesGeneric.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorOps.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/LegalizeVectorTypes.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/ScheduleDAGFast.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/ScheduleDAGRRList.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/ScheduleDAGSDNodes.h vendor/llvm/dist/lib/CodeGen/SelectionDAG/ScheduleDAGVLIW.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAG.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGAddressAnalysis.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.h vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGDumper.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/StatepointLowering.cpp vendor/llvm/dist/lib/CodeGen/SelectionDAG/TargetLowering.cpp vendor/llvm/dist/lib/CodeGen/ShrinkWrap.cpp vendor/llvm/dist/lib/CodeGen/SjLjEHPrepare.cpp vendor/llvm/dist/lib/CodeGen/SplitKit.cpp vendor/llvm/dist/lib/CodeGen/SplitKit.h vendor/llvm/dist/lib/CodeGen/StackMaps.cpp vendor/llvm/dist/lib/CodeGen/StackProtector.cpp vendor/llvm/dist/lib/CodeGen/StackSlotColoring.cpp vendor/llvm/dist/lib/CodeGen/SwiftErrorValueTracking.cpp vendor/llvm/dist/lib/CodeGen/TailDuplicator.cpp vendor/llvm/dist/lib/CodeGen/TargetFrameLoweringImpl.cpp vendor/llvm/dist/lib/CodeGen/TargetInstrInfo.cpp vendor/llvm/dist/lib/CodeGen/TargetLoweringBase.cpp vendor/llvm/dist/lib/CodeGen/TargetLoweringObjectFileImpl.cpp vendor/llvm/dist/lib/CodeGen/TargetPassConfig.cpp vendor/llvm/dist/lib/CodeGen/TargetRegisterInfo.cpp vendor/llvm/dist/lib/CodeGen/TargetSchedule.cpp vendor/llvm/dist/lib/CodeGen/TwoAddressInstructionPass.cpp vendor/llvm/dist/lib/CodeGen/UnreachableBlockElim.cpp vendor/llvm/dist/lib/CodeGen/ValueTypes.cpp vendor/llvm/dist/lib/CodeGen/VirtRegMap.cpp vendor/llvm/dist/lib/CodeGen/XRayInstrumentation.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/CVTypeVisitor.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/CodeViewRecordIO.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/EnumTables.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/SymbolDumper.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/SymbolRecordMapping.cpp vendor/llvm/dist/lib/DebugInfo/CodeView/TypeRecordMapping.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFAbbreviationDeclaration.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFAcceleratorTable.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFCompileUnit.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFContext.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDataExtractor.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDebugAbbrev.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDebugAddr.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDebugArangeSet.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDebugAranges.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDebugFrame.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDebugInfoEntry.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDebugLine.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDebugLoc.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDebugMacro.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDebugPubTable.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDebugRangeList.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDebugRnglists.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFDie.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFExpression.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFFormValue.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFGdbIndex.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFListTable.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFTypeUnit.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFUnit.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFUnitIndex.cpp vendor/llvm/dist/lib/DebugInfo/DWARF/DWARFVerifier.cpp vendor/llvm/dist/lib/DebugInfo/GSYM/FunctionInfo.cpp vendor/llvm/dist/lib/DebugInfo/GSYM/InlineInfo.cpp vendor/llvm/dist/lib/DebugInfo/GSYM/Range.cpp vendor/llvm/dist/lib/DebugInfo/MSF/MappedBlockStream.cpp vendor/llvm/dist/lib/DebugInfo/PDB/DIA/DIARawSymbol.cpp vendor/llvm/dist/lib/DebugInfo/PDB/DIA/DIASectionContrib.cpp vendor/llvm/dist/lib/DebugInfo/PDB/DIA/DIASession.cpp vendor/llvm/dist/lib/DebugInfo/PDB/GenericError.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/DbiModuleDescriptorBuilder.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/DbiStreamBuilder.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/GSIStreamBuilder.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/Hash.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/NativeEnumInjectedSources.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/NativeRawSymbol.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/NativeSession.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/NativeTypeEnum.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/NativeTypeFunctionSig.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/PDBFile.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/PDBFileBuilder.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/TpiHashing.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/TpiStream.cpp vendor/llvm/dist/lib/DebugInfo/PDB/Native/TpiStreamBuilder.cpp vendor/llvm/dist/lib/DebugInfo/PDB/PDBSymbolFunc.cpp vendor/llvm/dist/lib/DebugInfo/PDB/PDBSymbolTypeFunctionSig.cpp vendor/llvm/dist/lib/DebugInfo/PDB/UDTLayout.cpp vendor/llvm/dist/lib/DebugInfo/Symbolize/DIPrinter.cpp vendor/llvm/dist/lib/DebugInfo/Symbolize/SymbolizableObjectFile.cpp vendor/llvm/dist/lib/DebugInfo/Symbolize/SymbolizableObjectFile.h vendor/llvm/dist/lib/DebugInfo/Symbolize/Symbolize.cpp vendor/llvm/dist/lib/Demangle/ItaniumDemangle.cpp vendor/llvm/dist/lib/Demangle/MicrosoftDemangle.cpp vendor/llvm/dist/lib/Demangle/MicrosoftDemangleNodes.cpp vendor/llvm/dist/lib/ExecutionEngine/ExecutionEngine.cpp vendor/llvm/dist/lib/ExecutionEngine/GDBRegistrationListener.cpp vendor/llvm/dist/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp vendor/llvm/dist/lib/ExecutionEngine/JITLink/BasicGOTAndStubsBuilder.h vendor/llvm/dist/lib/ExecutionEngine/JITLink/EHFrameSupport.cpp vendor/llvm/dist/lib/ExecutionEngine/JITLink/EHFrameSupportImpl.h vendor/llvm/dist/lib/ExecutionEngine/JITLink/JITLink.cpp vendor/llvm/dist/lib/ExecutionEngine/JITLink/JITLinkGeneric.cpp vendor/llvm/dist/lib/ExecutionEngine/JITLink/JITLinkGeneric.h vendor/llvm/dist/lib/ExecutionEngine/JITLink/JITLinkMemoryManager.cpp vendor/llvm/dist/lib/ExecutionEngine/JITLink/MachO.cpp vendor/llvm/dist/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp vendor/llvm/dist/lib/ExecutionEngine/MCJIT/MCJIT.cpp vendor/llvm/dist/lib/ExecutionEngine/OProfileJIT/OProfileJITEventListener.cpp vendor/llvm/dist/lib/ExecutionEngine/OProfileJIT/OProfileWrapper.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/CompileOnDemandLayer.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/CompileUtils.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/Core.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/ExecutionUtils.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/IRCompileLayer.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/IRTransformLayer.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/IndirectionUtils.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/JITTargetMachineBuilder.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/LLJIT.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/Layer.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/LazyReexports.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/Legacy.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/ObjectLinkingLayer.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/OrcCBindingsStack.h vendor/llvm/dist/lib/ExecutionEngine/Orc/RTDyldObjectLinkingLayer.cpp vendor/llvm/dist/lib/ExecutionEngine/Orc/ThreadSafeModule.cpp vendor/llvm/dist/lib/ExecutionEngine/PerfJITEvents/PerfJITEventListener.cpp vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyld.cpp vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldCOFF.cpp vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldChecker.cpp vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldELF.cpp vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldImpl.h vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/RuntimeDyldMachO.cpp vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldCOFFX86_64.h vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOARM.h vendor/llvm/dist/lib/ExecutionEngine/RuntimeDyld/Targets/RuntimeDyldMachOI386.h vendor/llvm/dist/lib/FuzzMutate/FuzzerCLI.cpp vendor/llvm/dist/lib/IR/AsmWriter.cpp vendor/llvm/dist/lib/IR/AttributeImpl.h vendor/llvm/dist/lib/IR/Attributes.cpp vendor/llvm/dist/lib/IR/AutoUpgrade.cpp vendor/llvm/dist/lib/IR/BasicBlock.cpp vendor/llvm/dist/lib/IR/ConstantFold.cpp vendor/llvm/dist/lib/IR/ConstantRange.cpp vendor/llvm/dist/lib/IR/Constants.cpp vendor/llvm/dist/lib/IR/ConstantsContext.h vendor/llvm/dist/lib/IR/Core.cpp vendor/llvm/dist/lib/IR/DIBuilder.cpp vendor/llvm/dist/lib/IR/DataLayout.cpp vendor/llvm/dist/lib/IR/DebugInfo.cpp vendor/llvm/dist/lib/IR/DebugInfoMetadata.cpp vendor/llvm/dist/lib/IR/DiagnosticInfo.cpp vendor/llvm/dist/lib/IR/Function.cpp vendor/llvm/dist/lib/IR/Globals.cpp vendor/llvm/dist/lib/IR/IRBuilder.cpp vendor/llvm/dist/lib/IR/IRPrintingPasses.cpp vendor/llvm/dist/lib/IR/InlineAsm.cpp vendor/llvm/dist/lib/IR/Instruction.cpp vendor/llvm/dist/lib/IR/Instructions.cpp vendor/llvm/dist/lib/IR/IntrinsicInst.cpp vendor/llvm/dist/lib/IR/LLVMContext.cpp vendor/llvm/dist/lib/IR/LLVMContextImpl.cpp vendor/llvm/dist/lib/IR/LegacyPassManager.cpp vendor/llvm/dist/lib/IR/MDBuilder.cpp vendor/llvm/dist/lib/IR/Metadata.cpp vendor/llvm/dist/lib/IR/Module.cpp vendor/llvm/dist/lib/IR/RemarkStreamer.cpp vendor/llvm/dist/lib/IR/SafepointIRVerifier.cpp vendor/llvm/dist/lib/IR/Type.cpp vendor/llvm/dist/lib/IR/Value.cpp vendor/llvm/dist/lib/IR/Verifier.cpp vendor/llvm/dist/lib/LTO/Caching.cpp vendor/llvm/dist/lib/LTO/LTO.cpp vendor/llvm/dist/lib/LTO/LTOBackend.cpp vendor/llvm/dist/lib/LTO/LTOCodeGenerator.cpp vendor/llvm/dist/lib/LTO/LTOModule.cpp vendor/llvm/dist/lib/LTO/SummaryBasedOptimizations.cpp vendor/llvm/dist/lib/LTO/ThinLTOCodeGenerator.cpp vendor/llvm/dist/lib/Linker/IRMover.cpp vendor/llvm/dist/lib/Linker/LinkModules.cpp vendor/llvm/dist/lib/MC/ELFObjectWriter.cpp vendor/llvm/dist/lib/MC/MCAsmBackend.cpp vendor/llvm/dist/lib/MC/MCAsmInfoXCOFF.cpp vendor/llvm/dist/lib/MC/MCAsmMacro.cpp vendor/llvm/dist/lib/MC/MCAsmStreamer.cpp vendor/llvm/dist/lib/MC/MCAssembler.cpp vendor/llvm/dist/lib/MC/MCContext.cpp vendor/llvm/dist/lib/MC/MCDwarf.cpp vendor/llvm/dist/lib/MC/MCELFStreamer.cpp vendor/llvm/dist/lib/MC/MCExpr.cpp vendor/llvm/dist/lib/MC/MCInstPrinter.cpp vendor/llvm/dist/lib/MC/MCInstrAnalysis.cpp vendor/llvm/dist/lib/MC/MCMachOStreamer.cpp vendor/llvm/dist/lib/MC/MCObjectFileInfo.cpp vendor/llvm/dist/lib/MC/MCObjectStreamer.cpp vendor/llvm/dist/lib/MC/MCParser/AsmParser.cpp vendor/llvm/dist/lib/MC/MCParser/COFFAsmParser.cpp vendor/llvm/dist/lib/MC/MCParser/DarwinAsmParser.cpp vendor/llvm/dist/lib/MC/MCParser/WasmAsmParser.cpp vendor/llvm/dist/lib/MC/MCRegisterInfo.cpp vendor/llvm/dist/lib/MC/MCSectionXCOFF.cpp vendor/llvm/dist/lib/MC/MCStreamer.cpp vendor/llvm/dist/lib/MC/MCSubtargetInfo.cpp vendor/llvm/dist/lib/MC/MCWasmObjectTargetWriter.cpp vendor/llvm/dist/lib/MC/MCWasmStreamer.cpp vendor/llvm/dist/lib/MC/MCWinCOFFStreamer.cpp vendor/llvm/dist/lib/MC/MCXCOFFStreamer.cpp vendor/llvm/dist/lib/MC/MachObjectWriter.cpp vendor/llvm/dist/lib/MC/StringTableBuilder.cpp vendor/llvm/dist/lib/MC/WasmObjectWriter.cpp vendor/llvm/dist/lib/MC/WinCOFFObjectWriter.cpp vendor/llvm/dist/lib/MC/XCOFFObjectWriter.cpp vendor/llvm/dist/lib/MCA/Context.cpp vendor/llvm/dist/lib/MCA/HardwareUnits/LSUnit.cpp vendor/llvm/dist/lib/MCA/HardwareUnits/RegisterFile.cpp vendor/llvm/dist/lib/MCA/HardwareUnits/ResourceManager.cpp vendor/llvm/dist/lib/MCA/HardwareUnits/RetireControlUnit.cpp vendor/llvm/dist/lib/MCA/HardwareUnits/Scheduler.cpp vendor/llvm/dist/lib/MCA/InstrBuilder.cpp vendor/llvm/dist/lib/MCA/Instruction.cpp vendor/llvm/dist/lib/MCA/Stages/DispatchStage.cpp vendor/llvm/dist/lib/MCA/Stages/EntryStage.cpp vendor/llvm/dist/lib/MCA/Stages/ExecuteStage.cpp vendor/llvm/dist/lib/MCA/Stages/RetireStage.cpp vendor/llvm/dist/lib/Object/Archive.cpp vendor/llvm/dist/lib/Object/ArchiveWriter.cpp vendor/llvm/dist/lib/Object/Binary.cpp vendor/llvm/dist/lib/Object/COFFObjectFile.cpp vendor/llvm/dist/lib/Object/Decompressor.cpp vendor/llvm/dist/lib/Object/ELF.cpp vendor/llvm/dist/lib/Object/ELFObjectFile.cpp vendor/llvm/dist/lib/Object/MachOObjectFile.cpp vendor/llvm/dist/lib/Object/MachOUniversal.cpp vendor/llvm/dist/lib/Object/Minidump.cpp vendor/llvm/dist/lib/Object/Object.cpp vendor/llvm/dist/lib/Object/ObjectFile.cpp vendor/llvm/dist/lib/Object/RelocationResolver.cpp vendor/llvm/dist/lib/Object/SymbolicFile.cpp vendor/llvm/dist/lib/Object/WasmObjectFile.cpp vendor/llvm/dist/lib/Object/WindowsResource.cpp vendor/llvm/dist/lib/Object/XCOFFObjectFile.cpp vendor/llvm/dist/lib/ObjectYAML/CodeViewYAMLSymbols.cpp vendor/llvm/dist/lib/ObjectYAML/ELFYAML.cpp vendor/llvm/dist/lib/ObjectYAML/MachOYAML.cpp vendor/llvm/dist/lib/ObjectYAML/MinidumpYAML.cpp vendor/llvm/dist/lib/ObjectYAML/WasmYAML.cpp vendor/llvm/dist/lib/Option/ArgList.cpp vendor/llvm/dist/lib/Passes/PassBuilder.cpp vendor/llvm/dist/lib/Passes/PassRegistry.def vendor/llvm/dist/lib/ProfileData/Coverage/CoverageMapping.cpp vendor/llvm/dist/lib/ProfileData/Coverage/CoverageMappingReader.cpp vendor/llvm/dist/lib/ProfileData/Coverage/CoverageMappingWriter.cpp vendor/llvm/dist/lib/ProfileData/GCOV.cpp vendor/llvm/dist/lib/ProfileData/InstrProf.cpp vendor/llvm/dist/lib/ProfileData/InstrProfReader.cpp vendor/llvm/dist/lib/ProfileData/InstrProfWriter.cpp vendor/llvm/dist/lib/ProfileData/ProfileSummaryBuilder.cpp vendor/llvm/dist/lib/ProfileData/SampleProf.cpp vendor/llvm/dist/lib/ProfileData/SampleProfReader.cpp vendor/llvm/dist/lib/ProfileData/SampleProfWriter.cpp vendor/llvm/dist/lib/Remarks/RemarkFormat.cpp vendor/llvm/dist/lib/Remarks/RemarkParser.cpp vendor/llvm/dist/lib/Remarks/RemarkStringTable.cpp vendor/llvm/dist/lib/Remarks/YAMLRemarkParser.cpp vendor/llvm/dist/lib/Remarks/YAMLRemarkParser.h vendor/llvm/dist/lib/Remarks/YAMLRemarkSerializer.cpp vendor/llvm/dist/lib/Support/AArch64TargetParser.cpp vendor/llvm/dist/lib/Support/APInt.cpp vendor/llvm/dist/lib/Support/ARMTargetParser.cpp vendor/llvm/dist/lib/Support/CRC.cpp vendor/llvm/dist/lib/Support/CachePruning.cpp vendor/llvm/dist/lib/Support/CodeGenCoverage.cpp vendor/llvm/dist/lib/Support/CommandLine.cpp vendor/llvm/dist/lib/Support/CrashRecoveryContext.cpp vendor/llvm/dist/lib/Support/DataExtractor.cpp vendor/llvm/dist/lib/Support/Error.cpp vendor/llvm/dist/lib/Support/FileCheck.cpp vendor/llvm/dist/lib/Support/FileOutputBuffer.cpp vendor/llvm/dist/lib/Support/FileUtilities.cpp vendor/llvm/dist/lib/Support/GlobPattern.cpp vendor/llvm/dist/lib/Support/Host.cpp vendor/llvm/dist/lib/Support/JSON.cpp vendor/llvm/dist/lib/Support/ManagedStatic.cpp vendor/llvm/dist/lib/Support/MemoryBuffer.cpp vendor/llvm/dist/lib/Support/Parallel.cpp vendor/llvm/dist/lib/Support/Path.cpp vendor/llvm/dist/lib/Support/PrettyStackTrace.cpp vendor/llvm/dist/lib/Support/RWMutex.cpp vendor/llvm/dist/lib/Support/Regex.cpp vendor/llvm/dist/lib/Support/Signposts.cpp vendor/llvm/dist/lib/Support/SpecialCaseList.cpp vendor/llvm/dist/lib/Support/Statistic.cpp vendor/llvm/dist/lib/Support/StringExtras.cpp vendor/llvm/dist/lib/Support/TimeProfiler.cpp vendor/llvm/dist/lib/Support/Timer.cpp vendor/llvm/dist/lib/Support/Unix/Memory.inc vendor/llvm/dist/lib/Support/Unix/Path.inc vendor/llvm/dist/lib/Support/Unix/Process.inc vendor/llvm/dist/lib/Support/Unix/Program.inc vendor/llvm/dist/lib/Support/Unix/Signals.inc vendor/llvm/dist/lib/Support/VirtualFileSystem.cpp vendor/llvm/dist/lib/Support/Windows/Path.inc vendor/llvm/dist/lib/Support/Windows/Program.inc vendor/llvm/dist/lib/Support/Windows/Signals.inc vendor/llvm/dist/lib/Support/Windows/WindowsSupport.h vendor/llvm/dist/lib/Support/Windows/explicit_symbols.inc vendor/llvm/dist/lib/Support/YAMLTraits.cpp vendor/llvm/dist/lib/Support/Z3Solver.cpp vendor/llvm/dist/lib/Support/raw_ostream.cpp vendor/llvm/dist/lib/Support/regcomp.c vendor/llvm/dist/lib/TableGen/Error.cpp vendor/llvm/dist/lib/TableGen/Main.cpp vendor/llvm/dist/lib/TableGen/Record.cpp vendor/llvm/dist/lib/TableGen/SetTheory.cpp vendor/llvm/dist/lib/TableGen/TGLexer.cpp vendor/llvm/dist/lib/TableGen/TGParser.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64.h vendor/llvm/dist/lib/Target/AArch64/AArch64.td vendor/llvm/dist/lib/Target/AArch64/AArch64A57FPLoadBalancing.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64AdvSIMDScalarPass.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64AsmPrinter.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64CallLowering.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64CallLowering.h vendor/llvm/dist/lib/Target/AArch64/AArch64CallingConvention.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64CallingConvention.h vendor/llvm/dist/lib/Target/AArch64/AArch64CallingConvention.td vendor/llvm/dist/lib/Target/AArch64/AArch64CollectLOH.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64CondBrTuning.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64ConditionalCompares.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64DeadRegisterDefinitionsPass.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64ExpandPseudoInsts.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64FalkorHWPFFix.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64FastISel.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64FrameLowering.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64FrameLowering.h vendor/llvm/dist/lib/Target/AArch64/AArch64ISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64ISelLowering.h vendor/llvm/dist/lib/Target/AArch64/AArch64InstrAtomics.td vendor/llvm/dist/lib/Target/AArch64/AArch64InstrFormats.td vendor/llvm/dist/lib/Target/AArch64/AArch64InstrInfo.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64InstrInfo.h vendor/llvm/dist/lib/Target/AArch64/AArch64InstrInfo.td vendor/llvm/dist/lib/Target/AArch64/AArch64InstructionSelector.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64LegalizerInfo.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64LegalizerInfo.h vendor/llvm/dist/lib/Target/AArch64/AArch64LoadStoreOptimizer.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64MCInstLower.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64MachineFunctionInfo.h vendor/llvm/dist/lib/Target/AArch64/AArch64PBQPRegAlloc.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64PreLegalizerCombiner.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64RegisterBankInfo.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64RegisterInfo.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64SIMDInstrOpt.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64SVEInstrInfo.td vendor/llvm/dist/lib/Target/AArch64/AArch64SelectionDAGInfo.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64SpeculationHardening.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64StackTagging.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64StorePairSuppress.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64Subtarget.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64Subtarget.h vendor/llvm/dist/lib/Target/AArch64/AArch64SystemOperands.td vendor/llvm/dist/lib/Target/AArch64/AArch64TargetMachine.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64TargetObjectFile.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64TargetObjectFile.h vendor/llvm/dist/lib/Target/AArch64/AArch64TargetTransformInfo.cpp vendor/llvm/dist/lib/Target/AArch64/AArch64TargetTransformInfo.h vendor/llvm/dist/lib/Target/AArch64/AsmParser/AArch64AsmParser.cpp vendor/llvm/dist/lib/Target/AArch64/MCTargetDesc/AArch64AsmBackend.cpp vendor/llvm/dist/lib/Target/AArch64/MCTargetDesc/AArch64ELFObjectWriter.cpp vendor/llvm/dist/lib/Target/AArch64/MCTargetDesc/AArch64InstPrinter.cpp vendor/llvm/dist/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.cpp vendor/llvm/dist/lib/Target/AArch64/MCTargetDesc/AArch64MCAsmInfo.h vendor/llvm/dist/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.cpp vendor/llvm/dist/lib/Target/AArch64/MCTargetDesc/AArch64MCExpr.h vendor/llvm/dist/lib/Target/AArch64/MCTargetDesc/AArch64MCTargetDesc.cpp vendor/llvm/dist/lib/Target/AArch64/MCTargetDesc/AArch64MachObjectWriter.cpp vendor/llvm/dist/lib/Target/AArch64/MCTargetDesc/AArch64WinCOFFObjectWriter.cpp vendor/llvm/dist/lib/Target/AArch64/SVEInstrFormats.td vendor/llvm/dist/lib/Target/AArch64/Utils/AArch64BaseInfo.cpp vendor/llvm/dist/lib/Target/AArch64/Utils/AArch64BaseInfo.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPU.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPU.td vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUAnnotateKernelFeatures.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUArgumentUsageInfo.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUAsmPrinter.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUAsmPrinter.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUAtomicOptimizer.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUCallLowering.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUCallLowering.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUCallingConv.td vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUCodeGenPrepare.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUFrameLowering.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUFrameLowering.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUGISel.td vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUGenRegisterBankInfo.def vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUHSAMetadataStreamer.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUISelLowering.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUISelLowering.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUInline.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUInstrInfo.td vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUInstructionSelector.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUInstructionSelector.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/AMDGPULegalizerInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPULegalizerInfo.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPULibCalls.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPULibFunc.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPULowerKernelArguments.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUMCInstLower.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUMachineCFGStructurizer.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUMachineFunction.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUMachineFunction.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUPromoteAlloca.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPURegisterBankInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPURegisterBankInfo.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPURegisterBanks.td vendor/llvm/dist/lib/Target/AMDGPU/AMDGPURegisterInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPURegisterInfo.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUSearchableTables.td vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUSubtarget.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUSubtarget.h vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUTargetMachine.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/AMDGPUTargetTransformInfo.h vendor/llvm/dist/lib/Target/AMDGPU/AMDILCFGStructurizer.cpp vendor/llvm/dist/lib/Target/AMDGPU/AsmParser/AMDGPUAsmParser.cpp vendor/llvm/dist/lib/Target/AMDGPU/BUFInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/DSInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/Disassembler/AMDGPUDisassembler.cpp vendor/llvm/dist/lib/Target/AMDGPU/EvergreenInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/FLATInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/GCNDPPCombine.cpp vendor/llvm/dist/lib/Target/AMDGPU/GCNHazardRecognizer.cpp vendor/llvm/dist/lib/Target/AMDGPU/GCNILPSched.cpp vendor/llvm/dist/lib/Target/AMDGPU/GCNIterativeScheduler.cpp vendor/llvm/dist/lib/Target/AMDGPU/GCNNSAReassign.cpp vendor/llvm/dist/lib/Target/AMDGPU/GCNRegBankReassign.cpp vendor/llvm/dist/lib/Target/AMDGPU/GCNRegPressure.cpp vendor/llvm/dist/lib/Target/AMDGPU/GCNRegPressure.h vendor/llvm/dist/lib/Target/AMDGPU/GCNSchedStrategy.cpp vendor/llvm/dist/lib/Target/AMDGPU/GCNSchedStrategy.h vendor/llvm/dist/lib/Target/AMDGPU/MCTargetDesc/AMDGPUAsmBackend.cpp vendor/llvm/dist/lib/Target/AMDGPU/MCTargetDesc/AMDGPUELFObjectWriter.cpp vendor/llvm/dist/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.cpp vendor/llvm/dist/lib/Target/AMDGPU/MCTargetDesc/AMDGPUInstPrinter.h vendor/llvm/dist/lib/Target/AMDGPU/MCTargetDesc/AMDGPUTargetStreamer.cpp vendor/llvm/dist/lib/Target/AMDGPU/MIMGInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/R600AsmPrinter.cpp vendor/llvm/dist/lib/Target/AMDGPU/R600ControlFlowFinalizer.cpp vendor/llvm/dist/lib/Target/AMDGPU/R600ExpandSpecialInstrs.cpp vendor/llvm/dist/lib/Target/AMDGPU/R600FrameLowering.h vendor/llvm/dist/lib/Target/AMDGPU/R600ISelLowering.cpp vendor/llvm/dist/lib/Target/AMDGPU/R600InstrInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/R600MachineScheduler.cpp vendor/llvm/dist/lib/Target/AMDGPU/R600OptimizeVectorRegisters.cpp vendor/llvm/dist/lib/Target/AMDGPU/R600Packetizer.cpp vendor/llvm/dist/lib/Target/AMDGPU/R600RegisterInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIAddIMGInit.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIDefines.h vendor/llvm/dist/lib/Target/AMDGPU/SIFixSGPRCopies.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIFixupVectorISel.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIFoldOperands.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIFormMemoryClauses.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIFrameLowering.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIFrameLowering.h vendor/llvm/dist/lib/Target/AMDGPU/SIISelLowering.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIISelLowering.h vendor/llvm/dist/lib/Target/AMDGPU/SIInsertWaitcnts.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIInstrFormats.td vendor/llvm/dist/lib/Target/AMDGPU/SIInstrInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIInstrInfo.h vendor/llvm/dist/lib/Target/AMDGPU/SIInstrInfo.td vendor/llvm/dist/lib/Target/AMDGPU/SIInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/SILoadStoreOptimizer.cpp vendor/llvm/dist/lib/Target/AMDGPU/SILowerControlFlow.cpp vendor/llvm/dist/lib/Target/AMDGPU/SILowerI1Copies.cpp vendor/llvm/dist/lib/Target/AMDGPU/SILowerSGPRSpills.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIMachineFunctionInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIMachineFunctionInfo.h vendor/llvm/dist/lib/Target/AMDGPU/SIMachineScheduler.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIMemoryLegalizer.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIModeRegister.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIOptimizeExecMasking.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIOptimizeExecMaskingPreRA.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIPeepholeSDWA.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIPreAllocateWWMRegs.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIProgramInfo.h vendor/llvm/dist/lib/Target/AMDGPU/SIRegisterInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIRegisterInfo.h vendor/llvm/dist/lib/Target/AMDGPU/SIRegisterInfo.td vendor/llvm/dist/lib/Target/AMDGPU/SIShrinkInstructions.cpp vendor/llvm/dist/lib/Target/AMDGPU/SIWholeQuadMode.cpp vendor/llvm/dist/lib/Target/AMDGPU/SMInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/SOPInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.cpp vendor/llvm/dist/lib/Target/AMDGPU/Utils/AMDGPUBaseInfo.h vendor/llvm/dist/lib/Target/AMDGPU/Utils/AMDGPUPALMetadata.cpp vendor/llvm/dist/lib/Target/AMDGPU/VOP1Instructions.td vendor/llvm/dist/lib/Target/AMDGPU/VOP2Instructions.td vendor/llvm/dist/lib/Target/AMDGPU/VOP3Instructions.td vendor/llvm/dist/lib/Target/AMDGPU/VOP3PInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/VOPCInstructions.td vendor/llvm/dist/lib/Target/AMDGPU/VOPInstructions.td vendor/llvm/dist/lib/Target/ARC/ARCFrameLowering.h vendor/llvm/dist/lib/Target/ARC/ARCISelLowering.cpp vendor/llvm/dist/lib/Target/ARC/ARCMachineFunctionInfo.h vendor/llvm/dist/lib/Target/ARC/ARCOptAddrMode.cpp vendor/llvm/dist/lib/Target/ARC/ARCRegisterInfo.cpp vendor/llvm/dist/lib/Target/ARC/ARCTargetMachine.cpp vendor/llvm/dist/lib/Target/ARM/A15SDOptimizer.cpp vendor/llvm/dist/lib/Target/ARM/ARM.h vendor/llvm/dist/lib/Target/ARM/ARM.td vendor/llvm/dist/lib/Target/ARM/ARMAsmPrinter.cpp vendor/llvm/dist/lib/Target/ARM/ARMBaseInstrInfo.cpp vendor/llvm/dist/lib/Target/ARM/ARMBaseInstrInfo.h vendor/llvm/dist/lib/Target/ARM/ARMBaseRegisterInfo.cpp vendor/llvm/dist/lib/Target/ARM/ARMBaseRegisterInfo.h vendor/llvm/dist/lib/Target/ARM/ARMBasicBlockInfo.cpp vendor/llvm/dist/lib/Target/ARM/ARMBasicBlockInfo.h vendor/llvm/dist/lib/Target/ARM/ARMCallLowering.cpp vendor/llvm/dist/lib/Target/ARM/ARMCallLowering.h vendor/llvm/dist/lib/Target/ARM/ARMCallingConv.cpp vendor/llvm/dist/lib/Target/ARM/ARMCodeGenPrepare.cpp vendor/llvm/dist/lib/Target/ARM/ARMConstantIslandPass.cpp vendor/llvm/dist/lib/Target/ARM/ARMConstantPoolValue.cpp vendor/llvm/dist/lib/Target/ARM/ARMExpandPseudoInsts.cpp vendor/llvm/dist/lib/Target/ARM/ARMFastISel.cpp vendor/llvm/dist/lib/Target/ARM/ARMFrameLowering.cpp vendor/llvm/dist/lib/Target/ARM/ARMFrameLowering.h vendor/llvm/dist/lib/Target/ARM/ARMISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.cpp vendor/llvm/dist/lib/Target/ARM/ARMISelLowering.h vendor/llvm/dist/lib/Target/ARM/ARMInstrFormats.td vendor/llvm/dist/lib/Target/ARM/ARMInstrInfo.cpp vendor/llvm/dist/lib/Target/ARM/ARMInstrInfo.td vendor/llvm/dist/lib/Target/ARM/ARMInstrMVE.td vendor/llvm/dist/lib/Target/ARM/ARMInstrNEON.td vendor/llvm/dist/lib/Target/ARM/ARMInstrThumb.td vendor/llvm/dist/lib/Target/ARM/ARMInstrThumb2.td vendor/llvm/dist/lib/Target/ARM/ARMInstrVFP.td vendor/llvm/dist/lib/Target/ARM/ARMInstructionSelector.cpp vendor/llvm/dist/lib/Target/ARM/ARMLegalizerInfo.cpp vendor/llvm/dist/lib/Target/ARM/ARMLoadStoreOptimizer.cpp vendor/llvm/dist/lib/Target/ARM/ARMLowOverheadLoops.cpp vendor/llvm/dist/lib/Target/ARM/ARMMCInstLower.cpp vendor/llvm/dist/lib/Target/ARM/ARMMachineFunctionInfo.h vendor/llvm/dist/lib/Target/ARM/ARMParallelDSP.cpp vendor/llvm/dist/lib/Target/ARM/ARMPredicates.td vendor/llvm/dist/lib/Target/ARM/ARMRegisterInfo.td vendor/llvm/dist/lib/Target/ARM/ARMScheduleA9.td vendor/llvm/dist/lib/Target/ARM/ARMScheduleM4.td vendor/llvm/dist/lib/Target/ARM/ARMSubtarget.cpp vendor/llvm/dist/lib/Target/ARM/ARMSubtarget.h vendor/llvm/dist/lib/Target/ARM/ARMTargetMachine.cpp vendor/llvm/dist/lib/Target/ARM/ARMTargetTransformInfo.cpp vendor/llvm/dist/lib/Target/ARM/ARMTargetTransformInfo.h vendor/llvm/dist/lib/Target/ARM/AsmParser/ARMAsmParser.cpp vendor/llvm/dist/lib/Target/ARM/Disassembler/ARMDisassembler.cpp vendor/llvm/dist/lib/Target/ARM/MCTargetDesc/ARMAddressingModes.h vendor/llvm/dist/lib/Target/ARM/MCTargetDesc/ARMAsmBackend.cpp vendor/llvm/dist/lib/Target/ARM/MCTargetDesc/ARMBaseInfo.h vendor/llvm/dist/lib/Target/ARM/MCTargetDesc/ARMELFObjectWriter.cpp vendor/llvm/dist/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.cpp vendor/llvm/dist/lib/Target/ARM/MCTargetDesc/ARMInstPrinter.h vendor/llvm/dist/lib/Target/ARM/MCTargetDesc/ARMMCCodeEmitter.cpp vendor/llvm/dist/lib/Target/ARM/MCTargetDesc/ARMMachObjectWriter.cpp vendor/llvm/dist/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp vendor/llvm/dist/lib/Target/ARM/MCTargetDesc/ARMWinCOFFObjectWriter.cpp vendor/llvm/dist/lib/Target/ARM/MCTargetDesc/ARMWinCOFFStreamer.cpp vendor/llvm/dist/lib/Target/ARM/MLxExpansionPass.cpp vendor/llvm/dist/lib/Target/ARM/Thumb1FrameLowering.cpp vendor/llvm/dist/lib/Target/ARM/Thumb1InstrInfo.cpp vendor/llvm/dist/lib/Target/ARM/Thumb2ITBlockPass.cpp vendor/llvm/dist/lib/Target/ARM/Thumb2InstrInfo.cpp vendor/llvm/dist/lib/Target/ARM/Thumb2SizeReduction.cpp vendor/llvm/dist/lib/Target/ARM/ThumbRegisterInfo.cpp vendor/llvm/dist/lib/Target/AVR/AVRAsmPrinter.cpp vendor/llvm/dist/lib/Target/AVR/AVRExpandPseudoInsts.cpp vendor/llvm/dist/lib/Target/AVR/AVRFrameLowering.cpp vendor/llvm/dist/lib/Target/AVR/AVRISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/AVR/AVRISelLowering.cpp vendor/llvm/dist/lib/Target/AVR/AVRISelLowering.h vendor/llvm/dist/lib/Target/AVR/AVRRegisterInfo.cpp vendor/llvm/dist/lib/Target/AVR/AVRTargetMachine.cpp vendor/llvm/dist/lib/Target/AVR/AsmParser/AVRAsmParser.cpp vendor/llvm/dist/lib/Target/AVR/MCTargetDesc/AVRELFObjectWriter.cpp vendor/llvm/dist/lib/Target/BPF/AsmParser/BPFAsmParser.cpp vendor/llvm/dist/lib/Target/BPF/BPF.h vendor/llvm/dist/lib/Target/BPF/BPFAbstractMemberAccess.cpp vendor/llvm/dist/lib/Target/BPF/BPFAsmPrinter.cpp vendor/llvm/dist/lib/Target/BPF/BPFCORE.h vendor/llvm/dist/lib/Target/BPF/BPFFrameLowering.h vendor/llvm/dist/lib/Target/BPF/BPFISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/BPF/BPFISelLowering.cpp vendor/llvm/dist/lib/Target/BPF/BPFInstrInfo.cpp vendor/llvm/dist/lib/Target/BPF/BPFInstrInfo.td vendor/llvm/dist/lib/Target/BPF/BPFMIChecking.cpp vendor/llvm/dist/lib/Target/BPF/BPFMIPeephole.cpp vendor/llvm/dist/lib/Target/BPF/BPFMISimplifyPatchable.cpp vendor/llvm/dist/lib/Target/BPF/BPFRegisterInfo.cpp vendor/llvm/dist/lib/Target/BPF/BPFTargetMachine.cpp vendor/llvm/dist/lib/Target/BPF/BTF.h vendor/llvm/dist/lib/Target/BPF/BTFDebug.cpp vendor/llvm/dist/lib/Target/BPF/BTFDebug.h vendor/llvm/dist/lib/Target/BPF/MCTargetDesc/BPFELFObjectWriter.cpp vendor/llvm/dist/lib/Target/Hexagon/AsmParser/HexagonAsmParser.cpp vendor/llvm/dist/lib/Target/Hexagon/BitTracker.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonAsmPrinter.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonBitSimplify.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonBitTracker.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonBlockRanges.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonBranchRelaxation.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonConstExtenders.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonConstPropagation.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonCopyToCombine.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonDepMapAsm2Intrin.td vendor/llvm/dist/lib/Target/Hexagon/HexagonDepOperands.td vendor/llvm/dist/lib/Target/Hexagon/HexagonEarlyIfConv.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonExpandCondsets.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonFixupHwLoops.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonFrameLowering.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonFrameLowering.h vendor/llvm/dist/lib/Target/Hexagon/HexagonGenExtract.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonGenInsert.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonGenMux.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonGenPredicate.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonHardwareLoops.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonISelLowering.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonISelLowering.h vendor/llvm/dist/lib/Target/Hexagon/HexagonISelLoweringHVX.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonInstrInfo.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonInstrInfo.h vendor/llvm/dist/lib/Target/Hexagon/HexagonIntrinsics.td vendor/llvm/dist/lib/Target/Hexagon/HexagonLoopIdiomRecognition.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonNewValueJump.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonOptAddrMode.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonPatterns.td vendor/llvm/dist/lib/Target/Hexagon/HexagonPatternsHVX.td vendor/llvm/dist/lib/Target/Hexagon/HexagonPeephole.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonRegisterInfo.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonSplitConst32AndConst64.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonSplitDouble.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonStoreWidening.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonSubtarget.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonSubtarget.h vendor/llvm/dist/lib/Target/Hexagon/HexagonTargetMachine.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonTargetTransformInfo.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonTargetTransformInfo.h vendor/llvm/dist/lib/Target/Hexagon/HexagonVExtract.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonVLIWPacketizer.cpp vendor/llvm/dist/lib/Target/Hexagon/HexagonVLIWPacketizer.h vendor/llvm/dist/lib/Target/Hexagon/MCTargetDesc/HexagonAsmBackend.cpp vendor/llvm/dist/lib/Target/Hexagon/MCTargetDesc/HexagonELFObjectWriter.cpp vendor/llvm/dist/lib/Target/Hexagon/MCTargetDesc/HexagonMCChecker.cpp vendor/llvm/dist/lib/Target/Hexagon/MCTargetDesc/HexagonMCELFStreamer.cpp vendor/llvm/dist/lib/Target/Hexagon/MCTargetDesc/HexagonMCTargetDesc.cpp vendor/llvm/dist/lib/Target/Hexagon/RDFCopy.cpp vendor/llvm/dist/lib/Target/Hexagon/RDFDeadCode.cpp vendor/llvm/dist/lib/Target/Hexagon/RDFGraph.cpp vendor/llvm/dist/lib/Target/Hexagon/RDFLiveness.cpp vendor/llvm/dist/lib/Target/Hexagon/RDFRegisters.cpp vendor/llvm/dist/lib/Target/Hexagon/RDFRegisters.h vendor/llvm/dist/lib/Target/Lanai/AsmParser/LanaiAsmParser.cpp vendor/llvm/dist/lib/Target/Lanai/LanaiAsmPrinter.cpp vendor/llvm/dist/lib/Target/Lanai/LanaiDelaySlotFiller.cpp vendor/llvm/dist/lib/Target/Lanai/LanaiFrameLowering.cpp vendor/llvm/dist/lib/Target/Lanai/LanaiFrameLowering.h vendor/llvm/dist/lib/Target/Lanai/LanaiISelLowering.cpp vendor/llvm/dist/lib/Target/Lanai/LanaiISelLowering.h vendor/llvm/dist/lib/Target/Lanai/LanaiInstrInfo.cpp vendor/llvm/dist/lib/Target/Lanai/LanaiInstrInfo.h vendor/llvm/dist/lib/Target/Lanai/LanaiRegisterInfo.cpp vendor/llvm/dist/lib/Target/Lanai/MCTargetDesc/LanaiELFObjectWriter.cpp vendor/llvm/dist/lib/Target/MSP430/AsmParser/MSP430AsmParser.cpp vendor/llvm/dist/lib/Target/MSP430/MCTargetDesc/MSP430ELFObjectWriter.cpp vendor/llvm/dist/lib/Target/MSP430/MSP430AsmPrinter.cpp vendor/llvm/dist/lib/Target/MSP430/MSP430BranchSelector.cpp vendor/llvm/dist/lib/Target/MSP430/MSP430FrameLowering.h vendor/llvm/dist/lib/Target/MSP430/MSP430ISelLowering.cpp vendor/llvm/dist/lib/Target/MSP430/MSP430ISelLowering.h vendor/llvm/dist/lib/Target/MSP430/MSP430RegisterInfo.cpp vendor/llvm/dist/lib/Target/MSP430/MSP430TargetMachine.cpp vendor/llvm/dist/lib/Target/Mips/AsmParser/MipsAsmParser.cpp vendor/llvm/dist/lib/Target/Mips/Disassembler/MipsDisassembler.cpp vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.cpp vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsAsmBackend.h vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsELFObjectWriter.cpp vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsMCCodeEmitter.cpp vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsMCNaCl.h vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsMCTargetDesc.cpp vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsNaClELFStreamer.cpp vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsOptionRecord.cpp vendor/llvm/dist/lib/Target/Mips/MCTargetDesc/MipsTargetStreamer.cpp vendor/llvm/dist/lib/Target/Mips/MicroMipsDSPInstrInfo.td vendor/llvm/dist/lib/Target/Mips/MicroMipsInstrInfo.td vendor/llvm/dist/lib/Target/Mips/MicroMipsSizeReduction.cpp vendor/llvm/dist/lib/Target/Mips/Mips.td vendor/llvm/dist/lib/Target/Mips/Mips16ISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/Mips/Mips16ISelLowering.cpp vendor/llvm/dist/lib/Target/Mips/Mips16InstrInfo.cpp vendor/llvm/dist/lib/Target/Mips/Mips64InstrInfo.td vendor/llvm/dist/lib/Target/Mips/MipsAsmPrinter.cpp vendor/llvm/dist/lib/Target/Mips/MipsCallLowering.cpp vendor/llvm/dist/lib/Target/Mips/MipsCallLowering.h vendor/llvm/dist/lib/Target/Mips/MipsConstantIslandPass.cpp vendor/llvm/dist/lib/Target/Mips/MipsDSPInstrInfo.td vendor/llvm/dist/lib/Target/Mips/MipsExpandPseudo.cpp vendor/llvm/dist/lib/Target/Mips/MipsFastISel.cpp vendor/llvm/dist/lib/Target/Mips/MipsFrameLowering.h vendor/llvm/dist/lib/Target/Mips/MipsISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/Mips/MipsISelDAGToDAG.h vendor/llvm/dist/lib/Target/Mips/MipsISelLowering.cpp vendor/llvm/dist/lib/Target/Mips/MipsISelLowering.h vendor/llvm/dist/lib/Target/Mips/MipsInstrInfo.cpp vendor/llvm/dist/lib/Target/Mips/MipsInstrInfo.h vendor/llvm/dist/lib/Target/Mips/MipsInstrInfo.td vendor/llvm/dist/lib/Target/Mips/MipsInstructionSelector.cpp vendor/llvm/dist/lib/Target/Mips/MipsLegalizerInfo.cpp vendor/llvm/dist/lib/Target/Mips/MipsLegalizerInfo.h vendor/llvm/dist/lib/Target/Mips/MipsMSAInstrInfo.td vendor/llvm/dist/lib/Target/Mips/MipsOptimizePICCall.cpp vendor/llvm/dist/lib/Target/Mips/MipsPreLegalizerCombiner.cpp vendor/llvm/dist/lib/Target/Mips/MipsRegisterBankInfo.cpp vendor/llvm/dist/lib/Target/Mips/MipsRegisterBankInfo.h vendor/llvm/dist/lib/Target/Mips/MipsRegisterBanks.td vendor/llvm/dist/lib/Target/Mips/MipsSEFrameLowering.cpp vendor/llvm/dist/lib/Target/Mips/MipsSEISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/Mips/MipsSEISelDAGToDAG.h vendor/llvm/dist/lib/Target/Mips/MipsSEISelLowering.cpp vendor/llvm/dist/lib/Target/Mips/MipsSEInstrInfo.cpp vendor/llvm/dist/lib/Target/Mips/MipsSERegisterInfo.cpp vendor/llvm/dist/lib/Target/Mips/MipsSubtarget.cpp vendor/llvm/dist/lib/Target/Mips/MipsSubtarget.h vendor/llvm/dist/lib/Target/Mips/MipsTargetMachine.cpp vendor/llvm/dist/lib/Target/Mips/MipsTargetStreamer.h vendor/llvm/dist/lib/Target/NVPTX/NVPTX.h vendor/llvm/dist/lib/Target/NVPTX/NVPTXAsmPrinter.cpp vendor/llvm/dist/lib/Target/NVPTX/NVPTXAsmPrinter.h vendor/llvm/dist/lib/Target/NVPTX/NVPTXFrameLowering.cpp vendor/llvm/dist/lib/Target/NVPTX/NVPTXISelLowering.cpp vendor/llvm/dist/lib/Target/NVPTX/NVPTXInstrInfo.td vendor/llvm/dist/lib/Target/NVPTX/NVPTXIntrinsics.td vendor/llvm/dist/lib/Target/NVPTX/NVPTXLowerAggrCopies.cpp vendor/llvm/dist/lib/Target/NVPTX/NVPTXLowerAlloca.cpp vendor/llvm/dist/lib/Target/NVPTX/NVPTXLowerArgs.cpp vendor/llvm/dist/lib/Target/NVPTX/NVPTXPeephole.cpp vendor/llvm/dist/lib/Target/NVPTX/NVPTXPrologEpilogPass.cpp vendor/llvm/dist/lib/Target/NVPTX/NVPTXTargetMachine.cpp vendor/llvm/dist/lib/Target/NVPTX/NVPTXUtilities.cpp vendor/llvm/dist/lib/Target/PowerPC/AsmParser/PPCAsmParser.cpp vendor/llvm/dist/lib/Target/PowerPC/Disassembler/PPCDisassembler.cpp vendor/llvm/dist/lib/Target/PowerPC/MCTargetDesc/PPCELFObjectWriter.cpp vendor/llvm/dist/lib/Target/PowerPC/MCTargetDesc/PPCInstPrinter.cpp vendor/llvm/dist/lib/Target/PowerPC/MCTargetDesc/PPCMCAsmInfo.cpp vendor/llvm/dist/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.cpp vendor/llvm/dist/lib/Target/PowerPC/MCTargetDesc/PPCMCExpr.h vendor/llvm/dist/lib/Target/PowerPC/MCTargetDesc/PPCMachObjectWriter.cpp vendor/llvm/dist/lib/Target/PowerPC/MCTargetDesc/PPCXCOFFObjectWriter.cpp vendor/llvm/dist/lib/Target/PowerPC/P9InstrResources.td vendor/llvm/dist/lib/Target/PowerPC/PPC.h vendor/llvm/dist/lib/Target/PowerPC/PPCAsmPrinter.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCBranchCoalescing.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCBranchSelector.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCFastISel.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCFrameLowering.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCFrameLowering.h vendor/llvm/dist/lib/Target/PowerPC/PPCISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCISelLowering.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCISelLowering.h vendor/llvm/dist/lib/Target/PowerPC/PPCInstr64Bit.td vendor/llvm/dist/lib/Target/PowerPC/PPCInstrAltivec.td vendor/llvm/dist/lib/Target/PowerPC/PPCInstrFormats.td vendor/llvm/dist/lib/Target/PowerPC/PPCInstrInfo.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCInstrInfo.h vendor/llvm/dist/lib/Target/PowerPC/PPCInstrInfo.td vendor/llvm/dist/lib/Target/PowerPC/PPCInstrVSX.td vendor/llvm/dist/lib/Target/PowerPC/PPCLoopPreIncPrep.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCMCInstLower.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCMIPeephole.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCPreEmitPeephole.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCQPXLoadSplat.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCReduceCRLogicals.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCRegisterInfo.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCRegisterInfo.td vendor/llvm/dist/lib/Target/PowerPC/PPCSubtarget.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCSubtarget.h vendor/llvm/dist/lib/Target/PowerPC/PPCTLSDynamicCall.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCTOCRegDeps.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCTargetMachine.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCTargetTransformInfo.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCTargetTransformInfo.h vendor/llvm/dist/lib/Target/PowerPC/PPCVSXCopy.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCVSXFMAMutate.cpp vendor/llvm/dist/lib/Target/PowerPC/PPCVSXSwapRemoval.cpp vendor/llvm/dist/lib/Target/RISCV/AsmParser/RISCVAsmParser.cpp vendor/llvm/dist/lib/Target/RISCV/Disassembler/RISCVDisassembler.cpp vendor/llvm/dist/lib/Target/RISCV/MCTargetDesc/RISCVAsmBackend.cpp vendor/llvm/dist/lib/Target/RISCV/MCTargetDesc/RISCVELFObjectWriter.cpp vendor/llvm/dist/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.cpp vendor/llvm/dist/lib/Target/RISCV/MCTargetDesc/RISCVInstPrinter.h vendor/llvm/dist/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.cpp vendor/llvm/dist/lib/Target/RISCV/MCTargetDesc/RISCVMCAsmInfo.h vendor/llvm/dist/lib/Target/RISCV/MCTargetDesc/RISCVMCCodeEmitter.cpp vendor/llvm/dist/lib/Target/RISCV/MCTargetDesc/RISCVMCExpr.h vendor/llvm/dist/lib/Target/RISCV/MCTargetDesc/RISCVMCTargetDesc.cpp vendor/llvm/dist/lib/Target/RISCV/RISCV.h vendor/llvm/dist/lib/Target/RISCV/RISCV.td vendor/llvm/dist/lib/Target/RISCV/RISCVCallingConv.td vendor/llvm/dist/lib/Target/RISCV/RISCVExpandPseudoInsts.cpp vendor/llvm/dist/lib/Target/RISCV/RISCVFrameLowering.cpp vendor/llvm/dist/lib/Target/RISCV/RISCVFrameLowering.h vendor/llvm/dist/lib/Target/RISCV/RISCVISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/RISCV/RISCVISelLowering.cpp vendor/llvm/dist/lib/Target/RISCV/RISCVISelLowering.h vendor/llvm/dist/lib/Target/RISCV/RISCVInstrInfo.cpp vendor/llvm/dist/lib/Target/RISCV/RISCVInstrInfo.h vendor/llvm/dist/lib/Target/RISCV/RISCVInstrInfo.td vendor/llvm/dist/lib/Target/RISCV/RISCVInstrInfoA.td vendor/llvm/dist/lib/Target/RISCV/RISCVInstrInfoC.td vendor/llvm/dist/lib/Target/RISCV/RISCVInstrInfoF.td vendor/llvm/dist/lib/Target/RISCV/RISCVMergeBaseOffset.cpp vendor/llvm/dist/lib/Target/RISCV/RISCVRegisterInfo.cpp vendor/llvm/dist/lib/Target/RISCV/RISCVRegisterInfo.h vendor/llvm/dist/lib/Target/RISCV/RISCVRegisterInfo.td vendor/llvm/dist/lib/Target/RISCV/RISCVSubtarget.cpp vendor/llvm/dist/lib/Target/RISCV/RISCVSubtarget.h vendor/llvm/dist/lib/Target/RISCV/RISCVTargetMachine.cpp vendor/llvm/dist/lib/Target/RISCV/Utils/RISCVBaseInfo.h vendor/llvm/dist/lib/Target/Sparc/AsmParser/SparcAsmParser.cpp vendor/llvm/dist/lib/Target/Sparc/DelaySlotFiller.cpp vendor/llvm/dist/lib/Target/Sparc/MCTargetDesc/SparcELFObjectWriter.cpp vendor/llvm/dist/lib/Target/Sparc/SparcFrameLowering.cpp vendor/llvm/dist/lib/Target/Sparc/SparcISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/Sparc/SparcISelLowering.cpp vendor/llvm/dist/lib/Target/Sparc/SparcISelLowering.h vendor/llvm/dist/lib/Target/Sparc/SparcInstr64Bit.td vendor/llvm/dist/lib/Target/Sparc/SparcInstrInfo.cpp vendor/llvm/dist/lib/Target/Sparc/SparcInstrInfo.td vendor/llvm/dist/lib/Target/Sparc/SparcRegisterInfo.cpp vendor/llvm/dist/lib/Target/Sparc/SparcTargetMachine.cpp vendor/llvm/dist/lib/Target/SystemZ/AsmParser/SystemZAsmParser.cpp vendor/llvm/dist/lib/Target/SystemZ/MCTargetDesc/SystemZMCObjectWriter.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZ.h vendor/llvm/dist/lib/Target/SystemZ/SystemZAsmPrinter.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZAsmPrinter.h vendor/llvm/dist/lib/Target/SystemZ/SystemZElimCompare.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZFrameLowering.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZISelLowering.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZInstrFP.td vendor/llvm/dist/lib/Target/SystemZ/SystemZInstrFormats.td vendor/llvm/dist/lib/Target/SystemZ/SystemZInstrInfo.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZInstrInfo.h vendor/llvm/dist/lib/Target/SystemZ/SystemZInstrInfo.td vendor/llvm/dist/lib/Target/SystemZ/SystemZInstrVector.td vendor/llvm/dist/lib/Target/SystemZ/SystemZLongBranch.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZMachineScheduler.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZOperands.td vendor/llvm/dist/lib/Target/SystemZ/SystemZOperators.td vendor/llvm/dist/lib/Target/SystemZ/SystemZPatterns.td vendor/llvm/dist/lib/Target/SystemZ/SystemZPostRewrite.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZProcessors.td vendor/llvm/dist/lib/Target/SystemZ/SystemZRegisterInfo.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZRegisterInfo.h vendor/llvm/dist/lib/Target/SystemZ/SystemZSchedule.td vendor/llvm/dist/lib/Target/SystemZ/SystemZSelectionDAGInfo.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZShortenInst.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZTargetMachine.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZTargetTransformInfo.cpp vendor/llvm/dist/lib/Target/SystemZ/SystemZTargetTransformInfo.h vendor/llvm/dist/lib/Target/TargetLoweringObjectFile.cpp vendor/llvm/dist/lib/Target/TargetMachine.cpp vendor/llvm/dist/lib/Target/TargetMachineC.cpp vendor/llvm/dist/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp vendor/llvm/dist/lib/Target/WebAssembly/Disassembler/WebAssemblyDisassembler.cpp vendor/llvm/dist/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyAsmBackend.cpp vendor/llvm/dist/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.cpp vendor/llvm/dist/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyInstPrinter.h vendor/llvm/dist/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCCodeEmitter.cpp vendor/llvm/dist/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyMCTargetDesc.h vendor/llvm/dist/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.cpp vendor/llvm/dist/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyTargetStreamer.h vendor/llvm/dist/lib/Target/WebAssembly/MCTargetDesc/WebAssemblyWasmObjectWriter.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyAsmPrinter.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyCFGSort.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyCFGStackify.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyExplicitLocals.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyFastISel.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyFixFunctionBitcasts.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyFixIrreducibleControlFlow.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyFrameLowering.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyFrameLowering.h vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyISD.def vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyISelLowering.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyISelLowering.h vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyInstrAtomics.td vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyInstrBulkMemory.td vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyInstrControl.td vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyInstrConv.td vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyInstrInfo.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyInstrInfo.h vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyInstrInfo.td vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyInstrMemory.td vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyInstrSIMD.td vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyLateEHPrepare.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyLowerBrUnless.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyLowerEmscriptenEHSjLj.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyLowerGlobalDtors.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyMCInstLower.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyMCInstLower.h vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyMachineFunctionInfo.h vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyMemIntrinsicResults.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyOptimizeLiveIntervals.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyOptimizeReturned.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyPeephole.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyPrepareForLiveIntervals.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyRegColoring.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyRegNumbering.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyRegStackify.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyRegisterInfo.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyTargetMachine.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.cpp vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyTargetTransformInfo.h vendor/llvm/dist/lib/Target/WebAssembly/WebAssemblyUtilities.cpp vendor/llvm/dist/lib/Target/X86/AsmParser/X86AsmParser.cpp vendor/llvm/dist/lib/Target/X86/AsmParser/X86AsmParserCommon.h vendor/llvm/dist/lib/Target/X86/AsmParser/X86Operand.h vendor/llvm/dist/lib/Target/X86/Disassembler/X86DisassemblerDecoder.cpp vendor/llvm/dist/lib/Target/X86/MCTargetDesc/X86AsmBackend.cpp vendor/llvm/dist/lib/Target/X86/MCTargetDesc/X86ELFObjectWriter.cpp vendor/llvm/dist/lib/Target/X86/MCTargetDesc/X86MCAsmInfo.cpp vendor/llvm/dist/lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp vendor/llvm/dist/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.cpp vendor/llvm/dist/lib/Target/X86/MCTargetDesc/X86MCTargetDesc.h vendor/llvm/dist/lib/Target/X86/MCTargetDesc/X86MachObjectWriter.cpp vendor/llvm/dist/lib/Target/X86/MCTargetDesc/X86WinCOFFObjectWriter.cpp vendor/llvm/dist/lib/Target/X86/MCTargetDesc/X86WinCOFFStreamer.cpp vendor/llvm/dist/lib/Target/X86/MCTargetDesc/X86WinCOFFTargetStreamer.cpp vendor/llvm/dist/lib/Target/X86/X86.h vendor/llvm/dist/lib/Target/X86/X86.td vendor/llvm/dist/lib/Target/X86/X86AsmPrinter.cpp vendor/llvm/dist/lib/Target/X86/X86AvoidStoreForwardingBlocks.cpp vendor/llvm/dist/lib/Target/X86/X86CallFrameOptimization.cpp vendor/llvm/dist/lib/Target/X86/X86CallLowering.cpp vendor/llvm/dist/lib/Target/X86/X86CallLowering.h vendor/llvm/dist/lib/Target/X86/X86CallingConv.td vendor/llvm/dist/lib/Target/X86/X86CmovConversion.cpp vendor/llvm/dist/lib/Target/X86/X86CondBrFolding.cpp vendor/llvm/dist/lib/Target/X86/X86DomainReassignment.cpp vendor/llvm/dist/lib/Target/X86/X86EvexToVex.cpp vendor/llvm/dist/lib/Target/X86/X86ExpandPseudo.cpp vendor/llvm/dist/lib/Target/X86/X86FastISel.cpp vendor/llvm/dist/lib/Target/X86/X86FixupBWInsts.cpp vendor/llvm/dist/lib/Target/X86/X86FixupLEAs.cpp vendor/llvm/dist/lib/Target/X86/X86FixupSetCC.cpp vendor/llvm/dist/lib/Target/X86/X86FlagsCopyLowering.cpp vendor/llvm/dist/lib/Target/X86/X86FloatingPoint.cpp vendor/llvm/dist/lib/Target/X86/X86FrameLowering.cpp vendor/llvm/dist/lib/Target/X86/X86FrameLowering.h vendor/llvm/dist/lib/Target/X86/X86ISelDAGToDAG.cpp vendor/llvm/dist/lib/Target/X86/X86ISelLowering.cpp vendor/llvm/dist/lib/Target/X86/X86ISelLowering.h vendor/llvm/dist/lib/Target/X86/X86IndirectBranchTracking.cpp vendor/llvm/dist/lib/Target/X86/X86InsertPrefetch.cpp vendor/llvm/dist/lib/Target/X86/X86InstrAVX512.td vendor/llvm/dist/lib/Target/X86/X86InstrArithmetic.td vendor/llvm/dist/lib/Target/X86/X86InstrBuilder.h vendor/llvm/dist/lib/Target/X86/X86InstrCMovSetCC.td vendor/llvm/dist/lib/Target/X86/X86InstrCompiler.td vendor/llvm/dist/lib/Target/X86/X86InstrControl.td vendor/llvm/dist/lib/Target/X86/X86InstrExtension.td vendor/llvm/dist/lib/Target/X86/X86InstrFoldTables.cpp vendor/llvm/dist/lib/Target/X86/X86InstrFoldTables.h vendor/llvm/dist/lib/Target/X86/X86InstrFragmentsSIMD.td vendor/llvm/dist/lib/Target/X86/X86InstrInfo.cpp vendor/llvm/dist/lib/Target/X86/X86InstrInfo.h vendor/llvm/dist/lib/Target/X86/X86InstrInfo.td vendor/llvm/dist/lib/Target/X86/X86InstrMMX.td vendor/llvm/dist/lib/Target/X86/X86InstrMPX.td vendor/llvm/dist/lib/Target/X86/X86InstrSSE.td vendor/llvm/dist/lib/Target/X86/X86InstrSystem.td vendor/llvm/dist/lib/Target/X86/X86InstrTSX.td vendor/llvm/dist/lib/Target/X86/X86InstrXOP.td vendor/llvm/dist/lib/Target/X86/X86InstructionSelector.cpp vendor/llvm/dist/lib/Target/X86/X86IntrinsicsInfo.h vendor/llvm/dist/lib/Target/X86/X86LegalizerInfo.cpp vendor/llvm/dist/lib/Target/X86/X86LegalizerInfo.h vendor/llvm/dist/lib/Target/X86/X86MCInstLower.cpp vendor/llvm/dist/lib/Target/X86/X86MachineFunctionInfo.h vendor/llvm/dist/lib/Target/X86/X86OptimizeLEAs.cpp vendor/llvm/dist/lib/Target/X86/X86RegisterBankInfo.cpp vendor/llvm/dist/lib/Target/X86/X86RegisterInfo.cpp vendor/llvm/dist/lib/Target/X86/X86RetpolineThunks.cpp vendor/llvm/dist/lib/Target/X86/X86SchedBroadwell.td vendor/llvm/dist/lib/Target/X86/X86SchedHaswell.td vendor/llvm/dist/lib/Target/X86/X86SchedPredicates.td vendor/llvm/dist/lib/Target/X86/X86SchedSandyBridge.td vendor/llvm/dist/lib/Target/X86/X86SchedSkylakeClient.td vendor/llvm/dist/lib/Target/X86/X86SchedSkylakeServer.td vendor/llvm/dist/lib/Target/X86/X86Schedule.td vendor/llvm/dist/lib/Target/X86/X86ScheduleAtom.td vendor/llvm/dist/lib/Target/X86/X86ScheduleBdVer2.td vendor/llvm/dist/lib/Target/X86/X86ScheduleBtVer2.td vendor/llvm/dist/lib/Target/X86/X86ScheduleSLM.td vendor/llvm/dist/lib/Target/X86/X86ScheduleZnver1.td vendor/llvm/dist/lib/Target/X86/X86SelectionDAGInfo.cpp vendor/llvm/dist/lib/Target/X86/X86SpeculativeLoadHardening.cpp vendor/llvm/dist/lib/Target/X86/X86Subtarget.cpp vendor/llvm/dist/lib/Target/X86/X86Subtarget.h vendor/llvm/dist/lib/Target/X86/X86TargetMachine.cpp vendor/llvm/dist/lib/Target/X86/X86TargetMachine.h vendor/llvm/dist/lib/Target/X86/X86TargetObjectFile.cpp vendor/llvm/dist/lib/Target/X86/X86TargetObjectFile.h vendor/llvm/dist/lib/Target/X86/X86TargetTransformInfo.cpp vendor/llvm/dist/lib/Target/X86/X86TargetTransformInfo.h vendor/llvm/dist/lib/Target/X86/X86VZeroUpper.cpp vendor/llvm/dist/lib/Target/X86/X86WinAllocaExpander.cpp vendor/llvm/dist/lib/Target/X86/X86WinEHState.cpp vendor/llvm/dist/lib/Target/XCore/XCoreAsmPrinter.cpp vendor/llvm/dist/lib/Target/XCore/XCoreFrameLowering.cpp vendor/llvm/dist/lib/Target/XCore/XCoreFrameToArgsOffsetElim.cpp vendor/llvm/dist/lib/Target/XCore/XCoreISelLowering.cpp vendor/llvm/dist/lib/Target/XCore/XCoreRegisterInfo.cpp vendor/llvm/dist/lib/Target/XCore/XCoreTargetMachine.cpp vendor/llvm/dist/lib/Target/XCore/XCoreTargetTransformInfo.h vendor/llvm/dist/lib/TextAPI/MachO/Architecture.cpp vendor/llvm/dist/lib/TextAPI/MachO/InterfaceFile.cpp vendor/llvm/dist/lib/TextAPI/MachO/Symbol.cpp vendor/llvm/dist/lib/TextAPI/MachO/TextStub.cpp vendor/llvm/dist/lib/TextAPI/MachO/TextStubCommon.cpp vendor/llvm/dist/lib/TextAPI/MachO/TextStubCommon.h vendor/llvm/dist/lib/ToolDrivers/llvm-dlltool/DlltoolDriver.cpp vendor/llvm/dist/lib/ToolDrivers/llvm-lib/LibDriver.cpp vendor/llvm/dist/lib/Transforms/AggressiveInstCombine/AggressiveInstCombine.cpp vendor/llvm/dist/lib/Transforms/Coroutines/CoroCleanup.cpp vendor/llvm/dist/lib/Transforms/Coroutines/CoroEarly.cpp vendor/llvm/dist/lib/Transforms/Coroutines/CoroElide.cpp vendor/llvm/dist/lib/Transforms/Coroutines/CoroFrame.cpp vendor/llvm/dist/lib/Transforms/Coroutines/CoroInstr.h vendor/llvm/dist/lib/Transforms/Coroutines/CoroInternal.h vendor/llvm/dist/lib/Transforms/Coroutines/CoroSplit.cpp vendor/llvm/dist/lib/Transforms/Coroutines/Coroutines.cpp vendor/llvm/dist/lib/Transforms/IPO/ArgumentPromotion.cpp vendor/llvm/dist/lib/Transforms/IPO/Attributor.cpp vendor/llvm/dist/lib/Transforms/IPO/BlockExtractor.cpp vendor/llvm/dist/lib/Transforms/IPO/ConstantMerge.cpp vendor/llvm/dist/lib/Transforms/IPO/CrossDSOCFI.cpp vendor/llvm/dist/lib/Transforms/IPO/FunctionAttrs.cpp vendor/llvm/dist/lib/Transforms/IPO/FunctionImport.cpp vendor/llvm/dist/lib/Transforms/IPO/GlobalDCE.cpp vendor/llvm/dist/lib/Transforms/IPO/GlobalOpt.cpp vendor/llvm/dist/lib/Transforms/IPO/HotColdSplitting.cpp vendor/llvm/dist/lib/Transforms/IPO/IPO.cpp vendor/llvm/dist/lib/Transforms/IPO/InferFunctionAttrs.cpp vendor/llvm/dist/lib/Transforms/IPO/Inliner.cpp vendor/llvm/dist/lib/Transforms/IPO/LoopExtractor.cpp vendor/llvm/dist/lib/Transforms/IPO/LowerTypeTests.cpp vendor/llvm/dist/lib/Transforms/IPO/MergeFunctions.cpp vendor/llvm/dist/lib/Transforms/IPO/PartialInlining.cpp vendor/llvm/dist/lib/Transforms/IPO/PassManagerBuilder.cpp vendor/llvm/dist/lib/Transforms/IPO/SCCP.cpp vendor/llvm/dist/lib/Transforms/IPO/SampleProfile.cpp vendor/llvm/dist/lib/Transforms/IPO/ThinLTOBitcodeWriter.cpp vendor/llvm/dist/lib/Transforms/IPO/WholeProgramDevirt.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineAddSub.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineAndOrXor.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineAtomicRMW.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCalls.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCasts.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineCompares.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineInternal.h vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineLoadStoreAlloca.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineMulDivRem.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombinePHI.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineSelect.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineShifts.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineSimplifyDemanded.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstCombineVectorOps.cpp vendor/llvm/dist/lib/Transforms/InstCombine/InstructionCombining.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/AddressSanitizer.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/BoundsChecking.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/CFGMST.h vendor/llvm/dist/lib/Transforms/Instrumentation/ControlHeightReduction.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/DataFlowSanitizer.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/GCOVProfiling.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/HWAddressSanitizer.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/IndirectCallPromotion.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/InstrOrderFile.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/InstrProfiling.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/Instrumentation.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/MemorySanitizer.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/PGOInstrumentation.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/PGOMemOPSizeOpt.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/SanitizerCoverage.cpp vendor/llvm/dist/lib/Transforms/Instrumentation/ThreadSanitizer.cpp vendor/llvm/dist/lib/Transforms/ObjCARC/PtrState.cpp vendor/llvm/dist/lib/Transforms/Scalar/AlignmentFromAssumptions.cpp vendor/llvm/dist/lib/Transforms/Scalar/CallSiteSplitting.cpp vendor/llvm/dist/lib/Transforms/Scalar/ConstantHoisting.cpp vendor/llvm/dist/lib/Transforms/Scalar/ConstantProp.cpp vendor/llvm/dist/lib/Transforms/Scalar/CorrelatedValuePropagation.cpp vendor/llvm/dist/lib/Transforms/Scalar/DCE.cpp vendor/llvm/dist/lib/Transforms/Scalar/DeadStoreElimination.cpp vendor/llvm/dist/lib/Transforms/Scalar/DivRemPairs.cpp vendor/llvm/dist/lib/Transforms/Scalar/EarlyCSE.cpp vendor/llvm/dist/lib/Transforms/Scalar/FlattenCFGPass.cpp vendor/llvm/dist/lib/Transforms/Scalar/Float2Int.cpp vendor/llvm/dist/lib/Transforms/Scalar/GVN.cpp vendor/llvm/dist/lib/Transforms/Scalar/GVNHoist.cpp vendor/llvm/dist/lib/Transforms/Scalar/GuardWidening.cpp vendor/llvm/dist/lib/Transforms/Scalar/IndVarSimplify.cpp vendor/llvm/dist/lib/Transforms/Scalar/InferAddressSpaces.cpp vendor/llvm/dist/lib/Transforms/Scalar/InstSimplifyPass.cpp vendor/llvm/dist/lib/Transforms/Scalar/JumpThreading.cpp vendor/llvm/dist/lib/Transforms/Scalar/LICM.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopDataPrefetch.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopDeletion.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopFuse.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopIdiomRecognize.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopInstSimplify.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopInterchange.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopLoadElimination.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopPredication.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopRerollPass.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopRotation.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopSimplifyCFG.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopSink.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopStrengthReduce.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopUnrollAndJamPass.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopUnrollPass.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopUnswitch.cpp vendor/llvm/dist/lib/Transforms/Scalar/LoopVersioningLICM.cpp vendor/llvm/dist/lib/Transforms/Scalar/LowerExpectIntrinsic.cpp vendor/llvm/dist/lib/Transforms/Scalar/MemCpyOptimizer.cpp vendor/llvm/dist/lib/Transforms/Scalar/MergeICmps.cpp vendor/llvm/dist/lib/Transforms/Scalar/MergedLoadStoreMotion.cpp vendor/llvm/dist/lib/Transforms/Scalar/NaryReassociate.cpp vendor/llvm/dist/lib/Transforms/Scalar/NewGVN.cpp vendor/llvm/dist/lib/Transforms/Scalar/PartiallyInlineLibCalls.cpp vendor/llvm/dist/lib/Transforms/Scalar/PlaceSafepoints.cpp vendor/llvm/dist/lib/Transforms/Scalar/Reassociate.cpp vendor/llvm/dist/lib/Transforms/Scalar/RewriteStatepointsForGC.cpp vendor/llvm/dist/lib/Transforms/Scalar/SCCP.cpp vendor/llvm/dist/lib/Transforms/Scalar/SROA.cpp vendor/llvm/dist/lib/Transforms/Scalar/Scalar.cpp vendor/llvm/dist/lib/Transforms/Scalar/SeparateConstOffsetFromGEP.cpp vendor/llvm/dist/lib/Transforms/Scalar/SimpleLoopUnswitch.cpp vendor/llvm/dist/lib/Transforms/Scalar/SpeculateAroundPHIs.cpp vendor/llvm/dist/lib/Transforms/Scalar/StructurizeCFG.cpp vendor/llvm/dist/lib/Transforms/Scalar/TailRecursionElimination.cpp vendor/llvm/dist/lib/Transforms/Utils/BasicBlockUtils.cpp vendor/llvm/dist/lib/Transforms/Utils/BuildLibCalls.cpp vendor/llvm/dist/lib/Transforms/Utils/BypassSlowDivision.cpp vendor/llvm/dist/lib/Transforms/Utils/CanonicalizeAliases.cpp vendor/llvm/dist/lib/Transforms/Utils/CloneFunction.cpp vendor/llvm/dist/lib/Transforms/Utils/CloneModule.cpp vendor/llvm/dist/lib/Transforms/Utils/CodeExtractor.cpp vendor/llvm/dist/lib/Transforms/Utils/EntryExitInstrumenter.cpp vendor/llvm/dist/lib/Transforms/Utils/Evaluator.cpp vendor/llvm/dist/lib/Transforms/Utils/FlattenCFG.cpp vendor/llvm/dist/lib/Transforms/Utils/FunctionImportUtils.cpp vendor/llvm/dist/lib/Transforms/Utils/ImportedFunctionsInliningStatistics.cpp vendor/llvm/dist/lib/Transforms/Utils/LibCallsShrinkWrap.cpp vendor/llvm/dist/lib/Transforms/Utils/Local.cpp vendor/llvm/dist/lib/Transforms/Utils/LoopRotationUtils.cpp vendor/llvm/dist/lib/Transforms/Utils/LoopSimplify.cpp vendor/llvm/dist/lib/Transforms/Utils/LoopUnroll.cpp vendor/llvm/dist/lib/Transforms/Utils/LoopUnrollAndJam.cpp vendor/llvm/dist/lib/Transforms/Utils/LoopUnrollPeel.cpp vendor/llvm/dist/lib/Transforms/Utils/LoopUtils.cpp vendor/llvm/dist/lib/Transforms/Utils/LoopVersioning.cpp vendor/llvm/dist/lib/Transforms/Utils/MetaRenamer.cpp vendor/llvm/dist/lib/Transforms/Utils/ModuleUtils.cpp vendor/llvm/dist/lib/Transforms/Utils/PredicateInfo.cpp vendor/llvm/dist/lib/Transforms/Utils/SimplifyCFG.cpp vendor/llvm/dist/lib/Transforms/Utils/SimplifyLibCalls.cpp vendor/llvm/dist/lib/Transforms/Utils/SymbolRewriter.cpp vendor/llvm/dist/lib/Transforms/Utils/VNCoercion.cpp vendor/llvm/dist/lib/Transforms/Utils/ValueMapper.cpp vendor/llvm/dist/lib/Transforms/Vectorize/LoadStoreVectorizer.cpp vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorizationLegality.cpp vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorizationPlanner.h vendor/llvm/dist/lib/Transforms/Vectorize/LoopVectorize.cpp vendor/llvm/dist/lib/Transforms/Vectorize/SLPVectorizer.cpp vendor/llvm/dist/lib/Transforms/Vectorize/VPlan.cpp vendor/llvm/dist/lib/Transforms/Vectorize/VPlan.h vendor/llvm/dist/lib/Transforms/Vectorize/VPlanHCFGTransforms.cpp vendor/llvm/dist/lib/Transforms/Vectorize/VPlanSLP.cpp vendor/llvm/dist/lib/WindowsManifest/WindowsManifestMerger.cpp vendor/llvm/dist/lib/XRay/FDRRecordProducer.cpp vendor/llvm/dist/lib/XRay/FileHeaderReader.cpp vendor/llvm/dist/lib/XRay/InstrumentationMap.cpp vendor/llvm/dist/lib/XRay/Profile.cpp vendor/llvm/dist/lib/XRay/RecordInitializer.cpp vendor/llvm/dist/lib/XRay/Trace.cpp vendor/llvm/dist/tools/bugpoint/BugDriver.h vendor/llvm/dist/tools/bugpoint/ExtractFunction.cpp vendor/llvm/dist/tools/bugpoint/OptimizerDriver.cpp vendor/llvm/dist/tools/bugpoint/ToolRunner.cpp vendor/llvm/dist/tools/bugpoint/bugpoint.cpp vendor/llvm/dist/tools/llc/llc.cpp vendor/llvm/dist/tools/lli/lli.cpp vendor/llvm/dist/tools/llvm-ar/llvm-ar.cpp vendor/llvm/dist/tools/llvm-as/llvm-as.cpp vendor/llvm/dist/tools/llvm-cov/CodeCoverage.cpp vendor/llvm/dist/tools/llvm-cov/SourceCoverageView.cpp vendor/llvm/dist/tools/llvm-cov/TestingSupport.cpp vendor/llvm/dist/tools/llvm-cxxdump/llvm-cxxdump.cpp vendor/llvm/dist/tools/llvm-cxxmap/llvm-cxxmap.cpp vendor/llvm/dist/tools/llvm-dis/llvm-dis.cpp vendor/llvm/dist/tools/llvm-dwarfdump/Statistics.cpp vendor/llvm/dist/tools/llvm-dwarfdump/llvm-dwarfdump.cpp vendor/llvm/dist/tools/llvm-extract/llvm-extract.cpp vendor/llvm/dist/tools/llvm-link/llvm-link.cpp vendor/llvm/dist/tools/llvm-lto/llvm-lto.cpp vendor/llvm/dist/tools/llvm-lto2/llvm-lto2.cpp vendor/llvm/dist/tools/llvm-mc/Disassembler.cpp vendor/llvm/dist/tools/llvm-mc/Disassembler.h vendor/llvm/dist/tools/llvm-mc/llvm-mc.cpp vendor/llvm/dist/tools/llvm-mca/CodeRegion.cpp vendor/llvm/dist/tools/llvm-mca/CodeRegionGenerator.cpp vendor/llvm/dist/tools/llvm-mca/Views/BottleneckAnalysis.cpp vendor/llvm/dist/tools/llvm-mca/Views/BottleneckAnalysis.h vendor/llvm/dist/tools/llvm-mca/Views/InstructionInfoView.cpp vendor/llvm/dist/tools/llvm-mca/Views/InstructionInfoView.h vendor/llvm/dist/tools/llvm-mca/Views/TimelineView.cpp vendor/llvm/dist/tools/llvm-mca/Views/TimelineView.h vendor/llvm/dist/tools/llvm-mca/llvm-mca.cpp vendor/llvm/dist/tools/llvm-modextract/llvm-modextract.cpp vendor/llvm/dist/tools/llvm-nm/llvm-nm.cpp vendor/llvm/dist/tools/llvm-objcopy/COFF/COFFObjcopy.cpp vendor/llvm/dist/tools/llvm-objcopy/COFF/Reader.cpp vendor/llvm/dist/tools/llvm-objcopy/COFF/Writer.cpp vendor/llvm/dist/tools/llvm-objcopy/CopyConfig.cpp vendor/llvm/dist/tools/llvm-objcopy/CopyConfig.h vendor/llvm/dist/tools/llvm-objcopy/ELF/ELFObjcopy.cpp vendor/llvm/dist/tools/llvm-objcopy/ELF/Object.cpp vendor/llvm/dist/tools/llvm-objcopy/ELF/Object.h vendor/llvm/dist/tools/llvm-objcopy/MachO/MachOObjcopy.cpp vendor/llvm/dist/tools/llvm-objcopy/MachO/MachOReader.cpp vendor/llvm/dist/tools/llvm-objcopy/MachO/MachOReader.h vendor/llvm/dist/tools/llvm-objcopy/MachO/MachOWriter.cpp vendor/llvm/dist/tools/llvm-objcopy/MachO/MachOWriter.h vendor/llvm/dist/tools/llvm-objcopy/MachO/Object.h vendor/llvm/dist/tools/llvm-objcopy/ObjcopyOpts.td vendor/llvm/dist/tools/llvm-objcopy/StripOpts.td vendor/llvm/dist/tools/llvm-objcopy/llvm-objcopy.cpp vendor/llvm/dist/tools/llvm-objdump/COFFDump.cpp vendor/llvm/dist/tools/llvm-objdump/ELFDump.cpp vendor/llvm/dist/tools/llvm-objdump/MachODump.cpp vendor/llvm/dist/tools/llvm-objdump/llvm-objdump.cpp vendor/llvm/dist/tools/llvm-objdump/llvm-objdump.h vendor/llvm/dist/tools/llvm-pdbutil/BytesOutputStyle.cpp vendor/llvm/dist/tools/llvm-pdbutil/DumpOutputStyle.cpp vendor/llvm/dist/tools/llvm-pdbutil/ExplainOutputStyle.cpp vendor/llvm/dist/tools/llvm-pdbutil/InputFile.cpp vendor/llvm/dist/tools/llvm-pdbutil/MinimalSymbolDumper.cpp vendor/llvm/dist/tools/llvm-pdbutil/PrettyTypeDumper.cpp vendor/llvm/dist/tools/llvm-pdbutil/llvm-pdbutil.cpp vendor/llvm/dist/tools/llvm-profdata/llvm-profdata.cpp vendor/llvm/dist/tools/llvm-readobj/ARMEHABIPrinter.h vendor/llvm/dist/tools/llvm-readobj/ARMWinEHPrinter.cpp vendor/llvm/dist/tools/llvm-readobj/COFFDumper.cpp vendor/llvm/dist/tools/llvm-readobj/DwarfCFIEHPrinter.h vendor/llvm/dist/tools/llvm-readobj/ELFDumper.cpp vendor/llvm/dist/tools/llvm-readobj/MachODumper.cpp vendor/llvm/dist/tools/llvm-readobj/ObjDumper.cpp vendor/llvm/dist/tools/llvm-readobj/ObjDumper.h vendor/llvm/dist/tools/llvm-readobj/WasmDumper.cpp vendor/llvm/dist/tools/llvm-readobj/Win64EHDumper.cpp vendor/llvm/dist/tools/llvm-readobj/WindowsResourceDumper.cpp vendor/llvm/dist/tools/llvm-readobj/XCOFFDumper.cpp vendor/llvm/dist/tools/llvm-readobj/llvm-readobj.cpp vendor/llvm/dist/tools/llvm-readobj/llvm-readobj.h vendor/llvm/dist/tools/llvm-rtdyld/llvm-rtdyld.cpp vendor/llvm/dist/tools/llvm-stress/llvm-stress.cpp vendor/llvm/dist/tools/llvm-symbolizer/llvm-symbolizer.cpp vendor/llvm/dist/tools/llvm-xray/func-id-helper.cpp vendor/llvm/dist/tools/llvm-xray/xray-account.cpp vendor/llvm/dist/tools/llvm-xray/xray-converter.cpp vendor/llvm/dist/tools/llvm-xray/xray-extract.cpp vendor/llvm/dist/tools/llvm-xray/xray-fdr-dump.cpp vendor/llvm/dist/tools/llvm-xray/xray-graph-diff.cpp vendor/llvm/dist/tools/llvm-xray/xray-graph.cpp vendor/llvm/dist/tools/opt/opt.cpp vendor/llvm/dist/utils/TableGen/AsmMatcherEmitter.cpp vendor/llvm/dist/utils/TableGen/AsmWriterEmitter.cpp vendor/llvm/dist/utils/TableGen/CallingConvEmitter.cpp vendor/llvm/dist/utils/TableGen/CodeEmitterGen.cpp vendor/llvm/dist/utils/TableGen/CodeGenDAGPatterns.cpp vendor/llvm/dist/utils/TableGen/CodeGenDAGPatterns.h vendor/llvm/dist/utils/TableGen/CodeGenInstruction.cpp vendor/llvm/dist/utils/TableGen/CodeGenInstruction.h vendor/llvm/dist/utils/TableGen/CodeGenIntrinsics.h vendor/llvm/dist/utils/TableGen/CodeGenMapTable.cpp vendor/llvm/dist/utils/TableGen/CodeGenRegisters.cpp vendor/llvm/dist/utils/TableGen/CodeGenRegisters.h vendor/llvm/dist/utils/TableGen/CodeGenSchedule.cpp vendor/llvm/dist/utils/TableGen/CodeGenTarget.cpp vendor/llvm/dist/utils/TableGen/CodeGenTarget.h vendor/llvm/dist/utils/TableGen/DAGISelEmitter.cpp vendor/llvm/dist/utils/TableGen/DAGISelMatcher.h vendor/llvm/dist/utils/TableGen/DAGISelMatcherEmitter.cpp vendor/llvm/dist/utils/TableGen/DAGISelMatcherGen.cpp vendor/llvm/dist/utils/TableGen/DAGISelMatcherOpt.cpp vendor/llvm/dist/utils/TableGen/DFAPacketizerEmitter.cpp vendor/llvm/dist/utils/TableGen/DisassemblerEmitter.cpp vendor/llvm/dist/utils/TableGen/FixedLenDecoderEmitter.cpp vendor/llvm/dist/utils/TableGen/GlobalISelEmitter.cpp vendor/llvm/dist/utils/TableGen/InfoByHwMode.cpp vendor/llvm/dist/utils/TableGen/InfoByHwMode.h vendor/llvm/dist/utils/TableGen/InstrDocsEmitter.cpp vendor/llvm/dist/utils/TableGen/InstrInfoEmitter.cpp vendor/llvm/dist/utils/TableGen/IntrinsicEmitter.cpp vendor/llvm/dist/utils/TableGen/RISCVCompressInstEmitter.cpp vendor/llvm/dist/utils/TableGen/RegisterInfoEmitter.cpp vendor/llvm/dist/utils/TableGen/SearchableTableEmitter.cpp vendor/llvm/dist/utils/TableGen/SubtargetEmitter.cpp vendor/llvm/dist/utils/TableGen/SubtargetFeatureInfo.cpp vendor/llvm/dist/utils/TableGen/TableGen.cpp vendor/llvm/dist/utils/TableGen/TableGenBackends.h vendor/llvm/dist/utils/TableGen/WebAssemblyDisassemblerEmitter.cpp vendor/llvm/dist/utils/TableGen/X86DisassemblerTables.cpp vendor/llvm/dist/utils/TableGen/X86EVEX2VEXTablesEmitter.cpp vendor/llvm/dist/utils/TableGen/X86RecognizableInstr.cpp Modified: vendor/llvm/dist/include/llvm-c/Core.h ============================================================================== --- vendor/llvm/dist/include/llvm-c/Core.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm-c/Core.h Wed Oct 23 17:51:42 2019 (r353940) @@ -370,9 +370,13 @@ typedef enum { LLVMAtomicRMWBinOpUMax, /**< Sets the value if it's greater than the original using an unsigned comparison and return the old one */ - LLVMAtomicRMWBinOpUMin /**< Sets the value if it's greater than the - original using an unsigned comparison and return - the old one */ + LLVMAtomicRMWBinOpUMin, /**< Sets the value if it's greater than the + original using an unsigned comparison and return + the old one */ + LLVMAtomicRMWBinOpFAdd, /**< Add a floating point value and return the + old one */ + LLVMAtomicRMWBinOpFSub /**< Subtract a floating point value and return the + old one */ } LLVMAtomicRMWBinOp; typedef enum { @@ -1539,6 +1543,7 @@ LLVMTypeRef LLVMX86MMXType(void); macro(GlobalVariable) \ macro(UndefValue) \ macro(Instruction) \ + macro(UnaryOperator) \ macro(BinaryOperator) \ macro(CallInst) \ macro(IntrinsicInst) \ @@ -1571,6 +1576,8 @@ LLVMTypeRef LLVMX86MMXType(void); macro(ResumeInst) \ macro(CleanupReturnInst) \ macro(CatchReturnInst) \ + macro(CatchSwitchInst) \ + macro(CallBrInst) \ macro(FuncletPadInst) \ macro(CatchPadInst) \ macro(CleanupPadInst) \ @@ -1592,7 +1599,10 @@ LLVMTypeRef LLVMX86MMXType(void); macro(ZExtInst) \ macro(ExtractValueInst) \ macro(LoadInst) \ - macro(VAArgInst) + macro(VAArgInst) \ + macro(AtomicCmpXchgInst) \ + macro(AtomicRMWInst) \ + macro(FenceInst) /** * @defgroup LLVMCCoreValueGeneral General APIs @@ -3807,8 +3817,12 @@ LLVMValueRef LLVMBuildGlobalStringPtr(LLVMBuilderRef B const char *Name); LLVMBool LLVMGetVolatile(LLVMValueRef MemoryAccessInst); void LLVMSetVolatile(LLVMValueRef MemoryAccessInst, LLVMBool IsVolatile); +LLVMBool LLVMGetWeak(LLVMValueRef CmpXchgInst); +void LLVMSetWeak(LLVMValueRef CmpXchgInst, LLVMBool IsWeak); LLVMAtomicOrdering LLVMGetOrdering(LLVMValueRef MemoryAccessInst); void LLVMSetOrdering(LLVMValueRef MemoryAccessInst, LLVMAtomicOrdering Ordering); +LLVMAtomicRMWBinOp LLVMGetAtomicRMWBinOp(LLVMValueRef AtomicRMWInst); +void LLVMSetAtomicRMWBinOp(LLVMValueRef AtomicRMWInst, LLVMAtomicRMWBinOp BinOp); /* Casts */ LLVMValueRef LLVMBuildTrunc(LLVMBuilderRef, LLVMValueRef Val, Modified: vendor/llvm/dist/include/llvm-c/DebugInfo.h ============================================================================== --- vendor/llvm/dist/include/llvm-c/DebugInfo.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm-c/DebugInfo.h Wed Oct 23 17:51:42 2019 (r353940) @@ -32,7 +32,7 @@ typedef enum { LLVMDIFlagPublic = 3, LLVMDIFlagFwdDecl = 1 << 2, LLVMDIFlagAppleBlock = 1 << 3, - LLVMDIFlagBlockByrefStruct = 1 << 4, + LLVMDIFlagReservedBit4 = 1 << 4, LLVMDIFlagVirtual = 1 << 5, LLVMDIFlagArtificial = 1 << 6, LLVMDIFlagExplicit = 1 << 7, @@ -170,6 +170,19 @@ typedef unsigned LLVMMetadataKind; typedef unsigned LLVMDWARFTypeEncoding; /** + * Describes the kind of macro declaration used for LLVMDIBuilderCreateMacro. + * @see llvm::dwarf::MacinfoRecordType + * @note Values are from DW_MACINFO_* constants in the DWARF specification. + */ +typedef enum { + LLVMDWARFMacinfoRecordTypeDefine = 0x01, + LLVMDWARFMacinfoRecordTypeMacro = 0x02, + LLVMDWARFMacinfoRecordTypeStartFile = 0x03, + LLVMDWARFMacinfoRecordTypeEndFile = 0x04, + LLVMDWARFMacinfoRecordTypeVendorExt = 0xff +} LLVMDWARFMacinfoRecordType; + +/** * The current debug metadata version number. */ unsigned LLVMDebugMetadataVersion(void); @@ -520,6 +533,38 @@ LLVMDIBuilderCreateSubroutineType(LLVMDIBuilderRef Bui LLVMMetadataRef *ParameterTypes, unsigned NumParameterTypes, LLVMDIFlags Flags); + +/** + * Create debugging information entry for a macro. + * @param Builder The DIBuilder. + * @param ParentMacroFile Macro parent (could be NULL). + * @param Line Source line number where the macro is defined. + * @param RecordType DW_MACINFO_define or DW_MACINFO_undef. + * @param Name Macro name. + * @param NameLen Macro name length. + * @param Value Macro value. + * @param ValueLen Macro value length. + */ +LLVMMetadataRef LLVMDIBuilderCreateMacro(LLVMDIBuilderRef Builder, + LLVMMetadataRef ParentMacroFile, + unsigned Line, + LLVMDWARFMacinfoRecordType RecordType, + const char *Name, size_t NameLen, + const char *Value, size_t ValueLen); + +/** + * Create debugging information temporary entry for a macro file. + * List of macro node direct children will be calculated by DIBuilder, + * using the \p ParentMacroFile relationship. + * @param Builder The DIBuilder. + * @param ParentMacroFile Macro parent (could be NULL). + * @param Line Source line number where the macro file is included. + * @param File File descriptor containing the name of the macro file. + */ +LLVMMetadataRef +LLVMDIBuilderCreateTempMacroFile(LLVMDIBuilderRef Builder, + LLVMMetadataRef ParentMacroFile, unsigned Line, + LLVMMetadataRef File); /** * Create debugging information entry for an enumerator. Modified: vendor/llvm/dist/include/llvm-c/Remarks.h ============================================================================== --- vendor/llvm/dist/include/llvm-c/Remarks.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm-c/Remarks.h Wed Oct 23 17:51:42 2019 (r353940) @@ -30,7 +30,8 @@ extern "C" { * @{ */ -#define REMARKS_API_VERSION 0 +// 0 -> 1: Bitstream remarks support. +#define REMARKS_API_VERSION 1 /** * The type of the emitted remark. @@ -239,6 +240,20 @@ typedef struct LLVMRemarkOpaqueParser *LLVMRemarkParse */ extern LLVMRemarkParserRef LLVMRemarkParserCreateYAML(const void *Buf, uint64_t Size); + +/** + * Creates a remark parser that can be used to parse the buffer located in \p + * Buf of size \p Size bytes. + * + * \p Buf cannot be `NULL`. + * + * This function should be paired with LLVMRemarkParserDispose() to avoid + * leaking resources. + * + * \since REMARKS_API_VERSION=1 + */ +extern LLVMRemarkParserRef LLVMRemarkParserCreateBitstream(const void *Buf, + uint64_t Size); /** * Returns the next remark in the file. Modified: vendor/llvm/dist/include/llvm-c/Transforms/IPO.h ============================================================================== --- vendor/llvm/dist/include/llvm-c/Transforms/IPO.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm-c/Transforms/IPO.h Wed Oct 23 17:51:42 2019 (r353940) @@ -34,6 +34,9 @@ void LLVMAddArgumentPromotionPass(LLVMPassManagerRef P /** See llvm::createConstantMergePass function. */ void LLVMAddConstantMergePass(LLVMPassManagerRef PM); +/** See llvm::createMergeFunctionsPass function. */ +void LLVMAddMergeFunctionsPass(LLVMPassManagerRef PM); + /** See llvm::createCalledValuePropagationPass function. */ void LLVMAddCalledValuePropagationPass(LLVMPassManagerRef PM); @@ -66,6 +69,21 @@ void LLVMAddIPSCCPPass(LLVMPassManagerRef PM); /** See llvm::createInternalizePass function. */ void LLVMAddInternalizePass(LLVMPassManagerRef, unsigned AllButMain); + +/** + * Create and add the internalize pass to the given pass manager with the + * provided preservation callback. + * + * The context parameter is forwarded to the callback on each invocation. + * As such, it is the responsibility of the caller to extend its lifetime + * until execution of this pass has finished. + * + * @see llvm::createInternalizePass function. + */ +void LLVMAddInternalizePassWithMustPreservePredicate( + LLVMPassManagerRef PM, + void *Context, + LLVMBool (*MustPreserve)(LLVMValueRef, void *)); /** See llvm::createStripDeadPrototypesPass function. */ void LLVMAddStripDeadPrototypesPass(LLVMPassManagerRef PM); Modified: vendor/llvm/dist/include/llvm-c/Transforms/Scalar.h ============================================================================== --- vendor/llvm/dist/include/llvm-c/Transforms/Scalar.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm-c/Transforms/Scalar.h Wed Oct 23 17:51:42 2019 (r353940) @@ -35,6 +35,9 @@ extern "C" { /** See llvm::createAggressiveDCEPass function. */ void LLVMAddAggressiveDCEPass(LLVMPassManagerRef PM); +/** See llvm::createDeadCodeEliminationPass function. */ +void LLVMAddDCEPass(LLVMPassManagerRef PM); + /** See llvm::createBitTrackingDCEPass function. */ void LLVMAddBitTrackingDCEPass(LLVMPassManagerRef PM); @@ -143,6 +146,9 @@ void LLVMAddEarlyCSEMemSSAPass(LLVMPassManagerRef PM); /** See llvm::createLowerExpectIntrinsicPass function */ void LLVMAddLowerExpectIntrinsicPass(LLVMPassManagerRef PM); + +/** See llvm::createLowerConstantIntrinsicsPass function */ +void LLVMAddLowerConstantIntrinsicsPass(LLVMPassManagerRef PM); /** See llvm::createTypeBasedAliasAnalysisPass function */ void LLVMAddTypeBasedAliasAnalysisPass(LLVMPassManagerRef PM); Modified: vendor/llvm/dist/include/llvm-c/lto.h ============================================================================== --- vendor/llvm/dist/include/llvm-c/lto.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm-c/lto.h Wed Oct 23 17:51:42 2019 (r353940) @@ -44,7 +44,7 @@ typedef bool lto_bool_t; * @{ */ -#define LTO_API_VERSION 24 +#define LTO_API_VERSION 25 /** * \since prior to LTO_API_VERSION=3 @@ -550,7 +550,57 @@ extern void lto_codegen_set_should_embed_uselists(lto_code_gen_t cg, lto_bool_t ShouldEmbedUselists); +/** Opaque reference to an LTO input file */ +typedef struct LLVMOpaqueLTOInput *lto_input_t; + /** + * Creates an LTO input file from a buffer. The path + * argument is used for diagnotics as this function + * otherwise does not know which file the given buffer + * is associated with. + * + * \since LTO_API_VERSION=24 + */ +extern lto_input_t lto_input_create(const void *buffer, + size_t buffer_size, + const char *path); + +/** + * Frees all memory internally allocated by the LTO input file. + * Upon return the lto_module_t is no longer valid. + * + * \since LTO_API_VERSION=24 + */ +extern void lto_input_dispose(lto_input_t input); + +/** + * Returns the number of dependent library specifiers + * for the given LTO input file. + * + * \since LTO_API_VERSION=24 + */ +extern unsigned lto_input_get_num_dependent_libraries(lto_input_t input); + +/** + * Returns the ith dependent library specifier + * for the given LTO input file. The returned + * string is not null-terminated. + * + * \since LTO_API_VERSION=24 + */ +extern const char * lto_input_get_dependent_library(lto_input_t input, + size_t index, + size_t *size); + +/** + * Returns the list of libcall symbols that can be generated by LTO + * that might not be visible from the symbol table of bitcode files. + * + * \since prior to LTO_API_VERSION=25 + */ +extern const char *const *lto_runtime_lib_symbols_list(size_t *size); + +/** * @} // endgoup LLVMCLTO * @defgroup LLVMCTLTO ThinLTO * @ingroup LLVMC @@ -845,48 +895,6 @@ thinlto_codegen_set_cache_size_megabytes(thinlto_code_ */ extern void thinlto_codegen_set_cache_size_files(thinlto_code_gen_t cg, unsigned max_size_files); - -/** Opaque reference to an LTO input file */ -typedef struct LLVMOpaqueLTOInput *lto_input_t; - -/** - * Creates an LTO input file from a buffer. The path - * argument is used for diagnotics as this function - * otherwise does not know which file the given buffer - * is associated with. - * - * \since LTO_API_VERSION=24 - */ -extern lto_input_t lto_input_create(const void *buffer, - size_t buffer_size, - const char *path); - -/** - * Frees all memory internally allocated by the LTO input file. - * Upon return the lto_module_t is no longer valid. - * - * \since LTO_API_VERSION=24 - */ -extern void lto_input_dispose(lto_input_t input); - -/** - * Returns the number of dependent library specifiers - * for the given LTO input file. - * - * \since LTO_API_VERSION=24 - */ -extern unsigned lto_input_get_num_dependent_libraries(lto_input_t input); - -/** - * Returns the ith dependent library specifier - * for the given LTO input file. The returned - * string is not null-terminated. - * - * \since LTO_API_VERSION=24 - */ -extern const char * lto_input_get_dependent_library(lto_input_t input, - size_t index, - size_t *size); /** * @} // endgroup LLVMCTLTO_CACHING Modified: vendor/llvm/dist/include/llvm/ADT/APFloat.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/APFloat.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm/ADT/APFloat.h Wed Oct 23 17:51:42 2019 (r353940) @@ -192,6 +192,11 @@ struct APFloatBase { /// IEEE-754R 7: Default exception handling. /// /// opUnderflow or opOverflow are always returned or-ed with opInexact. + /// + /// APFloat models this behavior specified by IEEE-754: + /// "For operations producing results in floating-point format, the default + /// result of an operation that signals the invalid operation exception + /// shall be a quiet NaN." enum opStatus { opOK = 0x00, opInvalidOp = 0x01, Modified: vendor/llvm/dist/include/llvm/ADT/APInt.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/APInt.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm/ADT/APInt.h Wed Oct 23 17:51:42 2019 (r353940) @@ -1467,6 +1467,13 @@ class LLVM_NODISCARD APInt { (public) U.pVal[whichWord(BitPosition)] &= Mask; } + /// Set bottom loBits bits to 0. + void clearLowBits(unsigned loBits) { + assert(loBits <= BitWidth && "More bits than bitwidth"); + APInt Keep = getHighBitsSet(BitWidth, BitWidth - loBits); + *this &= Keep; + } + /// Set the sign bit to 0. void clearSignBit() { clearBit(BitWidth - 1); @@ -1496,9 +1503,11 @@ class LLVM_NODISCARD APInt { (public) /// Insert the bits from a smaller APInt starting at bitPosition. void insertBits(const APInt &SubBits, unsigned bitPosition); + void insertBits(uint64_t SubBits, unsigned bitPosition, unsigned numBits); /// Return an APInt with the extracted bits [bitPosition,bitPosition+numBits). APInt extractBits(unsigned numBits, unsigned bitPosition) const; + uint64_t extractBitsAsZExtValue(unsigned numBits, unsigned bitPosition) const; /// @} /// \name Value Characterization Functions Modified: vendor/llvm/dist/include/llvm/ADT/Any.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/Any.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm/ADT/Any.h Wed Oct 23 17:51:42 2019 (r353940) @@ -38,7 +38,7 @@ class Any { explicit StorageImpl(T &&Value) : Value(std::move(Value)) {} std::unique_ptr clone() const override { - return llvm::make_unique>(Value); + return std::make_unique>(Value); } const void *id() const override { return &TypeId::Id; } @@ -78,7 +78,7 @@ class Any { int>::type = 0> Any(T &&Value) { using U = typename std::decay::type; - Storage = llvm::make_unique>(std::forward(Value)); + Storage = std::make_unique>(std::forward(Value)); } Any(Any &&Other) : Storage(std::move(Other.Storage)) {} Modified: vendor/llvm/dist/include/llvm/ADT/ArrayRef.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/ArrayRef.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm/ADT/ArrayRef.h Wed Oct 23 17:51:42 2019 (r353940) @@ -481,6 +481,12 @@ namespace llvm { return Vec; } + /// Construct an ArrayRef from a std::array. + template + ArrayRef makeArrayRef(const std::array &Arr) { + return Arr; + } + /// Construct an ArrayRef from an ArrayRef (no-op) (const) template ArrayRef makeArrayRef(const ArrayRef &Vec) { return Vec; Modified: vendor/llvm/dist/include/llvm/ADT/DenseMap.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/DenseMap.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm/ADT/DenseMap.h Wed Oct 23 17:51:42 2019 (r353940) @@ -38,34 +38,8 @@ namespace detail { // implementation without requiring two members. template struct DenseMapPair : public std::pair { + using std::pair::pair; - // FIXME: Switch to inheriting constructors when we drop support for older - // clang versions. - // NOTE: This default constructor is declared with '{}' rather than - // '= default' to work around a separate bug in clang-3.8. This can - // also go when we switch to inheriting constructors. - DenseMapPair() {} - - DenseMapPair(const KeyT &Key, const ValueT &Value) - : std::pair(Key, Value) {} - - DenseMapPair(KeyT &&Key, ValueT &&Value) - : std::pair(std::move(Key), std::move(Value)) {} - - template - DenseMapPair(AltKeyT &&AltKey, AltValueT &&AltValue, - typename std::enable_if< - std::is_convertible::value && - std::is_convertible::value>::type * = 0) - : std::pair(std::forward(AltKey), - std::forward(AltValue)) {} - - template - DenseMapPair(AltPairT &&AltPair, - typename std::enable_if>::value>::type * = nullptr) - : std::pair(std::forward(AltPair)) {} - KeyT &getFirst() { return std::pair::first; } const KeyT &getFirst() const { return std::pair::first; } ValueT &getSecond() { return std::pair::second; } @@ -748,7 +722,7 @@ class DenseMap : public DenseMapBasedestroyAll(); - operator delete(Buckets); + deallocate_buffer(Buckets, sizeof(BucketT) * NumBuckets, alignof(BucketT)); } void swap(DenseMap& RHS) { @@ -768,7 +742,7 @@ class DenseMap : public DenseMapBasedestroyAll(); - operator delete(Buckets); + deallocate_buffer(Buckets, sizeof(BucketT) * NumBuckets, alignof(BucketT)); init(0); swap(other); return *this; @@ -776,7 +750,7 @@ class DenseMap : public DenseMapBasedestroyAll(); - operator delete(Buckets); + deallocate_buffer(Buckets, sizeof(BucketT) * NumBuckets, alignof(BucketT)); if (allocateBuckets(other.NumBuckets)) { this->BaseT::copyFrom(other); } else { @@ -809,10 +783,12 @@ class DenseMap : public DenseMapBasemoveFromOldBuckets(OldBuckets, OldBuckets+OldNumBuckets); // Free the old table. - operator delete(OldBuckets); + deallocate_buffer(OldBuckets, sizeof(BucketT) * OldNumBuckets, + alignof(BucketT)); } void shrink_and_clear() { + unsigned OldNumBuckets = NumBuckets; unsigned OldNumEntries = NumEntries; this->destroyAll(); @@ -825,7 +801,8 @@ class DenseMap : public DenseMapBase(operator new(sizeof(BucketT) * NumBuckets)); + Buckets = static_cast( + allocate_buffer(sizeof(BucketT) * NumBuckets, alignof(BucketT))); return true; } }; @@ -1076,7 +1054,8 @@ class SmallDenseMap (public) this->moveFromOldBuckets(OldRep.Buckets, OldRep.Buckets+OldRep.NumBuckets); // Free the old table. - operator delete(OldRep.Buckets); + deallocate_buffer(OldRep.Buckets, sizeof(BucketT) * OldRep.NumBuckets, + alignof(BucketT)); } void shrink_and_clear() { @@ -1160,15 +1139,17 @@ class SmallDenseMap (public) if (Small) return; - operator delete(getLargeRep()->Buckets); + deallocate_buffer(getLargeRep()->Buckets, + sizeof(BucketT) * getLargeRep()->NumBuckets, + alignof(BucketT)); getLargeRep()->~LargeRep(); } LargeRep allocateBuckets(unsigned Num) { assert(Num > InlineBuckets && "Must allocate more buckets than are inline"); - LargeRep Rep = { - static_cast(operator new(sizeof(BucketT) * Num)), Num - }; + LargeRep Rep = {static_cast(allocate_buffer( + sizeof(BucketT) * Num, alignof(BucketT))), + Num}; return Rep; } }; Modified: vendor/llvm/dist/include/llvm/ADT/DenseMapInfo.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/DenseMapInfo.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm/ADT/DenseMapInfo.h Wed Oct 23 17:51:42 2019 (r353940) @@ -17,7 +17,7 @@ #include "llvm/ADT/Hashing.h" #include "llvm/ADT/StringRef.h" #include "llvm/Support/PointerLikeTypeTraits.h" -#include "llvm/Support/ScalableSize.h" +#include "llvm/Support/TypeSize.h" #include #include #include @@ -63,6 +63,17 @@ template<> struct DenseMapInfo { static unsigned getHashValue(const char& Val) { return Val * 37U; } static bool isEqual(const char &LHS, const char &RHS) { + return LHS == RHS; + } +}; + +// Provide DenseMapInfo for unsigned chars. +template <> struct DenseMapInfo { + static inline unsigned char getEmptyKey() { return ~0; } + static inline unsigned char getTombstoneKey() { return ~0 - 1; } + static unsigned getHashValue(const unsigned char &Val) { return Val * 37U; } + + static bool isEqual(const unsigned char &LHS, const unsigned char &RHS) { return LHS == RHS; } }; Added: vendor/llvm/dist/include/llvm/ADT/DirectedGraph.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/llvm/dist/include/llvm/ADT/DirectedGraph.h Wed Oct 23 17:51:42 2019 (r353940) @@ -0,0 +1,270 @@ +//===- llvm/ADT/DirectedGraph.h - Directed Graph ----------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file defines the interface and a base class implementation for a +// directed graph. +// +//===----------------------------------------------------------------------===// + +#ifndef LLVM_ADT_DIRECTEDGRAPH_H +#define LLVM_ADT_DIRECTEDGRAPH_H + +#include "llvm/ADT/GraphTraits.h" +#include "llvm/ADT/SetVector.h" +#include "llvm/ADT/SmallVector.h" +#include "llvm/Support/Debug.h" +#include "llvm/Support/raw_ostream.h" + +namespace llvm { + +/// Represent an edge in the directed graph. +/// The edge contains the target node it connects to. +template class DGEdge { +public: + DGEdge() = delete; + /// Create an edge pointing to the given node \p N. + explicit DGEdge(NodeType &N) : TargetNode(N) {} + explicit DGEdge(const DGEdge &E) + : TargetNode(E.TargetNode) {} + DGEdge &operator=(const DGEdge &E) { + TargetNode = E.TargetNode; + return *this; + } + + /// Static polymorphism: delegate implementation (via isEqualTo) to the + /// derived class. + bool operator==(const EdgeType &E) const { return getDerived().isEqualTo(E); } + bool operator!=(const EdgeType &E) const { return !operator==(E); } + + /// Retrieve the target node this edge connects to. + const NodeType &getTargetNode() const { return TargetNode; } + NodeType &getTargetNode() { + return const_cast( + static_cast &>(*this).getTargetNode()); + } + +protected: + // As the default implementation use address comparison for equality. + bool isEqualTo(const EdgeType &E) const { return this == &E; } + + // Cast the 'this' pointer to the derived type and return a reference. + EdgeType &getDerived() { return *static_cast(this); } + const EdgeType &getDerived() const { + return *static_cast(this); + } + + // The target node this edge connects to. + NodeType &TargetNode; +}; + +/// Represent a node in the directed graph. +/// The node has a (possibly empty) list of outgoing edges. +template class DGNode { +public: + using EdgeListTy = SetVector; + using iterator = typename EdgeListTy::iterator; + using const_iterator = typename EdgeListTy::const_iterator; + + /// Create a node with a single outgoing edge \p E. + explicit DGNode(EdgeType &E) : Edges() { Edges.insert(&E); } + DGNode() = default; + + explicit DGNode(const DGNode &N) : Edges(N.Edges) {} + DGNode(DGNode &&N) : Edges(std::move(N.Edges)) {} + + DGNode &operator=(const DGNode &N) { + Edges = N.Edges; + return *this; + } + DGNode &operator=(const DGNode &&N) { + Edges = std::move(N.Edges); + return *this; + } + + /// Static polymorphism: delegate implementation (via isEqualTo) to the + /// derived class. + bool operator==(const NodeType &N) const { return getDerived().isEqualTo(N); } + bool operator!=(const NodeType &N) const { return !operator==(N); } + + const_iterator begin() const { return Edges.begin(); } + const_iterator end() const { return Edges.end(); } + iterator begin() { return Edges.begin(); } + iterator end() { return Edges.end(); } + const EdgeType &front() const { return *Edges.front(); } + EdgeType &front() { return *Edges.front(); } + const EdgeType &back() const { return *Edges.back(); } + EdgeType &back() { return *Edges.back(); } + + /// Collect in \p EL, all the edges from this node to \p N. + /// Return true if at least one edge was found, and false otherwise. + /// Note that this implementation allows more than one edge to connect + /// a given pair of nodes. + bool findEdgesTo(const NodeType &N, SmallVectorImpl &EL) const { + assert(EL.empty() && "Expected the list of edges to be empty."); + for (auto *E : Edges) + if (E->getTargetNode() == N) + EL.push_back(E); + return !EL.empty(); + } + + /// Add the given edge \p E to this node, if it doesn't exist already. Returns + /// true if the edge is added and false otherwise. + bool addEdge(EdgeType &E) { return Edges.insert(&E); } + + /// Remove the given edge \p E from this node, if it exists. + void removeEdge(EdgeType &E) { Edges.remove(&E); } + + /// Test whether there is an edge that goes from this node to \p N. + bool hasEdgeTo(const NodeType &N) const { + return (findEdgeTo(N) != Edges.end()); + } + + /// Retrieve the outgoing edges for the node. + const EdgeListTy &getEdges() const { return Edges; } + EdgeListTy &getEdges() { + return const_cast( + static_cast &>(*this).Edges); + } + + /// Clear the outgoing edges. + void clear() { Edges.clear(); } + +protected: + // As the default implementation use address comparison for equality. + bool isEqualTo(const NodeType &N) const { return this == &N; } + + // Cast the 'this' pointer to the derived type and return a reference. + NodeType &getDerived() { return *static_cast(this); } + const NodeType &getDerived() const { + return *static_cast(this); + } + + /// Find an edge to \p N. If more than one edge exists, this will return + /// the first one in the list of edges. + const_iterator findEdgeTo(const NodeType &N) const { + return llvm::find_if( + Edges, [&N](const EdgeType *E) { return E->getTargetNode() == N; }); + } + + // The list of outgoing edges. + EdgeListTy Edges; +}; + +/// Directed graph +/// +/// The graph is represented by a table of nodes. +/// Each node contains a (possibly empty) list of outgoing edges. +/// Each edge contains the target node it connects to. +template class DirectedGraph { +protected: + using NodeListTy = SmallVector; + using EdgeListTy = SmallVector; +public: + using iterator = typename NodeListTy::iterator; + using const_iterator = typename NodeListTy::const_iterator; + using DGraphType = DirectedGraph; + + DirectedGraph() = default; + explicit DirectedGraph(NodeType &N) : Nodes() { addNode(N); } + DirectedGraph(const DGraphType &G) : Nodes(G.Nodes) {} + DirectedGraph(DGraphType &&RHS) : Nodes(std::move(RHS.Nodes)) {} + DGraphType &operator=(const DGraphType &G) { + Nodes = G.Nodes; + return *this; + } + DGraphType &operator=(const DGraphType &&G) { + Nodes = std::move(G.Nodes); + return *this; + } + + const_iterator begin() const { return Nodes.begin(); } + const_iterator end() const { return Nodes.end(); } + iterator begin() { return Nodes.begin(); } + iterator end() { return Nodes.end(); } + const NodeType &front() const { return *Nodes.front(); } + NodeType &front() { return *Nodes.front(); } + const NodeType &back() const { return *Nodes.back(); } + NodeType &back() { return *Nodes.back(); } + + size_t size() const { return Nodes.size(); } + + /// Find the given node \p N in the table. + const_iterator findNode(const NodeType &N) const { + return llvm::find_if(Nodes, + [&N](const NodeType *Node) { return *Node == N; }); + } + iterator findNode(const NodeType &N) { + return const_cast( + static_cast(*this).findNode(N)); + } + + /// Add the given node \p N to the graph if it is not already present. + bool addNode(NodeType &N) { + if (findNode(N) != Nodes.end()) + return false; + Nodes.push_back(&N); + return true; + } + + /// Collect in \p EL all edges that are coming into node \p N. Return true + /// if at least one edge was found, and false otherwise. + bool findIncomingEdgesToNode(const NodeType &N, SmallVectorImpl &EL) const { + assert(EL.empty() && "Expected the list of edges to be empty."); + EdgeListTy TempList; + for (auto *Node : Nodes) { + if (*Node == N) + continue; + Node->findEdgesTo(N, TempList); + EL.insert(EL.end(), TempList.begin(), TempList.end()); + TempList.clear(); + } + return !EL.empty(); + } + + /// Remove the given node \p N from the graph. If the node has incoming or + /// outgoing edges, they are also removed. Return true if the node was found + /// and then removed, and false if the node was not found in the graph to + /// begin with. + bool removeNode(NodeType &N) { + iterator IT = findNode(N); + if (IT == Nodes.end()) + return false; + // Remove incoming edges. + EdgeListTy EL; + for (auto *Node : Nodes) { + if (*Node == N) + continue; + Node->findEdgesTo(N, EL); + for (auto *E : EL) + Node->removeEdge(*E); + EL.clear(); + } + N.clear(); + Nodes.erase(IT); + return true; + } + + /// Assuming nodes \p Src and \p Dst are already in the graph, connect node \p + /// Src to node \p Dst using the provided edge \p E. Return true if \p Src is + /// not already connected to \p Dst via \p E, and false otherwise. + bool connect(NodeType &Src, NodeType &Dst, EdgeType &E) { + assert(findNode(Src) != Nodes.end() && "Src node should be present."); + assert(findNode(Dst) != Nodes.end() && "Dst node should be present."); + assert((E.getTargetNode() == Dst) && + "Target of the given edge does not match Dst."); + return Src.addEdge(E); + } + +protected: + // The list of nodes in the graph. + NodeListTy Nodes; +}; + +} // namespace llvm + +#endif // LLVM_ADT_DIRECTEDGRAPH_H Modified: vendor/llvm/dist/include/llvm/ADT/Hashing.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/Hashing.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm/ADT/Hashing.h Wed Oct 23 17:51:42 2019 (r353940) @@ -45,7 +45,6 @@ #define LLVM_ADT_HASHING_H #include "llvm/Support/DataTypes.h" -#include "llvm/Support/Host.h" #include "llvm/Support/SwapByteOrder.h" #include "llvm/Support/type_traits.h" #include Modified: vendor/llvm/dist/include/llvm/ADT/IntervalMap.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/IntervalMap.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm/ADT/IntervalMap.h Wed Oct 23 17:51:42 2019 (r353940) @@ -963,8 +963,8 @@ class IntervalMap { (public) private: // The root data is either a RootLeaf or a RootBranchData instance. - LLVM_ALIGNAS(RootLeaf) LLVM_ALIGNAS(RootBranchData) - AlignedCharArrayUnion data; + alignas(RootLeaf) alignas(RootBranchData) + AlignedCharArrayUnion data; // Tree height. // 0: Leaves in root. Modified: vendor/llvm/dist/include/llvm/ADT/PointerIntPair.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/PointerIntPair.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm/ADT/PointerIntPair.h Wed Oct 23 17:51:42 2019 (r353940) @@ -13,6 +13,7 @@ #ifndef LLVM_ADT_POINTERINTPAIR_H #define LLVM_ADT_POINTERINTPAIR_H +#include "llvm/Support/Compiler.h" #include "llvm/Support/PointerLikeTypeTraits.h" #include "llvm/Support/type_traits.h" #include @@ -59,19 +60,19 @@ class PointerIntPair { (public) IntType getInt() const { return (IntType)Info::getInt(Value); } - void setPointer(PointerTy PtrVal) { + void setPointer(PointerTy PtrVal) LLVM_LVALUE_FUNCTION { Value = Info::updatePointer(Value, PtrVal); } - void setInt(IntType IntVal) { + void setInt(IntType IntVal) LLVM_LVALUE_FUNCTION { Value = Info::updateInt(Value, static_cast(IntVal)); } - void initWithPointer(PointerTy PtrVal) { + void initWithPointer(PointerTy PtrVal) LLVM_LVALUE_FUNCTION { Value = Info::updatePointer(0, PtrVal); } - void setPointerAndInt(PointerTy PtrVal, IntType IntVal) { + void setPointerAndInt(PointerTy PtrVal, IntType IntVal) LLVM_LVALUE_FUNCTION { Value = Info::updateInt(Info::updatePointer(0, PtrVal), static_cast(IntVal)); } @@ -89,7 +90,7 @@ class PointerIntPair { (public) void *getOpaqueValue() const { return reinterpret_cast(Value); } - void setFromOpaqueValue(void *Val) { + void setFromOpaqueValue(void *Val) LLVM_LVALUE_FUNCTION { Value = reinterpret_cast(Val); } Modified: vendor/llvm/dist/include/llvm/ADT/PointerUnion.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/PointerUnion.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm/ADT/PointerUnion.h Wed Oct 23 17:51:42 2019 (r353940) @@ -54,22 +54,15 @@ struct PointerUnionTypeSelectorReturn< }; namespace pointer_union_detail { - constexpr int constexprMin(int a, int b) { return a < b ? a : b; } /// Determine the number of bits required to store integers with values < n. /// This is ceil(log2(n)). constexpr int bitsRequired(unsigned n) { return n > 1 ? 1 + bitsRequired((n + 1) / 2) : 0; } - // FIXME: In C++14, replace this with - // std::min({PointerLikeTypeTraits::NumLowBitsAvailable...}) - template constexpr int lowBitsAvailable() { - return PointerLikeTypeTraits::NumLowBitsAvailable; + template constexpr int lowBitsAvailable() { + return std::min({PointerLikeTypeTraits::NumLowBitsAvailable...}); } - template - constexpr int lowBitsAvailable() { - return constexprMin(lowBitsAvailable(), lowBitsAvailable()); - } /// Find the index of a type in a list of types. TypeIndex::Index /// is the index of T in Us, or sizeof...(Us) if T does not appear in the @@ -167,10 +160,11 @@ class PointerUnion void *, pointer_union_detail::bitsRequired(sizeof...(PTs)), int, pointer_union_detail::PointerUnionUIntTraits>, 0, PTs...> { - // The first type is special in some ways, but we don't want PointerUnion to - // be a 'template ' because it's much more - // convenient to have a name for the whole pack. So split off the first type - // here. + // The first type is special because we want to directly cast a pointer to a + // default-initialized union to a pointer to the first type. But we don't + // want PointerUnion to be a 'template ' + // because it's much more convenient to have a name for the whole pack. So + // split off the first type here. using First = typename pointer_union_detail::GetFirstType::type; using Base = typename PointerUnion::PointerUnionMembers; @@ -182,12 +176,7 @@ class PointerUnion /// Test if the pointer held in the union is null, regardless of /// which type it is. - bool isNull() const { - // Convert from the void* to one of the pointer types, to make sure that - // we recursively strip off low bits if we have a nested PointerUnion. - return !PointerLikeTypeTraits::getFromVoidPointer( - this->Val.getPointer()); - } + bool isNull() const { return !this->Val.getPointer(); } explicit operator bool() const { return !isNull(); } @@ -226,7 +215,8 @@ class PointerUnion First *getAddrOfPtr1() { assert(is() && "Val is not the first pointer"); assert( - get() == this->Val.getPointer() && + PointerLikeTypeTraits::getAsVoidPointer(get()) == + this->Val.getPointer() && "Can't get the address because PointerLikeTypeTraits changes the ptr"); return const_cast( reinterpret_cast(this->Val.getAddrOfPointer())); Modified: vendor/llvm/dist/include/llvm/ADT/STLExtras.h ============================================================================== --- vendor/llvm/dist/include/llvm/ADT/STLExtras.h Wed Oct 23 17:28:35 2019 (r353939) +++ vendor/llvm/dist/include/llvm/ADT/STLExtras.h Wed Oct 23 17:51:42 2019 (r353940) @@ -95,18 +95,6 @@ template struct identity { } }; -template struct less_ptr { - bool operator()(const Ty* left, const Ty* right) const { - return *left < *right; - } -}; - -template struct greater_ptr { - bool operator()(const Ty* left, const Ty* right) const { - return *right < *left; - } -}; - /// An efficient, type-erasing, non-owning reference to a callable. This is *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Oct 23 17:51:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5938B1599F6; Wed, 23 Oct 2019 17:51:53 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yycT1kzCz4S5L; Wed, 23 Oct 2019 17:51:53 +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 05020341; Wed, 23 Oct 2019 17:51:53 +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 x9NHpqje075747; Wed, 23 Oct 2019 17:51:52 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHpqFn075746; Wed, 23 Oct 2019 17:51:52 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231751.x9NHpqFn075746@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:51:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353941 - vendor/llvm/llvm-r375505 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm/llvm-r375505 X-SVN-Commit-Revision: 353941 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:51:53 -0000 Author: dim Date: Wed Oct 23 17:51:52 2019 New Revision: 353941 URL: https://svnweb.freebsd.org/changeset/base/353941 Log: Tag stripped llvm trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub. Added: vendor/llvm/llvm-r375505/ - copied from r353940, vendor/llvm/dist/ From owner-svn-src-all@freebsd.org Wed Oct 23 17:52:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9AF3D159A83; Wed, 23 Oct 2019 17:52:13 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yycs4NC1z4SKF; Wed, 23 Oct 2019 17:52:13 +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 79F4835C; Wed, 23 Oct 2019 17:52:13 +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 x9NHqDuH077759; Wed, 23 Oct 2019 17:52:13 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHqBfP075797; Wed, 23 Oct 2019 17:52:11 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231752.x9NHqBfP075797@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:52:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353942 - in vendor/clang/dist: include/clang include/clang-c include/clang/AST include/clang/ASTMatchers include/clang/Analysis include/clang/Basic include/clang/CodeGen include/clang/... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/clang/dist: include/clang include/clang-c include/clang/AST include/clang/ASTMatchers include/clang/Analysis include/clang/Basic include/clang/CodeGen include/clang/CrossTU include/clang/Dir... X-SVN-Commit-Revision: 353942 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:52:13 -0000 Author: dim Date: Wed Oct 23 17:52:09 2019 New Revision: 353942 URL: https://svnweb.freebsd.org/changeset/base/353942 Log: Vendor import of stripped clang trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/cfe/trunk@375505 Added: vendor/clang/dist/include/clang-c/FatalErrorHandler.h vendor/clang/dist/include/clang/AST/CXXRecordDeclDefinitionBits.def vendor/clang/dist/include/clang/AST/OptionalDiagnostic.h vendor/clang/dist/include/clang/Analysis/PathDiagnostic.h vendor/clang/dist/include/clang/Basic/AArch64SVEACLETypes.def vendor/clang/dist/include/clang/Basic/AttributeCommonInfo.h vendor/clang/dist/include/clang/Basic/BuiltinsBPF.def vendor/clang/dist/include/clang/Basic/LangStandard.h vendor/clang/dist/include/clang/Basic/LangStandards.def vendor/clang/dist/include/clang/Basic/TypeNodes.td vendor/clang/dist/include/clang/Index/IndexingOptions.h vendor/clang/dist/include/clang/Lex/PreprocessorExcludedConditionalDirectiveSkipMapping.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicCastInfo.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicType.h vendor/clang/dist/include/clang/Tooling/DependencyScanning/DependencyScanningFilesystem.h vendor/clang/dist/include/clang/Tooling/DependencyScanning/DependencyScanningService.h vendor/clang/dist/include/clang/Tooling/DependencyScanning/DependencyScanningTool.h vendor/clang/dist/include/clang/Tooling/Refactoring/Extract/SourceExtraction.h (contents, props changed) vendor/clang/dist/include/clang/Tooling/Transformer/ vendor/clang/dist/include/clang/Tooling/Transformer/MatchConsumer.h vendor/clang/dist/include/clang/Tooling/Transformer/RangeSelector.h vendor/clang/dist/include/clang/Tooling/Transformer/RewriteRule.h vendor/clang/dist/include/clang/Tooling/Transformer/SourceCode.h vendor/clang/dist/include/clang/Tooling/Transformer/SourceCodeBuilders.h vendor/clang/dist/include/clang/Tooling/Transformer/Stencil.h vendor/clang/dist/include/clang/Tooling/Transformer/Transformer.h vendor/clang/dist/lib/AST/Interp/ vendor/clang/dist/lib/AST/Interp/Block.cpp vendor/clang/dist/lib/AST/Interp/Block.h vendor/clang/dist/lib/AST/Interp/Boolean.h vendor/clang/dist/lib/AST/Interp/ByteCodeEmitter.cpp vendor/clang/dist/lib/AST/Interp/ByteCodeEmitter.h vendor/clang/dist/lib/AST/Interp/ByteCodeExprGen.cpp vendor/clang/dist/lib/AST/Interp/ByteCodeExprGen.h vendor/clang/dist/lib/AST/Interp/ByteCodeGenError.cpp vendor/clang/dist/lib/AST/Interp/ByteCodeGenError.h vendor/clang/dist/lib/AST/Interp/ByteCodeStmtGen.cpp vendor/clang/dist/lib/AST/Interp/ByteCodeStmtGen.h vendor/clang/dist/lib/AST/Interp/Context.cpp vendor/clang/dist/lib/AST/Interp/Context.h vendor/clang/dist/lib/AST/Interp/Descriptor.cpp vendor/clang/dist/lib/AST/Interp/Descriptor.h vendor/clang/dist/lib/AST/Interp/Disasm.cpp vendor/clang/dist/lib/AST/Interp/EvalEmitter.cpp vendor/clang/dist/lib/AST/Interp/EvalEmitter.h vendor/clang/dist/lib/AST/Interp/Frame.cpp vendor/clang/dist/lib/AST/Interp/Frame.h vendor/clang/dist/lib/AST/Interp/Function.cpp vendor/clang/dist/lib/AST/Interp/Function.h vendor/clang/dist/lib/AST/Interp/Integral.h vendor/clang/dist/lib/AST/Interp/Interp.cpp vendor/clang/dist/lib/AST/Interp/Interp.h vendor/clang/dist/lib/AST/Interp/InterpFrame.cpp vendor/clang/dist/lib/AST/Interp/InterpFrame.h vendor/clang/dist/lib/AST/Interp/InterpStack.cpp vendor/clang/dist/lib/AST/Interp/InterpStack.h vendor/clang/dist/lib/AST/Interp/InterpState.cpp vendor/clang/dist/lib/AST/Interp/InterpState.h vendor/clang/dist/lib/AST/Interp/Opcode.h vendor/clang/dist/lib/AST/Interp/Opcodes.td vendor/clang/dist/lib/AST/Interp/Pointer.cpp vendor/clang/dist/lib/AST/Interp/Pointer.h vendor/clang/dist/lib/AST/Interp/PrimType.cpp vendor/clang/dist/lib/AST/Interp/PrimType.h vendor/clang/dist/lib/AST/Interp/Program.cpp vendor/clang/dist/lib/AST/Interp/Program.h vendor/clang/dist/lib/AST/Interp/Record.cpp vendor/clang/dist/lib/AST/Interp/Record.h vendor/clang/dist/lib/AST/Interp/Source.cpp vendor/clang/dist/lib/AST/Interp/Source.h vendor/clang/dist/lib/AST/Interp/State.cpp vendor/clang/dist/lib/AST/Interp/State.h vendor/clang/dist/lib/Analysis/PathDiagnostic.cpp vendor/clang/dist/lib/Basic/LangStandards.cpp vendor/clang/dist/lib/Basic/Stack.cpp vendor/clang/dist/lib/DirectoryWatcher/windows/ vendor/clang/dist/lib/DirectoryWatcher/windows/DirectoryWatcher-windows.cpp vendor/clang/dist/lib/Driver/ToolChains/InterfaceStubs.cpp vendor/clang/dist/lib/Driver/ToolChains/InterfaceStubs.h vendor/clang/dist/lib/Headers/ppc_wrappers/pmmintrin.h vendor/clang/dist/lib/Headers/ppc_wrappers/smmintrin.h vendor/clang/dist/lib/Headers/ppc_wrappers/tmmintrin.h vendor/clang/dist/lib/Sema/SemaConcept.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/Yaml.h (contents, props changed) vendor/clang/dist/lib/StaticAnalyzer/Core/DynamicType.cpp vendor/clang/dist/lib/Tooling/DependencyScanning/DependencyScanningFilesystem.cpp vendor/clang/dist/lib/Tooling/DependencyScanning/DependencyScanningService.cpp vendor/clang/dist/lib/Tooling/DependencyScanning/DependencyScanningTool.cpp vendor/clang/dist/lib/Tooling/Transformer/ vendor/clang/dist/lib/Tooling/Transformer/CMakeLists.txt vendor/clang/dist/lib/Tooling/Transformer/RangeSelector.cpp vendor/clang/dist/lib/Tooling/Transformer/RewriteRule.cpp vendor/clang/dist/lib/Tooling/Transformer/SourceCode.cpp vendor/clang/dist/lib/Tooling/Transformer/SourceCodeBuilders.cpp vendor/clang/dist/lib/Tooling/Transformer/Stencil.cpp vendor/clang/dist/lib/Tooling/Transformer/Transformer.cpp vendor/clang/dist/tools/clang-offload-wrapper/ vendor/clang/dist/tools/clang-offload-wrapper/CMakeLists.txt vendor/clang/dist/tools/clang-offload-wrapper/ClangOffloadWrapper.cpp vendor/clang/dist/utils/TableGen/ClangOpcodesEmitter.cpp vendor/clang/dist/utils/TableGen/ClangTypeNodesEmitter.cpp Deleted: vendor/clang/dist/include/clang/AST/TypeNodes.def vendor/clang/dist/include/clang/Frontend/LangStandard.h vendor/clang/dist/include/clang/Frontend/LangStandards.def vendor/clang/dist/include/clang/Index/CodegenNameGenerator.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/BugReporter/PathDiagnostic.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeMap.h vendor/clang/dist/include/clang/Tooling/Refactoring/RangeSelector.h vendor/clang/dist/include/clang/Tooling/Refactoring/SourceCode.h vendor/clang/dist/include/clang/Tooling/Refactoring/Stencil.h vendor/clang/dist/include/clang/Tooling/Refactoring/Transformer.h vendor/clang/dist/lib/Frontend/LangStandards.cpp vendor/clang/dist/lib/Index/CodegenNameGenerator.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/DynamicTypeMap.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/PathDiagnostic.cpp vendor/clang/dist/lib/Tooling/Refactoring/Extract/SourceExtraction.h vendor/clang/dist/lib/Tooling/Refactoring/RangeSelector.cpp vendor/clang/dist/lib/Tooling/Refactoring/SourceCode.cpp vendor/clang/dist/lib/Tooling/Refactoring/Stencil.cpp vendor/clang/dist/lib/Tooling/Refactoring/Transformer.cpp Modified: vendor/clang/dist/include/clang-c/Index.h vendor/clang/dist/include/clang/AST/APValue.h vendor/clang/dist/include/clang/AST/ASTContext.h vendor/clang/dist/include/clang/AST/ASTFwd.h vendor/clang/dist/include/clang/AST/ASTImporter.h vendor/clang/dist/include/clang/AST/ASTImporterSharedState.h vendor/clang/dist/include/clang/AST/ASTNodeTraverser.h vendor/clang/dist/include/clang/AST/ASTStructuralEquivalence.h vendor/clang/dist/include/clang/AST/ASTTypeTraits.h vendor/clang/dist/include/clang/AST/Attr.h vendor/clang/dist/include/clang/AST/CharUnits.h vendor/clang/dist/include/clang/AST/CommentCommands.td vendor/clang/dist/include/clang/AST/CommentLexer.h vendor/clang/dist/include/clang/AST/Decl.h vendor/clang/dist/include/clang/AST/DeclBase.h vendor/clang/dist/include/clang/AST/DeclCXX.h vendor/clang/dist/include/clang/AST/DeclTemplate.h vendor/clang/dist/include/clang/AST/Expr.h vendor/clang/dist/include/clang/AST/ExprCXX.h vendor/clang/dist/include/clang/AST/ExternalASTMerger.h vendor/clang/dist/include/clang/AST/FormatString.h vendor/clang/dist/include/clang/AST/GlobalDecl.h vendor/clang/dist/include/clang/AST/JSONNodeDumper.h vendor/clang/dist/include/clang/AST/Mangle.h vendor/clang/dist/include/clang/AST/NSAPI.h vendor/clang/dist/include/clang/AST/OpenMPClause.h vendor/clang/dist/include/clang/AST/OperationKinds.def vendor/clang/dist/include/clang/AST/RawCommentList.h vendor/clang/dist/include/clang/AST/RecursiveASTVisitor.h vendor/clang/dist/include/clang/AST/Stmt.h vendor/clang/dist/include/clang/AST/StmtOpenMP.h vendor/clang/dist/include/clang/AST/TextNodeDumper.h vendor/clang/dist/include/clang/AST/Type.h vendor/clang/dist/include/clang/AST/TypeLoc.h vendor/clang/dist/include/clang/AST/TypeLocNodes.def vendor/clang/dist/include/clang/AST/TypeVisitor.h vendor/clang/dist/include/clang/ASTMatchers/ASTMatchers.h vendor/clang/dist/include/clang/ASTMatchers/ASTMatchersInternal.h vendor/clang/dist/include/clang/Analysis/AnalysisDeclContext.h vendor/clang/dist/include/clang/Analysis/CFG.h vendor/clang/dist/include/clang/Analysis/CallGraph.h vendor/clang/dist/include/clang/Basic/Attr.td vendor/clang/dist/include/clang/Basic/AttrDocs.td vendor/clang/dist/include/clang/Basic/Builtins.def vendor/clang/dist/include/clang/Basic/BuiltinsAArch64.def vendor/clang/dist/include/clang/Basic/BuiltinsAMDGPU.def vendor/clang/dist/include/clang/Basic/BuiltinsARM.def vendor/clang/dist/include/clang/Basic/BuiltinsPPC.def vendor/clang/dist/include/clang/Basic/BuiltinsWebAssembly.def vendor/clang/dist/include/clang/Basic/BuiltinsX86.def vendor/clang/dist/include/clang/Basic/BuiltinsX86_64.def vendor/clang/dist/include/clang/Basic/CodeGenOptions.def vendor/clang/dist/include/clang/Basic/CodeGenOptions.h vendor/clang/dist/include/clang/Basic/Diagnostic.h vendor/clang/dist/include/clang/Basic/DiagnosticASTKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticCommentKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticCommonKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticDriverKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticFrontendKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticGroups.td vendor/clang/dist/include/clang/Basic/DiagnosticOptions.def vendor/clang/dist/include/clang/Basic/DiagnosticParseKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticSemaKinds.td vendor/clang/dist/include/clang/Basic/DiagnosticSerializationKinds.td vendor/clang/dist/include/clang/Basic/Features.def vendor/clang/dist/include/clang/Basic/FileManager.h vendor/clang/dist/include/clang/Basic/IdentifierTable.h vendor/clang/dist/include/clang/Basic/LangOptions.def vendor/clang/dist/include/clang/Basic/LangOptions.h vendor/clang/dist/include/clang/Basic/Linkage.h vendor/clang/dist/include/clang/Basic/OpenCLOptions.h vendor/clang/dist/include/clang/Basic/OpenMPKinds.def vendor/clang/dist/include/clang/Basic/OpenMPKinds.h vendor/clang/dist/include/clang/Basic/OperatorKinds.h vendor/clang/dist/include/clang/Basic/SourceManager.h vendor/clang/dist/include/clang/Basic/Specifiers.h vendor/clang/dist/include/clang/Basic/Stack.h vendor/clang/dist/include/clang/Basic/StmtNodes.td vendor/clang/dist/include/clang/Basic/SyncScope.h vendor/clang/dist/include/clang/Basic/TargetBuiltins.h vendor/clang/dist/include/clang/Basic/TargetInfo.h vendor/clang/dist/include/clang/Basic/TokenKinds.def vendor/clang/dist/include/clang/Basic/TokenKinds.h vendor/clang/dist/include/clang/Basic/X86Target.def vendor/clang/dist/include/clang/Basic/arm_neon.td vendor/clang/dist/include/clang/CodeGen/CGFunctionInfo.h vendor/clang/dist/include/clang/CrossTU/CrossTranslationUnit.h vendor/clang/dist/include/clang/DirectoryWatcher/DirectoryWatcher.h vendor/clang/dist/include/clang/Driver/Action.h vendor/clang/dist/include/clang/Driver/CC1Options.td vendor/clang/dist/include/clang/Driver/CLCompatOptions.td vendor/clang/dist/include/clang/Driver/Driver.h vendor/clang/dist/include/clang/Driver/Options.h vendor/clang/dist/include/clang/Driver/Options.td vendor/clang/dist/include/clang/Driver/Phases.h vendor/clang/dist/include/clang/Driver/SanitizerArgs.h vendor/clang/dist/include/clang/Driver/ToolChain.h vendor/clang/dist/include/clang/Driver/Types.def vendor/clang/dist/include/clang/Driver/Types.h vendor/clang/dist/include/clang/Format/Format.h vendor/clang/dist/include/clang/Frontend/ASTUnit.h vendor/clang/dist/include/clang/Frontend/CompilerInstance.h vendor/clang/dist/include/clang/Frontend/CompilerInvocation.h vendor/clang/dist/include/clang/Frontend/FrontendActions.h vendor/clang/dist/include/clang/Frontend/FrontendOptions.h vendor/clang/dist/include/clang/Frontend/Utils.h vendor/clang/dist/include/clang/Index/IndexDataConsumer.h vendor/clang/dist/include/clang/Index/IndexingAction.h vendor/clang/dist/include/clang/Lex/DependencyDirectivesSourceMinimizer.h vendor/clang/dist/include/clang/Lex/DirectoryLookup.h vendor/clang/dist/include/clang/Lex/HeaderMap.h vendor/clang/dist/include/clang/Lex/HeaderSearch.h vendor/clang/dist/include/clang/Lex/HeaderSearchOptions.h vendor/clang/dist/include/clang/Lex/Lexer.h vendor/clang/dist/include/clang/Lex/MacroArgs.h vendor/clang/dist/include/clang/Lex/PPCallbacks.h vendor/clang/dist/include/clang/Lex/Preprocessor.h vendor/clang/dist/include/clang/Lex/PreprocessorOptions.h vendor/clang/dist/include/clang/Parse/Parser.h vendor/clang/dist/include/clang/Rewrite/Core/Rewriter.h vendor/clang/dist/include/clang/Sema/Overload.h vendor/clang/dist/include/clang/Sema/ParsedAttr.h vendor/clang/dist/include/clang/Sema/ScopeInfo.h vendor/clang/dist/include/clang/Sema/Sema.h vendor/clang/dist/include/clang/Sema/SemaInternal.h vendor/clang/dist/include/clang/Sema/TypoCorrection.h vendor/clang/dist/include/clang/Serialization/ASTBitCodes.h vendor/clang/dist/include/clang/Serialization/ASTReader.h vendor/clang/dist/include/clang/StaticAnalyzer/Checkers/Checkers.td vendor/clang/dist/include/clang/StaticAnalyzer/Core/AnalyzerOptions.def vendor/clang/dist/include/clang/StaticAnalyzer/Core/AnalyzerOptions.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/BugReporter/BugReporter.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/BugReporter/BugReporterVisitors.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/BugReporter/BugType.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/BugReporter/CommonBugCategories.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/Checker.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/CheckerManager.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathDiagnosticConsumers.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/CallEvent.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/CheckerContext.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/DynamicTypeInfo.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/MemRegion.h vendor/clang/dist/include/clang/StaticAnalyzer/Core/PathSensitive/ProgramState.h vendor/clang/dist/include/clang/Tooling/ASTDiff/ASTDiff.h vendor/clang/dist/include/clang/Tooling/AllTUsExecution.h vendor/clang/dist/include/clang/Tooling/ArgumentsAdjusters.h vendor/clang/dist/include/clang/Tooling/DependencyScanning/DependencyScanningWorker.h vendor/clang/dist/include/clang/Tooling/Execution.h vendor/clang/dist/include/clang/Tooling/Inclusions/HeaderIncludes.h vendor/clang/dist/include/clang/Tooling/Inclusions/IncludeStyle.h vendor/clang/dist/include/clang/Tooling/Refactoring/RecursiveSymbolVisitor.h vendor/clang/dist/include/clang/Tooling/Refactoring/RefactoringActionRulesInternal.h vendor/clang/dist/include/clang/Tooling/StandaloneExecution.h vendor/clang/dist/include/clang/Tooling/Syntax/Tokens.h vendor/clang/dist/include/clang/Tooling/Tooling.h vendor/clang/dist/include/clang/module.modulemap vendor/clang/dist/lib/ARCMigrate/ARCMT.cpp vendor/clang/dist/lib/ARCMigrate/FileRemapper.cpp vendor/clang/dist/lib/ARCMigrate/ObjCMT.cpp vendor/clang/dist/lib/ARCMigrate/PlistReporter.cpp vendor/clang/dist/lib/AST/APValue.cpp vendor/clang/dist/lib/AST/ASTContext.cpp vendor/clang/dist/lib/AST/ASTDiagnostic.cpp vendor/clang/dist/lib/AST/ASTImporter.cpp vendor/clang/dist/lib/AST/ASTStructuralEquivalence.cpp vendor/clang/dist/lib/AST/ASTTypeTraits.cpp vendor/clang/dist/lib/AST/CXXInheritance.cpp vendor/clang/dist/lib/AST/Comment.cpp vendor/clang/dist/lib/AST/CommentLexer.cpp vendor/clang/dist/lib/AST/CommentParser.cpp vendor/clang/dist/lib/AST/CommentSema.cpp vendor/clang/dist/lib/AST/Decl.cpp vendor/clang/dist/lib/AST/DeclBase.cpp vendor/clang/dist/lib/AST/DeclCXX.cpp vendor/clang/dist/lib/AST/DeclPrinter.cpp vendor/clang/dist/lib/AST/DeclTemplate.cpp vendor/clang/dist/lib/AST/Expr.cpp vendor/clang/dist/lib/AST/ExprCXX.cpp vendor/clang/dist/lib/AST/ExprClassification.cpp vendor/clang/dist/lib/AST/ExprConstant.cpp vendor/clang/dist/lib/AST/ExternalASTMerger.cpp vendor/clang/dist/lib/AST/FormatString.cpp vendor/clang/dist/lib/AST/FormatStringParsing.h vendor/clang/dist/lib/AST/InheritViz.cpp vendor/clang/dist/lib/AST/ItaniumCXXABI.cpp vendor/clang/dist/lib/AST/ItaniumMangle.cpp vendor/clang/dist/lib/AST/JSONNodeDumper.cpp vendor/clang/dist/lib/AST/Mangle.cpp vendor/clang/dist/lib/AST/MicrosoftCXXABI.cpp vendor/clang/dist/lib/AST/MicrosoftMangle.cpp vendor/clang/dist/lib/AST/NSAPI.cpp vendor/clang/dist/lib/AST/OpenMPClause.cpp vendor/clang/dist/lib/AST/PrintfFormatString.cpp vendor/clang/dist/lib/AST/RawCommentList.cpp vendor/clang/dist/lib/AST/Stmt.cpp vendor/clang/dist/lib/AST/StmtOpenMP.cpp vendor/clang/dist/lib/AST/StmtPrinter.cpp vendor/clang/dist/lib/AST/StmtProfile.cpp vendor/clang/dist/lib/AST/TemplateBase.cpp vendor/clang/dist/lib/AST/TextNodeDumper.cpp vendor/clang/dist/lib/AST/Type.cpp vendor/clang/dist/lib/AST/TypeLoc.cpp vendor/clang/dist/lib/AST/TypePrinter.cpp vendor/clang/dist/lib/AST/VTTBuilder.cpp vendor/clang/dist/lib/AST/VTableBuilder.cpp vendor/clang/dist/lib/ASTMatchers/ASTMatchFinder.cpp vendor/clang/dist/lib/ASTMatchers/Dynamic/Marshallers.h vendor/clang/dist/lib/ASTMatchers/Dynamic/Registry.cpp vendor/clang/dist/lib/Analysis/AnalysisDeclContext.cpp vendor/clang/dist/lib/Analysis/BodyFarm.cpp vendor/clang/dist/lib/Analysis/CFG.cpp vendor/clang/dist/lib/Analysis/CallGraph.cpp vendor/clang/dist/lib/Analysis/CloneDetection.cpp vendor/clang/dist/lib/Analysis/CocoaConventions.cpp vendor/clang/dist/lib/Analysis/Consumed.cpp vendor/clang/dist/lib/Analysis/ProgramPoint.cpp vendor/clang/dist/lib/Analysis/ReachableCode.cpp vendor/clang/dist/lib/Analysis/RetainSummaryManager.cpp vendor/clang/dist/lib/Analysis/ThreadSafety.cpp vendor/clang/dist/lib/Analysis/plugins/SampleAnalyzer/MainCallChecker.cpp vendor/clang/dist/lib/Basic/Attributes.cpp vendor/clang/dist/lib/Basic/FileManager.cpp vendor/clang/dist/lib/Basic/IdentifierTable.cpp vendor/clang/dist/lib/Basic/Module.cpp vendor/clang/dist/lib/Basic/OpenMPKinds.cpp vendor/clang/dist/lib/Basic/SourceManager.cpp vendor/clang/dist/lib/Basic/TargetInfo.cpp vendor/clang/dist/lib/Basic/Targets.cpp vendor/clang/dist/lib/Basic/Targets/AArch64.cpp vendor/clang/dist/lib/Basic/Targets/AArch64.h vendor/clang/dist/lib/Basic/Targets/AMDGPU.cpp vendor/clang/dist/lib/Basic/Targets/ARM.cpp vendor/clang/dist/lib/Basic/Targets/BPF.cpp vendor/clang/dist/lib/Basic/Targets/BPF.h vendor/clang/dist/lib/Basic/Targets/OSTargets.h vendor/clang/dist/lib/Basic/Targets/PPC.cpp vendor/clang/dist/lib/Basic/Targets/PPC.h vendor/clang/dist/lib/Basic/Targets/RISCV.cpp vendor/clang/dist/lib/Basic/Targets/RISCV.h vendor/clang/dist/lib/Basic/Targets/SPIR.h vendor/clang/dist/lib/Basic/Targets/Sparc.h vendor/clang/dist/lib/Basic/Targets/SystemZ.cpp vendor/clang/dist/lib/Basic/Targets/X86.cpp vendor/clang/dist/lib/Basic/Targets/X86.h vendor/clang/dist/lib/Basic/TokenKinds.cpp vendor/clang/dist/lib/CodeGen/BackendUtil.cpp vendor/clang/dist/lib/CodeGen/CGAtomic.cpp vendor/clang/dist/lib/CodeGen/CGBlocks.cpp vendor/clang/dist/lib/CodeGen/CGBuiltin.cpp vendor/clang/dist/lib/CodeGen/CGCUDANV.cpp vendor/clang/dist/lib/CodeGen/CGCXX.cpp vendor/clang/dist/lib/CodeGen/CGCXXABI.cpp vendor/clang/dist/lib/CodeGen/CGCXXABI.h vendor/clang/dist/lib/CodeGen/CGCall.cpp vendor/clang/dist/lib/CodeGen/CGClass.cpp vendor/clang/dist/lib/CodeGen/CGCleanup.cpp vendor/clang/dist/lib/CodeGen/CGDebugInfo.cpp vendor/clang/dist/lib/CodeGen/CGDecl.cpp vendor/clang/dist/lib/CodeGen/CGDeclCXX.cpp vendor/clang/dist/lib/CodeGen/CGException.cpp vendor/clang/dist/lib/CodeGen/CGExpr.cpp vendor/clang/dist/lib/CodeGen/CGExprAgg.cpp vendor/clang/dist/lib/CodeGen/CGExprCXX.cpp vendor/clang/dist/lib/CodeGen/CGExprComplex.cpp vendor/clang/dist/lib/CodeGen/CGExprConstant.cpp vendor/clang/dist/lib/CodeGen/CGExprScalar.cpp vendor/clang/dist/lib/CodeGen/CGLoopInfo.cpp vendor/clang/dist/lib/CodeGen/CGLoopInfo.h vendor/clang/dist/lib/CodeGen/CGNonTrivialStruct.cpp vendor/clang/dist/lib/CodeGen/CGObjC.cpp vendor/clang/dist/lib/CodeGen/CGObjCGNU.cpp vendor/clang/dist/lib/CodeGen/CGObjCMac.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntime.h vendor/clang/dist/lib/CodeGen/CGOpenMPRuntimeNVPTX.cpp vendor/clang/dist/lib/CodeGen/CGOpenMPRuntimeNVPTX.h vendor/clang/dist/lib/CodeGen/CGStmt.cpp vendor/clang/dist/lib/CodeGen/CGStmtOpenMP.cpp vendor/clang/dist/lib/CodeGen/CGVTables.cpp vendor/clang/dist/lib/CodeGen/CodeGenAction.cpp vendor/clang/dist/lib/CodeGen/CodeGenFunction.cpp vendor/clang/dist/lib/CodeGen/CodeGenFunction.h vendor/clang/dist/lib/CodeGen/CodeGenModule.cpp vendor/clang/dist/lib/CodeGen/CodeGenModule.h vendor/clang/dist/lib/CodeGen/CodeGenPGO.cpp vendor/clang/dist/lib/CodeGen/CodeGenPGO.h vendor/clang/dist/lib/CodeGen/CodeGenTypes.cpp vendor/clang/dist/lib/CodeGen/ConstantInitBuilder.cpp vendor/clang/dist/lib/CodeGen/CoverageMappingGen.cpp vendor/clang/dist/lib/CodeGen/CoverageMappingGen.h vendor/clang/dist/lib/CodeGen/EHScopeStack.h vendor/clang/dist/lib/CodeGen/ItaniumCXXABI.cpp vendor/clang/dist/lib/CodeGen/MicrosoftCXXABI.cpp vendor/clang/dist/lib/CodeGen/ModuleBuilder.cpp vendor/clang/dist/lib/CodeGen/ObjectFilePCHContainerOperations.cpp vendor/clang/dist/lib/CodeGen/TargetInfo.cpp vendor/clang/dist/lib/CrossTU/CrossTranslationUnit.cpp vendor/clang/dist/lib/DirectoryWatcher/default/DirectoryWatcher-not-implemented.cpp vendor/clang/dist/lib/DirectoryWatcher/linux/DirectoryWatcher-linux.cpp vendor/clang/dist/lib/DirectoryWatcher/mac/DirectoryWatcher-mac.cpp vendor/clang/dist/lib/Driver/Action.cpp vendor/clang/dist/lib/Driver/Compilation.cpp vendor/clang/dist/lib/Driver/Driver.cpp vendor/clang/dist/lib/Driver/DriverOptions.cpp vendor/clang/dist/lib/Driver/Phases.cpp vendor/clang/dist/lib/Driver/SanitizerArgs.cpp vendor/clang/dist/lib/Driver/ToolChain.cpp vendor/clang/dist/lib/Driver/ToolChains/AMDGPU.cpp vendor/clang/dist/lib/Driver/ToolChains/AVR.cpp vendor/clang/dist/lib/Driver/ToolChains/Ananas.cpp vendor/clang/dist/lib/Driver/ToolChains/Arch/AArch64.cpp vendor/clang/dist/lib/Driver/ToolChains/Arch/ARM.cpp vendor/clang/dist/lib/Driver/ToolChains/Arch/Mips.cpp vendor/clang/dist/lib/Driver/ToolChains/Arch/Mips.h vendor/clang/dist/lib/Driver/ToolChains/Arch/PPC.cpp vendor/clang/dist/lib/Driver/ToolChains/Arch/RISCV.cpp vendor/clang/dist/lib/Driver/ToolChains/Arch/RISCV.h vendor/clang/dist/lib/Driver/ToolChains/Arch/X86.cpp vendor/clang/dist/lib/Driver/ToolChains/BareMetal.cpp vendor/clang/dist/lib/Driver/ToolChains/Clang.cpp vendor/clang/dist/lib/Driver/ToolChains/Clang.h vendor/clang/dist/lib/Driver/ToolChains/CloudABI.cpp vendor/clang/dist/lib/Driver/ToolChains/CommonArgs.cpp vendor/clang/dist/lib/Driver/ToolChains/CommonArgs.h vendor/clang/dist/lib/Driver/ToolChains/CrossWindows.cpp vendor/clang/dist/lib/Driver/ToolChains/Cuda.cpp vendor/clang/dist/lib/Driver/ToolChains/Darwin.cpp vendor/clang/dist/lib/Driver/ToolChains/DragonFly.cpp vendor/clang/dist/lib/Driver/ToolChains/FreeBSD.cpp vendor/clang/dist/lib/Driver/ToolChains/FreeBSD.h vendor/clang/dist/lib/Driver/ToolChains/Fuchsia.cpp vendor/clang/dist/lib/Driver/ToolChains/Fuchsia.h vendor/clang/dist/lib/Driver/ToolChains/Gnu.cpp vendor/clang/dist/lib/Driver/ToolChains/HIP.cpp vendor/clang/dist/lib/Driver/ToolChains/HIP.h vendor/clang/dist/lib/Driver/ToolChains/Hexagon.cpp vendor/clang/dist/lib/Driver/ToolChains/Linux.cpp vendor/clang/dist/lib/Driver/ToolChains/MSP430.cpp vendor/clang/dist/lib/Driver/ToolChains/MSVC.cpp vendor/clang/dist/lib/Driver/ToolChains/MSVC.h vendor/clang/dist/lib/Driver/ToolChains/MinGW.cpp vendor/clang/dist/lib/Driver/ToolChains/MinGW.h vendor/clang/dist/lib/Driver/ToolChains/Minix.cpp vendor/clang/dist/lib/Driver/ToolChains/Myriad.cpp vendor/clang/dist/lib/Driver/ToolChains/NaCl.cpp vendor/clang/dist/lib/Driver/ToolChains/NetBSD.cpp vendor/clang/dist/lib/Driver/ToolChains/OpenBSD.cpp vendor/clang/dist/lib/Driver/ToolChains/PPCLinux.cpp vendor/clang/dist/lib/Driver/ToolChains/PS4CPU.cpp vendor/clang/dist/lib/Driver/ToolChains/RISCVToolchain.cpp vendor/clang/dist/lib/Driver/ToolChains/RISCVToolchain.h vendor/clang/dist/lib/Driver/ToolChains/Solaris.cpp vendor/clang/dist/lib/Driver/ToolChains/WebAssembly.cpp vendor/clang/dist/lib/Driver/ToolChains/XCore.cpp vendor/clang/dist/lib/Driver/Types.cpp vendor/clang/dist/lib/Driver/XRayArgs.cpp vendor/clang/dist/lib/Format/BreakableToken.cpp vendor/clang/dist/lib/Format/ContinuationIndenter.cpp vendor/clang/dist/lib/Format/Encoding.h vendor/clang/dist/lib/Format/Format.cpp vendor/clang/dist/lib/Format/FormatToken.h vendor/clang/dist/lib/Format/FormatTokenLexer.cpp vendor/clang/dist/lib/Format/FormatTokenLexer.h vendor/clang/dist/lib/Format/NamespaceEndCommentsFixer.cpp vendor/clang/dist/lib/Format/TokenAnnotator.cpp vendor/clang/dist/lib/Format/TokenAnnotator.h vendor/clang/dist/lib/Format/UnwrappedLineFormatter.cpp vendor/clang/dist/lib/Format/UnwrappedLineParser.cpp vendor/clang/dist/lib/Format/UnwrappedLineParser.h vendor/clang/dist/lib/Format/WhitespaceManager.cpp vendor/clang/dist/lib/Frontend/ASTConsumers.cpp vendor/clang/dist/lib/Frontend/ASTUnit.cpp vendor/clang/dist/lib/Frontend/ChainedIncludesSource.cpp vendor/clang/dist/lib/Frontend/CompilerInstance.cpp vendor/clang/dist/lib/Frontend/CompilerInvocation.cpp vendor/clang/dist/lib/Frontend/CreateInvocationFromCommandLine.cpp vendor/clang/dist/lib/Frontend/DependencyFile.cpp vendor/clang/dist/lib/Frontend/DependencyGraph.cpp vendor/clang/dist/lib/Frontend/FrontendAction.cpp vendor/clang/dist/lib/Frontend/FrontendActions.cpp vendor/clang/dist/lib/Frontend/FrontendOptions.cpp vendor/clang/dist/lib/Frontend/HeaderIncludeGen.cpp vendor/clang/dist/lib/Frontend/InitHeaderSearch.cpp vendor/clang/dist/lib/Frontend/InitPreprocessor.cpp vendor/clang/dist/lib/Frontend/InterfaceStubFunctionsConsumer.cpp vendor/clang/dist/lib/Frontend/ModuleDependencyCollector.cpp vendor/clang/dist/lib/Frontend/MultiplexConsumer.cpp vendor/clang/dist/lib/Frontend/PrecompiledPreamble.cpp vendor/clang/dist/lib/Frontend/PrintPreprocessedOutput.cpp vendor/clang/dist/lib/Frontend/Rewrite/FixItRewriter.cpp vendor/clang/dist/lib/Frontend/Rewrite/FrontendActions.cpp vendor/clang/dist/lib/Frontend/Rewrite/HTMLPrint.cpp vendor/clang/dist/lib/Frontend/Rewrite/InclusionRewriter.cpp vendor/clang/dist/lib/Frontend/Rewrite/RewriteModernObjC.cpp vendor/clang/dist/lib/Frontend/Rewrite/RewriteObjC.cpp vendor/clang/dist/lib/Frontend/SerializedDiagnosticPrinter.cpp vendor/clang/dist/lib/Frontend/TextDiagnostic.cpp vendor/clang/dist/lib/Frontend/VerifyDiagnosticConsumer.cpp vendor/clang/dist/lib/FrontendTool/ExecuteCompilerInvocation.cpp vendor/clang/dist/lib/Headers/__clang_cuda_intrinsics.h vendor/clang/dist/lib/Headers/altivec.h vendor/clang/dist/lib/Headers/arm_acle.h vendor/clang/dist/lib/Headers/avx512fintrin.h vendor/clang/dist/lib/Headers/bmiintrin.h vendor/clang/dist/lib/Headers/cpuid.h vendor/clang/dist/lib/Headers/emmintrin.h vendor/clang/dist/lib/Headers/ia32intrin.h vendor/clang/dist/lib/Headers/immintrin.h vendor/clang/dist/lib/Headers/opencl-c-base.h vendor/clang/dist/lib/Headers/opencl-c.h vendor/clang/dist/lib/Headers/ppc_wrappers/emmintrin.h vendor/clang/dist/lib/Headers/ppc_wrappers/mm_malloc.h vendor/clang/dist/lib/Headers/ppc_wrappers/mmintrin.h vendor/clang/dist/lib/Headers/ppc_wrappers/xmmintrin.h vendor/clang/dist/lib/Index/IndexSymbol.cpp vendor/clang/dist/lib/Index/IndexingAction.cpp vendor/clang/dist/lib/Index/USRGeneration.cpp vendor/clang/dist/lib/Lex/DependencyDirectivesSourceMinimizer.cpp vendor/clang/dist/lib/Lex/HeaderMap.cpp vendor/clang/dist/lib/Lex/HeaderSearch.cpp vendor/clang/dist/lib/Lex/Lexer.cpp vendor/clang/dist/lib/Lex/MacroArgs.cpp vendor/clang/dist/lib/Lex/ModuleMap.cpp vendor/clang/dist/lib/Lex/PPDirectives.cpp vendor/clang/dist/lib/Lex/PPLexerChange.cpp vendor/clang/dist/lib/Lex/PPMacroExpansion.cpp vendor/clang/dist/lib/Lex/Pragma.cpp vendor/clang/dist/lib/Lex/Preprocessor.cpp vendor/clang/dist/lib/Lex/TokenLexer.cpp vendor/clang/dist/lib/Lex/UnicodeCharSets.h vendor/clang/dist/lib/Parse/ParseCXXInlineMethods.cpp vendor/clang/dist/lib/Parse/ParseDecl.cpp vendor/clang/dist/lib/Parse/ParseDeclCXX.cpp vendor/clang/dist/lib/Parse/ParseExpr.cpp vendor/clang/dist/lib/Parse/ParseExprCXX.cpp vendor/clang/dist/lib/Parse/ParseInit.cpp vendor/clang/dist/lib/Parse/ParseObjc.cpp vendor/clang/dist/lib/Parse/ParseOpenMP.cpp vendor/clang/dist/lib/Parse/ParsePragma.cpp vendor/clang/dist/lib/Parse/ParseStmt.cpp vendor/clang/dist/lib/Parse/ParseTemplate.cpp vendor/clang/dist/lib/Parse/ParseTentative.cpp vendor/clang/dist/lib/Parse/Parser.cpp vendor/clang/dist/lib/Rewrite/Rewriter.cpp vendor/clang/dist/lib/Sema/AnalysisBasedWarnings.cpp vendor/clang/dist/lib/Sema/DeclSpec.cpp vendor/clang/dist/lib/Sema/OpenCLBuiltins.td vendor/clang/dist/lib/Sema/ParsedAttr.cpp vendor/clang/dist/lib/Sema/Sema.cpp vendor/clang/dist/lib/Sema/SemaAccess.cpp vendor/clang/dist/lib/Sema/SemaAttr.cpp vendor/clang/dist/lib/Sema/SemaCUDA.cpp vendor/clang/dist/lib/Sema/SemaCXXScopeSpec.cpp vendor/clang/dist/lib/Sema/SemaCast.cpp vendor/clang/dist/lib/Sema/SemaChecking.cpp vendor/clang/dist/lib/Sema/SemaCodeComplete.cpp vendor/clang/dist/lib/Sema/SemaCoroutine.cpp vendor/clang/dist/lib/Sema/SemaDecl.cpp vendor/clang/dist/lib/Sema/SemaDeclAttr.cpp vendor/clang/dist/lib/Sema/SemaDeclCXX.cpp vendor/clang/dist/lib/Sema/SemaDeclObjC.cpp vendor/clang/dist/lib/Sema/SemaExceptionSpec.cpp vendor/clang/dist/lib/Sema/SemaExpr.cpp vendor/clang/dist/lib/Sema/SemaExprCXX.cpp vendor/clang/dist/lib/Sema/SemaExprMember.cpp vendor/clang/dist/lib/Sema/SemaExprObjC.cpp vendor/clang/dist/lib/Sema/SemaInit.cpp vendor/clang/dist/lib/Sema/SemaLambda.cpp vendor/clang/dist/lib/Sema/SemaLookup.cpp vendor/clang/dist/lib/Sema/SemaModule.cpp vendor/clang/dist/lib/Sema/SemaObjCProperty.cpp vendor/clang/dist/lib/Sema/SemaOpenMP.cpp vendor/clang/dist/lib/Sema/SemaOverload.cpp vendor/clang/dist/lib/Sema/SemaStmt.cpp vendor/clang/dist/lib/Sema/SemaStmtAsm.cpp vendor/clang/dist/lib/Sema/SemaStmtAttr.cpp vendor/clang/dist/lib/Sema/SemaTemplate.cpp vendor/clang/dist/lib/Sema/SemaTemplateDeduction.cpp vendor/clang/dist/lib/Sema/SemaTemplateInstantiate.cpp vendor/clang/dist/lib/Sema/SemaTemplateInstantiateDecl.cpp vendor/clang/dist/lib/Sema/SemaTemplateVariadic.cpp vendor/clang/dist/lib/Sema/SemaType.cpp vendor/clang/dist/lib/Sema/TreeTransform.h vendor/clang/dist/lib/Sema/TypeLocBuilder.cpp vendor/clang/dist/lib/Sema/TypeLocBuilder.h vendor/clang/dist/lib/Serialization/ASTCommon.cpp vendor/clang/dist/lib/Serialization/ASTReader.cpp vendor/clang/dist/lib/Serialization/ASTReaderDecl.cpp vendor/clang/dist/lib/Serialization/ASTReaderStmt.cpp vendor/clang/dist/lib/Serialization/ASTWriter.cpp vendor/clang/dist/lib/Serialization/ASTWriterDecl.cpp vendor/clang/dist/lib/Serialization/ASTWriterStmt.cpp vendor/clang/dist/lib/Serialization/GlobalModuleIndex.cpp vendor/clang/dist/lib/Serialization/ModuleManager.cpp vendor/clang/dist/lib/Serialization/PCHContainerOperations.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/ArrayBoundChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/ArrayBoundCheckerV2.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/BlockInCriticalSectionChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/BoolAssignmentChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/CStringChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/CStringSyntaxChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/CallAndMessageChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/CastSizeChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/CastValueChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/CheckObjCDealloc.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/CheckObjCInstMethSignature.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/CheckSecuritySyntaxOnly.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/ChrootChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/CloneChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/ConversionChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/DeleteWithNonVirtualDtorChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/DereferenceChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/DivZeroChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/DynamicTypeChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/DynamicTypePropagation.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/EnumCastOutOfRangeChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/ExprInspectionChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/FixedAddressChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/GenericTaintChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/InnerPointerChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/IteratorChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/IvarInvalidationChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/LocalizationChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/MIGChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/MPI-Checker/MPIBugReporter.h vendor/clang/dist/lib/StaticAnalyzer/Checkers/MacOSKeychainAPIChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/MacOSXAPIChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/MallocChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/MallocSizeofChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/MmapWriteExecChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/MoveChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/NSAutoreleasePoolChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/NSErrorChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/NonNullParamChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/NullabilityChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/ObjCAtSyncChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/ObjCContainersChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/ObjCMissingSuperCallChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/ObjCSelfInitChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/ObjCSuperDeallocChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/ObjCUnusedIVarsChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/PaddingChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/PointerArithChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/PointerSubChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/PthreadLockChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountChecker.h vendor/clang/dist/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/RetainCountChecker/RetainCountDiagnostics.h vendor/clang/dist/lib/StaticAnalyzer/Checkers/ReturnPointerRangeChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/ReturnUndefChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/SimpleStreamChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/StackAddrEscapeChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/StreamChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/Taint.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/Taint.h vendor/clang/dist/lib/StaticAnalyzer/Checkers/TaintTesterChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/TestAfterDivZeroChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/UndefBranchChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/UndefCapturedBlockVarChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/UndefResultChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/UndefinedArraySubscriptChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/UndefinedAssignmentChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedObjectChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/UninitializedObject/UninitializedPointee.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/UnixAPIChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/VLASizeChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/ValistChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/VforkChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Checkers/VirtualCallChecker.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/AnalysisManager.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/AnalyzerOptions.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/BugReporter.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/BugReporterVisitors.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/CallEvent.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/Checker.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/CheckerHelpers.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/CheckerManager.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/CommonBugCategories.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/Environment.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/ExplodedGraph.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/ExprEngine.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/ExprEngineC.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/ExprEngineCXX.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/ExprEngineCallAndReturn.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/HTMLDiagnostics.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/LoopUnrolling.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/MemRegion.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/PlistDiagnostics.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/ProgramState.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/RangeConstraintManager.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/RegionStore.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/SMTConstraintManager.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/SarifDiagnostics.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/Store.cpp vendor/clang/dist/lib/StaticAnalyzer/Core/WorkList.cpp vendor/clang/dist/lib/StaticAnalyzer/Frontend/AnalysisConsumer.cpp vendor/clang/dist/lib/StaticAnalyzer/Frontend/CheckerRegistration.cpp vendor/clang/dist/lib/StaticAnalyzer/Frontend/CheckerRegistry.cpp vendor/clang/dist/lib/StaticAnalyzer/Frontend/FrontendActions.cpp vendor/clang/dist/lib/StaticAnalyzer/Frontend/ModelInjector.cpp vendor/clang/dist/lib/Tooling/ASTDiff/ASTDiff.cpp vendor/clang/dist/lib/Tooling/AllTUsExecution.cpp vendor/clang/dist/lib/Tooling/ArgumentsAdjusters.cpp vendor/clang/dist/lib/Tooling/CommonOptionsParser.cpp vendor/clang/dist/lib/Tooling/CompilationDatabase.cpp vendor/clang/dist/lib/Tooling/Core/Replacement.cpp vendor/clang/dist/lib/Tooling/DependencyScanning/DependencyScanningWorker.cpp vendor/clang/dist/lib/Tooling/GuessTargetAndModeCompilationDatabase.cpp vendor/clang/dist/lib/Tooling/Inclusions/HeaderIncludes.cpp vendor/clang/dist/lib/Tooling/Inclusions/IncludeStyle.cpp vendor/clang/dist/lib/Tooling/InterpolatingCompilationDatabase.cpp vendor/clang/dist/lib/Tooling/Refactoring.cpp vendor/clang/dist/lib/Tooling/Refactoring/ASTSelectionRequirements.cpp vendor/clang/dist/lib/Tooling/Refactoring/Extract/Extract.cpp vendor/clang/dist/lib/Tooling/Refactoring/Extract/SourceExtraction.cpp vendor/clang/dist/lib/Tooling/Refactoring/RefactoringActions.cpp vendor/clang/dist/lib/Tooling/Refactoring/Rename/RenamingAction.cpp vendor/clang/dist/lib/Tooling/Refactoring/Rename/SymbolOccurrences.cpp vendor/clang/dist/lib/Tooling/Refactoring/Rename/USRFindingAction.cpp vendor/clang/dist/lib/Tooling/RefactoringCallbacks.cpp vendor/clang/dist/lib/Tooling/StandaloneExecution.cpp vendor/clang/dist/lib/Tooling/Syntax/BuildTree.cpp vendor/clang/dist/lib/Tooling/Syntax/Tokens.cpp vendor/clang/dist/lib/Tooling/Tooling.cpp vendor/clang/dist/tools/clang-format/ClangFormat.cpp vendor/clang/dist/tools/driver/cc1_main.cpp vendor/clang/dist/tools/driver/cc1as_main.cpp vendor/clang/dist/tools/driver/driver.cpp vendor/clang/dist/utils/TableGen/ClangASTNodesEmitter.cpp vendor/clang/dist/utils/TableGen/ClangAttrEmitter.cpp vendor/clang/dist/utils/TableGen/ClangCommentCommandInfoEmitter.cpp vendor/clang/dist/utils/TableGen/ClangCommentHTMLNamedCharacterReferenceEmitter.cpp vendor/clang/dist/utils/TableGen/ClangDataCollectorsEmitter.cpp vendor/clang/dist/utils/TableGen/ClangDiagnosticsEmitter.cpp vendor/clang/dist/utils/TableGen/ClangOpenCLBuiltinEmitter.cpp vendor/clang/dist/utils/TableGen/ClangOptionDocEmitter.cpp vendor/clang/dist/utils/TableGen/ClangSACheckersEmitter.cpp vendor/clang/dist/utils/TableGen/NeonEmitter.cpp vendor/clang/dist/utils/TableGen/TableGen.cpp vendor/clang/dist/utils/TableGen/TableGenBackends.h Added: vendor/clang/dist/include/clang-c/FatalErrorHandler.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/include/clang-c/FatalErrorHandler.h Wed Oct 23 17:52:09 2019 (r353942) @@ -0,0 +1,33 @@ +/*===-- clang-c/FatalErrorHandler.h - Fatal Error Handling --------*- C -*-===*\ +|* *| +|* Part of the LLVM Project, under the Apache License v2.0 with LLVM *| +|* Exceptions. *| +|* See https://llvm.org/LICENSE.txt for license information. *| +|* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception *| +|* *| +\*===----------------------------------------------------------------------===*/ + +#ifndef LLVM_CLANG_C_FATAL_ERROR_HANDLER_H +#define LLVM_CLANG_C_FATAL_ERROR_HANDLER_H + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * Installs error handler that prints error message to stderr and calls abort(). + * Replaces currently installed error handler (if any). + */ +void clang_install_aborting_llvm_fatal_error_handler(void); + +/** + * Removes currently installed error handler (if any). + * If no error handler is intalled, the default strategy is to print error + * message to stderr and call exit(1). + */ +void clang_uninstall_llvm_fatal_error_handler(void); + +#ifdef __cplusplus +} +#endif +#endif Modified: vendor/clang/dist/include/clang-c/Index.h ============================================================================== --- vendor/clang/dist/include/clang-c/Index.h Wed Oct 23 17:51:52 2019 (r353941) +++ vendor/clang/dist/include/clang-c/Index.h Wed Oct 23 17:52:09 2019 (r353942) @@ -1356,7 +1356,12 @@ enum CXTranslationUnit_Flags { * the case where these warnings are not of interest, as for an IDE for * example, which typically shows only the diagnostics in the main file. */ - CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 0x4000 + CXTranslationUnit_IgnoreNonErrorsFromIncludedFiles = 0x4000, + + /** + * Tells the preprocessor not to skip excluded conditional blocks. + */ + CXTranslationUnit_RetainExcludedConditionalBlocks = 0x8000 }; /** @@ -2550,7 +2555,20 @@ enum CXCursorKind { */ CXCursor_BuiltinBitCastExpr = 280, - CXCursor_LastStmt = CXCursor_BuiltinBitCastExpr, + /** OpenMP master taskloop directive. + */ + CXCursor_OMPMasterTaskLoopDirective = 281, + + /** OpenMP parallel master taskloop directive. + */ + CXCursor_OMPParallelMasterTaskLoopDirective = 282, + + /** OpenMP master taskloop simd directive. + */ + CXCursor_OMPMasterTaskLoopSimdDirective = 283, + + + CXCursor_LastStmt = CXCursor_OMPMasterTaskLoopSimdDirective, /** * Cursor that represents the translation unit itself. Modified: vendor/clang/dist/include/clang/AST/APValue.h ============================================================================== --- vendor/clang/dist/include/clang/AST/APValue.h Wed Oct 23 17:51:52 2019 (r353941) +++ vendor/clang/dist/include/clang/AST/APValue.h Wed Oct 23 17:52:09 2019 (r353942) @@ -53,6 +53,34 @@ class TypeInfoLValue { (public) void print(llvm::raw_ostream &Out, const PrintingPolicy &Policy) const; }; + +/// Symbolic representation of a dynamic allocation. +class DynamicAllocLValue { + unsigned Index; + +public: + DynamicAllocLValue() : Index(0) {} + explicit DynamicAllocLValue(unsigned Index) : Index(Index + 1) {} + unsigned getIndex() { return Index - 1; } + + explicit operator bool() const { return Index != 0; } + + void *getOpaqueValue() { + return reinterpret_cast(static_cast(Index) + << NumLowBitsAvailable); + } + static DynamicAllocLValue getFromOpaqueValue(void *Value) { + DynamicAllocLValue V; + V.Index = reinterpret_cast(Value) >> NumLowBitsAvailable; + return V; + } + + static unsigned getMaxIndex() { + return (std::numeric_limits::max() >> NumLowBitsAvailable) - 1; + } + + static constexpr int NumLowBitsAvailable = 3; +}; } namespace llvm { @@ -67,6 +95,17 @@ template<> struct PointerLikeTypeTraits struct PointerLikeTypeTraits { + static void *getAsVoidPointer(clang::DynamicAllocLValue V) { + return V.getOpaqueValue(); + } + static clang::DynamicAllocLValue getFromVoidPointer(void *P) { + return clang::DynamicAllocLValue::getFromOpaqueValue(P); + } + static constexpr int NumLowBitsAvailable = + clang::DynamicAllocLValue::NumLowBitsAvailable; +}; } namespace clang { @@ -97,13 +136,15 @@ class APValue { (public) }; class LValueBase { - typedef llvm::PointerUnion + typedef llvm::PointerUnion PtrTy; public: LValueBase() : Local{} {} LValueBase(const ValueDecl *P, unsigned I = 0, unsigned V = 0); LValueBase(const Expr *P, unsigned I = 0, unsigned V = 0); + static LValueBase getDynamicAlloc(DynamicAllocLValue LV, QualType Type); static LValueBase getTypeInfo(TypeInfoLValue LV, QualType TypeInfo); template @@ -124,6 +165,7 @@ class APValue { (public) unsigned getCallIndex() const; unsigned getVersion() const; QualType getTypeInfoType() const; + QualType getDynamicAllocType() const; friend bool operator==(const LValueBase &LHS, const LValueBase &RHS); friend bool operator!=(const LValueBase &LHS, const LValueBase &RHS) { @@ -140,6 +182,8 @@ class APValue { (public) LocalState Local; /// The type std::type_info, if this is a TypeInfoLValue. void *TypeInfoType; + /// The QualType, if this is a DynamicAllocLValue. + void *DynamicAllocType; }; }; Modified: vendor/clang/dist/include/clang/AST/ASTContext.h ============================================================================== --- vendor/clang/dist/include/clang/AST/ASTContext.h Wed Oct 23 17:51:52 2019 (r353941) +++ vendor/clang/dist/include/clang/AST/ASTContext.h Wed Oct 23 17:52:09 2019 (r353942) @@ -139,6 +139,12 @@ class FullComment; } // namespace comments +namespace interp { + +class Context; + +} // namespace interp + struct TypeInfo { uint64_t Width = 0; unsigned Align = 0; @@ -179,7 +185,8 @@ class ASTContext : public RefCountedBase { mutable llvm::FoldingSet LValueReferenceTypes; mutable llvm::FoldingSet RValueReferenceTypes; mutable llvm::FoldingSet MemberPointerTypes; - mutable llvm::FoldingSet ConstantArrayTypes; + mutable llvm::ContextualFoldingSet + ConstantArrayTypes; mutable llvm::FoldingSet IncompleteArrayTypes; mutable std::vector VariableArrayTypes; mutable llvm::FoldingSet DependentSizedArrayTypes; @@ -507,6 +514,8 @@ class ASTContext : public RefCountedBase { /// need to be consistently numbered for the mangler). llvm::DenseMap> MangleNumberingContexts; + llvm::DenseMap> + ExtraMangleNumberingContexts; /// Side-table of mangling numbers for declarations which rarely /// need them (like static local vars). @@ -564,6 +573,7 @@ class ASTContext : public RefCountedBase { const TargetInfo *Target = nullptr; const TargetInfo *AuxTarget = nullptr; clang::PrintingPolicy PrintingPolicy; + std::unique_ptr InterpContext; public: IdentifierTable &Idents; @@ -573,6 +583,9 @@ class ASTContext : public RefCountedBase { IntrusiveRefCntPtr ExternalSource; ASTMutationListener *Listener = nullptr; + /// Returns the clang bytecode interpreter context. + interp::Context &getInterpContext(); + /// Container for either a single DynTypedNode or for an ArrayRef to /// DynTypedNode. For use with ParentMap. class DynTypedNodeList { @@ -729,71 +742,49 @@ class ASTContext : public RefCountedBase { /// True if comments are already loaded from ExternalASTSource. mutable bool CommentsLoaded = false; - class RawCommentAndCacheFlags { - public: - enum Kind { - /// We searched for a comment attached to the particular declaration, but - /// didn't find any. - /// - /// getRaw() == 0. - NoCommentInDecl = 0, + /// Mapping from declaration to directly attached comment. + /// + /// Raw comments are owned by Comments list. This mapping is populated + /// lazily. + mutable llvm::DenseMap DeclRawComments; - /// We have found a comment attached to this particular declaration. - /// - /// getRaw() != 0. - FromDecl, - - /// This declaration does not have an attached comment, and we have - /// searched the redeclaration chain. - /// - /// If getRaw() == 0, the whole redeclaration chain does not have any - /// comments. - /// - /// If getRaw() != 0, it is a comment propagated from other - /// redeclaration. - FromRedecl - }; - - Kind getKind() const LLVM_READONLY { - return Data.getInt(); - } - - void setKind(Kind K) { - Data.setInt(K); - } - - const RawComment *getRaw() const LLVM_READONLY { - return Data.getPointer(); - } - - void setRaw(const RawComment *RC) { - Data.setPointer(RC); - } - - const Decl *getOriginalDecl() const LLVM_READONLY { - return OriginalDecl; - } - - void setOriginalDecl(const Decl *Orig) { - OriginalDecl = Orig; - } - - private: - llvm::PointerIntPair Data; - const Decl *OriginalDecl; - }; - - /// Mapping from declarations to comments attached to any - /// redeclaration. + /// Mapping from canonical declaration to the first redeclaration in chain + /// that has a comment attached. /// /// Raw comments are owned by Comments list. This mapping is populated /// lazily. - mutable llvm::DenseMap RedeclComments; + mutable llvm::DenseMap RedeclChainComments; + /// Keeps track of redeclaration chains that don't have any comment attached. + /// Mapping from canonical declaration to redeclaration chain that has no + /// comments attached to any redeclaration. Specifically it's mapping to + /// the last redeclaration we've checked. + /// + /// Shall not contain declarations that have comments attached to any + /// redeclaration in their chain. + mutable llvm::DenseMap CommentlessRedeclChains; + /// Mapping from declarations to parsed comments attached to any /// redeclaration. mutable llvm::DenseMap ParsedComments; + /// Attaches \p Comment to \p OriginalD and to its redeclaration chain + /// and removes the redeclaration chain from the set of commentless chains. + /// + /// Don't do anything if a comment has already been attached to \p OriginalD + /// or its redeclaration chain. + void cacheRawCommentForDecl(const Decl &OriginalD, + const RawComment &Comment) const; + + /// \returns searches \p CommentsInFile for doc comment for \p D. + /// + /// \p RepresentativeLocForDecl is used as a location for searching doc + /// comments. \p CommentsInFile is a mapping offset -> comment of files in the + /// same file where \p RepresentativeLocForDecl is. + RawComment *getRawCommentForDeclNoCacheImpl( + const Decl *D, const SourceLocation RepresentativeLocForDecl, + const std::map &CommentsInFile) const; + /// Return the documentation comment attached to a given declaration, /// without looking into cache. RawComment *getRawCommentForDeclNoCache(const Decl *D) const; @@ -818,6 +809,16 @@ class ASTContext : public RefCountedBase { getRawCommentForAnyRedecl(const Decl *D, const Decl **OriginalDecl = nullptr) const; + /// Searches existing comments for doc comments that should be attached to \p + /// Decls. If any doc comment is found, it is parsed. + /// + /// Requirement: All \p Decls are in the same file. + /// + /// If the last comment in the file is already attached we assume + /// there are not comments left to be attached to \p Decls. + void attachCommentsToJustParsedDecls(ArrayRef Decls, + const Preprocessor *PP); + /// Return parsed documentation comment attached to a given declaration. /// Returns nullptr if no comment is attached. /// @@ -1054,6 +1055,9 @@ class ASTContext : public RefCountedBase { #define EXT_OPAQUE_TYPE(ExtType, Id, Ext) \ CanQualType Id##Ty; #include "clang/Basic/OpenCLExtensionTypes.def" +#define SVE_TYPE(Name, Id, SingletonId) \ + CanQualType SingletonId; +#include "clang/Basic/AArch64SVEACLETypes.def" // Types for deductions in C++0x [stmt.ranged]'s desugaring. Built on demand. mutable QualType AutoDeductTy; // Deduction against 'auto'. @@ -1329,6 +1333,7 @@ class ASTContext : public RefCountedBase { /// Return the unique reference to the type for a constant array of /// the specified element type. QualType getConstantArrayType(QualType EltTy, const llvm::APInt &ArySize, + const Expr *SizeExpr, ArrayType::ArraySizeModifier ASM, unsigned IndexTypeQuals) const; @@ -1498,8 +1503,7 @@ class ASTContext : public RefCountedBase { bool isKindOf) const; QualType getObjCTypeParamType(const ObjCTypeParamDecl *Decl, - ArrayRef protocols, - QualType Canonical = QualType()) const; + ArrayRef protocols) const; bool ObjCObjectAdoptsQTypeProtocols(QualType QT, ObjCInterfaceDecl *Decl); @@ -2054,6 +2058,11 @@ class ASTContext : public RefCountedBase { /// types. bool areCompatibleVectorTypes(QualType FirstVec, QualType SecondVec); + /// Return true if the type has been explicitly qualified with ObjC ownership. + /// A type may be implicitly qualified with ownership under ObjC ARC, and in + /// some cases the compiler treats these differently. + bool hasDirectOwnershipQualifier(QualType Ty) const; + /// Return true if this is an \c NSObject object with its \c NSObject /// attribute set. static bool isObjCNSObjectType(QualType Ty) { @@ -2577,10 +2586,12 @@ class ASTContext : public RefCountedBase { return T == getObjCSelType(); } - bool ObjCQualifiedIdTypesAreCompatible(QualType LHS, QualType RHS, + bool ObjCQualifiedIdTypesAreCompatible(const ObjCObjectPointerType *LHS, + const ObjCObjectPointerType *RHS, bool ForCompare); - bool ObjCQualifiedClassTypesAreCompatible(QualType LHS, QualType RHS); + bool ObjCQualifiedClassTypesAreCompatible(const ObjCObjectPointerType *LHS, + const ObjCObjectPointerType *RHS); // Check the safety of assignment from LHS to RHS bool canAssignObjCInterfaces(const ObjCObjectPointerType *LHSOPT, @@ -2802,6 +2813,9 @@ class ASTContext : public RefCountedBase { /// Retrieve the context for computing mangling numbers in the given /// DeclContext. MangleNumberingContext &getManglingNumberContext(const DeclContext *DC); + enum NeedExtraManglingDecl_t { NeedExtraManglingDecl }; + MangleNumberingContext &getManglingNumberContext(NeedExtraManglingDecl_t, + const Decl *D); std::unique_ptr createMangleNumberingContext() const; Modified: vendor/clang/dist/include/clang/AST/ASTFwd.h ============================================================================== --- vendor/clang/dist/include/clang/AST/ASTFwd.h Wed Oct 23 17:51:52 2019 (r353941) +++ vendor/clang/dist/include/clang/AST/ASTFwd.h Wed Oct 23 17:52:09 2019 (r353942) @@ -24,7 +24,7 @@ class Stmt; #include "clang/AST/StmtNodes.inc" class Type; #define TYPE(DERIVED, BASE) class DERIVED##Type; -#include "clang/AST/TypeNodes.def" +#include "clang/AST/TypeNodes.inc" class CXXCtorInitializer; } // end namespace clang Modified: vendor/clang/dist/include/clang/AST/ASTImporter.h ============================================================================== --- vendor/clang/dist/include/clang/AST/ASTImporter.h Wed Oct 23 17:51:52 2019 (r353941) +++ vendor/clang/dist/include/clang/AST/ASTImporter.h Wed Oct 23 17:52:09 2019 (r353942) @@ -87,7 +87,11 @@ class TypeSourceInfo; using NonEquivalentDeclSet = llvm::DenseSet>; using ImportedCXXBaseSpecifierMap = llvm::DenseMap; + using FileIDImportHandlerType = + std::function; + enum class ODRHandlingType { Conservative, Liberal }; + // An ImportPath is the list of the AST nodes which we visit during an // Import call. // If node `A` depends on node `B` then the path contains an `A`->`B` edge. @@ -210,6 +214,8 @@ class TypeSourceInfo; }; private: + FileIDImportHandlerType FileIDImportHandler; + std::shared_ptr SharedState = nullptr; /// The path which we go through during the import of a given AST node. @@ -232,6 +238,8 @@ class TypeSourceInfo; /// Whether to perform a minimal import. bool Minimal; + ODRHandlingType ODRHandling; + /// Whether the last diagnostic came from the "from" context. bool LastDiagFromFrom = false; @@ -310,10 +318,20 @@ class TypeSourceInfo; virtual ~ASTImporter(); + /// Set a callback function for FileID import handling. + /// The function is invoked when a FileID is imported from the From context. + /// The imported FileID in the To context and the original FileID in the + /// From context is passed to it. + void setFileIDImportHandler(FileIDImportHandlerType H) { + FileIDImportHandler = H; + } + /// Whether the importer will perform a minimal import, creating /// to-be-completed forward declarations when possible. bool isMinimalImport() const { return Minimal; } + void setODRHandling(ODRHandlingType T) { ODRHandling = T; } + /// \brief Import the given object, returns the result. /// /// \param To Import the object into this variable. @@ -366,6 +384,20 @@ class TypeSourceInfo; /// imported. If it does not exist nullptr is returned. TranslationUnitDecl *GetFromTU(Decl *ToD); + /// Return the declaration in the "from" context from which the declaration + /// in the "to" context was imported. If it was not imported or of the wrong + /// type a null value is returned. + template + llvm::Optional getImportedFromDecl(const DeclT *ToD) const { + auto FromI = ImportedFromDecls.find(ToD); + if (FromI == ImportedFromDecls.end()) + return {}; + auto *FromD = dyn_cast(FromI->second); + if (!FromD) + return {}; + return FromD; + } + /// Import the given declaration context from the "from" /// AST context into the "to" AST context. /// @@ -491,12 +523,11 @@ class TypeSourceInfo; /// /// \param NumDecls the number of conflicting declarations in \p Decls. /// - /// \returns the name that the newly-imported declaration should have. - virtual DeclarationName HandleNameConflict(DeclarationName Name, - DeclContext *DC, - unsigned IDNS, - NamedDecl **Decls, - unsigned NumDecls); + /// \returns the name that the newly-imported declaration should have. Or + /// an error if we can't handle the name conflict. + virtual Expected + HandleNameConflict(DeclarationName Name, DeclContext *DC, unsigned IDNS, + NamedDecl **Decls, unsigned NumDecls); /// Retrieve the context that AST nodes are being imported into. ASTContext &getToContext() const { return ToContext; } Modified: vendor/clang/dist/include/clang/AST/ASTImporterSharedState.h ============================================================================== --- vendor/clang/dist/include/clang/AST/ASTImporterSharedState.h Wed Oct 23 17:51:52 2019 (r353941) +++ vendor/clang/dist/include/clang/AST/ASTImporterSharedState.h Wed Oct 23 17:52:09 2019 (r353942) @@ -47,7 +47,7 @@ class ASTImporterSharedState { (public) ASTImporterSharedState() = default; ASTImporterSharedState(TranslationUnitDecl &ToTU) { - LookupTable = llvm::make_unique(ToTU); + LookupTable = std::make_unique(ToTU); } ASTImporterLookupTable *getLookupTable() { return LookupTable.get(); } Modified: vendor/clang/dist/include/clang/AST/ASTNodeTraverser.h ============================================================================== --- vendor/clang/dist/include/clang/AST/ASTNodeTraverser.h Wed Oct 23 17:51:52 2019 (r353941) +++ vendor/clang/dist/include/clang/AST/ASTNodeTraverser.h Wed Oct 23 17:52:09 2019 (r353942) @@ -237,6 +237,9 @@ class ASTNodeTraverser (public) for (const auto &TP : *TPL) Visit(TP); + + if (const Expr *RC = TPL->getRequiresClause()) + Visit(RC); } void Modified: vendor/clang/dist/include/clang/AST/ASTStructuralEquivalence.h ============================================================================== --- vendor/clang/dist/include/clang/AST/ASTStructuralEquivalence.h Wed Oct 23 17:51:52 2019 (r353941) +++ vendor/clang/dist/include/clang/AST/ASTStructuralEquivalence.h Wed Oct 23 17:52:09 2019 (r353942) @@ -18,7 +18,7 @@ #include "llvm/ADT/DenseMap.h" #include "llvm/ADT/DenseSet.h" #include "llvm/ADT/Optional.h" -#include +#include #include namespace clang { @@ -42,14 +42,13 @@ struct StructuralEquivalenceContext { /// AST contexts for which we are checking structural equivalence. ASTContext &FromCtx, &ToCtx; - /// The set of "tentative" equivalences between two canonical - /// declarations, mapping from a declaration in the first context to the - /// declaration in the second context that we believe to be equivalent. - llvm::DenseMap TentativeEquivalences; + // Queue of from-to Decl pairs that are to be checked to determine the final + // result of equivalence of a starting Decl pair. + std::queue> DeclsToCheck; - /// Queue of declarations in the first context whose equivalence - /// with a declaration in the second context still needs to be verified. - std::deque DeclsToCheck; + // Set of from-to Decl pairs that are already visited during the check + // (are in or were once in \c DeclsToCheck) of a starting Decl pair. + llvm::DenseSet> VisitedDecls; /// Declaration (from, to) pairs that are known not to be equivalent /// (which we have already complained about). @@ -88,14 +87,14 @@ struct StructuralEquivalenceContext { /// Implementation functions (all static functions in /// ASTStructuralEquivalence.cpp) must never call this function because that /// will wreak havoc the internal state (\c DeclsToCheck and - /// \c TentativeEquivalences members) and can cause faulty equivalent results. + /// \c VisitedDecls members) and can cause faulty equivalent results. bool IsEquivalent(Decl *D1, Decl *D2); /// Determine whether the two types are structurally equivalent. /// Implementation functions (all static functions in /// ASTStructuralEquivalence.cpp) must never call this function because that /// will wreak havoc the internal state (\c DeclsToCheck and - /// \c TentativeEquivalences members) and can cause faulty equivalent results. + /// \c VisitedDecls members) and can cause faulty equivalent results. bool IsEquivalent(QualType T1, QualType T2); /// Find the index of the given anonymous struct/union within its Modified: vendor/clang/dist/include/clang/AST/ASTTypeTraits.h ============================================================================== --- vendor/clang/dist/include/clang/AST/ASTTypeTraits.h Wed Oct 23 17:51:52 2019 (r353941) +++ vendor/clang/dist/include/clang/AST/ASTTypeTraits.h Wed Oct 23 17:52:09 2019 (r353942) @@ -148,7 +148,7 @@ class ASTNodeKind { (private) #include "clang/AST/StmtNodes.inc" NKI_Type, #define TYPE(DERIVED, BASE) NKI_##DERIVED##Type, -#include "clang/AST/TypeNodes.def" +#include "clang/AST/TypeNodes.inc" NKI_OMPClause, #define OPENMP_CLAUSE(TextualSpelling, Class) NKI_##Class, #include "clang/Basic/OpenMPKinds.def" @@ -205,7 +205,7 @@ KIND_TO_KIND_ID(OMPClause) #define STMT(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED) #include "clang/AST/StmtNodes.inc" #define TYPE(DERIVED, BASE) KIND_TO_KIND_ID(DERIVED##Type) -#include "clang/AST/TypeNodes.def" +#include "clang/AST/TypeNodes.inc" #define OPENMP_CLAUSE(TextualSpelling, Class) KIND_TO_KIND_ID(Class) #include "clang/Basic/OpenMPKinds.def" #undef KIND_TO_KIND_ID Modified: vendor/clang/dist/include/clang/AST/Attr.h ============================================================================== --- vendor/clang/dist/include/clang/AST/Attr.h Wed Oct 23 17:51:52 2019 (r353941) +++ vendor/clang/dist/include/clang/AST/Attr.h Wed Oct 23 17:52:09 2019 (r353942) @@ -19,6 +19,7 @@ #include "clang/AST/Expr.h" #include "clang/AST/Type.h" #include "clang/Basic/AttrKinds.h" +#include "clang/Basic/AttributeCommonInfo.h" #include "clang/Basic/LLVM.h" #include "clang/Basic/OpenMPKinds.h" #include "clang/Basic/Sanitizers.h" @@ -32,6 +33,7 @@ namespace clang { class ASTContext; + class AttributeCommonInfo; class IdentifierInfo; class ObjCInterfaceDecl; class Expr; @@ -40,84 +42,79 @@ namespace clang { class TypeSourceInfo; /// Attr - This represents one attribute. -class Attr { -private: - SourceRange Range; - unsigned AttrKind : 16; + class Attr : public AttributeCommonInfo { + private: + unsigned AttrKind : 16; -protected: - /// An index into the spelling list of an - /// attribute defined in Attr.td file. - unsigned SpellingListIndex : 4; - unsigned Inherited : 1; - unsigned IsPackExpansion : 1; - unsigned Implicit : 1; - // FIXME: These are properties of the attribute kind, not state for this - // instance of the attribute. - unsigned IsLateParsed : 1; - unsigned InheritEvenIfAlreadyPresent : 1; + protected: + /// An index into the spelling list of an + /// attribute defined in Attr.td file. + unsigned Inherited : 1; + unsigned IsPackExpansion : 1; + unsigned Implicit : 1; + // FIXME: These are properties of the attribute kind, not state for this + // instance of the attribute. + unsigned IsLateParsed : 1; + unsigned InheritEvenIfAlreadyPresent : 1; - void *operator new(size_t bytes) noexcept { - llvm_unreachable("Attrs cannot be allocated with regular 'new'."); - } - void operator delete(void *data) noexcept { - llvm_unreachable("Attrs cannot be released with regular 'delete'."); - } + void *operator new(size_t bytes) noexcept { + llvm_unreachable("Attrs cannot be allocated with regular 'new'."); + } + void operator delete(void *data) noexcept { + llvm_unreachable("Attrs cannot be released with regular 'delete'."); + } -public: - // Forward so that the regular new and delete do not hide global ones. - void *operator new(size_t Bytes, ASTContext &C, - size_t Alignment = 8) noexcept { - return ::operator new(Bytes, C, Alignment); - } - void operator delete(void *Ptr, ASTContext &C, size_t Alignment) noexcept { - return ::operator delete(Ptr, C, Alignment); - } + public: + // Forward so that the regular new and delete do not hide global ones. + void *operator new(size_t Bytes, ASTContext &C, + size_t Alignment = 8) noexcept { + return ::operator new(Bytes, C, Alignment); + } + void operator delete(void *Ptr, ASTContext &C, size_t Alignment) noexcept { + return ::operator delete(Ptr, C, Alignment); + } -protected: - Attr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex, - bool IsLateParsed) - : Range(R), AttrKind(AK), SpellingListIndex(SpellingListIndex), - Inherited(false), IsPackExpansion(false), Implicit(false), - IsLateParsed(IsLateParsed), InheritEvenIfAlreadyPresent(false) {} + protected: + Attr(ASTContext &Context, const AttributeCommonInfo &CommonInfo, + attr::Kind AK, bool IsLateParsed) + : AttributeCommonInfo(CommonInfo), AttrKind(AK), Inherited(false), + IsPackExpansion(false), Implicit(false), IsLateParsed(IsLateParsed), + InheritEvenIfAlreadyPresent(false) {} -public: + public: + attr::Kind getKind() const { return static_cast(AttrKind); } - attr::Kind getKind() const { - return static_cast(AttrKind); - } + unsigned getSpellingListIndex() const { + return getAttributeSpellingListIndex(); + } + const char *getSpelling() const; - unsigned getSpellingListIndex() const { return SpellingListIndex; } - const char *getSpelling() const; + SourceLocation getLocation() const { return getRange().getBegin(); } - SourceLocation getLocation() const { return Range.getBegin(); } - SourceRange getRange() const { return Range; } - void setRange(SourceRange R) { Range = R; } + bool isInherited() const { return Inherited; } - bool isInherited() const { return Inherited; } + /// Returns true if the attribute has been implicitly created instead + /// of explicitly written by the user. + bool isImplicit() const { return Implicit; } + void setImplicit(bool I) { Implicit = I; } - /// Returns true if the attribute has been implicitly created instead - /// of explicitly written by the user. - bool isImplicit() const { return Implicit; } - void setImplicit(bool I) { Implicit = I; } + void setPackExpansion(bool PE) { IsPackExpansion = PE; } + bool isPackExpansion() const { return IsPackExpansion; } - void setPackExpansion(bool PE) { IsPackExpansion = PE; } - bool isPackExpansion() const { return IsPackExpansion; } + // Clone this attribute. + Attr *clone(ASTContext &C) const; - // Clone this attribute. - Attr *clone(ASTContext &C) const; + bool isLateParsed() const { return IsLateParsed; } - bool isLateParsed() const { return IsLateParsed; } + // Pretty print this attribute. + void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const; + }; - // Pretty print this attribute. - void printPretty(raw_ostream &OS, const PrintingPolicy &Policy) const; -}; - class TypeAttr : public Attr { protected: - TypeAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex, - bool IsLateParsed) - : Attr(AK, R, SpellingListIndex, IsLateParsed) {} + TypeAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo, + attr::Kind AK, bool IsLateParsed) + : Attr(Context, CommonInfo, AK, IsLateParsed) {} public: static bool classof(const Attr *A) { @@ -128,9 +125,9 @@ class TypeAttr : public Attr { (public) class StmtAttr : public Attr { protected: - StmtAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex, - bool IsLateParsed) - : Attr(AK, R, SpellingListIndex, IsLateParsed) {} + StmtAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo, + attr::Kind AK, bool IsLateParsed) + : Attr(Context, CommonInfo, AK, IsLateParsed) {} public: static bool classof(const Attr *A) { @@ -141,9 +138,10 @@ class StmtAttr : public Attr { (public) class InheritableAttr : public Attr { protected: - InheritableAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex, - bool IsLateParsed, bool InheritEvenIfAlreadyPresent) - : Attr(AK, R, SpellingListIndex, IsLateParsed) { + InheritableAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo, + attr::Kind AK, bool IsLateParsed, + bool InheritEvenIfAlreadyPresent) + : Attr(Context, CommonInfo, AK, IsLateParsed) { this->InheritEvenIfAlreadyPresent = InheritEvenIfAlreadyPresent; } @@ -165,9 +163,10 @@ class InheritableAttr : public Attr { (public) class InheritableParamAttr : public InheritableAttr { protected: - InheritableParamAttr(attr::Kind AK, SourceRange R, unsigned SpellingListIndex, + InheritableParamAttr(ASTContext &Context, + const AttributeCommonInfo &CommonInfo, attr::Kind AK, bool IsLateParsed, bool InheritEvenIfAlreadyPresent) - : InheritableAttr(AK, R, SpellingListIndex, IsLateParsed, + : InheritableAttr(Context, CommonInfo, AK, IsLateParsed, InheritEvenIfAlreadyPresent) {} public: @@ -182,11 +181,11 @@ class InheritableParamAttr : public InheritableAttr { /// for the parameter. class ParameterABIAttr : public InheritableParamAttr { protected: - ParameterABIAttr(attr::Kind AK, SourceRange R, - unsigned SpellingListIndex, bool IsLateParsed, + ParameterABIAttr(ASTContext &Context, const AttributeCommonInfo &CommonInfo, + attr::Kind AK, bool IsLateParsed, bool InheritEvenIfAlreadyPresent) - : InheritableParamAttr(AK, R, SpellingListIndex, IsLateParsed, - InheritEvenIfAlreadyPresent) {} + : InheritableParamAttr(Context, CommonInfo, AK, IsLateParsed, + InheritEvenIfAlreadyPresent) {} public: ParameterABI getABI() const { Added: vendor/clang/dist/include/clang/AST/CXXRecordDeclDefinitionBits.def ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/clang/dist/include/clang/AST/CXXRecordDeclDefinitionBits.def Wed Oct 23 17:52:09 2019 (r353942) @@ -0,0 +1,236 @@ +//===-- CXXRecordDeclDefinitionBits.def - Class definition bits -*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file enumerates the various bitfields that we want to store on C++ class +// definitions. +// +//===----------------------------------------------------------------------===// +// +/// @file CXXRecordDeclDefinitionBits.def +/// +/// In this file, each of the bitfields representing data about a C++ class +/// results in an expansion of the FIELD macro, which should be defined before +/// including this file. +/// +/// The macro have three operands: +/// +/// Name: The name of the field, as a member of CXXRecordDecl::DefinitionData. +/// +/// BitWidth: The width of the field in bits. +/// +/// MergePolicy: How to behave when the value of the field is different in +/// multiple translation units, one of: +/// NO_MERGE: It is an ODR violation if the fields do not match. +/// MERGE_OR: Merge the fields by ORing them together. + +#ifndef FIELD +#error define FIELD before including this file +#endif + +/// True if this class has any user-declared constructors. +FIELD(UserDeclaredConstructor, 1, NO_MERGE) + +/// The user-declared special members which this class has. +FIELD(UserDeclaredSpecialMembers, 6, NO_MERGE) + +/// True when this class is an aggregate. +FIELD(Aggregate, 1, NO_MERGE) + +/// True when this class is a POD-type. +FIELD(PlainOldData, 1, NO_MERGE) + +/// True when this class is empty for traits purposes, that is: +/// * has no data members other than 0-width bit-fields and empty fields +/// marked [[no_unique_address]] +/// * has no virtual function/base, and +/// * doesn't inherit from a non-empty class. +/// Doesn't take union-ness into account. +FIELD(Empty, 1, NO_MERGE) + +/// True when this class is polymorphic, i.e., has at +/// least one virtual member or derives from a polymorphic class. +FIELD(Polymorphic, 1, NO_MERGE) + +/// True when this class is abstract, i.e., has at least +/// one pure virtual function, (that can come from a base class). +FIELD(Abstract, 1, NO_MERGE) + +/// True when this class is standard-layout, per the applicable +/// language rules (including DRs). +FIELD(IsStandardLayout, 1, NO_MERGE) + +/// True when this class was standard-layout under the C++11 +/// definition. +/// +/// C++11 [class]p7. A standard-layout class is a class that: +/// * has no non-static data members of type non-standard-layout class (or +/// array of such types) or reference, +/// * has no virtual functions (10.3) and no virtual base classes (10.1), +/// * has the same access control (Clause 11) for all non-static data +/// members +/// * has no non-standard-layout base classes, +/// * either has no non-static data members in the most derived class and at +/// most one base class with non-static data members, or has no base +/// classes with non-static data members, and +/// * has no base classes of the same type as the first non-static data +/// member. +FIELD(IsCXX11StandardLayout, 1, NO_MERGE) + +/// True when any base class has any declared non-static data +/// members or bit-fields. +/// This is a helper bit of state used to implement IsStandardLayout more +/// efficiently. +FIELD(HasBasesWithFields, 1, NO_MERGE) + +/// True when any base class has any declared non-static data +/// members. +/// This is a helper bit of state used to implement IsCXX11StandardLayout +/// more efficiently. +FIELD(HasBasesWithNonStaticDataMembers, 1, NO_MERGE) + +/// True when there are private non-static data members. +FIELD(HasPrivateFields, 1, NO_MERGE) + +/// True when there are protected non-static data members. +FIELD(HasProtectedFields, 1, NO_MERGE) + +/// True when there are private non-static data members. +FIELD(HasPublicFields, 1, NO_MERGE) + +/// True if this class (or any subobject) has mutable fields. +FIELD(HasMutableFields, 1, NO_MERGE) + +/// True if this class (or any nested anonymous struct or union) +/// has variant members. +FIELD(HasVariantMembers, 1, NO_MERGE) + +/// True if there no non-field members declared by the user. +FIELD(HasOnlyCMembers, 1, NO_MERGE) + +/// True if any field has an in-class initializer, including those +/// within anonymous unions or structs. +FIELD(HasInClassInitializer, 1, NO_MERGE) + +/// True if any field is of reference type, and does not have an +/// in-class initializer. +/// +/// In this case, value-initialization of this class is illegal in C++98 +/// even if the class has a trivial default constructor. +FIELD(HasUninitializedReferenceMember, 1, NO_MERGE) + +/// True if any non-mutable field whose type doesn't have a user- +/// provided default ctor also doesn't have an in-class initializer. +FIELD(HasUninitializedFields, 1, NO_MERGE) + +/// True if there are any member using-declarations that inherit +/// constructors from a base class. +FIELD(HasInheritedConstructor, 1, NO_MERGE) + +/// True if there are any member using-declarations named +/// 'operator='. +FIELD(HasInheritedAssignment, 1, NO_MERGE) + +/// These flags are \c true if a defaulted corresponding special +/// member can't be fully analyzed without performing overload resolution. +/// @{ +FIELD(NeedOverloadResolutionForCopyConstructor, 1, NO_MERGE) +FIELD(NeedOverloadResolutionForMoveConstructor, 1, NO_MERGE) +FIELD(NeedOverloadResolutionForMoveAssignment, 1, NO_MERGE) +FIELD(NeedOverloadResolutionForDestructor, 1, NO_MERGE) +/// @} + +/// These flags are \c true if an implicit defaulted corresponding +/// special member would be defined as deleted. +/// @{ +FIELD(DefaultedCopyConstructorIsDeleted, 1, NO_MERGE) +FIELD(DefaultedMoveConstructorIsDeleted, 1, NO_MERGE) +FIELD(DefaultedMoveAssignmentIsDeleted, 1, NO_MERGE) +FIELD(DefaultedDestructorIsDeleted, 1, NO_MERGE) +/// @} + +/// The trivial special members which this class has, per +/// C++11 [class.ctor]p5, C++11 [class.copy]p12, C++11 [class.copy]p25, +/// C++11 [class.dtor]p5, or would have if the member were not suppressed. +/// +/// This excludes any user-declared but not user-provided special members +/// which have been declared but not yet defined. +FIELD(HasTrivialSpecialMembers, 6, MERGE_OR) + +/// These bits keep track of the triviality of special functions for the +/// purpose of calls. Only the bits corresponding to SMF_CopyConstructor, +/// SMF_MoveConstructor, and SMF_Destructor are meaningful here. +FIELD(HasTrivialSpecialMembersForCall, 6, MERGE_OR) + +/// The declared special members of this class which are known to be +/// non-trivial. +/// +/// This excludes any user-declared but not user-provided special members +/// which have been declared but not yet defined, and any implicit special +/// members which have not yet been declared. +FIELD(DeclaredNonTrivialSpecialMembers, 6, MERGE_OR) + +/// These bits keep track of the declared special members that are +/// non-trivial for the purpose of calls. +/// Only the bits corresponding to SMF_CopyConstructor, +/// SMF_MoveConstructor, and SMF_Destructor are meaningful here. +FIELD(DeclaredNonTrivialSpecialMembersForCall, 6, MERGE_OR) + +/// True when this class has a destructor with no semantic effect. *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Oct 23 17:52:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96F9E159A9D; Wed, 23 Oct 2019 17:52:17 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yycx186wz4SLc; Wed, 23 Oct 2019 17:52:17 +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 E284B362; Wed, 23 Oct 2019 17:52:16 +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 x9NHqG4g078101; Wed, 23 Oct 2019 17:52:16 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHqGfP078100; Wed, 23 Oct 2019 17:52:16 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231752.x9NHqGfP078100@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:52:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353943 - vendor/clang/clang-r375505 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/clang/clang-r375505 X-SVN-Commit-Revision: 353943 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:52:17 -0000 Author: dim Date: Wed Oct 23 17:52:16 2019 New Revision: 353943 URL: https://svnweb.freebsd.org/changeset/base/353943 Log: Tag stripped clang trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub. Added: vendor/clang/clang-r375505/ - copied from r353942, vendor/clang/dist/ From owner-svn-src-all@freebsd.org Wed Oct 23 17:52:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 46AC3159AF2; Wed, 23 Oct 2019 17:52:24 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yyd41xDpz4SXk; Wed, 23 Oct 2019 17:52:24 +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 0DA29371; Wed, 23 Oct 2019 17:52:24 +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 x9NHqOqK078157; Wed, 23 Oct 2019 17:52:24 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHqMbX078149; Wed, 23 Oct 2019 17:52:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231752.x9NHqMbX078149@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:52:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353944 - in vendor/compiler-rt/dist: include/fuzzer include/sanitizer lib/asan lib/builtins lib/builtins/aarch64 lib/builtins/arm lib/dfsan lib/fuzzer lib/fuzzer/utils lib/gwp_asan lib... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/compiler-rt/dist: include/fuzzer include/sanitizer lib/asan lib/builtins lib/builtins/aarch64 lib/builtins/arm lib/dfsan lib/fuzzer lib/fuzzer/utils lib/gwp_asan lib/gwp_asan/optional lib/gw... X-SVN-Commit-Revision: 353944 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:52:24 -0000 Author: dim Date: Wed Oct 23 17:52:22 2019 New Revision: 353944 URL: https://svnweb.freebsd.org/changeset/base/353944 Log: Vendor import of stripped compiler-rt trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/compiler-rt/trunk@375505 Added: vendor/compiler-rt/dist/include/fuzzer/ vendor/compiler-rt/dist/include/fuzzer/FuzzedDataProvider.h vendor/compiler-rt/dist/include/sanitizer/ubsan_interface.h vendor/compiler-rt/dist/lib/asan/asan_activation.cpp vendor/compiler-rt/dist/lib/asan/asan_allocator.cpp vendor/compiler-rt/dist/lib/asan/asan_debugging.cpp vendor/compiler-rt/dist/lib/asan/asan_descriptions.cpp vendor/compiler-rt/dist/lib/asan/asan_errors.cpp vendor/compiler-rt/dist/lib/asan/asan_fake_stack.cpp vendor/compiler-rt/dist/lib/asan/asan_flags.cpp vendor/compiler-rt/dist/lib/asan/asan_fuchsia.cpp vendor/compiler-rt/dist/lib/asan/asan_globals.cpp vendor/compiler-rt/dist/lib/asan/asan_globals_win.cpp vendor/compiler-rt/dist/lib/asan/asan_interceptors.cpp vendor/compiler-rt/dist/lib/asan/asan_interceptors_memintrinsics.cpp vendor/compiler-rt/dist/lib/asan/asan_linux.cpp vendor/compiler-rt/dist/lib/asan/asan_mac.cpp vendor/compiler-rt/dist/lib/asan/asan_malloc_linux.cpp vendor/compiler-rt/dist/lib/asan/asan_malloc_mac.cpp vendor/compiler-rt/dist/lib/asan/asan_malloc_win.cpp vendor/compiler-rt/dist/lib/asan/asan_memory_profile.cpp vendor/compiler-rt/dist/lib/asan/asan_new_delete.cpp vendor/compiler-rt/dist/lib/asan/asan_poisoning.cpp vendor/compiler-rt/dist/lib/asan/asan_posix.cpp vendor/compiler-rt/dist/lib/asan/asan_preinit.cpp vendor/compiler-rt/dist/lib/asan/asan_premap_shadow.cpp vendor/compiler-rt/dist/lib/asan/asan_report.cpp vendor/compiler-rt/dist/lib/asan/asan_rtems.cpp vendor/compiler-rt/dist/lib/asan/asan_rtl.cpp vendor/compiler-rt/dist/lib/asan/asan_shadow_setup.cpp vendor/compiler-rt/dist/lib/asan/asan_stack.cpp vendor/compiler-rt/dist/lib/asan/asan_stats.cpp vendor/compiler-rt/dist/lib/asan/asan_suppressions.cpp vendor/compiler-rt/dist/lib/asan/asan_thread.cpp vendor/compiler-rt/dist/lib/asan/asan_win.cpp vendor/compiler-rt/dist/lib/asan/asan_win_dll_thunk.cpp vendor/compiler-rt/dist/lib/asan/asan_win_dynamic_runtime_thunk.cpp vendor/compiler-rt/dist/lib/asan/asan_win_weak_interception.cpp vendor/compiler-rt/dist/lib/builtins/aarch64/fp_mode.c vendor/compiler-rt/dist/lib/builtins/arm/fp_mode.c vendor/compiler-rt/dist/lib/builtins/fp_mode.c vendor/compiler-rt/dist/lib/builtins/fp_mode.h vendor/compiler-rt/dist/lib/dfsan/dfsan.cpp vendor/compiler-rt/dist/lib/dfsan/dfsan_custom.cpp vendor/compiler-rt/dist/lib/dfsan/dfsan_interceptors.cpp vendor/compiler-rt/dist/lib/gwp_asan/scripts/ vendor/compiler-rt/dist/lib/gwp_asan/scripts/symbolize.sh (contents, props changed) vendor/compiler-rt/dist/lib/gwp_asan/stack_trace_compressor.cpp vendor/compiler-rt/dist/lib/gwp_asan/stack_trace_compressor.h vendor/compiler-rt/dist/lib/hwasan/hwasan_exceptions.cpp vendor/compiler-rt/dist/lib/interception/interception_linux.cpp vendor/compiler-rt/dist/lib/interception/interception_mac.cpp vendor/compiler-rt/dist/lib/interception/interception_type_test.cpp vendor/compiler-rt/dist/lib/interception/interception_win.cpp vendor/compiler-rt/dist/lib/lsan/lsan.cpp vendor/compiler-rt/dist/lib/lsan/lsan_allocator.cpp vendor/compiler-rt/dist/lib/lsan/lsan_common.cpp vendor/compiler-rt/dist/lib/lsan/lsan_common_linux.cpp vendor/compiler-rt/dist/lib/lsan/lsan_common_mac.cpp vendor/compiler-rt/dist/lib/lsan/lsan_interceptors.cpp vendor/compiler-rt/dist/lib/lsan/lsan_linux.cpp vendor/compiler-rt/dist/lib/lsan/lsan_mac.cpp vendor/compiler-rt/dist/lib/lsan/lsan_malloc_mac.cpp vendor/compiler-rt/dist/lib/lsan/lsan_preinit.cpp vendor/compiler-rt/dist/lib/lsan/lsan_thread.cpp vendor/compiler-rt/dist/lib/msan/msan.cpp vendor/compiler-rt/dist/lib/msan/msan_allocator.cpp vendor/compiler-rt/dist/lib/msan/msan_chained_origin_depot.cpp vendor/compiler-rt/dist/lib/msan/msan_interceptors.cpp vendor/compiler-rt/dist/lib/msan/msan_linux.cpp vendor/compiler-rt/dist/lib/msan/msan_new_delete.cpp vendor/compiler-rt/dist/lib/msan/msan_poisoning.cpp vendor/compiler-rt/dist/lib/msan/msan_report.cpp vendor/compiler-rt/dist/lib/msan/msan_thread.cpp vendor/compiler-rt/dist/lib/profile/InstrProfilingRuntime.cpp vendor/compiler-rt/dist/lib/safestack/safestack.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sancov_flags.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_checks.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_report.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_libcdep.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_nolibc.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_fuchsia.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_win_dll_thunk.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_win_sections.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_win_weak_interception.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_deadlock_detector1.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_deadlock_detector2.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_errno.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_file.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flag_parser.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_fuchsia.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_glibc_version.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_libc.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_libignore.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_libcdep.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_s390.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac_libcdep.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_netbsd.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_openbsd.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_persistent_allocator.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_linux.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_openbsd.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_posix.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_solaris.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_posix.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_posix_libcdep.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_printf.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_procmaps_bsd.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_procmaps_common.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_procmaps_linux.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_procmaps_mac.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_procmaps_solaris.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_rtems.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_solaris.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stackdepot.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stacktrace.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stacktrace_printer.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stacktrace_sparc.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stoptheworld_mac.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_suppressions.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_mac.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_markup.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_report.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_win.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_termination.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_thread_registry.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_tls_get_addr.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_type_traits.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_unwind_win.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win_dll_thunk.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cpp vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win_weak_interception.cpp vendor/compiler-rt/dist/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cpp vendor/compiler-rt/dist/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cpp vendor/compiler-rt/dist/lib/scudo/standalone/checksum.cpp vendor/compiler-rt/dist/lib/scudo/standalone/common.cpp vendor/compiler-rt/dist/lib/scudo/standalone/crc32_hw.cpp vendor/compiler-rt/dist/lib/scudo/standalone/flags.cpp vendor/compiler-rt/dist/lib/scudo/standalone/flags_parser.cpp vendor/compiler-rt/dist/lib/scudo/standalone/fuchsia.cpp vendor/compiler-rt/dist/lib/scudo/standalone/linux.cpp vendor/compiler-rt/dist/lib/scudo/standalone/report.cpp vendor/compiler-rt/dist/lib/scudo/standalone/secondary.cpp vendor/compiler-rt/dist/lib/scudo/standalone/string_utils.cpp vendor/compiler-rt/dist/lib/scudo/standalone/wrappers_c.cpp vendor/compiler-rt/dist/lib/scudo/standalone/wrappers_c_bionic.cpp vendor/compiler-rt/dist/lib/scudo/standalone/wrappers_cpp.cpp vendor/compiler-rt/dist/lib/stats/stats.cpp vendor/compiler-rt/dist/lib/stats/stats_client.cpp vendor/compiler-rt/dist/lib/tsan/benchmarks/func_entry_exit.cpp vendor/compiler-rt/dist/lib/tsan/benchmarks/mini_bench_local.cpp vendor/compiler-rt/dist/lib/tsan/benchmarks/mini_bench_shared.cpp vendor/compiler-rt/dist/lib/tsan/benchmarks/mop.cpp vendor/compiler-rt/dist/lib/tsan/benchmarks/start_many_threads.cpp vendor/compiler-rt/dist/lib/tsan/benchmarks/vts_many_threads_bench.cpp vendor/compiler-rt/dist/lib/tsan/dd/dd_interceptors.cpp vendor/compiler-rt/dist/lib/tsan/dd/dd_rtl.cpp vendor/compiler-rt/dist/lib/tsan/go/tsan_go.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_clock.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_debugging.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_external.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_fd.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_flags.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_ignoreset.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors_libdispatch.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors_mac.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors_mach_vm.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors_posix.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface_ann.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface_atomic.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface_java.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_malloc_mac.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_md5.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_mman.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_mutex.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_mutexset.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_new_delete.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform_linux.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform_mac.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform_posix.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform_windows.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_preinit.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_mutex.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_proc.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_report.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_thread.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_stack_trace.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_stat.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_suppressions.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_symbolize.cpp vendor/compiler-rt/dist/lib/tsan/rtl/tsan_sync.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_diag.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_diag_standalone.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_flags.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_handlers.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_handlers_cxx.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_init.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_init_standalone.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_init_standalone_preinit.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_monitor.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_signals_standalone.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_type_hash.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_type_hash_itanium.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_type_hash_win.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_value.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_win_dll_thunk.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_win_dynamic_runtime_thunk.cpp vendor/compiler-rt/dist/lib/ubsan/ubsan_win_weak_interception.cpp vendor/compiler-rt/dist/lib/ubsan_minimal/ubsan_minimal_handlers.cpp vendor/compiler-rt/dist/lib/xray/xray_AArch64.cpp vendor/compiler-rt/dist/lib/xray/xray_arm.cpp vendor/compiler-rt/dist/lib/xray/xray_basic_flags.cpp vendor/compiler-rt/dist/lib/xray/xray_basic_logging.cpp vendor/compiler-rt/dist/lib/xray/xray_buffer_queue.cpp vendor/compiler-rt/dist/lib/xray/xray_fdr_flags.cpp vendor/compiler-rt/dist/lib/xray/xray_fdr_logging.cpp vendor/compiler-rt/dist/lib/xray/xray_flags.cpp vendor/compiler-rt/dist/lib/xray/xray_init.cpp vendor/compiler-rt/dist/lib/xray/xray_interface.cpp vendor/compiler-rt/dist/lib/xray/xray_log_interface.cpp vendor/compiler-rt/dist/lib/xray/xray_mips.cpp vendor/compiler-rt/dist/lib/xray/xray_mips64.cpp vendor/compiler-rt/dist/lib/xray/xray_powerpc64.cpp vendor/compiler-rt/dist/lib/xray/xray_profile_collector.cpp vendor/compiler-rt/dist/lib/xray/xray_profiling.cpp vendor/compiler-rt/dist/lib/xray/xray_profiling_flags.cpp vendor/compiler-rt/dist/lib/xray/xray_trampoline_powerpc64.cpp vendor/compiler-rt/dist/lib/xray/xray_utils.cpp vendor/compiler-rt/dist/lib/xray/xray_x86_64.cpp vendor/compiler-rt/dist/tools/ vendor/compiler-rt/dist/tools/CMakeLists.txt vendor/compiler-rt/dist/tools/gwp_asan/ vendor/compiler-rt/dist/tools/gwp_asan/CMakeLists.txt vendor/compiler-rt/dist/tools/gwp_asan/stack_trace_compressor_fuzzer.cpp Deleted: vendor/compiler-rt/dist/lib/asan/asan_activation.cc vendor/compiler-rt/dist/lib/asan/asan_allocator.cc vendor/compiler-rt/dist/lib/asan/asan_debugging.cc vendor/compiler-rt/dist/lib/asan/asan_descriptions.cc vendor/compiler-rt/dist/lib/asan/asan_errors.cc vendor/compiler-rt/dist/lib/asan/asan_fake_stack.cc vendor/compiler-rt/dist/lib/asan/asan_flags.cc vendor/compiler-rt/dist/lib/asan/asan_fuchsia.cc vendor/compiler-rt/dist/lib/asan/asan_globals.cc vendor/compiler-rt/dist/lib/asan/asan_globals_win.cc vendor/compiler-rt/dist/lib/asan/asan_interceptors.cc vendor/compiler-rt/dist/lib/asan/asan_interceptors_memintrinsics.cc vendor/compiler-rt/dist/lib/asan/asan_linux.cc vendor/compiler-rt/dist/lib/asan/asan_mac.cc vendor/compiler-rt/dist/lib/asan/asan_malloc_linux.cc vendor/compiler-rt/dist/lib/asan/asan_malloc_mac.cc vendor/compiler-rt/dist/lib/asan/asan_malloc_win.cc vendor/compiler-rt/dist/lib/asan/asan_memory_profile.cc vendor/compiler-rt/dist/lib/asan/asan_new_delete.cc vendor/compiler-rt/dist/lib/asan/asan_poisoning.cc vendor/compiler-rt/dist/lib/asan/asan_posix.cc vendor/compiler-rt/dist/lib/asan/asan_preinit.cc vendor/compiler-rt/dist/lib/asan/asan_premap_shadow.cc vendor/compiler-rt/dist/lib/asan/asan_report.cc vendor/compiler-rt/dist/lib/asan/asan_rtems.cc vendor/compiler-rt/dist/lib/asan/asan_rtl.cc vendor/compiler-rt/dist/lib/asan/asan_shadow_setup.cc vendor/compiler-rt/dist/lib/asan/asan_stack.cc vendor/compiler-rt/dist/lib/asan/asan_stats.cc vendor/compiler-rt/dist/lib/asan/asan_suppressions.cc vendor/compiler-rt/dist/lib/asan/asan_thread.cc vendor/compiler-rt/dist/lib/asan/asan_win.cc vendor/compiler-rt/dist/lib/asan/asan_win_dll_thunk.cc vendor/compiler-rt/dist/lib/asan/asan_win_dynamic_runtime_thunk.cc vendor/compiler-rt/dist/lib/asan/asan_win_weak_interception.cc vendor/compiler-rt/dist/lib/dfsan/dfsan.cc vendor/compiler-rt/dist/lib/dfsan/dfsan_custom.cc vendor/compiler-rt/dist/lib/dfsan/dfsan_interceptors.cc vendor/compiler-rt/dist/lib/fuzzer/utils/ vendor/compiler-rt/dist/lib/interception/interception_linux.cc vendor/compiler-rt/dist/lib/interception/interception_mac.cc vendor/compiler-rt/dist/lib/interception/interception_type_test.cc vendor/compiler-rt/dist/lib/interception/interception_win.cc vendor/compiler-rt/dist/lib/lsan/lsan.cc vendor/compiler-rt/dist/lib/lsan/lsan_allocator.cc vendor/compiler-rt/dist/lib/lsan/lsan_common.cc vendor/compiler-rt/dist/lib/lsan/lsan_common_linux.cc vendor/compiler-rt/dist/lib/lsan/lsan_common_mac.cc vendor/compiler-rt/dist/lib/lsan/lsan_interceptors.cc vendor/compiler-rt/dist/lib/lsan/lsan_linux.cc vendor/compiler-rt/dist/lib/lsan/lsan_mac.cc vendor/compiler-rt/dist/lib/lsan/lsan_malloc_mac.cc vendor/compiler-rt/dist/lib/lsan/lsan_preinit.cc vendor/compiler-rt/dist/lib/lsan/lsan_thread.cc vendor/compiler-rt/dist/lib/msan/msan.cc vendor/compiler-rt/dist/lib/msan/msan_allocator.cc vendor/compiler-rt/dist/lib/msan/msan_chained_origin_depot.cc vendor/compiler-rt/dist/lib/msan/msan_interceptors.cc vendor/compiler-rt/dist/lib/msan/msan_linux.cc vendor/compiler-rt/dist/lib/msan/msan_new_delete.cc vendor/compiler-rt/dist/lib/msan/msan_poisoning.cc vendor/compiler-rt/dist/lib/msan/msan_report.cc vendor/compiler-rt/dist/lib/msan/msan_thread.cc vendor/compiler-rt/dist/lib/profile/InstrProfilingRuntime.cc vendor/compiler-rt/dist/lib/safestack/safestack.cc vendor/compiler-rt/dist/lib/sancov/ vendor/compiler-rt/dist/lib/sanitizer_common/sancov_flags.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_checks.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_report.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_libcdep.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_nolibc.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_fuchsia.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_libcdep_new.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_win_dll_thunk.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_win_dynamic_runtime_thunk.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_win_sections.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_coverage_win_weak_interception.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_deadlock_detector1.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_deadlock_detector2.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_errno.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_file.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flag_parser.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flags.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_fuchsia.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_libc.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_libignore.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_libcdep.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_linux_s390.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_mac_libcdep.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_netbsd.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_openbsd.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_persistent_allocator.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_freebsd.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_linux.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_netbsd.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_openbsd.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_posix.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_solaris.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_posix.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_posix_libcdep.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_printf.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_procmaps_bsd.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_procmaps_common.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_procmaps_linux.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_procmaps_mac.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_procmaps_solaris.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_rtems.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_solaris.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stackdepot.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stacktrace.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stacktrace_libcdep.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stacktrace_printer.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stacktrace_sparc.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stoptheworld_mac.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_stoptheworld_netbsd_libcdep.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_suppressions.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_libbacktrace.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_libcdep.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_mac.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_markup.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_posix_libcdep.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_report.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_win.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_termination.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_thread_registry.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_tls_get_addr.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_type_traits.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_unwind_linux_libcdep.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_unwind_win.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win_dll_thunk.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win_dynamic_runtime_thunk.cc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win_weak_interception.cc vendor/compiler-rt/dist/lib/sanitizer_common/symbolizer/sanitizer_symbolize.cc vendor/compiler-rt/dist/lib/sanitizer_common/symbolizer/sanitizer_wrappers.cc vendor/compiler-rt/dist/lib/scudo/standalone/checksum.cc vendor/compiler-rt/dist/lib/scudo/standalone/common.cc vendor/compiler-rt/dist/lib/scudo/standalone/crc32_hw.cc vendor/compiler-rt/dist/lib/scudo/standalone/flags.cc vendor/compiler-rt/dist/lib/scudo/standalone/flags_parser.cc vendor/compiler-rt/dist/lib/scudo/standalone/fuchsia.cc vendor/compiler-rt/dist/lib/scudo/standalone/linux.cc vendor/compiler-rt/dist/lib/scudo/standalone/report.cc vendor/compiler-rt/dist/lib/scudo/standalone/secondary.cc vendor/compiler-rt/dist/lib/scudo/standalone/string_utils.cc vendor/compiler-rt/dist/lib/scudo/standalone/wrappers_c.cc vendor/compiler-rt/dist/lib/scudo/standalone/wrappers_c_bionic.cc vendor/compiler-rt/dist/lib/scudo/standalone/wrappers_cpp.cc vendor/compiler-rt/dist/lib/stats/stats.cc vendor/compiler-rt/dist/lib/stats/stats_client.cc vendor/compiler-rt/dist/lib/tsan/benchmarks/func_entry_exit.cc vendor/compiler-rt/dist/lib/tsan/benchmarks/mini_bench_local.cc vendor/compiler-rt/dist/lib/tsan/benchmarks/mini_bench_shared.cc vendor/compiler-rt/dist/lib/tsan/benchmarks/mop.cc vendor/compiler-rt/dist/lib/tsan/benchmarks/start_many_threads.cc vendor/compiler-rt/dist/lib/tsan/benchmarks/vts_many_threads_bench.cc vendor/compiler-rt/dist/lib/tsan/dd/dd_interceptors.cc vendor/compiler-rt/dist/lib/tsan/dd/dd_rtl.cc vendor/compiler-rt/dist/lib/tsan/go/tsan_go.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_clock.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_debugging.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_external.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_fd.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_flags.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_ignoreset.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interceptors_mac.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface_ann.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface_atomic.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface_java.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_libdispatch.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_malloc_mac.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_md5.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_mman.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_mutex.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_mutexset.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_new_delete.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform_linux.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform_mac.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform_posix.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform_windows.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_preinit.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_report.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_mutex.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_proc.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_report.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl_thread.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_stack_trace.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_stat.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_suppressions.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_symbolize.cc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_sync.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_diag.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_diag_standalone.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_flags.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_handlers.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_handlers_cxx.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_init.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_init_standalone.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_init_standalone_preinit.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_monitor.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_signals_standalone.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_type_hash.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_type_hash_itanium.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_type_hash_win.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_value.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_win_dll_thunk.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_win_dynamic_runtime_thunk.cc vendor/compiler-rt/dist/lib/ubsan/ubsan_win_weak_interception.cc vendor/compiler-rt/dist/lib/ubsan_minimal/ubsan_minimal_handlers.cc vendor/compiler-rt/dist/lib/xray/xray_AArch64.cc vendor/compiler-rt/dist/lib/xray/xray_arm.cc vendor/compiler-rt/dist/lib/xray/xray_basic_flags.cc vendor/compiler-rt/dist/lib/xray/xray_basic_logging.cc vendor/compiler-rt/dist/lib/xray/xray_buffer_queue.cc vendor/compiler-rt/dist/lib/xray/xray_fdr_flags.cc vendor/compiler-rt/dist/lib/xray/xray_fdr_logging.cc vendor/compiler-rt/dist/lib/xray/xray_flags.cc vendor/compiler-rt/dist/lib/xray/xray_init.cc vendor/compiler-rt/dist/lib/xray/xray_interface.cc vendor/compiler-rt/dist/lib/xray/xray_log_interface.cc vendor/compiler-rt/dist/lib/xray/xray_mips.cc vendor/compiler-rt/dist/lib/xray/xray_mips64.cc vendor/compiler-rt/dist/lib/xray/xray_powerpc64.cc vendor/compiler-rt/dist/lib/xray/xray_profile_collector.cc vendor/compiler-rt/dist/lib/xray/xray_profiling.cc vendor/compiler-rt/dist/lib/xray/xray_profiling_flags.cc vendor/compiler-rt/dist/lib/xray/xray_trampoline_powerpc64.cc vendor/compiler-rt/dist/lib/xray/xray_utils.cc vendor/compiler-rt/dist/lib/xray/xray_x86_64.cc Modified: vendor/compiler-rt/dist/include/sanitizer/dfsan_interface.h vendor/compiler-rt/dist/include/sanitizer/tsan_interface_atomic.h vendor/compiler-rt/dist/lib/asan/asan_allocator.h vendor/compiler-rt/dist/lib/asan/asan_descriptions.h vendor/compiler-rt/dist/lib/asan/asan_errors.h vendor/compiler-rt/dist/lib/asan/asan_fake_stack.h vendor/compiler-rt/dist/lib/asan/asan_flags.inc vendor/compiler-rt/dist/lib/asan/asan_interceptors.h vendor/compiler-rt/dist/lib/asan/asan_interceptors_memintrinsics.h vendor/compiler-rt/dist/lib/asan/asan_internal.h vendor/compiler-rt/dist/lib/asan/asan_scariness_score.h vendor/compiler-rt/dist/lib/asan/asan_stack.h vendor/compiler-rt/dist/lib/asan/asan_suppressions.h vendor/compiler-rt/dist/lib/asan/asan_thread.h vendor/compiler-rt/dist/lib/builtins/adddf3.c vendor/compiler-rt/dist/lib/builtins/addsf3.c vendor/compiler-rt/dist/lib/builtins/addtf3.c vendor/compiler-rt/dist/lib/builtins/atomic.c vendor/compiler-rt/dist/lib/builtins/clear_cache.c vendor/compiler-rt/dist/lib/builtins/cpu_model.c vendor/compiler-rt/dist/lib/builtins/divtf3.c vendor/compiler-rt/dist/lib/builtins/emutls.c vendor/compiler-rt/dist/lib/builtins/extenddftf2.c vendor/compiler-rt/dist/lib/builtins/extendsftf2.c vendor/compiler-rt/dist/lib/builtins/fixunsxfdi.c vendor/compiler-rt/dist/lib/builtins/fixunsxfsi.c vendor/compiler-rt/dist/lib/builtins/fixxfdi.c vendor/compiler-rt/dist/lib/builtins/fp_add_impl.inc vendor/compiler-rt/dist/lib/builtins/fp_lib.h vendor/compiler-rt/dist/lib/builtins/fp_trunc_impl.inc vendor/compiler-rt/dist/lib/builtins/subdf3.c vendor/compiler-rt/dist/lib/builtins/subsf3.c vendor/compiler-rt/dist/lib/builtins/subtf3.c vendor/compiler-rt/dist/lib/builtins/udivmoddi4.c vendor/compiler-rt/dist/lib/fuzzer/FuzzerBuiltinsMsvc.h vendor/compiler-rt/dist/lib/fuzzer/FuzzerDefs.h vendor/compiler-rt/dist/lib/fuzzer/FuzzerDriver.cpp vendor/compiler-rt/dist/lib/fuzzer/FuzzerExtFunctions.def vendor/compiler-rt/dist/lib/fuzzer/FuzzerFlags.def vendor/compiler-rt/dist/lib/fuzzer/FuzzerInternal.h vendor/compiler-rt/dist/lib/fuzzer/FuzzerLoop.cpp vendor/compiler-rt/dist/lib/fuzzer/FuzzerMerge.cpp vendor/compiler-rt/dist/lib/fuzzer/FuzzerOptions.h vendor/compiler-rt/dist/lib/fuzzer/FuzzerTracePC.cpp vendor/compiler-rt/dist/lib/fuzzer/FuzzerTracePC.h vendor/compiler-rt/dist/lib/fuzzer/FuzzerUtil.h vendor/compiler-rt/dist/lib/fuzzer/FuzzerUtilFuchsia.cpp vendor/compiler-rt/dist/lib/fuzzer/FuzzerUtilPosix.cpp vendor/compiler-rt/dist/lib/fuzzer/FuzzerUtilWindows.cpp vendor/compiler-rt/dist/lib/gwp_asan/guarded_pool_allocator.cpp vendor/compiler-rt/dist/lib/gwp_asan/guarded_pool_allocator.h vendor/compiler-rt/dist/lib/gwp_asan/optional/backtrace.h vendor/compiler-rt/dist/lib/gwp_asan/optional/backtrace_linux_libc.cpp vendor/compiler-rt/dist/lib/gwp_asan/optional/backtrace_sanitizer_common.cpp vendor/compiler-rt/dist/lib/gwp_asan/options.h vendor/compiler-rt/dist/lib/gwp_asan/options.inc vendor/compiler-rt/dist/lib/hwasan/hwasan.cpp vendor/compiler-rt/dist/lib/hwasan/hwasan.h vendor/compiler-rt/dist/lib/hwasan/hwasan_allocator.cpp vendor/compiler-rt/dist/lib/hwasan/hwasan_allocator.h vendor/compiler-rt/dist/lib/hwasan/hwasan_flags.inc vendor/compiler-rt/dist/lib/hwasan/hwasan_interceptors.cpp vendor/compiler-rt/dist/lib/hwasan/hwasan_interface_internal.h vendor/compiler-rt/dist/lib/hwasan/hwasan_linux.cpp vendor/compiler-rt/dist/lib/hwasan/hwasan_new_delete.cpp vendor/compiler-rt/dist/lib/hwasan/hwasan_report.cpp vendor/compiler-rt/dist/lib/hwasan/hwasan_tag_mismatch_aarch64.S vendor/compiler-rt/dist/lib/interception/interception.h vendor/compiler-rt/dist/lib/lsan/lsan_common.h vendor/compiler-rt/dist/lib/msan/msan.h vendor/compiler-rt/dist/lib/profile/InstrProfiling.h vendor/compiler-rt/dist/lib/profile/InstrProfilingFile.c vendor/compiler-rt/dist/lib/profile/InstrProfilingPlatformFuchsia.c vendor/compiler-rt/dist/lib/profile/InstrProfilingUtil.c vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_allocator_checks.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_asm.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_atomic_msvc.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interceptors.inc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_interface.inc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_common_syscalls.inc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_flag_parser.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_getauxval.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_interceptors_ioctl_netbsd.inc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_internal_defs.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_malloc_mac.inc vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_interceptors.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_freebsd.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_netbsd.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_posix.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_platform_limits_solaris.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_posix.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_procmaps.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_suppressions.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_symbolizer_internal.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_tls_get_addr.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_vector.h vendor/compiler-rt/dist/lib/sanitizer_common/sanitizer_win_defs.h vendor/compiler-rt/dist/lib/sanitizer_common/symbolizer/scripts/build_symbolizer.sh vendor/compiler-rt/dist/lib/sanitizer_common/symbolizer/scripts/global_symbols.txt vendor/compiler-rt/dist/lib/scudo/scudo_allocator_secondary.h vendor/compiler-rt/dist/lib/scudo/scudo_errors.cpp vendor/compiler-rt/dist/lib/scudo/standalone/allocator_config.h vendor/compiler-rt/dist/lib/scudo/standalone/chunk.h vendor/compiler-rt/dist/lib/scudo/standalone/combined.h vendor/compiler-rt/dist/lib/scudo/standalone/internal_defs.h vendor/compiler-rt/dist/lib/scudo/standalone/linux.h vendor/compiler-rt/dist/lib/scudo/standalone/list.h vendor/compiler-rt/dist/lib/scudo/standalone/local_cache.h vendor/compiler-rt/dist/lib/scudo/standalone/mutex.h vendor/compiler-rt/dist/lib/scudo/standalone/primary32.h vendor/compiler-rt/dist/lib/scudo/standalone/primary64.h vendor/compiler-rt/dist/lib/scudo/standalone/quarantine.h vendor/compiler-rt/dist/lib/scudo/standalone/secondary.h vendor/compiler-rt/dist/lib/scudo/standalone/size_class_map.h vendor/compiler-rt/dist/lib/scudo/standalone/stats.h vendor/compiler-rt/dist/lib/scudo/standalone/string_utils.h vendor/compiler-rt/dist/lib/scudo/standalone/tsd_exclusive.h vendor/compiler-rt/dist/lib/scudo/standalone/tsd_shared.h vendor/compiler-rt/dist/lib/scudo/standalone/wrappers_c.inc vendor/compiler-rt/dist/lib/tsan/rtl/tsan_dispatch_defs.h vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface.h vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface_inl.h vendor/compiler-rt/dist/lib/tsan/rtl/tsan_interface_java.h vendor/compiler-rt/dist/lib/tsan/rtl/tsan_mman.h vendor/compiler-rt/dist/lib/tsan/rtl/tsan_platform.h vendor/compiler-rt/dist/lib/tsan/rtl/tsan_rtl.h vendor/compiler-rt/dist/lib/ubsan/ubsan_checks.inc Added: vendor/compiler-rt/dist/include/fuzzer/FuzzedDataProvider.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/include/fuzzer/FuzzedDataProvider.h Wed Oct 23 17:52:22 2019 (r353944) @@ -0,0 +1,299 @@ +//===- FuzzedDataProvider.h - Utility header for fuzz targets ---*- C++ -* ===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// A single header library providing an utility class to break up an array of +// bytes. Whenever run on the same input, provides the same output, as long as +// its methods are called in the same order, with the same arguments. +//===----------------------------------------------------------------------===// + +#ifndef LLVM_FUZZER_FUZZED_DATA_PROVIDER_H_ +#define LLVM_FUZZER_FUZZED_DATA_PROVIDER_H_ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// In addition to the comments below, the API is also briefly documented at +// https://github.com/google/fuzzing/blob/master/docs/split-inputs.md#fuzzed-data-provider +class FuzzedDataProvider { + public: + // |data| is an array of length |size| that the FuzzedDataProvider wraps to + // provide more granular access. |data| must outlive the FuzzedDataProvider. + FuzzedDataProvider(const uint8_t *data, size_t size) + : data_ptr_(data), remaining_bytes_(size) {} + ~FuzzedDataProvider() = default; + + // Returns a std::vector containing |num_bytes| of input data. If fewer than + // |num_bytes| of data remain, returns a shorter std::vector containing all + // of the data that's left. Can be used with any byte sized type, such as + // char, unsigned char, uint8_t, etc. + template std::vector ConsumeBytes(size_t num_bytes) { + num_bytes = std::min(num_bytes, remaining_bytes_); + return ConsumeBytes(num_bytes, num_bytes); + } + + // Similar to |ConsumeBytes|, but also appends the terminator value at the end + // of the resulting vector. Useful, when a mutable null-terminated C-string is + // needed, for example. But that is a rare case. Better avoid it, if possible, + // and prefer using |ConsumeBytes| or |ConsumeBytesAsString| methods. + template + std::vector ConsumeBytesWithTerminator(size_t num_bytes, + T terminator = 0) { + num_bytes = std::min(num_bytes, remaining_bytes_); + std::vector result = ConsumeBytes(num_bytes + 1, num_bytes); + result.back() = terminator; + return result; + } + + // Returns a std::string containing |num_bytes| of input data. Using this and + // |.c_str()| on the resulting string is the best way to get an immutable + // null-terminated C string. If fewer than |num_bytes| of data remain, returns + // a shorter std::string containing all of the data that's left. + std::string ConsumeBytesAsString(size_t num_bytes) { + static_assert(sizeof(std::string::value_type) == sizeof(uint8_t), + "ConsumeBytesAsString cannot convert the data to a string."); + + num_bytes = std::min(num_bytes, remaining_bytes_); + std::string result( + reinterpret_cast(data_ptr_), + num_bytes); + Advance(num_bytes); + return result; + } + + // Returns a number in the range [min, max] by consuming bytes from the + // input data. The value might not be uniformly distributed in the given + // range. If there's no input data left, always returns |min|. |min| must + // be less than or equal to |max|. + template T ConsumeIntegralInRange(T min, T max) { + static_assert(std::is_integral::value, "An integral type is required."); + static_assert(sizeof(T) <= sizeof(uint64_t), "Unsupported integral type."); + + if (min > max) + abort(); + + // Use the biggest type possible to hold the range and the result. + uint64_t range = static_cast(max) - min; + uint64_t result = 0; + size_t offset = 0; + + while (offset < sizeof(T) * CHAR_BIT && (range >> offset) > 0 && + remaining_bytes_ != 0) { + // Pull bytes off the end of the seed data. Experimentally, this seems to + // allow the fuzzer to more easily explore the input space. This makes + // sense, since it works by modifying inputs that caused new code to run, + // and this data is often used to encode length of data read by + // |ConsumeBytes|. Separating out read lengths makes it easier modify the + // contents of the data that is actually read. + --remaining_bytes_; + result = (result << CHAR_BIT) | data_ptr_[remaining_bytes_]; + offset += CHAR_BIT; + } + + // Avoid division by 0, in case |range + 1| results in overflow. + if (range != std::numeric_limits::max()) + result = result % (range + 1); + + return static_cast(min + result); + } + + // Returns a std::string of length from 0 to |max_length|. When it runs out of + // input data, returns what remains of the input. Designed to be more stable + // with respect to a fuzzer inserting characters than just picking a random + // length and then consuming that many bytes with |ConsumeBytes|. + std::string ConsumeRandomLengthString(size_t max_length) { + // Reads bytes from the start of |data_ptr_|. Maps "\\" to "\", and maps "\" + // followed by anything else to the end of the string. As a result of this + // logic, a fuzzer can insert characters into the string, and the string + // will be lengthened to include those new characters, resulting in a more + // stable fuzzer than picking the length of a string independently from + // picking its contents. + std::string result; + + // Reserve the anticipated capaticity to prevent several reallocations. + result.reserve(std::min(max_length, remaining_bytes_)); + for (size_t i = 0; i < max_length && remaining_bytes_ != 0; ++i) { + char next = ConvertUnsignedToSigned(data_ptr_[0]); + Advance(1); + if (next == '\\' && remaining_bytes_ != 0) { + next = ConvertUnsignedToSigned(data_ptr_[0]); + Advance(1); + if (next != '\\') + break; + } + result += next; + } + + result.shrink_to_fit(); + return result; + } + + // Returns a std::vector containing all remaining bytes of the input data. + template std::vector ConsumeRemainingBytes() { + return ConsumeBytes(remaining_bytes_); + } + + // Returns a std::string containing all remaining bytes of the input data. + // Prefer using |ConsumeRemainingBytes| unless you actually need a std::string + // object. + std::string ConsumeRemainingBytesAsString() { + return ConsumeBytesAsString(remaining_bytes_); + } + + // Returns a number in the range [Type's min, Type's max]. The value might + // not be uniformly distributed in the given range. If there's no input data + // left, always returns |min|. + template T ConsumeIntegral() { + return ConsumeIntegralInRange(std::numeric_limits::min(), + std::numeric_limits::max()); + } + + // Reads one byte and returns a bool, or false when no data remains. + bool ConsumeBool() { return 1 & ConsumeIntegral(); } + + // Returns a copy of the value selected from the given fixed-size |array|. + template + T PickValueInArray(const T (&array)[size]) { + static_assert(size > 0, "The array must be non empty."); + return array[ConsumeIntegralInRange(0, size - 1)]; + } + + template + T PickValueInArray(std::initializer_list list) { + // TODO(Dor1s): switch to static_assert once C++14 is allowed. + if (!list.size()) + abort(); + + return *(list.begin() + ConsumeIntegralInRange(0, list.size() - 1)); + } + + // Returns an enum value. The enum must start at 0 and be contiguous. It must + // also contain |kMaxValue| aliased to its largest (inclusive) value. Such as: + // enum class Foo { SomeValue, OtherValue, kMaxValue = OtherValue }; + template T ConsumeEnum() { + static_assert(std::is_enum::value, "|T| must be an enum type."); + return static_cast(ConsumeIntegralInRange( + 0, static_cast(T::kMaxValue))); + } + + // Returns a floating point number in the range [0.0, 1.0]. If there's no + // input data left, always returns 0. + template T ConsumeProbability() { + static_assert(std::is_floating_point::value, + "A floating point type is required."); + + // Use different integral types for different floating point types in order + // to provide better density of the resulting values. + using IntegralType = + typename std::conditional<(sizeof(T) <= sizeof(uint32_t)), uint32_t, + uint64_t>::type; + + T result = static_cast(ConsumeIntegral()); + result /= static_cast(std::numeric_limits::max()); + return result; + } + + // Returns a floating point value in the range [Type's lowest, Type's max] by + // consuming bytes from the input data. If there's no input data left, always + // returns approximately 0. + template T ConsumeFloatingPoint() { + return ConsumeFloatingPointInRange(std::numeric_limits::lowest(), + std::numeric_limits::max()); + } + + // Returns a floating point value in the given range by consuming bytes from + // the input data. If there's no input data left, returns |min|. Note that + // |min| must be less than or equal to |max|. + template T ConsumeFloatingPointInRange(T min, T max) { + if (min > max) + abort(); + + T range = .0; + T result = min; + constexpr T zero(.0); + if (max > zero && min < zero && max > min + std::numeric_limits::max()) { + // The diff |max - min| would overflow the given floating point type. Use + // the half of the diff as the range and consume a bool to decide whether + // the result is in the first of the second part of the diff. + range = (max / 2.0) - (min / 2.0); + if (ConsumeBool()) { + result += range; + } + } else { + range = max - min; + } + + return result + range * ConsumeProbability(); + } + + // Reports the remaining bytes available for fuzzed input. + size_t remaining_bytes() { return remaining_bytes_; } + + private: + FuzzedDataProvider(const FuzzedDataProvider &) = delete; + FuzzedDataProvider &operator=(const FuzzedDataProvider &) = delete; + + void Advance(size_t num_bytes) { + if (num_bytes > remaining_bytes_) + abort(); + + data_ptr_ += num_bytes; + remaining_bytes_ -= num_bytes; + } + + template + std::vector ConsumeBytes(size_t size, size_t num_bytes_to_consume) { + static_assert(sizeof(T) == sizeof(uint8_t), "Incompatible data type."); + + // The point of using the size-based constructor below is to increase the + // odds of having a vector object with capacity being equal to the length. + // That part is always implementation specific, but at least both libc++ and + // libstdc++ allocate the requested number of bytes in that constructor, + // which seems to be a natural choice for other implementations as well. + // To increase the odds even more, we also call |shrink_to_fit| below. + std::vector result(size); + std::memcpy(result.data(), data_ptr_, num_bytes_to_consume); + Advance(num_bytes_to_consume); + + // Even though |shrink_to_fit| is also implementation specific, we expect it + // to provide an additional assurance in case vector's constructor allocated + // a buffer which is larger than the actual amount of data we put inside it. + result.shrink_to_fit(); + return result; + } + + template TS ConvertUnsignedToSigned(TU value) { + static_assert(sizeof(TS) == sizeof(TU), "Incompatible data types."); + static_assert(!std::numeric_limits::is_signed, + "Source type must be unsigned."); + + // TODO(Dor1s): change to `if constexpr` once C++17 becomes mainstream. + if (std::numeric_limits::is_modulo) + return static_cast(value); + + // Avoid using implementation-defined unsigned to signer conversions. + // To learn more, see https://stackoverflow.com/questions/13150449. + if (value <= std::numeric_limits::max()) { + return static_cast(value); + } else { + constexpr auto TS_min = std::numeric_limits::min(); + return TS_min + static_cast(value - TS_min); + } + } + + const uint8_t *data_ptr_; + size_t remaining_bytes_; +}; + +#endif // LLVM_FUZZER_FUZZED_DATA_PROVIDER_H_ Modified: vendor/compiler-rt/dist/include/sanitizer/dfsan_interface.h ============================================================================== --- vendor/compiler-rt/dist/include/sanitizer/dfsan_interface.h Wed Oct 23 17:52:16 2019 (r353943) +++ vendor/compiler-rt/dist/include/sanitizer/dfsan_interface.h Wed Oct 23 17:52:22 2019 (r353944) @@ -112,7 +112,7 @@ void dfsan_weak_hook_strncmp(void *caller_pc, const ch } // extern "C" template -void dfsan_set_label(dfsan_label label, T &data) { // NOLINT +void dfsan_set_label(dfsan_label label, T &data) { // NOLINT dfsan_set_label(label, (void *)&data, sizeof(T)); } Modified: vendor/compiler-rt/dist/include/sanitizer/tsan_interface_atomic.h ============================================================================== --- vendor/compiler-rt/dist/include/sanitizer/tsan_interface_atomic.h Wed Oct 23 17:52:16 2019 (r353943) +++ vendor/compiler-rt/dist/include/sanitizer/tsan_interface_atomic.h Wed Oct 23 17:52:22 2019 (r353944) @@ -17,10 +17,10 @@ extern "C" { #endif -typedef char __tsan_atomic8; -typedef short __tsan_atomic16; // NOLINT -typedef int __tsan_atomic32; -typedef long __tsan_atomic64; // NOLINT +typedef char __tsan_atomic8; +typedef short __tsan_atomic16; +typedef int __tsan_atomic32; +typedef long __tsan_atomic64; #if defined(__SIZEOF_INT128__) \ || (__clang_major__ * 100 + __clang_minor__ >= 302) __extension__ typedef __int128 __tsan_atomic128; Added: vendor/compiler-rt/dist/include/sanitizer/ubsan_interface.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/include/sanitizer/ubsan_interface.h Wed Oct 23 17:52:22 2019 (r353944) @@ -0,0 +1,32 @@ +//===-- sanitizer/ubsan_interface.h -----------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file is a part of UBSanitizer (UBSan). +// +// Public interface header. +//===----------------------------------------------------------------------===// +#ifndef SANITIZER_UBSAN_INTERFACE_H +#define SANITIZER_UBSAN_INTERFACE_H + +#ifdef __cplusplus +extern "C" { +#endif +/// User-provided default option settings. +/// +/// You can provide your own implementation of this function to return a string +/// containing UBSan runtime options (for example, +/// verbosity=1:halt_on_error=0). +/// +/// \returns Default options string. +const char* __ubsan_default_options(void); + +#ifdef __cplusplus +} // extern "C" +#endif + +#endif // SANITIZER_UBSAN_INTERFACE_H Added: vendor/compiler-rt/dist/lib/asan/asan_activation.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/lib/asan/asan_activation.cpp Wed Oct 23 17:52:22 2019 (r353944) @@ -0,0 +1,143 @@ +//===-- asan_activation.cpp -------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file is a part of AddressSanitizer, an address sanity checker. +// +// ASan activation/deactivation logic. +//===----------------------------------------------------------------------===// + +#include "asan_activation.h" +#include "asan_allocator.h" +#include "asan_flags.h" +#include "asan_internal.h" +#include "asan_mapping.h" +#include "asan_poisoning.h" +#include "asan_stack.h" +#include "sanitizer_common/sanitizer_common.h" +#include "sanitizer_common/sanitizer_flags.h" + +namespace __asan { + +static struct AsanDeactivatedFlags { + AllocatorOptions allocator_options; + int malloc_context_size; + bool poison_heap; + bool coverage; + const char *coverage_dir; + + void RegisterActivationFlags(FlagParser *parser, Flags *f, CommonFlags *cf) { +#define ASAN_ACTIVATION_FLAG(Type, Name) \ + RegisterFlag(parser, #Name, "", &f->Name); +#define COMMON_ACTIVATION_FLAG(Type, Name) \ + RegisterFlag(parser, #Name, "", &cf->Name); +#include "asan_activation_flags.inc" +#undef ASAN_ACTIVATION_FLAG +#undef COMMON_ACTIVATION_FLAG + + RegisterIncludeFlags(parser, cf); + } + + void OverrideFromActivationFlags() { + Flags f; + CommonFlags cf; + FlagParser parser; + RegisterActivationFlags(&parser, &f, &cf); + + cf.SetDefaults(); + // Copy the current activation flags. + allocator_options.CopyTo(&f, &cf); + cf.malloc_context_size = malloc_context_size; + f.poison_heap = poison_heap; + cf.coverage = coverage; + cf.coverage_dir = coverage_dir; + cf.verbosity = Verbosity(); + cf.help = false; // this is activation-specific help + + // Check if activation flags need to be overriden. + if (const char *env = GetEnv("ASAN_ACTIVATION_OPTIONS")) { + parser.ParseString(env); + } + + InitializeCommonFlags(&cf); + + if (Verbosity()) ReportUnrecognizedFlags(); + + if (cf.help) parser.PrintFlagDescriptions(); + + allocator_options.SetFrom(&f, &cf); + malloc_context_size = cf.malloc_context_size; + poison_heap = f.poison_heap; + coverage = cf.coverage; + coverage_dir = cf.coverage_dir; + } + + void Print() { + Report( + "quarantine_size_mb %d, thread_local_quarantine_size_kb %d, " + "max_redzone %d, poison_heap %d, malloc_context_size %d, " + "alloc_dealloc_mismatch %d, allocator_may_return_null %d, coverage %d, " + "coverage_dir %s, allocator_release_to_os_interval_ms %d\n", + allocator_options.quarantine_size_mb, + allocator_options.thread_local_quarantine_size_kb, + allocator_options.max_redzone, poison_heap, malloc_context_size, + allocator_options.alloc_dealloc_mismatch, + allocator_options.may_return_null, coverage, coverage_dir, + allocator_options.release_to_os_interval_ms); + } +} asan_deactivated_flags; + +static bool asan_is_deactivated; + +void AsanDeactivate() { + CHECK(!asan_is_deactivated); + VReport(1, "Deactivating ASan\n"); + + // Stash runtime state. + GetAllocatorOptions(&asan_deactivated_flags.allocator_options); + asan_deactivated_flags.malloc_context_size = GetMallocContextSize(); + asan_deactivated_flags.poison_heap = CanPoisonMemory(); + asan_deactivated_flags.coverage = common_flags()->coverage; + asan_deactivated_flags.coverage_dir = common_flags()->coverage_dir; + + // Deactivate the runtime. + SetCanPoisonMemory(false); + SetMallocContextSize(1); + + AllocatorOptions disabled = asan_deactivated_flags.allocator_options; + disabled.quarantine_size_mb = 0; + disabled.thread_local_quarantine_size_kb = 0; + // Redzone must be at least Max(16, granularity) bytes long. + disabled.min_redzone = Max(16, (int)SHADOW_GRANULARITY); + disabled.max_redzone = disabled.min_redzone; + disabled.alloc_dealloc_mismatch = false; + disabled.may_return_null = true; + ReInitializeAllocator(disabled); + + asan_is_deactivated = true; +} + +void AsanActivate() { + if (!asan_is_deactivated) return; + VReport(1, "Activating ASan\n"); + + UpdateProcessName(); + + asan_deactivated_flags.OverrideFromActivationFlags(); + + SetCanPoisonMemory(asan_deactivated_flags.poison_heap); + SetMallocContextSize(asan_deactivated_flags.malloc_context_size); + ReInitializeAllocator(asan_deactivated_flags.allocator_options); + + asan_is_deactivated = false; + if (Verbosity()) { + Report("Activated with flags:\n"); + asan_deactivated_flags.Print(); + } +} + +} // namespace __asan Added: vendor/compiler-rt/dist/lib/asan/asan_allocator.cpp ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/compiler-rt/dist/lib/asan/asan_allocator.cpp Wed Oct 23 17:52:22 2019 (r353944) @@ -0,0 +1,1119 @@ +//===-- asan_allocator.cpp ------------------------------------------------===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// +// +// This file is a part of AddressSanitizer, an address sanity checker. +// +// Implementation of ASan's memory allocator, 2-nd version. +// This variant uses the allocator from sanitizer_common, i.e. the one shared +// with ThreadSanitizer and MemorySanitizer. +// +//===----------------------------------------------------------------------===// + +#include "asan_allocator.h" +#include "asan_mapping.h" +#include "asan_poisoning.h" +#include "asan_report.h" +#include "asan_stack.h" +#include "asan_thread.h" +#include "sanitizer_common/sanitizer_allocator_checks.h" +#include "sanitizer_common/sanitizer_allocator_interface.h" +#include "sanitizer_common/sanitizer_errno.h" +#include "sanitizer_common/sanitizer_flags.h" +#include "sanitizer_common/sanitizer_internal_defs.h" +#include "sanitizer_common/sanitizer_list.h" +#include "sanitizer_common/sanitizer_stackdepot.h" +#include "sanitizer_common/sanitizer_quarantine.h" +#include "lsan/lsan_common.h" + +namespace __asan { + +// Valid redzone sizes are 16, 32, 64, ... 2048, so we encode them in 3 bits. +// We use adaptive redzones: for larger allocation larger redzones are used. +static u32 RZLog2Size(u32 rz_log) { + CHECK_LT(rz_log, 8); + return 16 << rz_log; +} + +static u32 RZSize2Log(u32 rz_size) { + CHECK_GE(rz_size, 16); + CHECK_LE(rz_size, 2048); + CHECK(IsPowerOfTwo(rz_size)); + u32 res = Log2(rz_size) - 4; + CHECK_EQ(rz_size, RZLog2Size(res)); + return res; +} + +static AsanAllocator &get_allocator(); + +// The memory chunk allocated from the underlying allocator looks like this: +// L L L L L L H H U U U U U U R R +// L -- left redzone words (0 or more bytes) +// H -- ChunkHeader (16 bytes), which is also a part of the left redzone. +// U -- user memory. +// R -- right redzone (0 or more bytes) +// ChunkBase consists of ChunkHeader and other bytes that overlap with user +// memory. + +// If the left redzone is greater than the ChunkHeader size we store a magic +// value in the first uptr word of the memory block and store the address of +// ChunkBase in the next uptr. +// M B L L L L L L L L L H H U U U U U U +// | ^ +// ---------------------| +// M -- magic value kAllocBegMagic +// B -- address of ChunkHeader pointing to the first 'H' +static const uptr kAllocBegMagic = 0xCC6E96B9; + +struct ChunkHeader { + // 1-st 8 bytes. + u32 chunk_state : 8; // Must be first. + u32 alloc_tid : 24; + + u32 free_tid : 24; + u32 from_memalign : 1; + u32 alloc_type : 2; + u32 rz_log : 3; + u32 lsan_tag : 2; + // 2-nd 8 bytes + // This field is used for small sizes. For large sizes it is equal to + // SizeClassMap::kMaxSize and the actual size is stored in the + // SecondaryAllocator's metadata. + u32 user_requested_size : 29; + // align < 8 -> 0 + // else -> log2(min(align, 512)) - 2 + u32 user_requested_alignment_log : 3; + u32 alloc_context_id; +}; + +struct ChunkBase : ChunkHeader { + // Header2, intersects with user memory. + u32 free_context_id; +}; + +static const uptr kChunkHeaderSize = sizeof(ChunkHeader); +static const uptr kChunkHeader2Size = sizeof(ChunkBase) - kChunkHeaderSize; +COMPILER_CHECK(kChunkHeaderSize == 16); +COMPILER_CHECK(kChunkHeader2Size <= 16); + +// Every chunk of memory allocated by this allocator can be in one of 3 states: +// CHUNK_AVAILABLE: the chunk is in the free list and ready to be allocated. +// CHUNK_ALLOCATED: the chunk is allocated and not yet freed. +// CHUNK_QUARANTINE: the chunk was freed and put into quarantine zone. +enum { + CHUNK_AVAILABLE = 0, // 0 is the default value even if we didn't set it. + CHUNK_ALLOCATED = 2, + CHUNK_QUARANTINE = 3 +}; + +struct AsanChunk: ChunkBase { + uptr Beg() { return reinterpret_cast(this) + kChunkHeaderSize; } + uptr UsedSize(bool locked_version = false) { + if (user_requested_size != SizeClassMap::kMaxSize) + return user_requested_size; + return *reinterpret_cast( + get_allocator().GetMetaData(AllocBeg(locked_version))); + } + void *AllocBeg(bool locked_version = false) { + if (from_memalign) { + if (locked_version) + return get_allocator().GetBlockBeginFastLocked( + reinterpret_cast(this)); + return get_allocator().GetBlockBegin(reinterpret_cast(this)); + } + return reinterpret_cast(Beg() - RZLog2Size(rz_log)); + } + bool AddrIsInside(uptr addr, bool locked_version = false) { + return (addr >= Beg()) && (addr < Beg() + UsedSize(locked_version)); + } +}; + +struct QuarantineCallback { + QuarantineCallback(AllocatorCache *cache, BufferedStackTrace *stack) + : cache_(cache), + stack_(stack) { + } + + void Recycle(AsanChunk *m) { + CHECK_EQ(m->chunk_state, CHUNK_QUARANTINE); + atomic_store((atomic_uint8_t*)m, CHUNK_AVAILABLE, memory_order_relaxed); + CHECK_NE(m->alloc_tid, kInvalidTid); + CHECK_NE(m->free_tid, kInvalidTid); + PoisonShadow(m->Beg(), + RoundUpTo(m->UsedSize(), SHADOW_GRANULARITY), + kAsanHeapLeftRedzoneMagic); + void *p = reinterpret_cast(m->AllocBeg()); + if (p != m) { + uptr *alloc_magic = reinterpret_cast(p); + CHECK_EQ(alloc_magic[0], kAllocBegMagic); + // Clear the magic value, as allocator internals may overwrite the + // contents of deallocated chunk, confusing GetAsanChunk lookup. + alloc_magic[0] = 0; + CHECK_EQ(alloc_magic[1], reinterpret_cast(m)); + } + + // Statistics. + AsanStats &thread_stats = GetCurrentThreadStats(); + thread_stats.real_frees++; + thread_stats.really_freed += m->UsedSize(); + + get_allocator().Deallocate(cache_, p); + } + + void *Allocate(uptr size) { + void *res = get_allocator().Allocate(cache_, size, 1); + // TODO(alekseys): Consider making quarantine OOM-friendly. + if (UNLIKELY(!res)) + ReportOutOfMemory(size, stack_); + return res; + } + + void Deallocate(void *p) { + get_allocator().Deallocate(cache_, p); + } + + private: + AllocatorCache* const cache_; + BufferedStackTrace* const stack_; +}; + +typedef Quarantine AsanQuarantine; +typedef AsanQuarantine::Cache QuarantineCache; + +void AsanMapUnmapCallback::OnMap(uptr p, uptr size) const { + PoisonShadow(p, size, kAsanHeapLeftRedzoneMagic); + // Statistics. + AsanStats &thread_stats = GetCurrentThreadStats(); + thread_stats.mmaps++; + thread_stats.mmaped += size; +} +void AsanMapUnmapCallback::OnUnmap(uptr p, uptr size) const { + PoisonShadow(p, size, 0); + // We are about to unmap a chunk of user memory. + // Mark the corresponding shadow memory as not needed. + FlushUnneededASanShadowMemory(p, size); + // Statistics. + AsanStats &thread_stats = GetCurrentThreadStats(); + thread_stats.munmaps++; + thread_stats.munmaped += size; +} + +// We can not use THREADLOCAL because it is not supported on some of the +// platforms we care about (OSX 10.6, Android). +// static THREADLOCAL AllocatorCache cache; +AllocatorCache *GetAllocatorCache(AsanThreadLocalMallocStorage *ms) { + CHECK(ms); + return &ms->allocator_cache; +} + +QuarantineCache *GetQuarantineCache(AsanThreadLocalMallocStorage *ms) { + CHECK(ms); + CHECK_LE(sizeof(QuarantineCache), sizeof(ms->quarantine_cache)); + return reinterpret_cast(ms->quarantine_cache); +} + +void AllocatorOptions::SetFrom(const Flags *f, const CommonFlags *cf) { + quarantine_size_mb = f->quarantine_size_mb; + thread_local_quarantine_size_kb = f->thread_local_quarantine_size_kb; + min_redzone = f->redzone; + max_redzone = f->max_redzone; + may_return_null = cf->allocator_may_return_null; + alloc_dealloc_mismatch = f->alloc_dealloc_mismatch; + release_to_os_interval_ms = cf->allocator_release_to_os_interval_ms; +} + +void AllocatorOptions::CopyTo(Flags *f, CommonFlags *cf) { + f->quarantine_size_mb = quarantine_size_mb; + f->thread_local_quarantine_size_kb = thread_local_quarantine_size_kb; + f->redzone = min_redzone; + f->max_redzone = max_redzone; + cf->allocator_may_return_null = may_return_null; + f->alloc_dealloc_mismatch = alloc_dealloc_mismatch; + cf->allocator_release_to_os_interval_ms = release_to_os_interval_ms; +} + +struct Allocator { + static const uptr kMaxAllowedMallocSize = + FIRST_32_SECOND_64(3UL << 30, 1ULL << 40); + + AsanAllocator allocator; + AsanQuarantine quarantine; + StaticSpinMutex fallback_mutex; + AllocatorCache fallback_allocator_cache; + QuarantineCache fallback_quarantine_cache; + + atomic_uint8_t rss_limit_exceeded; + + // ------------------- Options -------------------------- + atomic_uint16_t min_redzone; + atomic_uint16_t max_redzone; + atomic_uint8_t alloc_dealloc_mismatch; + + // ------------------- Initialization ------------------------ + explicit Allocator(LinkerInitialized) + : quarantine(LINKER_INITIALIZED), + fallback_quarantine_cache(LINKER_INITIALIZED) {} + + void CheckOptions(const AllocatorOptions &options) const { + CHECK_GE(options.min_redzone, 16); + CHECK_GE(options.max_redzone, options.min_redzone); + CHECK_LE(options.max_redzone, 2048); + CHECK(IsPowerOfTwo(options.min_redzone)); + CHECK(IsPowerOfTwo(options.max_redzone)); + } + + void SharedInitCode(const AllocatorOptions &options) { + CheckOptions(options); + quarantine.Init((uptr)options.quarantine_size_mb << 20, + (uptr)options.thread_local_quarantine_size_kb << 10); + atomic_store(&alloc_dealloc_mismatch, options.alloc_dealloc_mismatch, + memory_order_release); + atomic_store(&min_redzone, options.min_redzone, memory_order_release); + atomic_store(&max_redzone, options.max_redzone, memory_order_release); + } + + void InitLinkerInitialized(const AllocatorOptions &options) { + SetAllocatorMayReturnNull(options.may_return_null); + allocator.InitLinkerInitialized(options.release_to_os_interval_ms); + SharedInitCode(options); + } + + bool RssLimitExceeded() { + return atomic_load(&rss_limit_exceeded, memory_order_relaxed); + } + + void SetRssLimitExceeded(bool limit_exceeded) { + atomic_store(&rss_limit_exceeded, limit_exceeded, memory_order_relaxed); + } + + void RePoisonChunk(uptr chunk) { + // This could be a user-facing chunk (with redzones), or some internal + // housekeeping chunk, like TransferBatch. Start by assuming the former. + AsanChunk *ac = GetAsanChunk((void *)chunk); + uptr allocated_size = allocator.GetActuallyAllocatedSize((void *)ac); + uptr beg = ac->Beg(); + uptr end = ac->Beg() + ac->UsedSize(true); + uptr chunk_end = chunk + allocated_size; + if (chunk < beg && beg < end && end <= chunk_end && + ac->chunk_state == CHUNK_ALLOCATED) { + // Looks like a valid AsanChunk in use, poison redzones only. + PoisonShadow(chunk, beg - chunk, kAsanHeapLeftRedzoneMagic); + uptr end_aligned_down = RoundDownTo(end, SHADOW_GRANULARITY); + FastPoisonShadowPartialRightRedzone( + end_aligned_down, end - end_aligned_down, + chunk_end - end_aligned_down, kAsanHeapLeftRedzoneMagic); + } else { + // This is either not an AsanChunk or freed or quarantined AsanChunk. + // In either case, poison everything. + PoisonShadow(chunk, allocated_size, kAsanHeapLeftRedzoneMagic); + } + } + + void ReInitialize(const AllocatorOptions &options) { + SetAllocatorMayReturnNull(options.may_return_null); + allocator.SetReleaseToOSIntervalMs(options.release_to_os_interval_ms); + SharedInitCode(options); + + // Poison all existing allocation's redzones. + if (CanPoisonMemory()) { + allocator.ForceLock(); + allocator.ForEachChunk( + [](uptr chunk, void *alloc) { + ((Allocator *)alloc)->RePoisonChunk(chunk); + }, + this); + allocator.ForceUnlock(); + } + } + + void GetOptions(AllocatorOptions *options) const { + options->quarantine_size_mb = quarantine.GetSize() >> 20; + options->thread_local_quarantine_size_kb = quarantine.GetCacheSize() >> 10; + options->min_redzone = atomic_load(&min_redzone, memory_order_acquire); + options->max_redzone = atomic_load(&max_redzone, memory_order_acquire); + options->may_return_null = AllocatorMayReturnNull(); + options->alloc_dealloc_mismatch = + atomic_load(&alloc_dealloc_mismatch, memory_order_acquire); + options->release_to_os_interval_ms = allocator.ReleaseToOSIntervalMs(); + } + + // -------------------- Helper methods. ------------------------- + uptr ComputeRZLog(uptr user_requested_size) { + u32 rz_log = + user_requested_size <= 64 - 16 ? 0 : + user_requested_size <= 128 - 32 ? 1 : + user_requested_size <= 512 - 64 ? 2 : + user_requested_size <= 4096 - 128 ? 3 : + user_requested_size <= (1 << 14) - 256 ? 4 : + user_requested_size <= (1 << 15) - 512 ? 5 : + user_requested_size <= (1 << 16) - 1024 ? 6 : 7; + u32 min_rz = atomic_load(&min_redzone, memory_order_acquire); + u32 max_rz = atomic_load(&max_redzone, memory_order_acquire); + return Min(Max(rz_log, RZSize2Log(min_rz)), RZSize2Log(max_rz)); + } + + static uptr ComputeUserRequestedAlignmentLog(uptr user_requested_alignment) { + if (user_requested_alignment < 8) + return 0; + if (user_requested_alignment > 512) + user_requested_alignment = 512; + return Log2(user_requested_alignment) - 2; + } + + static uptr ComputeUserAlignment(uptr user_requested_alignment_log) { + if (user_requested_alignment_log == 0) + return 0; + return 1LL << (user_requested_alignment_log + 2); + } + + // We have an address between two chunks, and we want to report just one. + AsanChunk *ChooseChunk(uptr addr, AsanChunk *left_chunk, + AsanChunk *right_chunk) { + // Prefer an allocated chunk over freed chunk and freed chunk + // over available chunk. + if (left_chunk->chunk_state != right_chunk->chunk_state) { + if (left_chunk->chunk_state == CHUNK_ALLOCATED) + return left_chunk; + if (right_chunk->chunk_state == CHUNK_ALLOCATED) + return right_chunk; + if (left_chunk->chunk_state == CHUNK_QUARANTINE) + return left_chunk; + if (right_chunk->chunk_state == CHUNK_QUARANTINE) + return right_chunk; + } + // Same chunk_state: choose based on offset. + sptr l_offset = 0, r_offset = 0; + CHECK(AsanChunkView(left_chunk).AddrIsAtRight(addr, 1, &l_offset)); + CHECK(AsanChunkView(right_chunk).AddrIsAtLeft(addr, 1, &r_offset)); + if (l_offset < r_offset) + return left_chunk; + return right_chunk; + } + + // -------------------- Allocation/Deallocation routines --------------- + void *Allocate(uptr size, uptr alignment, BufferedStackTrace *stack, + AllocType alloc_type, bool can_fill) { + if (UNLIKELY(!asan_inited)) + AsanInitFromRtl(); + if (RssLimitExceeded()) { + if (AllocatorMayReturnNull()) + return nullptr; + ReportRssLimitExceeded(stack); + } + Flags &fl = *flags(); + CHECK(stack); + const uptr min_alignment = SHADOW_GRANULARITY; + const uptr user_requested_alignment_log = + ComputeUserRequestedAlignmentLog(alignment); + if (alignment < min_alignment) + alignment = min_alignment; + if (size == 0) { + // We'd be happy to avoid allocating memory for zero-size requests, but + // some programs/tests depend on this behavior and assume that malloc + // would not return NULL even for zero-size allocations. Moreover, it + // looks like operator new should never return NULL, and results of + // consecutive "new" calls must be different even if the allocated size + // is zero. + size = 1; + } + CHECK(IsPowerOfTwo(alignment)); + uptr rz_log = ComputeRZLog(size); + uptr rz_size = RZLog2Size(rz_log); + uptr rounded_size = RoundUpTo(Max(size, kChunkHeader2Size), alignment); + uptr needed_size = rounded_size + rz_size; + if (alignment > min_alignment) + needed_size += alignment; + bool using_primary_allocator = true; + // If we are allocating from the secondary allocator, there will be no + // automatic right redzone, so add the right redzone manually. + if (!PrimaryAllocator::CanAllocate(needed_size, alignment)) { + needed_size += rz_size; + using_primary_allocator = false; + } + CHECK(IsAligned(needed_size, min_alignment)); + if (size > kMaxAllowedMallocSize || needed_size > kMaxAllowedMallocSize) { + if (AllocatorMayReturnNull()) { + Report("WARNING: AddressSanitizer failed to allocate 0x%zx bytes\n", + (void*)size); + return nullptr; + } + ReportAllocationSizeTooBig(size, needed_size, kMaxAllowedMallocSize, + stack); + } + + AsanThread *t = GetCurrentThread(); + void *allocated; + if (t) { + AllocatorCache *cache = GetAllocatorCache(&t->malloc_storage()); + allocated = allocator.Allocate(cache, needed_size, 8); + } else { + SpinMutexLock l(&fallback_mutex); + AllocatorCache *cache = &fallback_allocator_cache; + allocated = allocator.Allocate(cache, needed_size, 8); + } + if (UNLIKELY(!allocated)) { + SetAllocatorOutOfMemory(); + if (AllocatorMayReturnNull()) + return nullptr; + ReportOutOfMemory(size, stack); + } + + if (*(u8 *)MEM_TO_SHADOW((uptr)allocated) == 0 && CanPoisonMemory()) { + // Heap poisoning is enabled, but the allocator provides an unpoisoned + // chunk. This is possible if CanPoisonMemory() was false for some + // time, for example, due to flags()->start_disabled. + // Anyway, poison the block before using it for anything else. + uptr allocated_size = allocator.GetActuallyAllocatedSize(allocated); + PoisonShadow((uptr)allocated, allocated_size, kAsanHeapLeftRedzoneMagic); + } + + uptr alloc_beg = reinterpret_cast(allocated); + uptr alloc_end = alloc_beg + needed_size; + uptr beg_plus_redzone = alloc_beg + rz_size; + uptr user_beg = beg_plus_redzone; + if (!IsAligned(user_beg, alignment)) + user_beg = RoundUpTo(user_beg, alignment); + uptr user_end = user_beg + size; + CHECK_LE(user_end, alloc_end); + uptr chunk_beg = user_beg - kChunkHeaderSize; + AsanChunk *m = reinterpret_cast(chunk_beg); + m->alloc_type = alloc_type; + m->rz_log = rz_log; + u32 alloc_tid = t ? t->tid() : 0; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Oct 23 17:52:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 63DE2159B10; Wed, 23 Oct 2019 17:52:27 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yyd723MNz4SYB; Wed, 23 Oct 2019 17:52:27 +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 120FE374; Wed, 23 Oct 2019 17:52:27 +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 x9NHqQVi078204; Wed, 23 Oct 2019 17:52:26 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHqQm6078203; Wed, 23 Oct 2019 17:52:26 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231752.x9NHqQm6078203@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:52:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353945 - vendor/compiler-rt/compiler-rt-r375505 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/compiler-rt/compiler-rt-r375505 X-SVN-Commit-Revision: 353945 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:52:27 -0000 Author: dim Date: Wed Oct 23 17:52:26 2019 New Revision: 353945 URL: https://svnweb.freebsd.org/changeset/base/353945 Log: Tag stripped compiler-rt trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub. Added: vendor/compiler-rt/compiler-rt-r375505/ - copied from r353944, vendor/compiler-rt/dist/ From owner-svn-src-all@freebsd.org Wed Oct 23 17:52:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 23E46159B80; Wed, 23 Oct 2019 17:52:34 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yydF5XbDz4SjW; Wed, 23 Oct 2019 17:52:33 +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 2949937D; Wed, 23 Oct 2019 17:52:33 +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 x9NHqXNp078274; Wed, 23 Oct 2019 17:52:33 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHqUv2078256; Wed, 23 Oct 2019 17:52:30 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231752.x9NHqUv2078256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:52:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353946 - in vendor/libc++/dist: include include/experimental include/ext src src/experimental src/filesystem X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/libc++/dist: include include/experimental include/ext src src/experimental src/filesystem X-SVN-Commit-Revision: 353946 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:52:34 -0000 Author: dim Date: Wed Oct 23 17:52:30 2019 New Revision: 353946 URL: https://svnweb.freebsd.org/changeset/base/353946 Log: Vendor import of stripped libc++ trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/libcxx/trunk@375505 Added: vendor/libc++/dist/include/execution Modified: vendor/libc++/dist/include/__config vendor/libc++/dist/include/__functional_base vendor/libc++/dist/include/__libcpp_version vendor/libc++/dist/include/__locale vendor/libc++/dist/include/__mutex_base vendor/libc++/dist/include/__split_buffer vendor/libc++/dist/include/__string vendor/libc++/dist/include/__threading_support vendor/libc++/dist/include/__tuple vendor/libc++/dist/include/algorithm vendor/libc++/dist/include/atomic vendor/libc++/dist/include/bit vendor/libc++/dist/include/chrono vendor/libc++/dist/include/cmath vendor/libc++/dist/include/cstdio vendor/libc++/dist/include/deque vendor/libc++/dist/include/experimental/coroutine vendor/libc++/dist/include/ext/hash_map vendor/libc++/dist/include/ext/hash_set vendor/libc++/dist/include/filesystem vendor/libc++/dist/include/fstream vendor/libc++/dist/include/functional vendor/libc++/dist/include/istream vendor/libc++/dist/include/map vendor/libc++/dist/include/memory vendor/libc++/dist/include/module.modulemap vendor/libc++/dist/include/mutex vendor/libc++/dist/include/new vendor/libc++/dist/include/numeric vendor/libc++/dist/include/ostream vendor/libc++/dist/include/random vendor/libc++/dist/include/regex vendor/libc++/dist/include/set vendor/libc++/dist/include/string vendor/libc++/dist/include/string_view vendor/libc++/dist/include/thread vendor/libc++/dist/include/tuple vendor/libc++/dist/include/type_traits vendor/libc++/dist/include/utility vendor/libc++/dist/include/vector vendor/libc++/dist/src/CMakeLists.txt vendor/libc++/dist/src/algorithm.cpp vendor/libc++/dist/src/chrono.cpp vendor/libc++/dist/src/condition_variable.cpp vendor/libc++/dist/src/debug.cpp vendor/libc++/dist/src/experimental/memory_resource.cpp vendor/libc++/dist/src/filesystem/directory_iterator.cpp vendor/libc++/dist/src/filesystem/int128_builtins.cpp vendor/libc++/dist/src/filesystem/operations.cpp vendor/libc++/dist/src/iostream.cpp vendor/libc++/dist/src/memory.cpp vendor/libc++/dist/src/mutex.cpp vendor/libc++/dist/src/shared_mutex.cpp vendor/libc++/dist/src/thread.cpp vendor/libc++/dist/src/utility.cpp vendor/libc++/dist/src/valarray.cpp Modified: vendor/libc++/dist/include/__config ============================================================================== --- vendor/libc++/dist/include/__config Wed Oct 23 17:52:26 2019 (r353945) +++ vendor/libc++/dist/include/__config Wed Oct 23 17:52:30 2019 (r353946) @@ -32,7 +32,7 @@ # define _GNUC_VER_NEW 0 #endif -#define _LIBCPP_VERSION 9000 +#define _LIBCPP_VERSION 10000 #ifndef _LIBCPP_ABI_VERSION # define _LIBCPP_ABI_VERSION 1 @@ -183,10 +183,6 @@ # define _LIBCPP_COMPILER_IBM #endif -#ifndef _LIBCPP_CLANG_VER -#define _LIBCPP_CLANG_VER 0 -#endif - #if defined(_LIBCPP_COMPILER_GCC) && __cplusplus < 201103L #error "libc++ does not support using GCC with C++03. Please enable C++11" #endif @@ -246,6 +242,7 @@ #ifdef __FreeBSD__ # include +# include # if _BYTE_ORDER == _LITTLE_ENDIAN # define _LIBCPP_LITTLE_ENDIAN # else // _BYTE_ORDER == _LITTLE_ENDIAN @@ -483,11 +480,14 @@ typedef __char32_t char32_t; #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) -// No apple compilers support ""d and ""y at this time. -#if _LIBCPP_CLANG_VER < 800 || defined(__apple_build_version__) -#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS +// Literal operators ""d and ""y are supported starting with LLVM Clang 8 and AppleClang 10.0.1 +#if (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER < 800) || \ + (defined(__apple_build_version__) && __apple_build_version__ < 10010000) +#define _LIBCPP_HAS_NO_CXX20_CHRONO_LITERALS #endif +#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ + #elif defined(_LIBCPP_COMPILER_GCC) #define _ALIGNAS(x) __attribute__((__aligned__(x))) @@ -523,6 +523,8 @@ typedef __char32_t char32_t; #define _LIBCPP_ALWAYS_INLINE __attribute__ ((__always_inline__)) +#define _LIBCPP_DISABLE_EXTENSION_WARNING __extension__ + #elif defined(_LIBCPP_COMPILER_MSVC) #define _LIBCPP_TOSTRING2(x) #x @@ -548,6 +550,8 @@ typedef __char32_t char32_t; #define _LIBCPP_HAS_NO_VECTOR_EXTENSION +#define _LIBCPP_DISABLE_EXTENSION_WARNING + #elif defined(_LIBCPP_COMPILER_IBM) #define _ALIGNAS(x) __attribute__((__aligned__(x))) @@ -568,6 +572,8 @@ typedef __char32_t char32_t; #define _LIBCPP_HAS_NO_VECTOR_EXTENSION +#define _LIBCPP_DISABLE_EXTENSION_WARNING + #endif // _LIBCPP_COMPILER_[CLANG|GCC|MSVC|IBM] #if defined(_LIBCPP_OBJECT_FORMAT_COFF) @@ -958,6 +964,20 @@ typedef unsigned int char32_t; # define _LIBCPP_DEPRECATED_IN_CXX17 #endif +// Macros to enter and leave a state where deprecation warnings are suppressed. +#if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH) && \ + (defined(_LIBCPP_COMPILER_CLANG) || defined(_LIBCPP_COMPILER_GCC)) +# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH \ + _Pragma("GCC diagnostic push") \ + _Pragma("GCC diagnostic ignored \"-Wdeprecated\"") +# define _LIBCPP_SUPPRESS_DEPRECATED_POP \ + _Pragma("GCC diagnostic pop") +#endif +#if !defined(_LIBCPP_SUPPRESS_DEPRECATED_PUSH) +# define _LIBCPP_SUPPRESS_DEPRECATED_PUSH +# define _LIBCPP_SUPPRESS_DEPRECATED_POP +#endif + #if _LIBCPP_STD_VER <= 11 # define _LIBCPP_EXPLICIT_AFTER_CXX11 #else @@ -1082,6 +1102,16 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_ # endif // _LIBCPP_HAS_THREAD_API #endif // _LIBCPP_HAS_NO_THREADS +#if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) +#if defined(__ANDROID__) && __ANDROID_API__ >= 30 +#define _LIBCPP_HAS_COND_CLOCKWAIT +#elif defined(_LIBCPP_GLIBC_PREREQ) +#if _LIBCPP_GLIBC_PREREQ(2, 30) +#define _LIBCPP_HAS_COND_CLOCKWAIT +#endif +#endif +#endif + #if defined(_LIBCPP_HAS_NO_THREADS) && defined(_LIBCPP_HAS_THREAD_API_PTHREAD) #error _LIBCPP_HAS_THREAD_API_PTHREAD may only be defined when \ _LIBCPP_HAS_NO_THREADS is not defined. @@ -1097,17 +1127,35 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_ _LIBCPP_HAS_NO_THREADS is defined. #endif -// The Apple, glibc, and Bionic implementation of pthreads implements +#if defined(__STDCPP_THREADS__) && defined(_LIBCPP_HAS_NO_THREADS) +#error _LIBCPP_HAS_NO_THREADS cannot be set when __STDCPP_THREADS__ is set. +#endif + +#if !defined(_LIBCPP_HAS_NO_THREADS) && !defined(__STDCPP_THREADS__) +#define __STDCPP_THREADS__ 1 +#endif + +// The glibc and Bionic implementation of pthreads implements // pthread_mutex_destroy as nop for regular mutexes. Additionally, Win32 // mutexes have no destroy mechanism. -// TODO(EricWF): Enable this optimization on Apple and Bionic platforms after -// speaking to their respective stakeholders. +// +// This optimization can't be performed on Apple platforms, where +// pthread_mutex_destroy can allow the kernel to release resources. +// See https://llvm.org/D64298 for details. +// +// TODO(EricWF): Enable this optimization on Bionic after speaking to their +// respective stakeholders. #if (defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && defined(__GLIBC__)) \ || defined(_LIBCPP_HAS_THREAD_API_WIN32) # define _LIBCPP_HAS_TRIVIAL_MUTEX_DESTRUCTION #endif // Destroying a condvar is a nop on Windows. +// +// This optimization can't be performed on Apple platforms, where +// pthread_cond_destroy can allow the kernel to release resources. +// See https://llvm.org/D64298 for details. +// // TODO(EricWF): This is potentially true for some pthread implementations // as well. #if defined(_LIBCPP_HAS_THREAD_API_WIN32) @@ -1129,6 +1177,14 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_ #define _LIBCPP_HAS_NO_STDOUT #endif +// Some systems do not provide gets() in their C library, for security reasons. +#ifndef _LIBCPP_C_HAS_NO_GETS +# if defined(_LIBCPP_MSVCRT) || \ + (defined(__FreeBSD_version) && __FreeBSD_version >= 1300043) +# define _LIBCPP_C_HAS_NO_GETS +# endif +#endif + #if defined(__BIONIC__) || defined(__CloudABI__) || \ defined(__Fuchsia__) || defined(__wasi__) || defined(_LIBCPP_HAS_MUSL_LIBC) #define _LIBCPP_PROVIDES_DEFAULT_RUNE_TABLE @@ -1224,7 +1280,7 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_ #ifndef _LIBCPP_NODEBUG_TYPE #if __has_attribute(__nodebug__) && \ - (defined(_LIBCPP_COMPILER_CLANG) && _LIBCPP_CLANG_VER >= 900) + (defined(_LIBCPP_CLANG_VER) && _LIBCPP_CLANG_VER >= 900) #define _LIBCPP_NODEBUG_TYPE __attribute__((nodebug)) #else #define _LIBCPP_NODEBUG_TYPE @@ -1410,6 +1466,17 @@ _LIBCPP_FUNC_VIS extern "C" void __sanitizer_annotate_ #endif // _LIBCPP_NO_AUTO_LINK #define _LIBCPP_UNUSED_VAR(x) ((void)(x)) + +// Configures the fopen close-on-exec mode character, if any. This string will +// be appended to any mode string used by fstream for fopen/fdopen. +// +// Not all platforms support this, but it helps avoid fd-leaks on platforms that +// do. +#if defined(__BIONIC__) +# define _LIBCPP_FOPEN_CLOEXEC_MODE "e" +#else +# define _LIBCPP_FOPEN_CLOEXEC_MODE +#endif #endif // __cplusplus Modified: vendor/libc++/dist/include/__functional_base ============================================================================== --- vendor/libc++/dist/include/__functional_base Wed Oct 23 17:52:26 2019 (r353945) +++ vendor/libc++/dist/include/__functional_base Wed Oct 23 17:52:30 2019 (r353946) @@ -558,7 +558,7 @@ struct __is_transparent<_Tp, _Up, // allocator_arg_t -struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { }; +struct _LIBCPP_TEMPLATE_VIS allocator_arg_t { explicit allocator_arg_t() = default; }; #if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) extern _LIBCPP_EXPORTED_FROM_ABI const allocator_arg_t allocator_arg; Modified: vendor/libc++/dist/include/__libcpp_version ============================================================================== --- vendor/libc++/dist/include/__libcpp_version Wed Oct 23 17:52:26 2019 (r353945) +++ vendor/libc++/dist/include/__libcpp_version Wed Oct 23 17:52:30 2019 (r353946) @@ -1 +1 @@ -9000 +10000 Modified: vendor/libc++/dist/include/__locale ============================================================================== --- vendor/libc++/dist/include/__locale Wed Oct 23 17:52:26 2019 (r353945) +++ vendor/libc++/dist/include/__locale Wed Oct 23 17:52:30 2019 (r353946) @@ -409,7 +409,7 @@ class _LIBCPP_TYPE_VIS ctype_base (public) static const mask xdigit = _ISxdigit; static const mask blank = _ISblank; #if defined(__mips__) - static const mask __regex_word = static_cast(_ISbit(15)); + static const mask __regex_word = static_cast(_ISbit(15)); #else static const mask __regex_word = 0x80; #endif Modified: vendor/libc++/dist/include/__mutex_base ============================================================================== --- vendor/libc++/dist/include/__mutex_base Wed Oct 23 17:52:26 2019 (r353945) +++ vendor/libc++/dist/include/__mutex_base Wed Oct 23 17:52:30 2019 (r353946) @@ -15,6 +15,7 @@ #include #include <__threading_support> +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header @@ -65,9 +66,9 @@ class _LIBCPP_TYPE_VIS _LIBCPP_THREAD_SAFETY_ANNOTATIO static_assert(is_nothrow_default_constructible::value, "the default constructor for std::mutex must be nothrow"); -struct _LIBCPP_TYPE_VIS defer_lock_t {}; -struct _LIBCPP_TYPE_VIS try_to_lock_t {}; -struct _LIBCPP_TYPE_VIS adopt_lock_t {}; +struct _LIBCPP_TYPE_VIS defer_lock_t { explicit defer_lock_t() = default; }; +struct _LIBCPP_TYPE_VIS try_to_lock_t { explicit try_to_lock_t() = default; }; +struct _LIBCPP_TYPE_VIS adopt_lock_t { explicit adopt_lock_t() = default; }; #if defined(_LIBCPP_CXX03_LANG) || defined(_LIBCPP_BUILDING_LIBRARY) @@ -94,10 +95,11 @@ lock_guard (private) mutex_type& __m_; public: - _LIBCPP_INLINE_VISIBILITY + _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY explicit lock_guard(mutex_type& __m) _LIBCPP_THREAD_SAFETY_ANNOTATION(acquire_capability(__m)) : __m_(__m) {__m_.lock();} - _LIBCPP_INLINE_VISIBILITY + + _LIBCPP_NODISCARD_EXT _LIBCPP_INLINE_VISIBILITY lock_guard(mutex_type& __m, adopt_lock_t) _LIBCPP_THREAD_SAFETY_ANNOTATION(requires_capability(__m)) : __m_(__m) {} _LIBCPP_INLINE_VISIBILITY @@ -336,25 +338,77 @@ class _LIBCPP_TYPE_VIS condition_variable (public) private: void __do_timed_wait(unique_lock& __lk, chrono::time_point) _NOEXCEPT; +#if defined(_LIBCPP_HAS_COND_CLOCKWAIT) + void __do_timed_wait(unique_lock& __lk, + chrono::time_point) _NOEXCEPT; +#endif + template + void __do_timed_wait(unique_lock& __lk, + chrono::time_point<_Clock, chrono::nanoseconds>) _NOEXCEPT; }; #endif // !_LIBCPP_HAS_NO_THREADS -template +template inline _LIBCPP_INLINE_VISIBILITY typename enable_if < - chrono::__is_duration<_To>::value, - _To + is_floating_point<_Rep>::value, + chrono::nanoseconds >::type -__ceil(chrono::duration<_Rep, _Period> __d) +__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) { using namespace chrono; - _To __r = duration_cast<_To>(__d); - if (__r < __d) - ++__r; - return __r; + using __ratio = ratio_divide<_Period, nano>; + using __ns_rep = nanoseconds::rep; + _Rep __result_float = __d.count() * __ratio::num / __ratio::den; + + _Rep __result_max = numeric_limits<__ns_rep>::max(); + if (__result_float >= __result_max) { + return nanoseconds::max(); + } + + _Rep __result_min = numeric_limits<__ns_rep>::min(); + if (__result_float <= __result_min) { + return nanoseconds::min(); + } + + return nanoseconds(static_cast<__ns_rep>(__result_float)); } +template +inline _LIBCPP_INLINE_VISIBILITY +typename enable_if +< + !is_floating_point<_Rep>::value, + chrono::nanoseconds +>::type +__safe_nanosecond_cast(chrono::duration<_Rep, _Period> __d) +{ + using namespace chrono; + if (__d.count() == 0) { + return nanoseconds(0); + } + + using __ratio = ratio_divide<_Period, nano>; + using __ns_rep = nanoseconds::rep; + __ns_rep __result_max = std::numeric_limits<__ns_rep>::max(); + if (__d.count() > 0 && __d.count() > __result_max / __ratio::num) { + return nanoseconds::max(); + } + + __ns_rep __result_min = std::numeric_limits<__ns_rep>::min(); + if (__d.count() < 0 && __d.count() < __result_min / __ratio::num) { + return nanoseconds::min(); + } + + __ns_rep __result = __d.count() * __ratio::num / __ratio::den; + if (__result == 0) { + return nanoseconds(1); + } + + return nanoseconds(__result); +} + #ifndef _LIBCPP_HAS_NO_THREADS template void @@ -370,7 +424,15 @@ condition_variable::wait_until(unique_lock& __l const chrono::time_point<_Clock, _Duration>& __t) { using namespace chrono; - wait_for(__lk, __t - _Clock::now()); + using __clock_tp_ns = time_point<_Clock, nanoseconds>; + + typename _Clock::time_point __now = _Clock::now(); + if (__t <= __now) + return cv_status::timeout; + + __clock_tp_ns __t_ns = __clock_tp_ns(__safe_nanosecond_cast(__t.time_since_epoch())); + + __do_timed_wait(__lk, __t_ns); return _Clock::now() < __t ? cv_status::no_timeout : cv_status::timeout; } @@ -396,15 +458,25 @@ condition_variable::wait_for(unique_lock& __lk, using namespace chrono; if (__d <= __d.zero()) return cv_status::timeout; - typedef time_point > __sys_tpf; - typedef time_point __sys_tpi; - __sys_tpf _Max = __sys_tpi::max(); + using __ns_rep = nanoseconds::rep; steady_clock::time_point __c_now = steady_clock::now(); - system_clock::time_point __s_now = system_clock::now(); - if (_Max - __d > __s_now) - __do_timed_wait(__lk, __s_now + __ceil(__d)); - else - __do_timed_wait(__lk, __sys_tpi::max()); + +#if defined(_LIBCPP_HAS_COND_CLOCKWAIT) + using __clock_tp_ns = time_point; + __ns_rep __now_count_ns = __safe_nanosecond_cast(__c_now.time_since_epoch()).count(); +#else + using __clock_tp_ns = time_point; + __ns_rep __now_count_ns = __safe_nanosecond_cast(system_clock::now().time_since_epoch()).count(); +#endif + + __ns_rep __d_ns_count = __safe_nanosecond_cast(__d).count(); + + if (__now_count_ns > numeric_limits<__ns_rep>::max() - __d_ns_count) { + __do_timed_wait(__lk, __clock_tp_ns::max()); + } else { + __do_timed_wait(__lk, __clock_tp_ns(nanoseconds(__now_count_ns + __d_ns_count))); + } + return steady_clock::now() - __c_now < __d ? cv_status::no_timeout : cv_status::timeout; } @@ -418,6 +490,46 @@ condition_variable::wait_for(unique_lock& __lk, { return wait_until(__lk, chrono::steady_clock::now() + __d, _VSTD::move(__pred)); +} + +#if defined(_LIBCPP_HAS_COND_CLOCKWAIT) +inline +void +condition_variable::__do_timed_wait(unique_lock& __lk, + chrono::time_point __tp) _NOEXCEPT +{ + using namespace chrono; + if (!__lk.owns_lock()) + __throw_system_error(EPERM, + "condition_variable::timed wait: mutex not locked"); + nanoseconds __d = __tp.time_since_epoch(); + timespec __ts; + seconds __s = duration_cast(__d); + using __ts_sec = decltype(__ts.tv_sec); + const __ts_sec __ts_sec_max = numeric_limits<__ts_sec>::max(); + if (__s.count() < __ts_sec_max) + { + __ts.tv_sec = static_cast<__ts_sec>(__s.count()); + __ts.tv_nsec = (__d - __s).count(); + } + else + { + __ts.tv_sec = __ts_sec_max; + __ts.tv_nsec = giga::num - 1; + } + int __ec = pthread_cond_clockwait(&__cv_, __lk.mutex()->native_handle(), CLOCK_MONOTONIC, &__ts); + if (__ec != 0 && __ec != ETIMEDOUT) + __throw_system_error(__ec, "condition_variable timed_wait failed"); +} +#endif // _LIBCPP_HAS_COND_CLOCKWAIT + +template +inline +void +condition_variable::__do_timed_wait(unique_lock& __lk, + chrono::time_point<_Clock, chrono::nanoseconds> __tp) _NOEXCEPT +{ + wait_for(__lk, __tp - _Clock::now()); } #endif // !_LIBCPP_HAS_NO_THREADS Modified: vendor/libc++/dist/include/__split_buffer ============================================================================== --- vendor/libc++/dist/include/__split_buffer Wed Oct 23 17:52:26 2019 (r353945) +++ vendor/libc++/dist/include/__split_buffer Wed Oct 23 17:52:30 2019 (r353946) @@ -161,6 +161,19 @@ struct __split_buffer (private) _LIBCPP_INLINE_VISIBILITY void __move_assign_alloc(__split_buffer&, false_type) _NOEXCEPT {} + + struct _ConstructTransaction { + explicit _ConstructTransaction(pointer* __p, size_type __n) _NOEXCEPT + : __pos_(*__p), __end_(*__p + __n), __dest_(__p) { + } + ~_ConstructTransaction() { + *__dest_ = __pos_; + } + pointer __pos_; + const pointer __end_; + private: + pointer *__dest_; + }; }; template @@ -197,13 +210,10 @@ template void __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n) { - __alloc_rr& __a = this->__alloc(); - do - { - __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_)); - ++this->__end_; - --__n; - } while (__n > 0); + _ConstructTransaction __tx(&this->__end_, __n); + for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { + __alloc_traits::construct(this->__alloc(), _VSTD::__to_raw_pointer(__tx.__pos_)); + } } // Copy constructs __n objects starting at __end_ from __x @@ -216,13 +226,11 @@ template void __split_buffer<_Tp, _Allocator>::__construct_at_end(size_type __n, const_reference __x) { - __alloc_rr& __a = this->__alloc(); - do - { - __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), __x); - ++this->__end_; - --__n; - } while (__n > 0); + _ConstructTransaction __tx(&this->__end_, __n); + for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_) { + __alloc_traits::construct(this->__alloc(), + _VSTD::__to_raw_pointer(__tx.__pos_), __x); + } } template @@ -262,11 +270,10 @@ typename enable_if >::type __split_buffer<_Tp, _Allocator>::__construct_at_end(_ForwardIterator __first, _ForwardIterator __last) { - __alloc_rr& __a = this->__alloc(); - for (; __first != __last; ++__first) - { - __alloc_traits::construct(__a, _VSTD::__to_raw_pointer(this->__end_), *__first); - ++this->__end_; + _ConstructTransaction __tx(&this->__end_, std::distance(__first, __last)); + for (; __tx.__pos_ != __tx.__end_; ++__tx.__pos_, ++__first) { + __alloc_traits::construct(this->__alloc(), + _VSTD::__to_raw_pointer(__tx.__pos_), *__first); } } Modified: vendor/libc++/dist/include/__string ============================================================================== --- vendor/libc++/dist/include/__string Wed Oct 23 17:52:26 2019 (r353945) +++ vendor/libc++/dist/include/__string Wed Oct 23 17:52:30 2019 (r353946) @@ -351,6 +351,18 @@ char_traits::compare(const char_type* __s1, c #endif } + +template +_LIBCPP_INLINE_VISIBILITY +_LIBCPP_CONSTEXPR +inline size_t __char_traits_length_checked(const typename _Traits::char_type* __s) _NOEXCEPT { +#if _LIBCPP_DEBUG_LEVEL >= 1 + return __s ? _Traits::length(__s) : (_VSTD::__libcpp_debug_function(_VSTD::__libcpp_debug_info(__FILE__, __LINE__, "p == nullptr", "null pointer pass to non-null argument of char_traits<...>::length")), 0); +#else + return _Traits::length(__s); +#endif +} + inline _LIBCPP_CONSTEXPR_AFTER_CXX14 size_t char_traits::length(const char_type* __s) _NOEXCEPT Modified: vendor/libc++/dist/include/__threading_support ============================================================================== --- vendor/libc++/dist/include/__threading_support Wed Oct 23 17:52:26 2019 (r353945) +++ vendor/libc++/dist/include/__threading_support Wed Oct 23 17:52:30 2019 (r353946) @@ -12,6 +12,7 @@ #include <__config> #include +#include #include #ifndef _LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER @@ -22,16 +23,11 @@ # include <__external_threading> #elif !defined(_LIBCPP_HAS_NO_THREADS) -typedef ::timespec __libcpp_timespec_t; - #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) # include # include #endif -_LIBCPP_PUSH_MACROS -#include <__undef_macros> - #if defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL) || \ defined(_LIBCPP_HAS_THREAD_API_WIN32) @@ -46,8 +42,16 @@ _LIBCPP_PUSH_MACROS #define _LIBCPP_NO_THREAD_SAFETY_ANALYSIS #endif +typedef ::timespec __libcpp_timespec_t; +#endif // !defined(_LIBCPP_HAS_NO_THREADS) + +_LIBCPP_PUSH_MACROS +#include <__undef_macros> + _LIBCPP_BEGIN_NAMESPACE_STD +#if !defined(_LIBCPP_HAS_NO_THREADS) + #if defined(_LIBCPP_HAS_THREAD_API_PTHREAD) // Mutex typedef pthread_mutex_t __libcpp_mutex_t; @@ -75,7 +79,7 @@ typedef pthread_t __libcpp_thread_t; typedef pthread_key_t __libcpp_tls_key; #define _LIBCPP_TLS_DESTRUCTOR_CC -#else +#elif !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) // Mutex typedef void* __libcpp_mutex_t; #define _LIBCPP_MUTEX_INITIALIZER 0 @@ -108,8 +112,9 @@ typedef void* __libcpp_thread_t; typedef long __libcpp_tls_key; #define _LIBCPP_TLS_DESTRUCTOR_CC __stdcall -#endif +#endif // !defined(_LIBCPP_HAS_THREAD_API_PTHREAD) && !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) +#if !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) // Mutex _LIBCPP_THREAD_ABI_VISIBILITY int __libcpp_recursive_mutex_init(__libcpp_recursive_mutex_t *__m); @@ -204,6 +209,8 @@ void *__libcpp_tls_get(__libcpp_tls_key __key); _LIBCPP_THREAD_ABI_VISIBILITY int __libcpp_tls_set(__libcpp_tls_key __key, void *__p); +#endif // !defined(_LIBCPP_HAS_THREAD_API_EXTERNAL) + #if (!defined(_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL) || \ defined(_LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL)) && \ defined(_LIBCPP_HAS_THREAD_API_PTHREAD) @@ -394,10 +401,90 @@ int __libcpp_tls_set(__libcpp_tls_key __key, void *__p #endif // !_LIBCPP_HAS_THREAD_LIBRARY_EXTERNAL || _LIBCPP_BUILDING_THREAD_LIBRARY_EXTERNAL -_LIBCPP_END_NAMESPACE_STD +class _LIBCPP_TYPE_VIS thread; +class _LIBCPP_TYPE_VIS __thread_id; -_LIBCPP_POP_MACROS +namespace this_thread +{ +_LIBCPP_INLINE_VISIBILITY __thread_id get_id() _NOEXCEPT; + +} // this_thread + +template<> struct hash<__thread_id>; + +class _LIBCPP_TEMPLATE_VIS __thread_id +{ + // FIXME: pthread_t is a pointer on Darwin but a long on Linux. + // NULL is the no-thread value on Darwin. Someone needs to check + // on other platforms. We assume 0 works everywhere for now. + __libcpp_thread_id __id_; + +public: + _LIBCPP_INLINE_VISIBILITY + __thread_id() _NOEXCEPT : __id_(0) {} + + friend _LIBCPP_INLINE_VISIBILITY + bool operator==(__thread_id __x, __thread_id __y) _NOEXCEPT + { // don't pass id==0 to underlying routines + if (__x.__id_ == 0) return __y.__id_ == 0; + if (__y.__id_ == 0) return false; + return __libcpp_thread_id_equal(__x.__id_, __y.__id_); + } + friend _LIBCPP_INLINE_VISIBILITY + bool operator!=(__thread_id __x, __thread_id __y) _NOEXCEPT + {return !(__x == __y);} + friend _LIBCPP_INLINE_VISIBILITY + bool operator< (__thread_id __x, __thread_id __y) _NOEXCEPT + { // id==0 is always less than any other thread_id + if (__x.__id_ == 0) return __y.__id_ != 0; + if (__y.__id_ == 0) return false; + return __libcpp_thread_id_less(__x.__id_, __y.__id_); + } + friend _LIBCPP_INLINE_VISIBILITY + bool operator<=(__thread_id __x, __thread_id __y) _NOEXCEPT + {return !(__y < __x);} + friend _LIBCPP_INLINE_VISIBILITY + bool operator> (__thread_id __x, __thread_id __y) _NOEXCEPT + {return __y < __x ;} + friend _LIBCPP_INLINE_VISIBILITY + bool operator>=(__thread_id __x, __thread_id __y) _NOEXCEPT + {return !(__x < __y);} + + _LIBCPP_INLINE_VISIBILITY + void __reset() { __id_ = 0; } + + template + friend + _LIBCPP_INLINE_VISIBILITY + basic_ostream<_CharT, _Traits>& + operator<<(basic_ostream<_CharT, _Traits>& __os, __thread_id __id); + +private: + _LIBCPP_INLINE_VISIBILITY + __thread_id(__libcpp_thread_id __id) : __id_(__id) {} + + friend __thread_id this_thread::get_id() _NOEXCEPT; + friend class _LIBCPP_TYPE_VIS thread; + friend struct _LIBCPP_TEMPLATE_VIS hash<__thread_id>; +}; + +namespace this_thread +{ + +inline _LIBCPP_INLINE_VISIBILITY +__thread_id +get_id() _NOEXCEPT +{ + return __libcpp_thread_get_current_id(); +} + +} // this_thread + #endif // !_LIBCPP_HAS_NO_THREADS + +_LIBCPP_END_NAMESPACE_STD + +_LIBCPP_POP_MACROS #endif // _LIBCPP_THREADING_SUPPORT Modified: vendor/libc++/dist/include/__tuple ============================================================================== --- vendor/libc++/dist/include/__tuple Wed Oct 23 17:52:26 2019 (r353945) +++ vendor/libc++/dist/include/__tuple Wed Oct 23 17:52:30 2019 (r353946) @@ -477,8 +477,9 @@ using __tuple_like_with_size _LIBCPP_NODEBUG_TYPE = __ >; struct _LIBCPP_TYPE_VIS __check_tuple_constructor_fail { - template - static constexpr bool __enable_default() { return false; } + + static constexpr bool __enable_explicit_default() { return false; } + static constexpr bool __enable_implicit_default() { return false; } template static constexpr bool __enable_explicit() { return false; } template Modified: vendor/libc++/dist/include/algorithm ============================================================================== --- vendor/libc++/dist/include/algorithm Wed Oct 23 17:52:26 2019 (r353945) +++ vendor/libc++/dist/include/algorithm Wed Oct 23 17:52:30 2019 (r353946) @@ -3117,10 +3117,10 @@ _SampleIterator __sample(_PopulationIterator __first, input_iterator_tag) { _Distance __k = 0; - for (; __first != __last && __k < __n; ++__first, (void)++__k) + for (; __first != __last && __k < __n; ++__first, (void) ++__k) __output_iter[__k] = *__first; _Distance __sz = __k; - for (; __first != __last; ++__first, (void)++__k) { + for (; __first != __last; ++__first, (void) ++__k) { _Distance __r = _VSTD::uniform_int_distribution<_Distance>(0, __k)(__g); if (__r < __sz) __output_iter[__r] = *__first; @@ -3190,7 +3190,7 @@ template 1) { _Dp __uid; - for (--__last, --__d; __first < __last; ++__first, --__d) + for (--__last, (void) --__d; __first < __last; ++__first, (void) --__d) { difference_type __i = __uid(__g, _Pp(0, __d)); if (__i != difference_type(0)) @@ -3373,7 +3373,7 @@ __stable_partition(_ForwardIterator __first, _ForwardI // All trues now at start of range, all falses in buffer // Move falses back into range, but don't mess up __first which points to first false __i = __first; - for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, ++__i) + for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i) *__i = _VSTD::move(*__t2); // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer return __first; @@ -3505,7 +3505,7 @@ __stable_partition(_BidirectionalIterator __first, _Bi __i = ++__first; // All trues now at start of range, all falses in buffer // Move falses back into range, but don't mess up __first which points to first false - for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, ++__i) + for (value_type* __t2 = __p.first; __t2 < __t; ++__t2, (void) ++__i) *__i = _VSTD::move(*__t2); // __h destructs moved-from values out of the temp buffer, but doesn't deallocate buffer return __first; @@ -4382,7 +4382,7 @@ merge(_InputIterator1 __first1, _InputIterator1 __last { typedef typename iterator_traits<_InputIterator1>::value_type __v1; typedef typename iterator_traits<_InputIterator2>::value_type __v2; - return merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>()); + return _VSTD::merge(__first1, __last1, __first2, __last2, __result, __less<__v1, __v2>()); } // inplace_merge @@ -4428,14 +4428,14 @@ __buffered_inplace_merge(_BidirectionalIterator __firs if (__len1 <= __len2) { value_type* __p = __buff; - for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, ++__p) + for (_BidirectionalIterator __i = __first; __i != __middle; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p) ::new(__p) value_type(_VSTD::move(*__i)); __half_inplace_merge(__buff, __p, __middle, __last, __first, __comp); } else { value_type* __p = __buff; - for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, ++__p) + for (_BidirectionalIterator __i = __middle; __i != __last; __d.__incr((value_type*)0), (void) ++__i, (void) ++__p) ::new(__p) value_type(_VSTD::move(*__i)); typedef reverse_iterator<_BidirectionalIterator> _RBi; typedef reverse_iterator _Rv; @@ -4575,14 +4575,14 @@ __merge_move_construct(_InputIterator1 __first1, _Inpu { if (__first1 == __last1) { - for (; __first2 != __last2; ++__first2, ++__result, __d.__incr((value_type*)0)) + for (; __first2 != __last2; ++__first2, ++__result, (void) __d.__incr((value_type*)0)) ::new (__result) value_type(_VSTD::move(*__first2)); __h.release(); return; } if (__first2 == __last2) { - for (; __first1 != __last1; ++__first1, ++__result, __d.__incr((value_type*)0)) + for (; __first1 != __last1; ++__first1, ++__result, (void) __d.__incr((value_type*)0)) ::new (__result) value_type(_VSTD::move(*__first1)); __h.release(); return; @@ -4612,7 +4612,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIt { if (__first2 == __last2) { - for (; __first1 != __last1; ++__first1, ++__result) + for (; __first1 != __last1; ++__first1, (void) ++__result) *__result = _VSTD::move(*__first1); return; } @@ -4627,7 +4627,7 @@ __merge_move_assign(_InputIterator1 __first1, _InputIt ++__first1; } } - for (; __first2 != __last2; ++__first2, ++__result) + for (; __first2 != __last2; ++__first2, (void) ++__result) *__result = _VSTD::move(*__first2); } @@ -4995,7 +4995,7 @@ void __sort_heap(_RandomAccessIterator __first, _RandomAccessIterator __last, _Compare __comp) { typedef typename iterator_traits<_RandomAccessIterator>::difference_type difference_type; - for (difference_type __n = __last - __first; __n > 1; --__last, --__n) + for (difference_type __n = __last - __first; __n > 1; --__last, (void) --__n) __pop_heap<_Compare>(__first, __last, __comp, __n); } @@ -5065,7 +5065,7 @@ __partial_sort_copy(_InputIterator __first, _InputIter _RandomAccessIterator __r = __result_first; if (__r != __result_last) { - for (; __first != __last && __r != __result_last; (void) ++__first, ++__r) + for (; __first != __last && __r != __result_last; ++__first, (void) ++__r) *__r = *__first; __make_heap<_Compare>(__result_first, __r, __comp); typename iterator_traits<_RandomAccessIterator>::difference_type __len = __r - __result_first; @@ -5677,5 +5677,9 @@ prev_permutation(_BidirectionalIterator __first, _Bidi _LIBCPP_END_NAMESPACE_STD _LIBCPP_POP_MACROS + +#if defined(_LIBCPP_HAS_PARALLEL_ALGORITHMS) && _LIBCPP_STD_VER >= 17 +# include <__pstl_algorithm> +#endif #endif // _LIBCPP_ALGORITHM Modified: vendor/libc++/dist/include/atomic ============================================================================== --- vendor/libc++/dist/include/atomic Wed Oct 23 17:52:26 2019 (r353945) +++ vendor/libc++/dist/include/atomic Wed Oct 23 17:52:30 2019 (r353946) @@ -920,7 +920,7 @@ struct __cxx_atomic_base_impl { #endif // _LIBCPP_CXX03_LANG _LIBCPP_CONSTEXPR explicit __cxx_atomic_base_impl(_Tp value) _NOEXCEPT : __a_value(value) {} - _Atomic(_Tp) __a_value; + _LIBCPP_DISABLE_EXTENSION_WARNING _Atomic(_Tp) __a_value; }; #define __cxx_atomic_is_lock_free(__s) __c11_atomic_is_lock_free(__s) Modified: vendor/libc++/dist/include/bit ============================================================================== --- vendor/libc++/dist/include/bit Wed Oct 23 17:52:26 2019 (r353945) +++ vendor/libc++/dist/include/bit Wed Oct 23 17:52:30 2019 (r353946) @@ -42,6 +42,13 @@ namespace std { template constexpr int popcount(T x) noexcept; // C++20 + // 20.15.9, endian + enum class endian { + little = see below, // C++20 + big = see below, // C++20 + native = see below // C++20 +}; + } // namespace std */ @@ -455,6 +462,20 @@ log2p1(_Tp __t) noexcept { return __t == 0 ? 0 : __bit_log2(__t) + 1; } + + +enum class endian +{ + little = 0xDEAD, + big = 0xFACE, +#if defined(_LIBCPP_LITTLE_ENDIAN) + native = little +#elif defined(_LIBCPP_BIG_ENDIAN) + native = big +#else + native = 0xCAFE +#endif +}; #endif // _LIBCPP_STD_VER > 17 Modified: vendor/libc++/dist/include/chrono ============================================================================== --- vendor/libc++/dist/include/chrono Wed Oct 23 17:52:26 2019 (r353945) +++ vendor/libc++/dist/include/chrono Wed Oct 23 17:52:30 2019 (r353946) @@ -612,14 +612,44 @@ constexpr year_month_weekday_last constexpr year_month_weekday_last operator/(const month_weekday_last& mwdl, int y) noexcept; -// 25.9, class template time_of_day // C++20 -template class time_of_day; +// 26.9, class template hh_mm_ss +template +class hh_mm_ss +{ + bool is_neg; // exposition only + chrono::hours h; // exposition only + chrono::minutes m; // exposition only + chrono::seconds s; // exposition only + precision ss; // exposition only -template<> class time_of_day; -template<> class time_of_day; -template<> class time_of_day; -template class time_of_day>; +public: + static unsigned constexpr fractional_width = see below; + using precision = see below; + constexpr hh_mm_ss() noexcept : hh_mm_ss{Duration::zero()} {} + constexpr explicit hh_mm_ss(Duration d) noexcept; + + constexpr bool is_negative() const noexcept; + constexpr chrono::hours hours() const noexcept; + constexpr chrono::minutes minutes() const noexcept; + constexpr chrono::seconds seconds() const noexcept; + constexpr precision subseconds() const noexcept; + + constexpr explicit operator precision() const noexcept; + constexpr precision to_duration() const noexcept; +}; + +template + basic_ostream& + operator<<(basic_ostream& os, hh_mm_ss const& hms); + +// 26.10, 12/24 hour functions +constexpr bool is_am(hours const& h) noexcept; +constexpr bool is_pm(hours const& h) noexcept; +constexpr hours make12(const hours& h) noexcept; +constexpr hours make24(const hours& h, bool is_pm) noexcept; + + // 25.10.2, time zone database // C++20 struct tzdb; class tzdb_list; @@ -1428,7 +1458,7 @@ typename enable_if >::type abs(duration<_Rep, _Period> __d) { - return __d >= __d.zero() ? __d : -__d; + return __d >= __d.zero() ? +__d : -__d; } #endif @@ -1810,7 +1840,7 @@ class weekday { (private) unsigned char __wd; public: weekday() = default; - inline explicit constexpr weekday(unsigned __val) noexcept : __wd(static_cast(__val)) {} + inline explicit constexpr weekday(unsigned __val) noexcept : __wd(static_cast(__val == 7 ? 0 : __val)) {} inline constexpr weekday(const sys_days& __sysd) noexcept : __wd(__weekday_from_days(__sysd.time_since_epoch().count())) {} inline explicit constexpr weekday(const local_days& __locd) noexcept @@ -1822,7 +1852,8 @@ class weekday { (private) inline constexpr weekday operator--(int) noexcept { weekday __tmp = *this; --(*this); return __tmp; } constexpr weekday& operator+=(const days& __dd) noexcept; constexpr weekday& operator-=(const days& __dd) noexcept; - inline explicit constexpr operator unsigned() const noexcept { return __wd; } + inline constexpr unsigned c_encoding() const noexcept { return __wd; } + inline constexpr unsigned iso_encoding() const noexcept { return __wd == 0u ? 7 : __wd; } inline constexpr bool ok() const noexcept { return __wd <= 6; } constexpr weekday_indexed operator[](unsigned __index) const noexcept; constexpr weekday_last operator[](last_spec) const noexcept; @@ -1842,7 +1873,7 @@ unsigned char weekday::__weekday_from_days(int __days) inline constexpr bool operator==(const weekday& __lhs, const weekday& __rhs) noexcept -{ return static_cast(__lhs) == static_cast(__rhs); } +{ return __lhs.c_encoding() == __rhs.c_encoding(); } inline constexpr bool operator!=(const weekday& __lhs, const weekday& __rhs) noexcept @@ -1850,7 +1881,7 @@ bool operator!=(const weekday& __lhs, const weekday& _ inline constexpr bool operator< (const weekday& __lhs, const weekday& __rhs) noexcept -{ return static_cast(__lhs) < static_cast(__rhs); } +{ return __lhs.c_encoding() < __rhs.c_encoding(); } inline constexpr bool operator> (const weekday& __lhs, const weekday& __rhs) noexcept @@ -1866,7 +1897,7 @@ bool operator>=(const weekday& __lhs, const weekday& _ constexpr weekday operator+(const weekday& __lhs, const days& __rhs) noexcept { *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Oct 23 17:52:36 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5F21B159BA5; Wed, 23 Oct 2019 17:52:36 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yydJ1pTsz4Snj; Wed, 23 Oct 2019 17:52:36 +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 09D5037F; Wed, 23 Oct 2019 17:52:36 +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 x9NHqZOJ078320; Wed, 23 Oct 2019 17:52:35 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHqZcH078319; Wed, 23 Oct 2019 17:52:35 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231752.x9NHqZcH078319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:52:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353947 - vendor/libc++/libc++-r375505 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/libc++/libc++-r375505 X-SVN-Commit-Revision: 353947 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:52:36 -0000 Author: dim Date: Wed Oct 23 17:52:35 2019 New Revision: 353947 URL: https://svnweb.freebsd.org/changeset/base/353947 Log: Tag stripped libc++ trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub. Added: vendor/libc++/libc++-r375505/ - copied from r353946, vendor/libc++/dist/ From owner-svn-src-all@freebsd.org Wed Oct 23 17:52:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D8A4159C23; Wed, 23 Oct 2019 17:52:43 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yydR18lBz4T1S; Wed, 23 Oct 2019 17:52:42 +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 5AEA8383; Wed, 23 Oct 2019 17:52:42 +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 x9NHqggF078421; Wed, 23 Oct 2019 17:52:42 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHqgDX078420; Wed, 23 Oct 2019 17:52:42 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231752.x9NHqgDX078420@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353949 - vendor/llvm-libunwind/libunwind-r375505 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm-libunwind/libunwind-r375505 X-SVN-Commit-Revision: 353949 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:52:43 -0000 Author: dim Date: Wed Oct 23 17:52:41 2019 New Revision: 353949 URL: https://svnweb.freebsd.org/changeset/base/353949 Log: Tag stripped LLVM libunwind trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub. Added: vendor/llvm-libunwind/libunwind-r375505/ - copied from r353948, vendor/llvm-libunwind/dist/ From owner-svn-src-all@freebsd.org Wed Oct 23 17:52:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60919159BE5; Wed, 23 Oct 2019 17:52:40 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yydM6V2Nz4Svf; Wed, 23 Oct 2019 17:52:39 +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 30998381; Wed, 23 Oct 2019 17:52:39 +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 x9NHqdrY078374; Wed, 23 Oct 2019 17:52:39 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHqcI1078369; Wed, 23 Oct 2019 17:52:38 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231752.x9NHqcI1078369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:52:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353948 - vendor/llvm-libunwind/dist/src X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm-libunwind/dist/src X-SVN-Commit-Revision: 353948 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:52:40 -0000 Author: dim Date: Wed Oct 23 17:52:37 2019 New Revision: 353948 URL: https://svnweb.freebsd.org/changeset/base/353948 Log: Vendor import of stripped LLVM libunwind trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/libunwind/trunk@375505 Modified: vendor/llvm-libunwind/dist/src/AddressSpace.hpp vendor/llvm-libunwind/dist/src/RWMutex.hpp vendor/llvm-libunwind/dist/src/Unwind-EHABI.cpp vendor/llvm-libunwind/dist/src/UnwindCursor.hpp vendor/llvm-libunwind/dist/src/libunwind.cpp Modified: vendor/llvm-libunwind/dist/src/AddressSpace.hpp ============================================================================== --- vendor/llvm-libunwind/dist/src/AddressSpace.hpp Wed Oct 23 17:52:35 2019 (r353947) +++ vendor/llvm-libunwind/dist/src/AddressSpace.hpp Wed Oct 23 17:52:37 2019 (r353948) @@ -27,11 +27,18 @@ #if _LIBUNWIND_USE_DLADDR #include -#if defined(__unix__) && defined(__ELF__) && defined(_LIBUNWIND_HAS_COMMENT_LIB_PRAGMA) +#if defined(__unix__) && defined(__ELF__) && defined(_LIBUNWIND_HAS_COMMENT_LIB_PRAGMA) #pragma comment(lib, "dl") #endif #endif +#if defined(_LIBUNWIND_ARM_EHABI) +struct EHABIIndexEntry { + uint32_t functionOffset; + uint32_t data; +}; +#endif + #ifdef __APPLE__ #include namespace libunwind { @@ -462,12 +469,13 @@ inline bool LocalAddressSpace::findUnwindSections(pint (void)targetAddr; (void)info; return true; -#elif defined(_LIBUNWIND_ARM_EHABI) && defined(__BIONIC__) && \ - (__ANDROID_API__ < 21) +#elif defined(_LIBUNWIND_ARM_EHABI) && defined(__BIONIC__) + // For ARM EHABI, Bionic didn't implement dl_iterate_phdr until API 21. After + // API 21, dl_iterate_phdr exists, but dl_unwind_find_exidx is much faster. int length = 0; info.arm_section = (uintptr_t)dl_unwind_find_exidx((_Unwind_Ptr)targetAddr, &length); - info.arm_section_length = (uintptr_t)length; + info.arm_section_length = (uintptr_t)length * sizeof(EHABIIndexEntry); if (info.arm_section && info.arm_section_length) return true; #elif defined(_LIBUNWIND_ARM_EHABI) || defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) @@ -497,32 +505,40 @@ inline bool LocalAddressSpace::findUnwindSections(pint #if !defined(Elf_Phdr) typedef ElfW(Phdr) Elf_Phdr; #endif -#if !defined(Elf_Addr) && defined(__ANDROID__) +#if !defined(Elf_Addr) typedef ElfW(Addr) Elf_Addr; #endif + Elf_Addr image_base = pinfo->dlpi_addr; + +#if defined(__ANDROID__) && __ANDROID_API__ < 18 + if (image_base == 0) { + // Normally, an image base of 0 indicates a non-PIE executable. On + // versions of Android prior to API 18, the dynamic linker reported a + // dlpi_addr of 0 for PIE executables. Compute the true image base + // using the PT_PHDR segment. + // See https://github.com/android/ndk/issues/505. + for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) { + const Elf_Phdr *phdr = &pinfo->dlpi_phdr[i]; + if (phdr->p_type == PT_PHDR) { + image_base = reinterpret_cast(pinfo->dlpi_phdr) - + phdr->p_vaddr; + break; + } + } + } +#endif + #if defined(_LIBUNWIND_SUPPORT_DWARF_UNWIND) #if !defined(_LIBUNWIND_SUPPORT_DWARF_INDEX) #error "_LIBUNWIND_SUPPORT_DWARF_UNWIND requires _LIBUNWIND_SUPPORT_DWARF_INDEX on this platform." #endif size_t object_length; -#if defined(__ANDROID__) - Elf_Addr image_base = - pinfo->dlpi_phnum - ? reinterpret_cast(pinfo->dlpi_phdr) - - reinterpret_cast(pinfo->dlpi_phdr) - ->p_offset - : 0; -#endif for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) { const Elf_Phdr *phdr = &pinfo->dlpi_phdr[i]; if (phdr->p_type == PT_LOAD) { - uintptr_t begin = pinfo->dlpi_addr + phdr->p_vaddr; -#if defined(__ANDROID__) - if (pinfo->dlpi_addr == 0 && phdr->p_vaddr < image_base) - begin = begin + image_base; -#endif + uintptr_t begin = image_base + phdr->p_vaddr; uintptr_t end = begin + phdr->p_memsz; if (cbdata->targetAddr >= begin && cbdata->targetAddr < end) { cbdata->sects->dso_base = begin; @@ -531,11 +547,7 @@ inline bool LocalAddressSpace::findUnwindSections(pint } } else if (phdr->p_type == PT_GNU_EH_FRAME) { EHHeaderParser::EHHeaderInfo hdrInfo; - uintptr_t eh_frame_hdr_start = pinfo->dlpi_addr + phdr->p_vaddr; -#if defined(__ANDROID__) - if (pinfo->dlpi_addr == 0 && phdr->p_vaddr < image_base) - eh_frame_hdr_start = eh_frame_hdr_start + image_base; -#endif + uintptr_t eh_frame_hdr_start = image_base + phdr->p_vaddr; cbdata->sects->dwarf_index_section = eh_frame_hdr_start; cbdata->sects->dwarf_index_section_length = phdr->p_memsz; found_hdr = EHHeaderParser::decodeEHHdr( @@ -556,12 +568,12 @@ inline bool LocalAddressSpace::findUnwindSections(pint for (Elf_Half i = 0; i < pinfo->dlpi_phnum; i++) { const Elf_Phdr *phdr = &pinfo->dlpi_phdr[i]; if (phdr->p_type == PT_LOAD) { - uintptr_t begin = pinfo->dlpi_addr + phdr->p_vaddr; + uintptr_t begin = image_base + phdr->p_vaddr; uintptr_t end = begin + phdr->p_memsz; if (cbdata->targetAddr >= begin && cbdata->targetAddr < end) found_obj = true; } else if (phdr->p_type == PT_ARM_EXIDX) { - uintptr_t exidx_start = pinfo->dlpi_addr + phdr->p_vaddr; + uintptr_t exidx_start = image_base + phdr->p_vaddr; cbdata->sects->arm_section = exidx_start; cbdata->sects->arm_section_length = phdr->p_memsz; found_hdr = true; Modified: vendor/llvm-libunwind/dist/src/RWMutex.hpp ============================================================================== --- vendor/llvm-libunwind/dist/src/RWMutex.hpp Wed Oct 23 17:52:35 2019 (r353947) +++ vendor/llvm-libunwind/dist/src/RWMutex.hpp Wed Oct 23 17:52:37 2019 (r353948) @@ -17,7 +17,7 @@ #include #elif !defined(_LIBUNWIND_HAS_NO_THREADS) #include -#if defined(__unix__) && defined(__ELF__) && defined(_LIBUNWIND_HAS_COMMENT_LIB_PRAGMA) +#if defined(__unix__) && !defined(__ANDROID__) && defined(__ELF__) && defined(_LIBUNWIND_HAS_COMMENT_LIB_PRAGMA) #pragma comment(lib, "pthread") #endif #endif Modified: vendor/llvm-libunwind/dist/src/Unwind-EHABI.cpp ============================================================================== --- vendor/llvm-libunwind/dist/src/Unwind-EHABI.cpp Wed Oct 23 17:52:35 2019 (r353947) +++ vendor/llvm-libunwind/dist/src/Unwind-EHABI.cpp Wed Oct 23 17:52:37 2019 (r353948) @@ -941,8 +941,13 @@ _Unwind_VRS_Pop(_Unwind_Context *context, _Unwind_VRS_ // format 1", which is equivalent to FSTMD + a padding word. for (uint32_t i = first; i < end; ++i) { // SP is only 32-bit aligned so don't copy 64-bit at a time. - uint64_t value = *sp++; - value |= ((uint64_t)(*sp++)) << 32; + uint64_t w0 = *sp++; + uint64_t w1 = *sp++; +#ifdef __LITTLE_ENDIAN__ + uint64_t value = (w1 << 32) | w0; +#else + uint64_t value = (w0 << 32) | w1; +#endif if (_Unwind_VRS_Set(context, regclass, i, representation, &value) != _UVRSR_OK) return _UVRSR_FAILED; Modified: vendor/llvm-libunwind/dist/src/UnwindCursor.hpp ============================================================================== --- vendor/llvm-libunwind/dist/src/UnwindCursor.hpp Wed Oct 23 17:52:35 2019 (r353947) +++ vendor/llvm-libunwind/dist/src/UnwindCursor.hpp Wed Oct 23 17:52:37 2019 (r353948) @@ -1222,11 +1222,6 @@ template bool UnwindCursor struct EHABISectionIterator { typedef EHABISectionIterator _Self; @@ -1991,7 +1986,10 @@ int UnwindCursor::step() { template void UnwindCursor::getInfo(unw_proc_info_t *info) { - *info = _info; + if (_unwindInfoMissing) + memset(info, 0, sizeof(*info)); + else + *info = _info; } template Modified: vendor/llvm-libunwind/dist/src/libunwind.cpp ============================================================================== --- vendor/llvm-libunwind/dist/src/libunwind.cpp Wed Oct 23 17:52:35 2019 (r353947) +++ vendor/llvm-libunwind/dist/src/libunwind.cpp Wed Oct 23 17:52:37 2019 (r353948) @@ -171,8 +171,7 @@ _LIBUNWIND_HIDDEN int __unw_get_proc_info(unw_cursor_t co->getInfo(info); if (info->end_ip == 0) return UNW_ENOINFO; - else - return UNW_ESUCCESS; + return UNW_ESUCCESS; } _LIBUNWIND_WEAK_ALIAS(__unw_get_proc_info, unw_get_proc_info) @@ -194,8 +193,7 @@ _LIBUNWIND_HIDDEN int __unw_get_proc_name(unw_cursor_t AbstractUnwindCursor *co = (AbstractUnwindCursor *)cursor; if (co->getFunctionName(buf, bufLen, offset)) return UNW_ESUCCESS; - else - return UNW_EUNSPEC; + return UNW_EUNSPEC; } _LIBUNWIND_WEAK_ALIAS(__unw_get_proc_name, unw_get_proc_name) From owner-svn-src-all@freebsd.org Wed Oct 23 17:52:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 26F93159C96; Wed, 23 Oct 2019 17:52:49 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yydX66TGz4TCT; Wed, 23 Oct 2019 17:52: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 19504385; Wed, 23 Oct 2019 17:52: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 x9NHqmh9078481; Wed, 23 Oct 2019 17:52:48 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHqkRl078470; Wed, 23 Oct 2019 17:52:46 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231752.x9NHqkRl078470@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:52:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353950 - in vendor/lld/dist: . COFF Common ELF ELF/Arch docs include/lld/Common include/lld/Core include/lld/ReaderWriter lib/Driver lib/ReaderWriter lib/ReaderWriter/MachO lib/ReaderW... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lld/dist: . COFF Common ELF ELF/Arch docs include/lld/Common include/lld/Core include/lld/ReaderWriter lib/Driver lib/ReaderWriter lib/ReaderWriter/MachO lib/ReaderWriter/YAML tools/lld X-SVN-Commit-Revision: 353950 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:52:49 -0000 Author: dim Date: Wed Oct 23 17:52:45 2019 New Revision: 353950 URL: https://svnweb.freebsd.org/changeset/base/353950 Log: Vendor import of stripped lld trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/lld/trunk@375505 Added: vendor/lld/dist/Common/DWARF.cpp vendor/lld/dist/ELF/ARMErrataFix.cpp vendor/lld/dist/ELF/ARMErrataFix.h vendor/lld/dist/include/lld/Common/DWARF.h Modified: vendor/lld/dist/CMakeLists.txt vendor/lld/dist/COFF/CMakeLists.txt vendor/lld/dist/COFF/Config.h vendor/lld/dist/COFF/DLL.cpp vendor/lld/dist/COFF/DebugTypes.cpp vendor/lld/dist/COFF/Driver.cpp vendor/lld/dist/COFF/Driver.h vendor/lld/dist/COFF/DriverUtils.cpp vendor/lld/dist/COFF/ICF.cpp vendor/lld/dist/COFF/InputFiles.cpp vendor/lld/dist/COFF/InputFiles.h vendor/lld/dist/COFF/LTO.cpp vendor/lld/dist/COFF/MapFile.cpp vendor/lld/dist/COFF/MinGW.cpp vendor/lld/dist/COFF/Options.td vendor/lld/dist/COFF/PDB.cpp vendor/lld/dist/COFF/PDB.h vendor/lld/dist/COFF/SymbolTable.cpp vendor/lld/dist/COFF/SymbolTable.h vendor/lld/dist/COFF/Symbols.cpp vendor/lld/dist/COFF/Symbols.h vendor/lld/dist/COFF/Writer.cpp vendor/lld/dist/Common/CMakeLists.txt vendor/lld/dist/Common/ErrorHandler.cpp vendor/lld/dist/Common/Strings.cpp vendor/lld/dist/Common/TargetOptionsCommandFlags.cpp vendor/lld/dist/ELF/AArch64ErrataFix.cpp vendor/lld/dist/ELF/Arch/AArch64.cpp vendor/lld/dist/ELF/Arch/AMDGPU.cpp vendor/lld/dist/ELF/Arch/ARM.cpp vendor/lld/dist/ELF/Arch/AVR.cpp vendor/lld/dist/ELF/Arch/Hexagon.cpp vendor/lld/dist/ELF/Arch/MSP430.cpp vendor/lld/dist/ELF/Arch/Mips.cpp vendor/lld/dist/ELF/Arch/MipsArchTree.cpp vendor/lld/dist/ELF/Arch/PPC.cpp vendor/lld/dist/ELF/Arch/PPC64.cpp vendor/lld/dist/ELF/Arch/RISCV.cpp vendor/lld/dist/ELF/Arch/SPARCV9.cpp vendor/lld/dist/ELF/Arch/X86.cpp vendor/lld/dist/ELF/Arch/X86_64.cpp vendor/lld/dist/ELF/CMakeLists.txt vendor/lld/dist/ELF/CallGraphSort.cpp vendor/lld/dist/ELF/Config.h vendor/lld/dist/ELF/DWARF.cpp vendor/lld/dist/ELF/DWARF.h vendor/lld/dist/ELF/Driver.cpp vendor/lld/dist/ELF/DriverUtils.cpp vendor/lld/dist/ELF/EhFrame.cpp vendor/lld/dist/ELF/ICF.cpp vendor/lld/dist/ELF/InputFiles.cpp vendor/lld/dist/ELF/InputFiles.h vendor/lld/dist/ELF/InputSection.cpp vendor/lld/dist/ELF/InputSection.h vendor/lld/dist/ELF/LTO.cpp vendor/lld/dist/ELF/LinkerScript.cpp vendor/lld/dist/ELF/LinkerScript.h vendor/lld/dist/ELF/MapFile.cpp vendor/lld/dist/ELF/MarkLive.cpp vendor/lld/dist/ELF/Options.td vendor/lld/dist/ELF/OutputSections.cpp vendor/lld/dist/ELF/OutputSections.h vendor/lld/dist/ELF/Relocations.cpp vendor/lld/dist/ELF/Relocations.h vendor/lld/dist/ELF/ScriptLexer.cpp vendor/lld/dist/ELF/ScriptParser.cpp vendor/lld/dist/ELF/SymbolTable.cpp vendor/lld/dist/ELF/SymbolTable.h vendor/lld/dist/ELF/Symbols.cpp vendor/lld/dist/ELF/Symbols.h vendor/lld/dist/ELF/SyntheticSections.cpp vendor/lld/dist/ELF/SyntheticSections.h vendor/lld/dist/ELF/Target.cpp vendor/lld/dist/ELF/Writer.cpp vendor/lld/dist/ELF/Writer.h vendor/lld/dist/docs/ReleaseNotes.rst vendor/lld/dist/docs/WebAssembly.rst vendor/lld/dist/docs/conf.py vendor/lld/dist/docs/ld.lld.1 vendor/lld/dist/include/lld/Common/ErrorHandler.h vendor/lld/dist/include/lld/Common/LLVM.h vendor/lld/dist/include/lld/Common/Strings.h vendor/lld/dist/include/lld/Common/TargetOptionsCommandFlags.h vendor/lld/dist/include/lld/Core/File.h vendor/lld/dist/include/lld/ReaderWriter/MachOLinkingContext.h vendor/lld/dist/lib/Driver/DarwinLdDriver.cpp vendor/lld/dist/lib/ReaderWriter/FileArchive.cpp vendor/lld/dist/lib/ReaderWriter/MachO/ArchHandler_x86_64.cpp vendor/lld/dist/lib/ReaderWriter/MachO/CompactUnwindPass.cpp vendor/lld/dist/lib/ReaderWriter/MachO/DebugInfo.h vendor/lld/dist/lib/ReaderWriter/MachO/GOTPass.cpp vendor/lld/dist/lib/ReaderWriter/MachO/LayoutPass.cpp vendor/lld/dist/lib/ReaderWriter/MachO/MachOLinkingContext.cpp vendor/lld/dist/lib/ReaderWriter/MachO/MachONormalizedFileBinaryReader.cpp vendor/lld/dist/lib/ReaderWriter/MachO/MachONormalizedFileBinaryWriter.cpp vendor/lld/dist/lib/ReaderWriter/MachO/MachONormalizedFileToAtoms.cpp vendor/lld/dist/lib/ReaderWriter/MachO/ObjCPass.cpp vendor/lld/dist/lib/ReaderWriter/MachO/ShimPass.cpp vendor/lld/dist/lib/ReaderWriter/MachO/TLVPass.cpp vendor/lld/dist/lib/ReaderWriter/YAML/ReaderWriterYAML.cpp vendor/lld/dist/tools/lld/lld.cpp Modified: vendor/lld/dist/CMakeLists.txt ============================================================================== --- vendor/lld/dist/CMakeLists.txt Wed Oct 23 17:52:41 2019 (r353949) +++ vendor/lld/dist/CMakeLists.txt Wed Oct 23 17:52:45 2019 (r353950) @@ -56,7 +56,6 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) include(HandleLLVMOptions) if(LLVM_INCLUDE_TESTS) - set(Python_ADDITIONAL_VERSIONS 2.7) include(FindPythonInterp) if(NOT PYTHONINTERP_FOUND) message(FATAL_ERROR Modified: vendor/lld/dist/COFF/CMakeLists.txt ============================================================================== --- vendor/lld/dist/COFF/CMakeLists.txt Wed Oct 23 17:52:41 2019 (r353949) +++ vendor/lld/dist/COFF/CMakeLists.txt Wed Oct 23 17:52:45 2019 (r353950) @@ -28,8 +28,10 @@ add_lld_library(lldCOFF BinaryFormat Core DebugInfoCodeView + DebugInfoDWARF DebugInfoMSF DebugInfoPDB + Demangle LibDriver LTO MC Modified: vendor/lld/dist/COFF/Config.h ============================================================================== --- vendor/lld/dist/COFF/Config.h Wed Oct 23 17:52:41 2019 (r353949) +++ vendor/lld/dist/COFF/Config.h Wed Oct 23 17:52:45 2019 (r353950) @@ -122,6 +122,7 @@ struct Configuration { bool dll = false; StringRef implib; std::vector exports; + bool hadExplicitExports; std::set delayLoads; std::map dllOrder; Symbol *delayLoadHelper = nullptr; @@ -189,6 +190,10 @@ struct Configuration { // Used for /thinlto-object-suffix-replace: std::pair thinLTOObjectSuffixReplace; + // Used for /lto-obj-path: + llvm::StringRef ltoObjPath; + + uint64_t align = 4096; uint64_t imageBase = -1; uint64_t fileAlign = 512; uint64_t stackReserve = 1024 * 1024; Modified: vendor/lld/dist/COFF/DLL.cpp ============================================================================== --- vendor/lld/dist/COFF/DLL.cpp Wed Oct 23 17:52:41 2019 (r353949) +++ vendor/lld/dist/COFF/DLL.cpp Wed Oct 23 17:52:45 2019 (r353950) @@ -135,7 +135,7 @@ class NullChunk : public NonSectionChunk { (private) static std::vector> binImports(const std::vector &imports) { // Group DLL-imported symbols by DLL name because that's how - // symbols are layed out in the import descriptor table. + // symbols are laid out in the import descriptor table. auto less = [](const std::string &a, const std::string &b) { return config->dllOrder[a] < config->dllOrder[b]; }; @@ -188,7 +188,7 @@ class DelayDirectoryChunk : public NonSectionChunk { ( // Initial contents for delay-loaded functions. // This code calls __delayLoadHelper2 function to resolve a symbol -// and then overwrites its jump table slot with the result +// which then overwrites its jump table slot with the result // for subsequent function calls. static const uint8_t thunkX64[] = { 0x48, 0x8D, 0x05, 0, 0, 0, 0, // lea rax, [__imp_] Modified: vendor/lld/dist/COFF/DebugTypes.cpp ============================================================================== --- vendor/lld/dist/COFF/DebugTypes.cpp Wed Oct 23 17:52:41 2019 (r353949) +++ vendor/lld/dist/COFF/DebugTypes.cpp Wed Oct 23 17:52:45 2019 (r353950) @@ -17,11 +17,12 @@ #include "llvm/DebugInfo/PDB/Native/PDBFile.h" #include "llvm/Support/Path.h" -using namespace lld; -using namespace lld::coff; using namespace llvm; using namespace llvm::codeview; +namespace lld { +namespace coff { + namespace { // The TypeServerSource class represents a PDB type server, a file referenced by // OBJ files compiled with MSVC /Zi. A single PDB can be shared by several OBJ @@ -96,27 +97,25 @@ TpiSource::TpiSource(TpiKind k, const ObjFile *f) : ki GC.push_back(std::unique_ptr(this)); } -TpiSource *lld::coff::makeTpiSource(const ObjFile *f) { +TpiSource *makeTpiSource(const ObjFile *f) { return new TpiSource(TpiSource::Regular, f); } -TpiSource *lld::coff::makeUseTypeServerSource(const ObjFile *f, +TpiSource *makeUseTypeServerSource(const ObjFile *f, const TypeServer2Record *ts) { TypeServerSource::enqueue(f, *ts); return new UseTypeServerSource(f, ts); } -TpiSource *lld::coff::makePrecompSource(const ObjFile *f) { +TpiSource *makePrecompSource(const ObjFile *f) { return new PrecompSource(f); } -TpiSource *lld::coff::makeUsePrecompSource(const ObjFile *f, +TpiSource *makeUsePrecompSource(const ObjFile *f, const PrecompRecord *precomp) { return new UsePrecompSource(f, precomp); } -namespace lld { -namespace coff { template <> const PrecompRecord &retrieveDependencyInfo(const TpiSource *source) { assert(source->kind == TpiSource::UsingPCH); @@ -128,8 +127,6 @@ const TypeServer2Record &retrieveDependencyInfo(const assert(source->kind == TpiSource::UsingPDB); return ((const UseTypeServerSource *)source)->typeServerDependency; } -} // namespace coff -} // namespace lld std::map> TypeServerSource::instances; @@ -210,8 +207,7 @@ TypeServerSource::findFromFile(const ObjFile *dependen // FIXME: Temporary interface until PDBLinker::maybeMergeTypeServerPDB() is // moved here. -Expected -lld::coff::findTypeServerSource(const ObjFile *f) { +Expected findTypeServerSource(const ObjFile *f) { Expected ts = TypeServerSource::findFromFile(f); if (!ts) return ts.takeError(); @@ -231,7 +227,7 @@ void TypeServerSource::enqueue(const ObjFile *dependen if (!it.second) return; // another OBJ already scheduled this PDB for load - driver->enqueuePath(*p, false); + driver->enqueuePath(*p, false, false); } // Create an instance of TypeServerSource or an error string if the PDB couldn't @@ -239,7 +235,7 @@ void TypeServerSource::enqueue(const ObjFile *dependen // will be merged in. NOTE - a PDB load failure is not a link error: some // debug info will simply be missing from the final PDB - that is the default // accepted behavior. -void lld::coff::loadTypeServerSource(llvm::MemoryBufferRef m) { +void loadTypeServerSource(llvm::MemoryBufferRef m) { std::string path = normalizePdbPath(m.getBufferIdentifier()); Expected ts = TypeServerSource::getInstance(m); @@ -266,3 +262,6 @@ Expected TypeServerSource::getInst return info.takeError(); return new TypeServerSource(m, session.release()); } + +} // namespace coff +} // namespace lld Modified: vendor/lld/dist/COFF/Driver.cpp ============================================================================== --- vendor/lld/dist/COFF/Driver.cpp Wed Oct 23 17:52:41 2019 (r353949) +++ vendor/lld/dist/COFF/Driver.cpp Wed Oct 23 17:52:45 2019 (r353950) @@ -27,6 +27,7 @@ #include "llvm/ADT/Optional.h" #include "llvm/ADT/StringSwitch.h" #include "llvm/BinaryFormat/Magic.h" +#include "llvm/LTO/LTO.h" #include "llvm/Object/ArchiveWriter.h" #include "llvm/Object/COFFImportFile.h" #include "llvm/Object/COFFModuleDefinition.h" @@ -36,6 +37,7 @@ #include "llvm/Option/Option.h" #include "llvm/Support/Debug.h" #include "llvm/Support/LEB128.h" +#include "llvm/Support/MathExtras.h" #include "llvm/Support/Path.h" #include "llvm/Support/Process.h" #include "llvm/Support/TarWriter.h" @@ -62,16 +64,16 @@ LinkerDriver *driver; bool link(ArrayRef args, bool canExitEarly, raw_ostream &diag) { errorHandler().logName = args::getFilenameWithoutExe(args[0]); errorHandler().errorOS = &diag; - errorHandler().colorDiagnostics = diag.has_colors(); errorHandler().errorLimitExceededMsg = "too many errors emitted, stopping now" " (use /errorlimit:0 to see all errors)"; errorHandler().exitEarly = canExitEarly; - config = make(); + enableColors(diag.has_colors()); + config = make(); symtab = make(); - driver = make(); + driver->link(args); // Call exit() if we can to avoid calling destructors. @@ -169,7 +171,7 @@ MemoryBufferRef LinkerDriver::takeBuffer(std::unique_p } void LinkerDriver::addBuffer(std::unique_ptr mb, - bool wholeArchive) { + bool wholeArchive, bool lazy) { StringRef filename = mb->getBufferIdentifier(); MemoryBufferRef mbref = takeBuffer(std::move(mb)); @@ -184,19 +186,28 @@ void LinkerDriver::addBuffer(std::unique_ptr file = CHECK(Archive::create(mbref), filename + ": failed to parse archive"); + Archive *archive = file.get(); + make>(std::move(file)); // take ownership - for (MemoryBufferRef m : getArchiveMembers(file.get())) - addArchiveBuffer(m, "", filename, 0); + int memberIndex = 0; + for (MemoryBufferRef m : getArchiveMembers(archive)) + addArchiveBuffer(m, "", filename, memberIndex++); return; } symtab->addFile(make(mbref)); break; case file_magic::bitcode: - symtab->addFile(make(mbref, "", 0)); + if (lazy) + symtab->addFile(make(mbref)); + else + symtab->addFile(make(mbref, "", 0)); break; case file_magic::coff_object: case file_magic::coff_import_library: - symtab->addFile(make(mbref)); + if (lazy) + symtab->addFile(make(mbref)); + else + symtab->addFile(make(mbref)); break; case file_magic::pdb: loadTypeServerSource(mbref); @@ -217,7 +228,7 @@ void LinkerDriver::addBuffer(std::unique_ptr>(createFutureForFile(path)); std::string pathStr = path; @@ -237,7 +248,7 @@ void LinkerDriver::enqueuePath(StringRef path, bool wh else error(msg + "; did you mean '" + nearest + "'"); } else - driver->addBuffer(std::move(mbOrErr.first), wholeArchive); + driver->addBuffer(std::move(mbOrErr.first), wholeArchive, lazy); }); } @@ -268,13 +279,12 @@ void LinkerDriver::addArchiveBuffer(MemoryBufferRef mb } void LinkerDriver::enqueueArchiveMember(const Archive::Child &c, - StringRef symName, + const Archive::Symbol &sym, StringRef parentName) { - auto reportBufferError = [=](Error &&e, - StringRef childName) { + auto reportBufferError = [=](Error &&e, StringRef childName) { fatal("could not get the buffer for the member defining symbol " + - symName + ": " + parentName + "(" + childName + "): " + + toCOFFString(sym) + ": " + parentName + "(" + childName + "): " + toString(std::move(e))); }; @@ -285,7 +295,8 @@ void LinkerDriver::enqueueArchiveMember(const Archive: reportBufferError(mbOrErr.takeError(), check(c.getFullName())); MemoryBufferRef mb = mbOrErr.get(); enqueueTask([=]() { - driver->addArchiveBuffer(mb, symName, parentName, offsetInArchive); + driver->addArchiveBuffer(mb, toCOFFString(sym), parentName, + offsetInArchive); }); return; } @@ -293,15 +304,17 @@ void LinkerDriver::enqueueArchiveMember(const Archive: std::string childName = CHECK( c.getFullName(), "could not get the filename for the member defining symbol " + - symName); + toCOFFString(sym)); auto future = std::make_shared>( createFutureForFile(childName)); enqueueTask([=]() { auto mbOrErr = future->get(); if (mbOrErr.second) reportBufferError(errorCodeToError(mbOrErr.second), childName); - driver->addArchiveBuffer(takeBuffer(std::move(mbOrErr.first)), symName, - parentName, /* OffsetInArchive */ 0); + // Pass empty string as archive name so that the original filename is + // used as the buffer identifier. + driver->addArchiveBuffer(takeBuffer(std::move(mbOrErr.first)), + toCOFFString(sym), "", /*OffsetInArchive=*/0); }); } @@ -355,7 +368,7 @@ void LinkerDriver::parseDirectives(InputFile *file) { break; case OPT_defaultlib: if (Optional path = findLib(arg->getValue())) - enqueuePath(*path, false); + enqueuePath(*path, false, false); break; case OPT_entry: config->entry = addUndefined(mangle(arg->getValue())); @@ -590,6 +603,7 @@ static std::string createResponseFile(const opt::Input for (auto *arg : args) { switch (arg->getOption().getID()) { case OPT_linkrepro: + case OPT_reproduce: case OPT_INPUT: case OPT_defaultlib: case OPT_libpath: @@ -704,9 +718,8 @@ static std::string getImplibPath() { return out.str(); } +// The import name is calculated as follows: // -// The import name is caculated as the following: -// // | LIBRARY w/ ext | LIBRARY w/o ext | no LIBRARY // -----+----------------+---------------------+------------------ // LINK | {value} | {value}.{.dll/.exe} | {output name} @@ -987,30 +1000,37 @@ static void parsePDBAltPath(StringRef altPath) { config->pdbAltPath = buf; } -/// Check that at most one resource obj file was used. +/// Convert resource files and potentially merge input resource object +/// trees into one resource tree. /// Call after ObjFile::Instances is complete. -static void diagnoseMultipleResourceObjFiles() { - // The .rsrc$01 section in a resource obj file contains a tree description - // of resources. Merging multiple resource obj files would require merging - // the trees instead of using usual linker section merging semantics. - // Since link.exe disallows linking more than one resource obj file with - // LNK4078, mirror that. The normal use of resource files is to give the - // linker many .res files, which are then converted to a single resource obj - // file internally, so this is not a big restriction in practice. - ObjFile *resourceObjFile = nullptr; +void LinkerDriver::convertResources() { + std::vector resourceObjFiles; + for (ObjFile *f : ObjFile::instances) { - if (!f->isResourceObjFile) - continue; + if (f->isResourceObjFile()) + resourceObjFiles.push_back(f); + } - if (!resourceObjFile) { - resourceObjFile = f; - continue; - } - - error(toString(f) + + if (!config->mingw && + (resourceObjFiles.size() > 1 || + (resourceObjFiles.size() == 1 && !resources.empty()))) { + error((!resources.empty() ? "internal .obj file created from .res files" + : toString(resourceObjFiles[1])) + ": more than one resource obj file not allowed, already got " + - toString(resourceObjFile)); + toString(resourceObjFiles.front())); + return; } + + if (resources.empty() && resourceObjFiles.size() <= 1) { + // No resources to convert, and max one resource object file in + // the input. Keep that preconverted resource section as is. + for (ObjFile *f : resourceObjFiles) + f->includeResourceChunks(); + return; + } + ObjFile *f = make(convertResToCOFF(resources, resourceObjFiles)); + symtab->addFile(f); + f->includeResourceChunks(); } // In MinGW, if no symbols are chosen to be exported, then all symbols are @@ -1051,6 +1071,26 @@ void LinkerDriver::maybeExportMinGWSymbols(const opt:: }); } +// lld has a feature to create a tar file containing all input files as well as +// all command line options, so that other people can run lld again with exactly +// the same inputs. This feature is accessible via /linkrepro and /reproduce. +// +// /linkrepro and /reproduce are very similar, but /linkrepro takes a directory +// name while /reproduce takes a full path. We have /linkrepro for compatibility +// with Microsoft link.exe. +Optional getReproduceFile(const opt::InputArgList &args) { + if (auto *arg = args.getLastArg(OPT_reproduce)) + return std::string(arg->getValue()); + + if (auto *arg = args.getLastArg(OPT_linkrepro)) { + SmallString<64> path = StringRef(arg->getValue()); + sys::path::append(path, "repro.tar"); + return path.str().str(); + } + + return None; +} + void LinkerDriver::link(ArrayRef argsArr) { // Needed for LTO. InitializeAllTargetInfos(); @@ -1069,7 +1109,7 @@ void LinkerDriver::link(ArrayRef argsArr // Parse command line options. ArgParser parser; - opt::InputArgList args = parser.parseLINK(argsArr); + opt::InputArgList args = parser.parse(argsArr); // Parse and evaluate -mllvm options. std::vector v; @@ -1113,17 +1153,15 @@ void LinkerDriver::link(ArrayRef argsArr // options are handled. config->mingw = args.hasArg(OPT_lldmingw); - if (auto *arg = args.getLastArg(OPT_linkrepro)) { - SmallString<64> path = StringRef(arg->getValue()); - sys::path::append(path, "repro.tar"); - + // Handle /linkrepro and /reproduce. + if (Optional path = getReproduceFile(args)) { Expected> errOrWriter = - TarWriter::create(path, "repro"); + TarWriter::create(*path, sys::path::stem(*path)); if (errOrWriter) { tar = std::move(*errOrWriter); } else { - error("/linkrepro: failed to open " + path + ": " + + error("/linkrepro: failed to open " + *path + ": " + toString(errOrWriter.takeError())); } } @@ -1139,7 +1177,8 @@ void LinkerDriver::link(ArrayRef argsArr searchPaths.push_back(""); for (auto *arg : args.filtered(OPT_libpath)) searchPaths.push_back(arg->getValue()); - addLibSearchPaths(); + if (!args.hasArg(OPT_lldignoreenv)) + addLibSearchPaths(); // Handle /ignore for (auto *arg : args.filtered(OPT_ignore)) { @@ -1419,6 +1458,13 @@ void LinkerDriver::link(ArrayRef argsArr for (auto *arg : args.filtered(OPT_section)) parseSection(arg->getValue()); + // Handle /align + if (auto *arg = args.getLastArg(OPT_align)) { + parseNumbers(arg->getValue(), &config->align); + if (!isPowerOf2_64(config->align)) + error("/align: not a power of two: " + StringRef(arg->getValue())); + } + // Handle /aligncomm for (auto *arg : args.filtered(OPT_aligncomm)) parseAligncomm(arg->getValue()); @@ -1464,6 +1510,7 @@ void LinkerDriver::link(ArrayRef argsArr getOldNewOptions(args, OPT_thinlto_prefix_replace); config->thinLTOObjectSuffixReplace = getOldNewOptions(args, OPT_thinlto_object_suffix_replace); + config->ltoObjPath = args.getLastArgValue(OPT_lto_obj_path); // Handle miscellaneous boolean flags. config->allowBind = args.hasFlag(OPT_allowbind, OPT_allowbind_no, true); config->allowIsolation = @@ -1528,19 +1575,45 @@ void LinkerDriver::link(ArrayRef argsArr return false; }; - // Create a list of input files. Files can be given as arguments - // for /defaultlib option. - for (auto *arg : args.filtered(OPT_INPUT, OPT_wholearchive_file)) - if (Optional path = findFile(arg->getValue())) - enqueuePath(*path, isWholeArchive(*path)); + // Create a list of input files. These can be given as OPT_INPUT options + // and OPT_wholearchive_file options, and we also need to track OPT_start_lib + // and OPT_end_lib. + bool inLib = false; + for (auto *arg : args) { + switch (arg->getOption().getID()) { + case OPT_end_lib: + if (!inLib) + error("stray " + arg->getSpelling()); + inLib = false; + break; + case OPT_start_lib: + if (inLib) + error("nested " + arg->getSpelling()); + inLib = true; + break; + case OPT_wholearchive_file: + if (Optional path = findFile(arg->getValue())) + enqueuePath(*path, true, inLib); + break; + case OPT_INPUT: + if (Optional path = findFile(arg->getValue())) + enqueuePath(*path, isWholeArchive(*path), inLib); + break; + default: + // Ignore other options. + break; + } + } + // Process files specified as /defaultlib. These should be enequeued after + // other files, which is why they are in a separate loop. for (auto *arg : args.filtered(OPT_defaultlib)) if (Optional path = findLib(arg->getValue())) - enqueuePath(*path, false); + enqueuePath(*path, false, false); // Windows specific -- Create a resource file containing a manifest file. if (config->manifest == Configuration::Embed) - addBuffer(createManifestRes(), false); + addBuffer(createManifestRes(), false, false); // Read all input files given via the command line. run(); @@ -1565,12 +1638,6 @@ void LinkerDriver::link(ArrayRef argsArr for (auto *arg : args.filtered(OPT_functionpadmin, OPT_functionpadmin_opt)) parseFunctionPadMin(arg, config->machine); - // Input files can be Windows resource files (.res files). We use - // WindowsResource to convert resource files to a regular COFF file, - // then link the resulting file normally. - if (!resources.empty()) - symtab->addFile(make(convertResToCOFF(resources))); - if (tar) tar->append("response.txt", createResponseFile(args, filePaths, @@ -1746,33 +1813,24 @@ void LinkerDriver::link(ArrayRef argsArr u->weakAlias = symtab->addUndefined(to); } + // If any inputs are bitcode files, the LTO code generator may create + // references to library functions that are not explicit in the bitcode + // file's symbol table. If any of those library functions are defined in a + // bitcode file in an archive member, we need to arrange to use LTO to + // compile those archive members by adding them to the link beforehand. + if (!BitcodeFile::instances.empty()) + for (auto *s : lto::LTO::getRuntimeLibcallSymbols()) + symtab->addLibcall(s); + // Windows specific -- if __load_config_used can be resolved, resolve it. if (symtab->findUnderscore("_load_config_used")) addUndefined(mangle("_load_config_used")); } while (run()); - if (errorCount()) - return; - - // Do LTO by compiling bitcode input files to a set of native COFF files then - // link those files (unless -thinlto-index-only was given, in which case we - // resolve symbols and write indices, but don't generate native code or link). - symtab->addCombinedLTOObjects(); - - // If -thinlto-index-only is given, we should create only "index - // files" and not object files. Index file creation is already done - // in addCombinedLTOObject, so we are done if that's the case. - if (config->thinLTOIndexOnly) - return; - - // If we generated native object files from bitcode files, this resolves - // references to the symbols we use from them. - run(); - if (args.hasArg(OPT_include_optional)) { // Handle /includeoptional for (auto *arg : args.filtered(OPT_include_optional)) - if (dyn_cast_or_null(symtab->find(arg->getValue()))) + if (dyn_cast_or_null(symtab->find(arg->getValue()))) addUndefined(arg->getValue()); while (run()); } @@ -1795,11 +1853,36 @@ void LinkerDriver::link(ArrayRef argsArr run(); } - // Make sure we have resolved all symbols. - symtab->reportRemainingUndefines(); + // At this point, we should not have any symbols that cannot be resolved. + // If we are going to do codegen for link-time optimization, check for + // unresolvable symbols first, so we don't spend time generating code that + // will fail to link anyway. + if (!BitcodeFile::instances.empty() && !config->forceUnresolved) + symtab->reportUnresolvable(); if (errorCount()) return; + // Do LTO by compiling bitcode input files to a set of native COFF files then + // link those files (unless -thinlto-index-only was given, in which case we + // resolve symbols and write indices, but don't generate native code or link). + symtab->addCombinedLTOObjects(); + + // If -thinlto-index-only is given, we should create only "index + // files" and not object files. Index file creation is already done + // in addCombinedLTOObject, so we are done if that's the case. + if (config->thinLTOIndexOnly) + return; + + // If we generated native object files from bitcode files, this resolves + // references to the symbols we use from them. + run(); + + // Resolve remaining undefined symbols and warn about imported locals. + symtab->resolveRemainingUndefines(); + if (errorCount()) + return; + + config->hadExplicitExports = !config->exports.empty(); if (config->mingw) { // In MinGW, all symbols are automatically exported if no symbols // are chosen to be exported. @@ -1823,10 +1906,12 @@ void LinkerDriver::link(ArrayRef argsArr } // Windows specific -- when we are creating a .dll file, we also - // need to create a .lib file. + // need to create a .lib file. In MinGW mode, we only do that when the + // -implib option is given explicitly, for compatibility with GNU ld. if (!config->exports.empty() || config->dll) { fixupExports(); - createImportLibrary(/*asLib=*/false); + if (!config->mingw || !config->implib.empty()) + createImportLibrary(/*asLib=*/false); assignExportOrdinals(); } @@ -1870,7 +1955,7 @@ void LinkerDriver::link(ArrayRef argsArr markLive(symtab->getChunks()); // Needs to happen after the last call to addFile(). - diagnoseMultipleResourceObjFiles(); + convertResources(); // Identify identical COMDAT sections to merge them. if (config->doICF) { Modified: vendor/lld/dist/COFF/Driver.h ============================================================================== --- vendor/lld/dist/COFF/Driver.h Wed Oct 23 17:52:41 2019 (r353949) +++ vendor/lld/dist/COFF/Driver.h Wed Oct 23 17:52:45 2019 (r353950) @@ -43,8 +43,8 @@ class COFFOptTable : public llvm::opt::OptTable { (pub class ArgParser { public: - // Concatenate LINK environment variable and given arguments and parse them. - llvm::opt::InputArgList parseLINK(std::vector args); + // Parses command line options. + llvm::opt::InputArgList parse(llvm::ArrayRef args); // Tokenizes a given string and then parses as command line options. llvm::opt::InputArgList parse(StringRef s) { return parse(tokenize(s)); } @@ -56,8 +56,8 @@ class ArgParser { (public) parseDirectives(StringRef s); private: - // Parses command line options. - llvm::opt::InputArgList parse(llvm::ArrayRef args); + // Concatenate LINK environment variable. + void addLINK(SmallVector &argv); std::vector tokenize(StringRef s); @@ -72,12 +72,12 @@ class LinkerDriver { (public) void parseDirectives(InputFile *file); // Used by ArchiveFile to enqueue members. - void enqueueArchiveMember(const Archive::Child &c, StringRef symName, + void enqueueArchiveMember(const Archive::Child &c, const Archive::Symbol &sym, StringRef parentName); MemoryBufferRef takeBuffer(std::unique_ptr mb); - void enqueuePath(StringRef path, bool wholeArchive); + void enqueuePath(StringRef path, bool wholeArchive, bool lazy); private: std::unique_ptr tar; // for /linkrepro @@ -98,6 +98,10 @@ class LinkerDriver { (public) // Library search path. The first element is always "" (current directory). std::vector searchPaths; + // Convert resource files and potentially merge input resource object + // trees into one resource tree. + void convertResources(); + void maybeExportMinGWSymbols(const llvm::opt::InputArgList &args); // We don't want to add the same file more than once. @@ -120,7 +124,8 @@ class LinkerDriver { (public) StringRef findDefaultEntry(); WindowsSubsystem inferSubsystem(); - void addBuffer(std::unique_ptr mb, bool wholeArchive); + void addBuffer(std::unique_ptr mb, bool wholeArchive, + bool lazy); void addArchiveBuffer(MemoryBufferRef mbref, StringRef symName, StringRef parentName, uint64_t offsetInArchive); @@ -184,7 +189,8 @@ void assignExportOrdinals(); void checkFailIfMismatch(StringRef arg, InputFile *source); // Convert Windows resource files (.res files) to a .obj file. -MemoryBufferRef convertResToCOFF(ArrayRef mbs); +MemoryBufferRef convertResToCOFF(ArrayRef mbs, + ArrayRef objs); void runMSVCLinker(std::string rsp, ArrayRef objects); Modified: vendor/lld/dist/COFF/DriverUtils.cpp ============================================================================== --- vendor/lld/dist/COFF/DriverUtils.cpp Wed Oct 23 17:52:41 2019 (r353949) +++ vendor/lld/dist/COFF/DriverUtils.cpp Wed Oct 23 17:52:45 2019 (r353950) @@ -322,7 +322,7 @@ class TemporaryFile { (public) if (!contents.empty()) { std::error_code ec; - raw_fd_ostream os(path, ec, sys::fs::F_None); + raw_fd_ostream os(path, ec, sys::fs::OF_None); if (ec) fatal("failed to open " + path + ": " + ec.message()); os << contents; @@ -410,7 +410,7 @@ static std::string createManifestXmlWithExternalMt(Str // Create the default manifest file as a temporary file. TemporaryFile Default("defaultxml", "manifest"); std::error_code ec; - raw_fd_ostream os(Default.path, ec, sys::fs::F_Text); + raw_fd_ostream os(Default.path, ec, sys::fs::OF_Text); if (ec) fatal("failed to open " + Default.path + ": " + ec.message()); os << defaultXml; @@ -511,7 +511,7 @@ void createSideBySideManifest() { if (path == "") path = config->outputFile + ".manifest"; std::error_code ec; - raw_fd_ostream out(path, ec, sys::fs::F_Text); + raw_fd_ostream out(path, ec, sys::fs::OF_Text); if (ec) fatal("failed to create manifest: " + ec.message()); out << createManifestXml(); @@ -700,26 +700,42 @@ void checkFailIfMismatch(StringRef arg, InputFile *sou // Convert Windows resource files (.res files) to a .obj file. // Does what cvtres.exe does, but in-process and cross-platform. -MemoryBufferRef convertResToCOFF(ArrayRef mbs) { - object::WindowsResourceParser parser; +MemoryBufferRef convertResToCOFF(ArrayRef mbs, + ArrayRef objs) { + object::WindowsResourceParser parser(/* MinGW */ config->mingw); + std::vector duplicates; for (MemoryBufferRef mb : mbs) { std::unique_ptr bin = check(object::createBinary(mb)); object::WindowsResource *rf = dyn_cast(bin.get()); if (!rf) fatal("cannot compile non-resource file as resource"); - std::vector duplicates; if (auto ec = parser.parse(rf, duplicates)) fatal(toString(std::move(ec))); + } - for (const auto &dupeDiag : duplicates) - if (config->forceMultipleRes) - warn(dupeDiag); - else - error(dupeDiag); + // Note: This processes all .res files before all objs. Ideally they'd be + // handled in the same order they were linked (to keep the right one, if + // there are duplicates that are tolerated due to forceMultipleRes). + for (ObjFile *f : objs) { + object::ResourceSectionRef rsf; + if (auto ec = rsf.load(f->getCOFFObj())) + fatal(toString(f) + ": " + toString(std::move(ec))); + + if (auto ec = parser.parse(rsf, f->getName(), duplicates)) + fatal(toString(std::move(ec))); } + if (config->mingw) + parser.cleanUpManifests(duplicates); + + for (const auto &dupeDiag : duplicates) + if (config->forceMultipleRes) + warn(dupeDiag); + else + error(dupeDiag); + Expected> e = llvm::object::writeWindowsResourceCOFF(config->machine, parser, config->timestamp); @@ -757,15 +773,15 @@ static void handleColorDiagnostics(opt::InputArgList & if (!arg) return; if (arg->getOption().getID() == OPT_color_diagnostics) { - errorHandler().colorDiagnostics = true; + enableColors(true); } else if (arg->getOption().getID() == OPT_no_color_diagnostics) { - errorHandler().colorDiagnostics = false; + enableColors(false); } else { StringRef s = arg->getValue(); if (s == "always") - errorHandler().colorDiagnostics = true; + enableColors(true); else if (s == "never") - errorHandler().colorDiagnostics = false; + enableColors(false); else if (s != "auto") error("unknown option: --color-diagnostics=" + s); } @@ -792,13 +808,17 @@ opt::InputArgList ArgParser::parse(ArrayRef) - // and then parse the argument again. + + // Expand response files (arguments in the form of @) and insert + // flags from %LINK% and %_LINK_%, and then parse the argument again. SmallVector expandedArgv(argv.data(), argv.data() + argv.size()); + if (!args.hasArg(OPT_lldignoreenv)) + addLINK(expandedArgv); cl::ExpandResponseFiles(saver, getQuotingStyle(args), expandedArgv); args = table.ParseArgs(makeArrayRef(expandedArgv).drop_front(), missingIndex, missingCount); @@ -868,7 +888,7 @@ ArgParser::parseDirectives(StringRef s) { // link.exe has an interesting feature. If LINK or _LINK_ environment // variables exist, their contents are handled as command line strings. // So you can pass extra arguments using them. -opt::InputArgList ArgParser::parseLINK(std::vector argv) { +void ArgParser::addLINK(SmallVector &argv) { // Concatenate LINK env and command line arguments, and then parse them. if (Optional s = Process::GetEnv("LINK")) { std::vector v = tokenize(*s); @@ -878,7 +898,6 @@ opt::InputArgList ArgParser::parseLINK(std::vector v = tokenize(*s); argv.insert(std::next(argv.begin()), v.begin(), v.end()); } - return parse(argv); } std::vector ArgParser::tokenize(StringRef s) { Modified: vendor/lld/dist/COFF/ICF.cpp ============================================================================== --- vendor/lld/dist/COFF/ICF.cpp Wed Oct 23 17:52:41 2019 (r353949) +++ vendor/lld/dist/COFF/ICF.cpp Wed Oct 23 17:52:45 2019 (r353950) @@ -13,7 +13,7 @@ // // On Windows, ICF is enabled by default. // -// See ELF/ICF.cpp for the details about the algortihm. +// See ELF/ICF.cpp for the details about the algorithm. // //===----------------------------------------------------------------------===// @@ -77,7 +77,7 @@ class ICF { (private) // section is insignificant to the user program and the behaviour matches that // of the Visual C++ linker. bool ICF::isEligible(SectionChunk *c) { - // Non-comdat chunks, dead chunks, and writable chunks are not elegible. + // Non-comdat chunks, dead chunks, and writable chunks are not eligible. bool writable = c->getOutputCharacteristics() & llvm::COFF::IMAGE_SCN_MEM_WRITE; if (!c->isCOMDAT() || !c->live || writable) return false; @@ -274,7 +274,7 @@ void ICF::run(ArrayRef vec) { for (Symbol *b : sc->symbols()) if (auto *sym = dyn_cast_or_null(b)) hash += sym->getChunk()->eqClass[cnt % 2]; - // Set MSB to 1 to avoid collisions with non-hash classs. + // Set MSB to 1 to avoid collisions with non-hash classes. sc->eqClass[(cnt + 1) % 2] = hash | (1U << 31); }); } @@ -297,7 +297,7 @@ void ICF::run(ArrayRef vec) { log("ICF needed " + Twine(cnt) + " iterations"); - // Merge sections in the same classs. + // Merge sections in the same classes. forEachClass([&](size_t begin, size_t end) { if (end - begin == 1) return; Modified: vendor/lld/dist/COFF/InputFiles.cpp ============================================================================== --- vendor/lld/dist/COFF/InputFiles.cpp Wed Oct 23 17:52:41 2019 (r353949) +++ vendor/lld/dist/COFF/InputFiles.cpp Wed Oct 23 17:52:45 2019 (r353950) @@ -47,6 +47,24 @@ using llvm::Triple; using llvm::support::ulittle32_t; namespace lld { + +// Returns the last element of a path, which is supposed to be a filename. +static StringRef getBasename(StringRef path) { + return sys::path::filename(path, sys::path::Style::windows); +} + +// Returns a string in the format of "foo.obj" or "foo.obj(bar.lib)". +std::string toString(const coff::InputFile *file) { + if (!file) + return ""; + if (file->parentName.empty() || file->kind() == coff::InputFile::ImportKind) + return file->getName(); + + return (getBasename(file->parentName) + "(" + getBasename(file->getName()) + + ")") + .str(); +} + namespace coff { std::vector ObjFile::instances; @@ -73,6 +91,10 @@ static void checkAndSetWeakAlias(SymbolTable *symtab, } } +static bool ignoredSymbolName(StringRef name) { + return name == "@feat.00" || name == "@comp.id"; +} + ArchiveFile::ArchiveFile(MemoryBufferRef m) : InputFile(ArchiveKind, m) {} void ArchiveFile::parse() { @@ -81,20 +103,20 @@ void ArchiveFile::parse() { // Read the symbol table to construct Lazy objects. for (const Archive::Symbol &sym : file->symbols()) - symtab->addLazy(this, sym); + symtab->addLazyArchive(this, sym); } // Returns a buffer pointing to a member file containing a given symbol. -void ArchiveFile::addMember(const Archive::Symbol *sym) { +void ArchiveFile::addMember(const Archive::Symbol &sym) { const Archive::Child &c = - CHECK(sym->getMember(), - "could not get the member for symbol " + sym->getName()); + CHECK(sym.getMember(), + "could not get the member for symbol " + toCOFFString(sym)); // Return an empty buffer if we have already returned the same buffer. if (!seen.insert(c.getChildOffset()).second) return; - driver->enqueueArchiveMember(c, sym->getName(), getName()); + driver->enqueueArchiveMember(c, sym, getName()); } std::vector getArchiveMembers(Archive *file) { @@ -116,6 +138,49 @@ std::vector getArchiveMembers(Archive return v; } +void LazyObjFile::fetch() { + if (mb.getBuffer().empty()) + return; + + InputFile *file; + if (isBitcode(mb)) + file = make(mb, "", 0, std::move(symbols)); + else + file = make(mb, std::move(symbols)); + mb = {}; + symtab->addFile(file); +} + +void LazyObjFile::parse() { + if (isBitcode(this->mb)) { + // Bitcode file. + std::unique_ptr obj = + CHECK(lto::InputFile::create(this->mb), this); + for (const lto::InputFile::Symbol &sym : obj->symbols()) { + if (!sym.isUndefined()) + symtab->addLazyObject(this, sym.getName()); + } + return; + } + + // Native object file. + std::unique_ptr coffObjPtr = CHECK(createBinary(mb), this); + COFFObjectFile *coffObj = cast(coffObjPtr.get()); + uint32_t numSymbols = coffObj->getNumberOfSymbols(); + for (uint32_t i = 0; i < numSymbols; ++i) { + COFFSymbolRef coffSym = check(coffObj->getSymbol(i)); + if (coffSym.isUndefined() || !coffSym.isExternal() || + coffSym.isWeakExternal()) + continue; + StringRef name; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Oct 23 17:52:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D268159CAC; Wed, 23 Oct 2019 17:52:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yydb0vQ7z4TDV; Wed, 23 Oct 2019 17:52:51 +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 DD337386; Wed, 23 Oct 2019 17:52:50 +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 x9NHqoLU078529; Wed, 23 Oct 2019 17:52:50 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHqobU078528; Wed, 23 Oct 2019 17:52:50 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231752.x9NHqobU078528@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:52:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353951 - vendor/lld/lld-r375505 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lld/lld-r375505 X-SVN-Commit-Revision: 353951 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:52:51 -0000 Author: dim Date: Wed Oct 23 17:52:50 2019 New Revision: 353951 URL: https://svnweb.freebsd.org/changeset/base/353951 Log: Tag stripped lld trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub. Added: vendor/lld/lld-r375505/ - copied from r353950, vendor/lld/dist/ From owner-svn-src-all@freebsd.org Wed Oct 23 17:53:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FE60159DB5; Wed, 23 Oct 2019 17:53:09 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yydx2Zqlz4TVS; Wed, 23 Oct 2019 17:53:09 +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 3B9D9387; Wed, 23 Oct 2019 17:53:09 +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 x9NHr9Ak078627; Wed, 23 Oct 2019 17:53:09 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHr2Zf078587; Wed, 23 Oct 2019 17:53:02 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231753.x9NHr2Zf078587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:53:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353952 - in vendor/lldb/dist: docs include/lldb include/lldb/API include/lldb/Breakpoint include/lldb/Core include/lldb/DataFormatters include/lldb/Expression include/lldb/Host include... X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/lldb/dist: docs include/lldb include/lldb/API include/lldb/Breakpoint include/lldb/Core include/lldb/DataFormatters include/lldb/Expression include/lldb/Host include/lldb/Host/common include... X-SVN-Commit-Revision: 353952 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:53:09 -0000 Author: dim Date: Wed Oct 23 17:53:01 2019 New Revision: 353952 URL: https://svnweb.freebsd.org/changeset/base/353952 Log: Vendor import of stripped lldb trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/lldb/trunk@375505 Added: vendor/lldb/dist/include/lldb/API/SBFile.h vendor/lldb/dist/include/lldb/Core/PropertiesBase.td vendor/lldb/dist/include/lldb/Host/LZMA.h vendor/lldb/dist/include/lldb/Interpreter/OptionGroupPythonClassWithDict.h vendor/lldb/dist/include/lldb/Symbol/CallFrameInfo.h vendor/lldb/dist/include/lldb/Utility/GDBRemote.h vendor/lldb/dist/source/API/SBFile.cpp vendor/lldb/dist/source/Core/CoreProperties.td vendor/lldb/dist/source/Host/common/LZMA.cpp vendor/lldb/dist/source/Interpreter/InterpreterProperties.td vendor/lldb/dist/source/Interpreter/OptionGroupPythonClassWithDict.cpp vendor/lldb/dist/source/Interpreter/OptionValueFileSpecList.cpp vendor/lldb/dist/source/Plugins/ABI/SysV-arc/ vendor/lldb/dist/source/Plugins/ABI/SysV-arc/ABISysV_arc.cpp vendor/lldb/dist/source/Plugins/ABI/SysV-arc/ABISysV_arc.h vendor/lldb/dist/source/Plugins/ABI/SysV-arc/CMakeLists.txt vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangDeclVendor.h vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/CppModuleConfiguration.h vendor/lldb/dist/source/Plugins/JITLoader/GDB/JITLoaderGDBProperties.td vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextWindows_i386.cpp vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextWindows_i386.h vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.cpp vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextWindows_x86_64.h vendor/lldb/dist/source/Plugins/Process/gdb-remote/ProcessGDBRemoteProperties.td vendor/lldb/dist/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLogProperties.td vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFProperties.td vendor/lldb/dist/source/Target/TargetProperties.td vendor/lldb/dist/source/Utility/GDBRemote.cpp vendor/lldb/dist/utils/TableGen/LLDBPropertyDefEmitter.cpp vendor/lldb/dist/utils/TableGen/LLDBTableGenUtils.cpp vendor/lldb/dist/utils/TableGen/LLDBTableGenUtils.h Deleted: vendor/lldb/dist/include/lldb/Symbol/VerifyDecl.h vendor/lldb/dist/include/lldb/Utility/CleanUp.h vendor/lldb/dist/include/lldb/Utility/FileCollector.h vendor/lldb/dist/include/lldb/Utility/JSON.h vendor/lldb/dist/include/lldb/Utility/StreamGDBRemote.h vendor/lldb/dist/source/Commands/CommandObjectBugreport.cpp vendor/lldb/dist/source/Commands/CommandObjectBugreport.h vendor/lldb/dist/source/Interpreter/OptionValueFileSpecLIst.cpp vendor/lldb/dist/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.cpp vendor/lldb/dist/source/Plugins/ScriptInterpreter/Python/PythonExceptionState.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDebugLine.h vendor/lldb/dist/source/Symbol/VerifyDecl.cpp vendor/lldb/dist/source/Utility/FileCollector.cpp vendor/lldb/dist/source/Utility/JSON.cpp vendor/lldb/dist/source/Utility/StreamGDBRemote.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgContext.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgContext.h vendor/lldb/dist/tools/lldb-mi/MICmdArgSet.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgSet.h vendor/lldb/dist/tools/lldb-mi/MICmdArgValBase.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgValBase.h vendor/lldb/dist/tools/lldb-mi/MICmdArgValConsume.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgValConsume.h vendor/lldb/dist/tools/lldb-mi/MICmdArgValFile.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgValFile.h vendor/lldb/dist/tools/lldb-mi/MICmdArgValListBase.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgValListBase.h vendor/lldb/dist/tools/lldb-mi/MICmdArgValListOfN.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgValListOfN.h vendor/lldb/dist/tools/lldb-mi/MICmdArgValNumber.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgValNumber.h vendor/lldb/dist/tools/lldb-mi/MICmdArgValOptionLong.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgValOptionLong.h vendor/lldb/dist/tools/lldb-mi/MICmdArgValOptionShort.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgValOptionShort.h vendor/lldb/dist/tools/lldb-mi/MICmdArgValPrintValues.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgValPrintValues.h vendor/lldb/dist/tools/lldb-mi/MICmdArgValString.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgValString.h vendor/lldb/dist/tools/lldb-mi/MICmdArgValThreadGrp.cpp vendor/lldb/dist/tools/lldb-mi/MICmdArgValThreadGrp.h vendor/lldb/dist/tools/lldb-mi/MICmdBase.cpp vendor/lldb/dist/tools/lldb-mi/MICmdBase.h vendor/lldb/dist/tools/lldb-mi/MICmdCmd.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmd.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdBreak.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdBreak.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdData.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdData.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdEnviro.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdEnviro.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdExec.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdExec.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdFile.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdFile.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdGdbInfo.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdGdbInfo.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdGdbSet.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdGdbSet.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdGdbShow.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdGdbShow.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdGdbThread.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdGdbThread.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdMiscellanous.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdMiscellanous.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdStack.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdStack.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdSupportInfo.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdSupportInfo.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdSupportList.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdSupportList.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdSymbol.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdSymbol.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdTarget.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdTarget.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdThread.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdThread.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdTrace.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdTrace.h vendor/lldb/dist/tools/lldb-mi/MICmdCmdVar.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCmdVar.h vendor/lldb/dist/tools/lldb-mi/MICmdCommands.cpp vendor/lldb/dist/tools/lldb-mi/MICmdCommands.h vendor/lldb/dist/tools/lldb-mi/MICmdData.cpp vendor/lldb/dist/tools/lldb-mi/MICmdData.h vendor/lldb/dist/tools/lldb-mi/MICmdFactory.cpp vendor/lldb/dist/tools/lldb-mi/MICmdFactory.h vendor/lldb/dist/tools/lldb-mi/MICmdInterpreter.cpp vendor/lldb/dist/tools/lldb-mi/MICmdInterpreter.h vendor/lldb/dist/tools/lldb-mi/MICmdInvoker.cpp vendor/lldb/dist/tools/lldb-mi/MICmdInvoker.h vendor/lldb/dist/tools/lldb-mi/MICmdMgr.cpp vendor/lldb/dist/tools/lldb-mi/MICmdMgr.h vendor/lldb/dist/tools/lldb-mi/MICmdMgrSetCmdDeleteCallback.cpp vendor/lldb/dist/tools/lldb-mi/MICmdMgrSetCmdDeleteCallback.h vendor/lldb/dist/tools/lldb-mi/MICmnBase.cpp vendor/lldb/dist/tools/lldb-mi/MICmnBase.h vendor/lldb/dist/tools/lldb-mi/MICmnConfig.h vendor/lldb/dist/tools/lldb-mi/MICmnLLDBBroadcaster.cpp vendor/lldb/dist/tools/lldb-mi/MICmnLLDBBroadcaster.h vendor/lldb/dist/tools/lldb-mi/MICmnLLDBDebugSessionInfo.cpp vendor/lldb/dist/tools/lldb-mi/MICmnLLDBDebugSessionInfo.h vendor/lldb/dist/tools/lldb-mi/MICmnLLDBDebugSessionInfoVarObj.cpp vendor/lldb/dist/tools/lldb-mi/MICmnLLDBDebugSessionInfoVarObj.h vendor/lldb/dist/tools/lldb-mi/MICmnLLDBDebugger.cpp vendor/lldb/dist/tools/lldb-mi/MICmnLLDBDebugger.h vendor/lldb/dist/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.cpp vendor/lldb/dist/tools/lldb-mi/MICmnLLDBDebuggerHandleEvents.h vendor/lldb/dist/tools/lldb-mi/MICmnLLDBProxySBValue.cpp vendor/lldb/dist/tools/lldb-mi/MICmnLLDBProxySBValue.h vendor/lldb/dist/tools/lldb-mi/MICmnLLDBUtilSBValue.cpp vendor/lldb/dist/tools/lldb-mi/MICmnLLDBUtilSBValue.h vendor/lldb/dist/tools/lldb-mi/MICmnLog.cpp vendor/lldb/dist/tools/lldb-mi/MICmnLog.h vendor/lldb/dist/tools/lldb-mi/MICmnLogMediumFile.cpp vendor/lldb/dist/tools/lldb-mi/MICmnLogMediumFile.h vendor/lldb/dist/tools/lldb-mi/MICmnMIOutOfBandRecord.cpp vendor/lldb/dist/tools/lldb-mi/MICmnMIOutOfBandRecord.h vendor/lldb/dist/tools/lldb-mi/MICmnMIResultRecord.cpp vendor/lldb/dist/tools/lldb-mi/MICmnMIResultRecord.h vendor/lldb/dist/tools/lldb-mi/MICmnMIValue.cpp vendor/lldb/dist/tools/lldb-mi/MICmnMIValue.h vendor/lldb/dist/tools/lldb-mi/MICmnMIValueConst.cpp vendor/lldb/dist/tools/lldb-mi/MICmnMIValueConst.h vendor/lldb/dist/tools/lldb-mi/MICmnMIValueList.cpp vendor/lldb/dist/tools/lldb-mi/MICmnMIValueList.h vendor/lldb/dist/tools/lldb-mi/MICmnMIValueResult.cpp vendor/lldb/dist/tools/lldb-mi/MICmnMIValueResult.h vendor/lldb/dist/tools/lldb-mi/MICmnMIValueTuple.cpp vendor/lldb/dist/tools/lldb-mi/MICmnMIValueTuple.h vendor/lldb/dist/tools/lldb-mi/MICmnResources.cpp vendor/lldb/dist/tools/lldb-mi/MICmnResources.h vendor/lldb/dist/tools/lldb-mi/MICmnStreamStderr.cpp vendor/lldb/dist/tools/lldb-mi/MICmnStreamStderr.h vendor/lldb/dist/tools/lldb-mi/MICmnStreamStdin.cpp vendor/lldb/dist/tools/lldb-mi/MICmnStreamStdin.h vendor/lldb/dist/tools/lldb-mi/MICmnStreamStdout.cpp vendor/lldb/dist/tools/lldb-mi/MICmnStreamStdout.h vendor/lldb/dist/tools/lldb-mi/MICmnThreadMgrStd.cpp vendor/lldb/dist/tools/lldb-mi/MICmnThreadMgrStd.h vendor/lldb/dist/tools/lldb-mi/MIDataTypes.h vendor/lldb/dist/tools/lldb-mi/MIDriver.cpp vendor/lldb/dist/tools/lldb-mi/MIDriver.h vendor/lldb/dist/tools/lldb-mi/MIDriverBase.cpp vendor/lldb/dist/tools/lldb-mi/MIDriverBase.h vendor/lldb/dist/tools/lldb-mi/MIDriverMain.cpp vendor/lldb/dist/tools/lldb-mi/MIDriverMgr.cpp vendor/lldb/dist/tools/lldb-mi/MIDriverMgr.h vendor/lldb/dist/tools/lldb-mi/MIExtensions.txt vendor/lldb/dist/tools/lldb-mi/MIReadMe.txt vendor/lldb/dist/tools/lldb-mi/MIUtilDateTimeStd.cpp vendor/lldb/dist/tools/lldb-mi/MIUtilDateTimeStd.h vendor/lldb/dist/tools/lldb-mi/MIUtilDebug.cpp vendor/lldb/dist/tools/lldb-mi/MIUtilDebug.h vendor/lldb/dist/tools/lldb-mi/MIUtilFileStd.cpp vendor/lldb/dist/tools/lldb-mi/MIUtilFileStd.h vendor/lldb/dist/tools/lldb-mi/MIUtilMapIdToVariant.cpp vendor/lldb/dist/tools/lldb-mi/MIUtilMapIdToVariant.h vendor/lldb/dist/tools/lldb-mi/MIUtilSingletonBase.h vendor/lldb/dist/tools/lldb-mi/MIUtilSingletonHelper.h vendor/lldb/dist/tools/lldb-mi/MIUtilString.cpp vendor/lldb/dist/tools/lldb-mi/MIUtilString.h vendor/lldb/dist/tools/lldb-mi/MIUtilThreadBaseStd.cpp vendor/lldb/dist/tools/lldb-mi/MIUtilThreadBaseStd.h vendor/lldb/dist/tools/lldb-mi/MIUtilVariant.cpp vendor/lldb/dist/tools/lldb-mi/MIUtilVariant.h vendor/lldb/dist/tools/lldb-mi/Platform.h vendor/lldb/dist/tools/lldb-mi/module.modulemap Modified: vendor/lldb/dist/docs/lldb.1 vendor/lldb/dist/include/lldb/API/LLDB.h vendor/lldb/dist/include/lldb/API/SBCommandReturnObject.h vendor/lldb/dist/include/lldb/API/SBDebugger.h vendor/lldb/dist/include/lldb/API/SBDefines.h vendor/lldb/dist/include/lldb/API/SBError.h vendor/lldb/dist/include/lldb/API/SBInstruction.h vendor/lldb/dist/include/lldb/API/SBInstructionList.h vendor/lldb/dist/include/lldb/API/SBProcess.h vendor/lldb/dist/include/lldb/API/SBStream.h vendor/lldb/dist/include/lldb/API/SBStructuredData.h vendor/lldb/dist/include/lldb/API/SBThread.h vendor/lldb/dist/include/lldb/API/SBThreadPlan.h vendor/lldb/dist/include/lldb/Breakpoint/BreakpointLocation.h vendor/lldb/dist/include/lldb/Breakpoint/BreakpointOptions.h vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverAddress.h vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverFileLine.h vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverFileRegex.h vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverName.h vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverScripted.h vendor/lldb/dist/include/lldb/Core/Address.h vendor/lldb/dist/include/lldb/Core/AddressResolverFileLine.h vendor/lldb/dist/include/lldb/Core/AddressResolverName.h vendor/lldb/dist/include/lldb/Core/Debugger.h vendor/lldb/dist/include/lldb/Core/FileLineResolver.h vendor/lldb/dist/include/lldb/Core/FileSpecList.h vendor/lldb/dist/include/lldb/Core/FormatEntity.h vendor/lldb/dist/include/lldb/Core/IOHandler.h vendor/lldb/dist/include/lldb/Core/LoadedModuleInfoList.h vendor/lldb/dist/include/lldb/Core/Mangled.h vendor/lldb/dist/include/lldb/Core/Module.h vendor/lldb/dist/include/lldb/Core/ModuleList.h vendor/lldb/dist/include/lldb/Core/ModuleSpec.h vendor/lldb/dist/include/lldb/Core/PluginManager.h vendor/lldb/dist/include/lldb/Core/SearchFilter.h vendor/lldb/dist/include/lldb/Core/Section.h vendor/lldb/dist/include/lldb/Core/StreamFile.h vendor/lldb/dist/include/lldb/Core/StructuredDataImpl.h vendor/lldb/dist/include/lldb/Core/Value.h vendor/lldb/dist/include/lldb/Core/dwarf.h vendor/lldb/dist/include/lldb/DataFormatters/FormattersContainer.h vendor/lldb/dist/include/lldb/DataFormatters/StringPrinter.h vendor/lldb/dist/include/lldb/DataFormatters/TypeCategory.h vendor/lldb/dist/include/lldb/Expression/DWARFExpression.h vendor/lldb/dist/include/lldb/Expression/DiagnosticManager.h vendor/lldb/dist/include/lldb/Expression/ExpressionSourceCode.h vendor/lldb/dist/include/lldb/Expression/LLVMUserExpression.h vendor/lldb/dist/include/lldb/Expression/Materializer.h vendor/lldb/dist/include/lldb/Expression/REPL.h vendor/lldb/dist/include/lldb/Host/Config.h.cmake vendor/lldb/dist/include/lldb/Host/Editline.h vendor/lldb/dist/include/lldb/Host/File.h vendor/lldb/dist/include/lldb/Host/FileCache.h vendor/lldb/dist/include/lldb/Host/FileSystem.h vendor/lldb/dist/include/lldb/Host/Socket.h vendor/lldb/dist/include/lldb/Host/common/NativeProcessProtocol.h vendor/lldb/dist/include/lldb/Interpreter/CommandAlias.h vendor/lldb/dist/include/lldb/Interpreter/CommandCompletions.h vendor/lldb/dist/include/lldb/Interpreter/CommandInterpreter.h vendor/lldb/dist/include/lldb/Interpreter/CommandObject.h vendor/lldb/dist/include/lldb/Interpreter/CommandObjectMultiword.h vendor/lldb/dist/include/lldb/Interpreter/CommandObjectRegexCommand.h vendor/lldb/dist/include/lldb/Interpreter/CommandReturnObject.h vendor/lldb/dist/include/lldb/Interpreter/OptionValue.h vendor/lldb/dist/include/lldb/Interpreter/OptionValueArch.h vendor/lldb/dist/include/lldb/Interpreter/OptionValueBoolean.h vendor/lldb/dist/include/lldb/Interpreter/OptionValueEnumeration.h vendor/lldb/dist/include/lldb/Interpreter/OptionValueFileSpec.h vendor/lldb/dist/include/lldb/Interpreter/OptionValueFormatEntity.h vendor/lldb/dist/include/lldb/Interpreter/OptionValueRegex.h vendor/lldb/dist/include/lldb/Interpreter/OptionValueUUID.h vendor/lldb/dist/include/lldb/Interpreter/Options.h vendor/lldb/dist/include/lldb/Interpreter/ScriptInterpreter.h vendor/lldb/dist/include/lldb/Symbol/ClangASTContext.h vendor/lldb/dist/include/lldb/Symbol/ClangASTImporter.h vendor/lldb/dist/include/lldb/Symbol/CompileUnit.h vendor/lldb/dist/include/lldb/Symbol/CompilerType.h vendor/lldb/dist/include/lldb/Symbol/DeclVendor.h vendor/lldb/dist/include/lldb/Symbol/FuncUnwinders.h vendor/lldb/dist/include/lldb/Symbol/Function.h vendor/lldb/dist/include/lldb/Symbol/ObjectFile.h vendor/lldb/dist/include/lldb/Symbol/PostfixExpression.h vendor/lldb/dist/include/lldb/Symbol/Symbol.h vendor/lldb/dist/include/lldb/Symbol/SymbolContext.h vendor/lldb/dist/include/lldb/Symbol/SymbolFile.h vendor/lldb/dist/include/lldb/Symbol/SymbolVendor.h vendor/lldb/dist/include/lldb/Symbol/Symtab.h vendor/lldb/dist/include/lldb/Symbol/Type.h vendor/lldb/dist/include/lldb/Symbol/TypeList.h vendor/lldb/dist/include/lldb/Symbol/TypeSystem.h vendor/lldb/dist/include/lldb/Symbol/UnwindPlan.h vendor/lldb/dist/include/lldb/Symbol/UnwindTable.h vendor/lldb/dist/include/lldb/Symbol/Variable.h vendor/lldb/dist/include/lldb/Target/ABI.h vendor/lldb/dist/include/lldb/Target/DynamicLoader.h vendor/lldb/dist/include/lldb/Target/Language.h vendor/lldb/dist/include/lldb/Target/Platform.h vendor/lldb/dist/include/lldb/Target/Process.h vendor/lldb/dist/include/lldb/Target/RemoteAwarePlatform.h vendor/lldb/dist/include/lldb/Target/StackFrame.h vendor/lldb/dist/include/lldb/Target/StopInfo.h vendor/lldb/dist/include/lldb/Target/Target.h vendor/lldb/dist/include/lldb/Target/Thread.h vendor/lldb/dist/include/lldb/Target/ThreadPlanPython.h vendor/lldb/dist/include/lldb/Target/Unwind.h vendor/lldb/dist/include/lldb/Utility/AnsiTerminal.h vendor/lldb/dist/include/lldb/Utility/ArchSpec.h vendor/lldb/dist/include/lldb/Utility/Args.h vendor/lldb/dist/include/lldb/Utility/CompletionRequest.h vendor/lldb/dist/include/lldb/Utility/ConstString.h vendor/lldb/dist/include/lldb/Utility/DataEncoder.h vendor/lldb/dist/include/lldb/Utility/DataExtractor.h vendor/lldb/dist/include/lldb/Utility/FileSpec.h vendor/lldb/dist/include/lldb/Utility/Flags.h vendor/lldb/dist/include/lldb/Utility/IOObject.h vendor/lldb/dist/include/lldb/Utility/Log.h vendor/lldb/dist/include/lldb/Utility/Logging.h vendor/lldb/dist/include/lldb/Utility/Predicate.h vendor/lldb/dist/include/lldb/Utility/ProcessInfo.h vendor/lldb/dist/include/lldb/Utility/RangeMap.h vendor/lldb/dist/include/lldb/Utility/RegularExpression.h vendor/lldb/dist/include/lldb/Utility/Reproducer.h vendor/lldb/dist/include/lldb/Utility/ReproducerInstrumentation.h vendor/lldb/dist/include/lldb/Utility/Scalar.h vendor/lldb/dist/include/lldb/Utility/Status.h vendor/lldb/dist/include/lldb/Utility/Stream.h vendor/lldb/dist/include/lldb/Utility/StringExtractor.h vendor/lldb/dist/include/lldb/Utility/StringLexer.h vendor/lldb/dist/include/lldb/Utility/StringList.h vendor/lldb/dist/include/lldb/Utility/StructuredData.h vendor/lldb/dist/include/lldb/Utility/UUID.h vendor/lldb/dist/include/lldb/lldb-enumerations.h vendor/lldb/dist/include/lldb/lldb-forward.h vendor/lldb/dist/include/lldb/lldb-private-enumerations.h vendor/lldb/dist/include/lldb/lldb-private-interfaces.h vendor/lldb/dist/source/API/SBAddress.cpp vendor/lldb/dist/source/API/SBBreakpointOptionCommon.cpp vendor/lldb/dist/source/API/SBCommandInterpreter.cpp vendor/lldb/dist/source/API/SBCommandReturnObject.cpp vendor/lldb/dist/source/API/SBCompileUnit.cpp vendor/lldb/dist/source/API/SBDebugger.cpp vendor/lldb/dist/source/API/SBDeclaration.cpp vendor/lldb/dist/source/API/SBFrame.cpp vendor/lldb/dist/source/API/SBInstruction.cpp vendor/lldb/dist/source/API/SBInstructionList.cpp vendor/lldb/dist/source/API/SBLineEntry.cpp vendor/lldb/dist/source/API/SBModule.cpp vendor/lldb/dist/source/API/SBProcess.cpp vendor/lldb/dist/source/API/SBReproducer.cpp vendor/lldb/dist/source/API/SBReproducerPrivate.h vendor/lldb/dist/source/API/SBStream.cpp vendor/lldb/dist/source/API/SBStringList.cpp vendor/lldb/dist/source/API/SBSymbolContext.cpp vendor/lldb/dist/source/API/SBTarget.cpp vendor/lldb/dist/source/API/SBThread.cpp vendor/lldb/dist/source/API/SBThreadPlan.cpp vendor/lldb/dist/source/API/SBType.cpp vendor/lldb/dist/source/API/SBTypeCategory.cpp vendor/lldb/dist/source/API/SystemInitializerFull.cpp vendor/lldb/dist/source/API/Utils.h vendor/lldb/dist/source/Breakpoint/Breakpoint.cpp vendor/lldb/dist/source/Breakpoint/BreakpointIDList.cpp vendor/lldb/dist/source/Breakpoint/BreakpointLocation.cpp vendor/lldb/dist/source/Breakpoint/BreakpointOptions.cpp vendor/lldb/dist/source/Breakpoint/BreakpointResolver.cpp vendor/lldb/dist/source/Breakpoint/BreakpointResolverAddress.cpp vendor/lldb/dist/source/Breakpoint/BreakpointResolverFileLine.cpp vendor/lldb/dist/source/Breakpoint/BreakpointResolverFileRegex.cpp vendor/lldb/dist/source/Breakpoint/BreakpointResolverName.cpp vendor/lldb/dist/source/Breakpoint/BreakpointResolverScripted.cpp vendor/lldb/dist/source/Breakpoint/Watchpoint.cpp vendor/lldb/dist/source/Breakpoint/WatchpointOptions.cpp vendor/lldb/dist/source/Commands/CommandCompletions.cpp vendor/lldb/dist/source/Commands/CommandObjectApropos.cpp vendor/lldb/dist/source/Commands/CommandObjectBreakpoint.cpp vendor/lldb/dist/source/Commands/CommandObjectBreakpointCommand.cpp vendor/lldb/dist/source/Commands/CommandObjectCommands.cpp vendor/lldb/dist/source/Commands/CommandObjectDisassemble.cpp vendor/lldb/dist/source/Commands/CommandObjectExpression.cpp vendor/lldb/dist/source/Commands/CommandObjectExpression.h vendor/lldb/dist/source/Commands/CommandObjectFrame.cpp vendor/lldb/dist/source/Commands/CommandObjectGUI.cpp vendor/lldb/dist/source/Commands/CommandObjectHelp.cpp vendor/lldb/dist/source/Commands/CommandObjectHelp.h vendor/lldb/dist/source/Commands/CommandObjectLog.cpp vendor/lldb/dist/source/Commands/CommandObjectMemory.cpp vendor/lldb/dist/source/Commands/CommandObjectMultiword.cpp vendor/lldb/dist/source/Commands/CommandObjectPlatform.cpp vendor/lldb/dist/source/Commands/CommandObjectPlugin.cpp vendor/lldb/dist/source/Commands/CommandObjectProcess.cpp vendor/lldb/dist/source/Commands/CommandObjectRegister.cpp vendor/lldb/dist/source/Commands/CommandObjectReproducer.cpp vendor/lldb/dist/source/Commands/CommandObjectSettings.cpp vendor/lldb/dist/source/Commands/CommandObjectSource.cpp vendor/lldb/dist/source/Commands/CommandObjectStats.cpp vendor/lldb/dist/source/Commands/CommandObjectTarget.cpp vendor/lldb/dist/source/Commands/CommandObjectThread.cpp vendor/lldb/dist/source/Commands/CommandObjectType.cpp vendor/lldb/dist/source/Commands/CommandObjectWatchpoint.cpp vendor/lldb/dist/source/Commands/CommandObjectWatchpointCommand.cpp vendor/lldb/dist/source/Commands/Options.td vendor/lldb/dist/source/Commands/OptionsBase.td vendor/lldb/dist/source/Core/Address.cpp vendor/lldb/dist/source/Core/AddressResolverFileLine.cpp vendor/lldb/dist/source/Core/AddressResolverName.cpp vendor/lldb/dist/source/Core/Communication.cpp vendor/lldb/dist/source/Core/Debugger.cpp vendor/lldb/dist/source/Core/Disassembler.cpp vendor/lldb/dist/source/Core/DumpDataExtractor.cpp vendor/lldb/dist/source/Core/FileLineResolver.cpp vendor/lldb/dist/source/Core/FormatEntity.cpp vendor/lldb/dist/source/Core/Highlighter.cpp vendor/lldb/dist/source/Core/IOHandler.cpp vendor/lldb/dist/source/Core/Mangled.cpp vendor/lldb/dist/source/Core/Module.cpp vendor/lldb/dist/source/Core/ModuleList.cpp vendor/lldb/dist/source/Core/PluginManager.cpp vendor/lldb/dist/source/Core/SearchFilter.cpp vendor/lldb/dist/source/Core/Section.cpp vendor/lldb/dist/source/Core/SourceManager.cpp vendor/lldb/dist/source/Core/StreamFile.cpp vendor/lldb/dist/source/Core/Value.cpp vendor/lldb/dist/source/Core/ValueObject.cpp vendor/lldb/dist/source/Core/ValueObjectCast.cpp vendor/lldb/dist/source/Core/ValueObjectChild.cpp vendor/lldb/dist/source/Core/ValueObjectConstResult.cpp vendor/lldb/dist/source/Core/ValueObjectDynamicValue.cpp vendor/lldb/dist/source/Core/ValueObjectMemory.cpp vendor/lldb/dist/source/Core/ValueObjectRegister.cpp vendor/lldb/dist/source/Core/ValueObjectSyntheticFilter.cpp vendor/lldb/dist/source/Core/ValueObjectVariable.cpp vendor/lldb/dist/source/DataFormatters/FormatManager.cpp vendor/lldb/dist/source/DataFormatters/FormattersHelpers.cpp vendor/lldb/dist/source/DataFormatters/TypeCategoryMap.cpp vendor/lldb/dist/source/DataFormatters/TypeFormat.cpp vendor/lldb/dist/source/DataFormatters/ValueObjectPrinter.cpp vendor/lldb/dist/source/DataFormatters/VectorType.cpp vendor/lldb/dist/source/Expression/DWARFExpression.cpp vendor/lldb/dist/source/Expression/DiagnosticManager.cpp vendor/lldb/dist/source/Expression/ExpressionVariable.cpp vendor/lldb/dist/source/Expression/FunctionCaller.cpp vendor/lldb/dist/source/Expression/IRExecutionUnit.cpp vendor/lldb/dist/source/Expression/IRInterpreter.cpp vendor/lldb/dist/source/Expression/IRMemoryMap.cpp vendor/lldb/dist/source/Expression/LLVMUserExpression.cpp vendor/lldb/dist/source/Expression/Materializer.cpp vendor/lldb/dist/source/Expression/REPL.cpp vendor/lldb/dist/source/Expression/UserExpression.cpp vendor/lldb/dist/source/Expression/UtilityFunction.cpp vendor/lldb/dist/source/Host/common/Editline.cpp vendor/lldb/dist/source/Host/common/File.cpp vendor/lldb/dist/source/Host/common/FileCache.cpp vendor/lldb/dist/source/Host/common/FileSystem.cpp vendor/lldb/dist/source/Host/common/Host.cpp vendor/lldb/dist/source/Host/common/HostInfoBase.cpp vendor/lldb/dist/source/Host/common/HostNativeThreadBase.cpp vendor/lldb/dist/source/Host/common/MainLoop.cpp vendor/lldb/dist/source/Host/common/NativeProcessProtocol.cpp vendor/lldb/dist/source/Host/common/NativeRegisterContext.cpp vendor/lldb/dist/source/Host/common/Socket.cpp vendor/lldb/dist/source/Host/common/TCPSocket.cpp vendor/lldb/dist/source/Host/common/UDPSocket.cpp vendor/lldb/dist/source/Host/freebsd/HostInfoFreeBSD.cpp vendor/lldb/dist/source/Host/posix/ConnectionFileDescriptorPosix.cpp vendor/lldb/dist/source/Host/posix/HostInfoPosix.cpp vendor/lldb/dist/source/Initialization/SystemInitializerCommon.cpp vendor/lldb/dist/source/Interpreter/CommandAlias.cpp vendor/lldb/dist/source/Interpreter/CommandInterpreter.cpp vendor/lldb/dist/source/Interpreter/CommandObject.cpp vendor/lldb/dist/source/Interpreter/CommandObjectRegexCommand.cpp vendor/lldb/dist/source/Interpreter/CommandReturnObject.cpp vendor/lldb/dist/source/Interpreter/OptionArgParser.cpp vendor/lldb/dist/source/Interpreter/OptionGroupArchitecture.cpp vendor/lldb/dist/source/Interpreter/OptionGroupFormat.cpp vendor/lldb/dist/source/Interpreter/OptionGroupOutputFile.cpp vendor/lldb/dist/source/Interpreter/OptionGroupPlatform.cpp vendor/lldb/dist/source/Interpreter/OptionGroupUUID.cpp vendor/lldb/dist/source/Interpreter/OptionGroupValueObjectDisplay.cpp vendor/lldb/dist/source/Interpreter/OptionGroupVariable.cpp vendor/lldb/dist/source/Interpreter/OptionGroupWatchpoint.cpp vendor/lldb/dist/source/Interpreter/OptionValue.cpp vendor/lldb/dist/source/Interpreter/OptionValueArch.cpp vendor/lldb/dist/source/Interpreter/OptionValueBoolean.cpp vendor/lldb/dist/source/Interpreter/OptionValueDictionary.cpp vendor/lldb/dist/source/Interpreter/OptionValueEnumeration.cpp vendor/lldb/dist/source/Interpreter/OptionValueFileSpec.cpp vendor/lldb/dist/source/Interpreter/OptionValueFormatEntity.cpp vendor/lldb/dist/source/Interpreter/OptionValueLanguage.cpp vendor/lldb/dist/source/Interpreter/OptionValueRegex.cpp vendor/lldb/dist/source/Interpreter/OptionValueUUID.cpp vendor/lldb/dist/source/Interpreter/Options.cpp vendor/lldb/dist/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.cpp vendor/lldb/dist/source/Plugins/ABI/MacOSX-arm/ABIMacOSX_arm.h vendor/lldb/dist/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.cpp vendor/lldb/dist/source/Plugins/ABI/MacOSX-arm64/ABIMacOSX_arm64.h vendor/lldb/dist/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.cpp vendor/lldb/dist/source/Plugins/ABI/MacOSX-i386/ABIMacOSX_i386.h vendor/lldb/dist/source/Plugins/ABI/SysV-arm/ABISysV_arm.cpp vendor/lldb/dist/source/Plugins/ABI/SysV-arm/ABISysV_arm.h vendor/lldb/dist/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.cpp vendor/lldb/dist/source/Plugins/ABI/SysV-arm64/ABISysV_arm64.h vendor/lldb/dist/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.cpp vendor/lldb/dist/source/Plugins/ABI/SysV-hexagon/ABISysV_hexagon.h vendor/lldb/dist/source/Plugins/ABI/SysV-i386/ABISysV_i386.cpp vendor/lldb/dist/source/Plugins/ABI/SysV-i386/ABISysV_i386.h vendor/lldb/dist/source/Plugins/ABI/SysV-mips/ABISysV_mips.cpp vendor/lldb/dist/source/Plugins/ABI/SysV-mips/ABISysV_mips.h vendor/lldb/dist/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.cpp vendor/lldb/dist/source/Plugins/ABI/SysV-mips64/ABISysV_mips64.h vendor/lldb/dist/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.cpp vendor/lldb/dist/source/Plugins/ABI/SysV-ppc/ABISysV_ppc.h vendor/lldb/dist/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.cpp vendor/lldb/dist/source/Plugins/ABI/SysV-ppc64/ABISysV_ppc64.h vendor/lldb/dist/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.cpp vendor/lldb/dist/source/Plugins/ABI/SysV-s390x/ABISysV_s390x.h vendor/lldb/dist/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.cpp vendor/lldb/dist/source/Plugins/ABI/SysV-x86_64/ABISysV_x86_64.h vendor/lldb/dist/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.cpp vendor/lldb/dist/source/Plugins/ABI/Windows-x86_64/ABIWindows_x86_64.h vendor/lldb/dist/source/Plugins/Architecture/Mips/ArchitectureMips.cpp vendor/lldb/dist/source/Plugins/Disassembler/llvm/DisassemblerLLVMC.cpp vendor/lldb/dist/source/Plugins/DynamicLoader/Hexagon-DYLD/DynamicLoaderHexagonDYLD.cpp vendor/lldb/dist/source/Plugins/DynamicLoader/Hexagon-DYLD/HexagonDYLDRendezvous.cpp vendor/lldb/dist/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.cpp vendor/lldb/dist/source/Plugins/DynamicLoader/POSIX-DYLD/DYLDRendezvous.h vendor/lldb/dist/source/Plugins/DynamicLoader/POSIX-DYLD/DynamicLoaderPOSIXDYLD.cpp vendor/lldb/dist/source/Plugins/DynamicLoader/Windows-DYLD/DynamicLoaderWindowsDYLD.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ASTDumper.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ASTResultSynthesizer.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangASTSource.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangDiagnostic.h vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangExpressionDeclMap.h vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangExpressionParser.h vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangExpressionSourceCode.h vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangFunctionCaller.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangHost.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangModulesDeclVendor.h vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangPersistentVariables.h vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangUserExpression.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangUserExpression.h vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ClangUtilityFunction.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/IRDynamicChecks.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/IRForTarget.cpp vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/IRForTarget.h vendor/lldb/dist/source/Plugins/ExpressionParser/Clang/ModuleDependencyCollector.h vendor/lldb/dist/source/Plugins/Instruction/ARM/EmulateInstructionARM.cpp vendor/lldb/dist/source/Plugins/Instruction/ARM64/EmulateInstructionARM64.cpp vendor/lldb/dist/source/Plugins/Instruction/MIPS/EmulateInstructionMIPS.cpp vendor/lldb/dist/source/Plugins/Instruction/MIPS64/EmulateInstructionMIPS64.cpp vendor/lldb/dist/source/Plugins/Instruction/PPC64/EmulateInstructionPPC64.cpp vendor/lldb/dist/source/Plugins/InstrumentationRuntime/ASan/ASanRuntime.cpp vendor/lldb/dist/source/Plugins/InstrumentationRuntime/TSan/TSanRuntime.cpp vendor/lldb/dist/source/Plugins/InstrumentationRuntime/UBSan/UBSanRuntime.cpp vendor/lldb/dist/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp vendor/lldb/dist/source/Plugins/Language/CPlusPlus/BlockPointer.cpp vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CPlusPlusLanguage.cpp vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CxxStringTypes.cpp vendor/lldb/dist/source/Plugins/Language/CPlusPlus/CxxStringTypes.h vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibCxxBitset.cpp vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibCxxOptional.cpp vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibCxxQueue.cpp vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibCxxTuple.cpp vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibCxxVariant.cpp vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibStdcppTuple.cpp vendor/lldb/dist/source/Plugins/Language/CPlusPlus/LibStdcppUniquePointer.cpp vendor/lldb/dist/source/Plugins/Language/ObjC/CoreMedia.cpp vendor/lldb/dist/source/Plugins/Language/ObjC/NSArray.cpp vendor/lldb/dist/source/Plugins/Language/ObjC/NSDictionary.h vendor/lldb/dist/source/Plugins/Language/ObjC/NSString.cpp vendor/lldb/dist/source/Plugins/Language/ObjC/ObjCLanguage.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/CPlusPlus/CPPLanguageRuntime.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/CPlusPlus/ItaniumABI/ItaniumABILanguageRuntime.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCDeclVendor.h vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntime.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV1.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCRuntimeV2.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTrampolineHandler.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleObjCTypeEncodingParser.h vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/AppleObjCRuntime/AppleThreadPlanStepThroughObjCTrampoline.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/ObjC/ObjCLanguageRuntime.h vendor/lldb/dist/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptExpressionOpts.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.cpp vendor/lldb/dist/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptRuntime.h vendor/lldb/dist/source/Plugins/LanguageRuntime/RenderScript/RenderScriptRuntime/RenderScriptx86ABIFixups.cpp vendor/lldb/dist/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.cpp vendor/lldb/dist/source/Plugins/ObjectFile/Breakpad/BreakpadRecords.h vendor/lldb/dist/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.cpp vendor/lldb/dist/source/Plugins/ObjectFile/Breakpad/ObjectFileBreakpad.h vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ObjectFileELF.cpp vendor/lldb/dist/source/Plugins/ObjectFile/ELF/ObjectFileELF.h vendor/lldb/dist/source/Plugins/ObjectFile/JIT/ObjectFileJIT.cpp vendor/lldb/dist/source/Plugins/ObjectFile/JIT/ObjectFileJIT.h vendor/lldb/dist/source/Plugins/OperatingSystem/Python/OperatingSystemPython.cpp vendor/lldb/dist/source/Plugins/Platform/POSIX/PlatformPOSIX.cpp vendor/lldb/dist/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.cpp vendor/lldb/dist/source/Plugins/Platform/gdb-server/PlatformRemoteGDBServer.h vendor/lldb/dist/source/Plugins/Process/Darwin/DarwinProcessLauncher.cpp vendor/lldb/dist/source/Plugins/Process/Darwin/MachException.cpp vendor/lldb/dist/source/Plugins/Process/Darwin/NativeProcessDarwin.cpp vendor/lldb/dist/source/Plugins/Process/Darwin/NativeThreadListDarwin.cpp vendor/lldb/dist/source/Plugins/Process/FreeBSD/FreeBSDThread.cpp vendor/lldb/dist/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp vendor/lldb/dist/source/Plugins/Process/FreeBSD/ProcessMonitor.cpp vendor/lldb/dist/source/Plugins/Process/FreeBSD/ProcessMonitor.h vendor/lldb/dist/source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp vendor/lldb/dist/source/Plugins/Process/NetBSD/NativeProcessNetBSD.h vendor/lldb/dist/source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD_x86_64.cpp vendor/lldb/dist/source/Plugins/Process/POSIX/CrashReason.cpp vendor/lldb/dist/source/Plugins/Process/POSIX/NativeProcessELF.cpp vendor/lldb/dist/source/Plugins/Process/POSIX/NativeProcessELF.h vendor/lldb/dist/source/Plugins/Process/POSIX/ProcessMessage.cpp vendor/lldb/dist/source/Plugins/Process/Utility/AuxVector.cpp vendor/lldb/dist/source/Plugins/Process/Utility/DynamicRegisterInfo.cpp vendor/lldb/dist/source/Plugins/Process/Utility/HistoryThread.cpp vendor/lldb/dist/source/Plugins/Process/Utility/HistoryUnwind.cpp vendor/lldb/dist/source/Plugins/Process/Utility/HistoryUnwind.h vendor/lldb/dist/source/Plugins/Process/Utility/InferiorCallPOSIX.cpp vendor/lldb/dist/source/Plugins/Process/Utility/InferiorCallPOSIX.h vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextDarwin_arm.cpp vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.cpp vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextDarwin_arm64.h vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextDarwin_i386.cpp vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextDarwin_x86_64.cpp vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextLLDB.cpp vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextLLDB.h vendor/lldb/dist/source/Plugins/Process/Utility/RegisterContextPOSIX_arm64.cpp vendor/lldb/dist/source/Plugins/Process/Utility/RegisterInfoPOSIX_arm64.cpp vendor/lldb/dist/source/Plugins/Process/Utility/RegisterInfos_arm64.h vendor/lldb/dist/source/Plugins/Process/Utility/StopInfoMachException.cpp vendor/lldb/dist/source/Plugins/Process/Utility/UnwindLLDB.cpp vendor/lldb/dist/source/Plugins/Process/Utility/UnwindLLDB.h vendor/lldb/dist/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.cpp vendor/lldb/dist/source/Plugins/Process/Utility/UnwindMacOSXFrameBackchain.h vendor/lldb/dist/source/Plugins/Process/elf-core/ProcessElfCore.cpp vendor/lldb/dist/source/Plugins/Process/elf-core/RegisterUtilities.h vendor/lldb/dist/source/Plugins/Process/elf-core/ThreadElfCore.cpp vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.cpp vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteClientBase.h vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunication.cpp vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.cpp vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationClient.h vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.cpp vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationHistory.h vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.cpp vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationReplayServer.h vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServer.cpp vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerCommon.cpp vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.cpp vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerLLGS.h vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteCommunicationServerPlatform.cpp vendor/lldb/dist/source/Plugins/Process/gdb-remote/GDBRemoteRegisterContext.cpp vendor/lldb/dist/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp vendor/lldb/dist/source/Plugins/Process/gdb-remote/ProcessGDBRemote.h vendor/lldb/dist/source/Plugins/Process/gdb-remote/ThreadGDBRemote.cpp vendor/lldb/dist/source/Plugins/Process/minidump/MinidumpParser.cpp vendor/lldb/dist/source/Plugins/Process/minidump/MinidumpParser.h vendor/lldb/dist/source/Plugins/Process/minidump/MinidumpTypes.cpp vendor/lldb/dist/source/Plugins/Process/minidump/MinidumpTypes.h vendor/lldb/dist/source/Plugins/Process/minidump/ProcessMinidump.cpp vendor/lldb/dist/source/Plugins/Process/minidump/ProcessMinidump.h vendor/lldb/dist/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.cpp vendor/lldb/dist/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.h vendor/lldb/dist/source/Plugins/ScriptInterpreter/None/ScriptInterpreterNone.cpp vendor/lldb/dist/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.cpp vendor/lldb/dist/source/Plugins/ScriptInterpreter/Python/PythonDataObjects.h vendor/lldb/dist/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp vendor/lldb/dist/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.h vendor/lldb/dist/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPythonImpl.h vendor/lldb/dist/source/Plugins/StructuredData/DarwinLog/StructuredDataDarwinLog.cpp vendor/lldb/dist/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.cpp vendor/lldb/dist/source/Plugins/SymbolFile/Breakpad/SymbolFileBreakpad.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/AppleDWARFIndex.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParser.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFASTParserClang.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFAbbreviationDeclaration.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFBaseDIE.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDIE.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDIE.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDebugAranges.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDebugInfo.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDebugInfoEntry.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDebugRanges.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDeclContext.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFDefines.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFUnit.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DWARFUnit.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/DebugNamesDWARFIndex.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/HashedNameToDIE.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARF.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDebugMap.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.cpp vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/SymbolFileDWARFDwo.h vendor/lldb/dist/source/Plugins/SymbolFile/DWARF/UniqueDWARFASTType.cpp vendor/lldb/dist/source/Plugins/SymbolFile/NativePDB/CompileUnitIndex.cpp vendor/lldb/dist/source/Plugins/SymbolFile/NativePDB/DWARFLocationExpression.cpp vendor/lldb/dist/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.cpp vendor/lldb/dist/source/Plugins/SymbolFile/NativePDB/PdbAstBuilder.h vendor/lldb/dist/source/Plugins/SymbolFile/NativePDB/PdbFPOProgramToDWARFExpression.cpp vendor/lldb/dist/source/Plugins/SymbolFile/NativePDB/PdbUtil.cpp vendor/lldb/dist/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.cpp vendor/lldb/dist/source/Plugins/SymbolFile/NativePDB/SymbolFileNativePDB.h vendor/lldb/dist/source/Plugins/SymbolFile/PDB/PDBASTParser.cpp vendor/lldb/dist/source/Plugins/SymbolFile/PDB/PDBLocationToDWARFExpression.cpp vendor/lldb/dist/source/Plugins/SymbolFile/PDB/SymbolFilePDB.cpp vendor/lldb/dist/source/Plugins/SymbolFile/PDB/SymbolFilePDB.h vendor/lldb/dist/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.cpp vendor/lldb/dist/source/Plugins/SymbolFile/Symtab/SymbolFileSymtab.h vendor/lldb/dist/source/Plugins/SymbolVendor/ELF/SymbolVendorELF.cpp vendor/lldb/dist/source/Plugins/UnwindAssembly/x86/x86AssemblyInspectionEngine.cpp vendor/lldb/dist/source/Symbol/ArmUnwindInfo.cpp vendor/lldb/dist/source/Symbol/Block.cpp vendor/lldb/dist/source/Symbol/ClangASTContext.cpp vendor/lldb/dist/source/Symbol/ClangASTImporter.cpp vendor/lldb/dist/source/Symbol/CompactUnwindInfo.cpp vendor/lldb/dist/source/Symbol/CompileUnit.cpp vendor/lldb/dist/source/Symbol/CompilerType.cpp vendor/lldb/dist/source/Symbol/CxxModuleHandler.cpp vendor/lldb/dist/source/Symbol/DWARFCallFrameInfo.cpp vendor/lldb/dist/source/Symbol/DeclVendor.cpp vendor/lldb/dist/source/Symbol/FuncUnwinders.cpp vendor/lldb/dist/source/Symbol/Function.cpp vendor/lldb/dist/source/Symbol/LineTable.cpp vendor/lldb/dist/source/Symbol/LocateSymbolFile.cpp vendor/lldb/dist/source/Symbol/LocateSymbolFileMacOSX.cpp vendor/lldb/dist/source/Symbol/ObjectFile.cpp vendor/lldb/dist/source/Symbol/PostfixExpression.cpp vendor/lldb/dist/source/Symbol/Symbol.cpp vendor/lldb/dist/source/Symbol/SymbolContext.cpp vendor/lldb/dist/source/Symbol/SymbolFile.cpp vendor/lldb/dist/source/Symbol/SymbolVendor.cpp vendor/lldb/dist/source/Symbol/Symtab.cpp vendor/lldb/dist/source/Symbol/Type.cpp vendor/lldb/dist/source/Symbol/TypeMap.cpp vendor/lldb/dist/source/Symbol/TypeSystem.cpp vendor/lldb/dist/source/Symbol/UnwindPlan.cpp vendor/lldb/dist/source/Symbol/UnwindTable.cpp vendor/lldb/dist/source/Symbol/Variable.cpp vendor/lldb/dist/source/Target/ABI.cpp vendor/lldb/dist/source/Target/ExecutionContext.cpp vendor/lldb/dist/source/Target/Language.cpp vendor/lldb/dist/source/Target/LanguageRuntime.cpp vendor/lldb/dist/source/Target/Memory.cpp vendor/lldb/dist/source/Target/ModuleCache.cpp vendor/lldb/dist/source/Target/Platform.cpp vendor/lldb/dist/source/Target/Process.cpp vendor/lldb/dist/source/Target/RegisterContext.cpp vendor/lldb/dist/source/Target/RemoteAwarePlatform.cpp vendor/lldb/dist/source/Target/SectionLoadList.cpp vendor/lldb/dist/source/Target/StackFrame.cpp vendor/lldb/dist/source/Target/StackFrameList.cpp vendor/lldb/dist/source/Target/StopInfo.cpp vendor/lldb/dist/source/Target/Target.cpp vendor/lldb/dist/source/Target/Thread.cpp vendor/lldb/dist/source/Target/ThreadList.cpp vendor/lldb/dist/source/Target/ThreadPlan.cpp vendor/lldb/dist/source/Target/ThreadPlanBase.cpp vendor/lldb/dist/source/Target/ThreadPlanCallFunction.cpp vendor/lldb/dist/source/Target/ThreadPlanCallUserExpression.cpp vendor/lldb/dist/source/Target/ThreadPlanPython.cpp vendor/lldb/dist/source/Target/ThreadPlanRunToAddress.cpp vendor/lldb/dist/source/Target/ThreadPlanShouldStopHere.cpp vendor/lldb/dist/source/Target/ThreadPlanStepInRange.cpp vendor/lldb/dist/source/Target/ThreadPlanStepInstruction.cpp vendor/lldb/dist/source/Target/ThreadPlanStepOut.cpp vendor/lldb/dist/source/Target/ThreadPlanStepOverBreakpoint.cpp vendor/lldb/dist/source/Target/ThreadPlanStepOverRange.cpp vendor/lldb/dist/source/Target/ThreadPlanStepRange.cpp vendor/lldb/dist/source/Target/ThreadPlanStepThrough.cpp vendor/lldb/dist/source/Target/ThreadPlanStepUntil.cpp vendor/lldb/dist/source/Target/ThreadPlanTracer.cpp vendor/lldb/dist/source/Utility/ArchSpec.cpp vendor/lldb/dist/source/Utility/Args.cpp vendor/lldb/dist/source/Utility/Broadcaster.cpp vendor/lldb/dist/source/Utility/CompletionRequest.cpp vendor/lldb/dist/source/Utility/ConstString.cpp vendor/lldb/dist/source/Utility/DataExtractor.cpp vendor/lldb/dist/source/Utility/FileSpec.cpp vendor/lldb/dist/source/Utility/Listener.cpp vendor/lldb/dist/source/Utility/Log.cpp vendor/lldb/dist/source/Utility/Logging.cpp vendor/lldb/dist/source/Utility/ProcessInfo.cpp vendor/lldb/dist/source/Utility/RegularExpression.cpp vendor/lldb/dist/source/Utility/Reproducer.cpp vendor/lldb/dist/source/Utility/Scalar.cpp vendor/lldb/dist/source/Utility/SelectHelper.cpp vendor/lldb/dist/source/Utility/StringExtractor.cpp vendor/lldb/dist/source/Utility/StringLexer.cpp vendor/lldb/dist/source/Utility/StringList.cpp vendor/lldb/dist/source/Utility/StructuredData.cpp vendor/lldb/dist/tools/argdumper/argdumper.cpp vendor/lldb/dist/tools/compact-unwind/compact-unwind-dumper.c vendor/lldb/dist/tools/driver/Driver.cpp vendor/lldb/dist/tools/driver/Platform.h vendor/lldb/dist/tools/lldb-instr/Instrument.cpp vendor/lldb/dist/tools/lldb-server/LLDBServerUtilities.cpp vendor/lldb/dist/tools/lldb-server/lldb-gdbserver.cpp vendor/lldb/dist/tools/lldb-server/lldb-platform.cpp vendor/lldb/dist/tools/lldb-server/lldb-server.cpp vendor/lldb/dist/utils/TableGen/LLDBOptionDefEmitter.cpp vendor/lldb/dist/utils/TableGen/LLDBTableGen.cpp vendor/lldb/dist/utils/TableGen/LLDBTableGenBackends.h Modified: vendor/lldb/dist/docs/lldb.1 ============================================================================== --- vendor/lldb/dist/docs/lldb.1 Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/docs/lldb.1 Wed Oct 23 17:53:01 2019 (r353952) @@ -149,6 +149,6 @@ The LLDB project page http://lldb.llvm.org/ has many d users -- the gdb/lldb command equivalence page http://lldb.llvm.org/lldb-gdb.html can be especially helpful for users coming from gdb. .Sh BUGS -To report bugs, please visit http://llvm.org/bugs/ +To report bugs, please visit https://bugs.llvm.org/ .Sh AUTHOR Maintained by the LLDB Team, http://lldb.llvm.org/ Modified: vendor/lldb/dist/include/lldb/API/LLDB.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/LLDB.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/API/LLDB.h Wed Oct 23 17:53:01 2019 (r353952) @@ -13,8 +13,8 @@ #include "lldb/API/SBAttachInfo.h" #include "lldb/API/SBBlock.h" #include "lldb/API/SBBreakpoint.h" -#include "lldb/API/SBBreakpointName.h" #include "lldb/API/SBBreakpointLocation.h" +#include "lldb/API/SBBreakpointName.h" #include "lldb/API/SBBroadcaster.h" #include "lldb/API/SBCommandInterpreter.h" #include "lldb/API/SBCommandReturnObject.h" @@ -28,6 +28,7 @@ #include "lldb/API/SBEvent.h" #include "lldb/API/SBExecutionContext.h" #include "lldb/API/SBExpressionOptions.h" +#include "lldb/API/SBFile.h" #include "lldb/API/SBFileSpec.h" #include "lldb/API/SBFileSpecList.h" #include "lldb/API/SBFrame.h" Modified: vendor/lldb/dist/include/lldb/API/SBCommandReturnObject.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBCommandReturnObject.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/API/SBCommandReturnObject.h Wed Oct 23 17:53:01 2019 (r353952) @@ -15,23 +15,27 @@ #include "lldb/API/SBDefines.h" +namespace lldb_private { +class SBCommandReturnObjectImpl; +} + namespace lldb { class LLDB_API SBCommandReturnObject { public: SBCommandReturnObject(); + SBCommandReturnObject(lldb_private::CommandReturnObject &ref); + + // rvalue ctor+assignment are incompatible with Reproducers. + SBCommandReturnObject(const lldb::SBCommandReturnObject &rhs); ~SBCommandReturnObject(); - const lldb::SBCommandReturnObject & + lldb::SBCommandReturnObject & operator=(const lldb::SBCommandReturnObject &rhs); - SBCommandReturnObject(lldb_private::CommandReturnObject *ptr); - - lldb_private::CommandReturnObject *Release(); - explicit operator bool() const; bool IsValid() const; @@ -40,14 +44,22 @@ class LLDB_API SBCommandReturnObject { (public) const char *GetError(); - size_t PutOutput(FILE *fh); + size_t PutOutput(FILE *fh); // DEPRECATED + size_t PutOutput(SBFile file); + + size_t PutOutput(FileSP file); + size_t GetOutputSize(); size_t GetErrorSize(); - size_t PutError(FILE *fh); + size_t PutError(FILE *fh); // DEPRECATED + size_t PutError(SBFile file); + + size_t PutError(FileSP file); + void Clear(); lldb::ReturnStatus GetStatus(); @@ -64,15 +76,22 @@ class LLDB_API SBCommandReturnObject { (public) bool GetDescription(lldb::SBStream &description); - // deprecated, these two functions do not take ownership of file handle - void SetImmediateOutputFile(FILE *fh); + void SetImmediateOutputFile(FILE *fh); // DEPRECATED - void SetImmediateErrorFile(FILE *fh); + void SetImmediateErrorFile(FILE *fh); // DEPRECATED - void SetImmediateOutputFile(FILE *fh, bool transfer_ownership); + void SetImmediateOutputFile(FILE *fh, bool transfer_ownership); // DEPRECATED - void SetImmediateErrorFile(FILE *fh, bool transfer_ownership); + void SetImmediateErrorFile(FILE *fh, bool transfer_ownership); // DEPRECATED + void SetImmediateOutputFile(SBFile file); + + void SetImmediateErrorFile(SBFile file); + + void SetImmediateOutputFile(FileSP file); + + void SetImmediateErrorFile(FileSP file); + void PutCString(const char *string, int len = -1); size_t Printf(const char *format, ...) __attribute__((format(printf, 2, 3))); @@ -86,6 +105,9 @@ class LLDB_API SBCommandReturnObject { (public) void SetError(const char *error_cstr); + // ref() is internal for LLDB only. + lldb_private::CommandReturnObject &ref() const; + protected: friend class SBCommandInterpreter; friend class SBOptions; @@ -96,12 +118,8 @@ class LLDB_API SBCommandReturnObject { (public) lldb_private::CommandReturnObject &operator*() const; - lldb_private::CommandReturnObject &ref() const; - - void SetLLDBObjectPtr(lldb_private::CommandReturnObject *ptr); - private: - std::unique_ptr m_opaque_up; + std::unique_ptr m_opaque_up; }; } // namespace lldb Modified: vendor/lldb/dist/include/lldb/API/SBDebugger.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBDebugger.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/API/SBDebugger.h Wed Oct 23 17:53:01 2019 (r353952) @@ -88,6 +88,24 @@ class LLDB_API SBDebugger { (public) FILE *GetErrorFileHandle(); + SBError SetInputFile(SBFile file); + + SBError SetOutputFile(SBFile file); + + SBError SetErrorFile(SBFile file); + + SBError SetInputFile(FileSP file); + + SBError SetOutputFile(FileSP file); + + SBError SetErrorFile(FileSP file); + + SBFile GetInputFile(); + + SBFile GetOutputFile(); + + SBFile GetErrorFile(); + void SaveInputTerminalState(); void RestoreInputTerminalState(); @@ -99,7 +117,14 @@ class LLDB_API SBDebugger { (public) lldb::SBListener GetListener(); void HandleProcessEvent(const lldb::SBProcess &process, - const lldb::SBEvent &event, FILE *out, FILE *err); + const lldb::SBEvent &event, FILE *out, + FILE *err); // DEPRECATED + + void HandleProcessEvent(const lldb::SBProcess &process, + const lldb::SBEvent &event, SBFile out, SBFile err); + + void HandleProcessEvent(const lldb::SBProcess &process, + const lldb::SBEvent &event, FileSP out, FileSP err); lldb::SBTarget CreateTarget(const char *filename, const char *target_triple, const char *platform_name, Modified: vendor/lldb/dist/include/lldb/API/SBDefines.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBDefines.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/API/SBDefines.h Wed Oct 23 17:53:01 2019 (r353952) @@ -41,6 +41,7 @@ class LLDB_API SBEvent; class LLDB_API SBEventList; class LLDB_API SBExecutionContext; class LLDB_API SBExpressionOptions; +class LLDB_API SBFile; class LLDB_API SBFileSpec; class LLDB_API SBFileSpecList; class LLDB_API SBFrame; Modified: vendor/lldb/dist/include/lldb/API/SBError.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBError.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/API/SBError.h Wed Oct 23 17:53:01 2019 (r353952) @@ -70,6 +70,7 @@ class LLDB_API SBError { (protected) friend class SBTrace; friend class SBValue; friend class SBWatchpoint; + friend class SBFile; lldb_private::Status *get(); Added: vendor/lldb/dist/include/lldb/API/SBFile.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ vendor/lldb/dist/include/lldb/API/SBFile.h Wed Oct 23 17:53:01 2019 (r353952) @@ -0,0 +1,47 @@ +//===-- SBFile.h --------------------------------------------*- C++ -*-===// +// +// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. +// See https://llvm.org/LICENSE.txt for license information. +// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +// +//===----------------------------------------------------------------------===// + +#ifndef LLDB_SBFile_h_ +#define LLDB_SBFile_h_ + +#include "lldb/API/SBDefines.h" + +namespace lldb { + +class LLDB_API SBFile { + friend class SBInstruction; + friend class SBInstructionList; + friend class SBDebugger; + friend class SBCommandReturnObject; + friend class SBProcess; + +public: + SBFile(); + SBFile(FileSP file_sp); + SBFile(FILE *file, bool transfer_ownership); + SBFile(int fd, const char *mode, bool transfer_ownership); + ~SBFile(); + + SBError Read(uint8_t *buf, size_t num_bytes, size_t *bytes_read); + SBError Write(const uint8_t *buf, size_t num_bytes, size_t *bytes_written); + SBError Flush(); + bool IsValid() const; + SBError Close(); + + operator bool() const; + bool operator!() const; + + FileSP GetFile() const; + +private: + FileSP m_opaque_sp; +}; + +} // namespace lldb + +#endif // LLDB_SBFile_h_ Modified: vendor/lldb/dist/include/lldb/API/SBInstruction.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBInstruction.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/API/SBInstruction.h Wed Oct 23 17:53:01 2019 (r353952) @@ -55,6 +55,10 @@ class LLDB_API SBInstruction { (public) void Print(FILE *out); + void Print(SBFile out); + + void Print(FileSP out); + bool GetDescription(lldb::SBStream &description); bool EmulateWithFrame(lldb::SBFrame &frame, uint32_t evaluate_options); Modified: vendor/lldb/dist/include/lldb/API/SBInstructionList.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBInstructionList.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/API/SBInstructionList.h Wed Oct 23 17:53:01 2019 (r353952) @@ -46,6 +46,10 @@ class LLDB_API SBInstructionList { (public) void Print(FILE *out); + void Print(SBFile out); + + void Print(FileSP out); + bool GetDescription(lldb::SBStream &description); bool DumpEmulationForAllInstructions(const char *triple); @@ -56,6 +60,8 @@ class LLDB_API SBInstructionList { (public) friend class SBTarget; void SetDisassembler(const lldb::DisassemblerSP &opaque_sp); + bool GetDescription(lldb_private::Stream &description); + private: lldb::DisassemblerSP m_opaque_sp; Modified: vendor/lldb/dist/include/lldb/API/SBProcess.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBProcess.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/API/SBProcess.h Wed Oct 23 17:53:01 2019 (r353952) @@ -67,6 +67,10 @@ class LLDB_API SBProcess { (public) void ReportEventState(const lldb::SBEvent &event, FILE *out) const; + void ReportEventState(const lldb::SBEvent &event, SBFile file) const; + + void ReportEventState(const lldb::SBEvent &event, FileSP file) const; + void AppendEventStateReport(const lldb::SBEvent &event, lldb::SBCommandReturnObject &result); Modified: vendor/lldb/dist/include/lldb/API/SBStream.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBStream.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/API/SBStream.h Wed Oct 23 17:53:01 2019 (r353952) @@ -39,6 +39,10 @@ class LLDB_API SBStream { (public) void RedirectToFile(const char *path, bool append); + void RedirectToFile(lldb::SBFile file); + + void RedirectToFile(lldb::FileSP file); + void RedirectToFileHandle(FILE *fh, bool transfer_fh_ownership); void RedirectToFileDescriptor(int fd, bool transfer_fh_ownership); Modified: vendor/lldb/dist/include/lldb/API/SBStructuredData.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBStructuredData.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/API/SBStructuredData.h Wed Oct 23 17:53:01 2019 (r353952) @@ -91,6 +91,8 @@ class SBStructuredData { (protected) friend class SBTraceOptions; friend class SBDebugger; friend class SBTarget; + friend class SBThread; + friend class SBThreadPlan; StructuredDataImplUP m_impl_up; }; Modified: vendor/lldb/dist/include/lldb/API/SBThread.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBThread.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/API/SBThread.h Wed Oct 23 17:53:01 2019 (r353952) @@ -122,6 +122,10 @@ class LLDB_API SBThread { (public) SBError StepUsingScriptedThreadPlan(const char *script_class_name, bool resume_immediately); + SBError StepUsingScriptedThreadPlan(const char *script_class_name, + lldb::SBStructuredData &args_data, + bool resume_immediately); + SBError JumpToLine(lldb::SBFileSpec &file_spec, uint32_t line); void RunToAddress(lldb::addr_t addr); Modified: vendor/lldb/dist/include/lldb/API/SBThreadPlan.h ============================================================================== --- vendor/lldb/dist/include/lldb/API/SBThreadPlan.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/API/SBThreadPlan.h Wed Oct 23 17:53:01 2019 (r353952) @@ -28,6 +28,9 @@ class LLDB_API SBThreadPlan { (public) SBThreadPlan(lldb::SBThread &thread, const char *class_name); + SBThreadPlan(lldb::SBThread &thread, const char *class_name, + lldb::SBStructuredData &args_data); + ~SBThreadPlan(); explicit operator bool() const; @@ -99,6 +102,9 @@ class LLDB_API SBThreadPlan { (public) SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name); SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name, + SBError &error); + SBThreadPlan QueueThreadPlanForStepScripted(const char *script_class_name, + lldb::SBStructuredData &args_data, SBError &error); private: Modified: vendor/lldb/dist/include/lldb/Breakpoint/BreakpointLocation.h ============================================================================== --- vendor/lldb/dist/include/lldb/Breakpoint/BreakpointLocation.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Breakpoint/BreakpointLocation.h Wed Oct 23 17:53:01 2019 (r353952) @@ -67,7 +67,7 @@ class BreakpointLocation (public) // The next section deals with various breakpoint options. - /// If \a enable is \b true, enable the breakpoint, if \b false disable it. + /// If \a enabled is \b true, enable the breakpoint, if \b false disable it. void SetEnabled(bool enabled); /// Check the Enable/Disable state. Modified: vendor/lldb/dist/include/lldb/Breakpoint/BreakpointOptions.h ============================================================================== --- vendor/lldb/dist/include/lldb/Breakpoint/BreakpointOptions.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Breakpoint/BreakpointOptions.h Wed Oct 23 17:53:01 2019 (r353952) @@ -107,6 +107,12 @@ friend class Breakpoint; (public) /// \param[in] ignore /// How many breakpoint hits we should ignore before stopping. /// + /// \param[in] one_shot + /// Should this breakpoint delete itself after being hit once. + /// + /// \param[in] auto_continue + /// Should this breakpoint auto-continue after running its commands. + /// BreakpointOptions(const char *condition, bool enabled = true, int32_t ignore = 0, bool one_shot = false, bool auto_continue = false); @@ -319,7 +325,10 @@ friend class Breakpoint; (public) void GetDescription(Stream *s, lldb::DescriptionLevel level) const; - /// Returns true if the breakpoint option has a callback set. + /// Check if the breakpoint option has a callback set. + /// + /// \return + /// If the breakpoint option has a callback, \b true otherwise \b false. bool HasCallback() const; /// This is the default empty callback. @@ -367,22 +376,32 @@ friend class Breakpoint; (public) void SetThreadSpec(std::unique_ptr &thread_spec_up); private: - // For BreakpointOptions only - BreakpointHitCallback m_callback; // This is the callback function pointer - lldb::BatonSP m_callback_baton_sp; // This is the client data for the callback + /// For BreakpointOptions only + + /// This is the callback function pointer + BreakpointHitCallback m_callback; + /// This is the client data for the callback + lldb::BatonSP m_callback_baton_sp; bool m_baton_is_command_baton; bool m_callback_is_synchronous; bool m_enabled; + /// If set, the breakpoint delete itself after being hit once. bool m_one_shot; - uint32_t m_ignore_count; // Number of times to ignore this breakpoint - std::unique_ptr - m_thread_spec_up; // Thread for which this breakpoint will take - std::string m_condition_text; // The condition to test. - size_t m_condition_text_hash; // Its hash, so that locations know when the - // condition is updated. - bool m_auto_continue; // If set, auto-continue from breakpoint. - Flags m_set_flags; // Which options are set at this level. Drawn - // from BreakpointOptions::SetOptionsFlags. + /// Number of times to ignore this breakpoint. + uint32_t m_ignore_count; + /// Thread for which this breakpoint will stop. + std::unique_ptr m_thread_spec_up; + /// The condition to test. + std::string m_condition_text; + /// Its hash, so that locations know when the condition is updated. + size_t m_condition_text_hash; + /// If set, inject breakpoint condition into process. + bool m_inject_condition; + /// If set, auto-continue from breakpoint. + bool m_auto_continue; + /// Which options are set at this level. + /// Drawn from BreakpointOptions::SetOptionsFlags. + Flags m_set_flags; }; } // namespace lldb_private Modified: vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverAddress.h ============================================================================== --- vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverAddress.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverAddress.h Wed Oct 23 17:53:01 2019 (r353952) @@ -41,8 +41,8 @@ class BreakpointResolverAddress : public BreakpointRes ModuleList &modules) override; Searcher::CallbackReturn SearchCallback(SearchFilter &filter, - SymbolContext &context, Address *addr, - bool containing) override; + SymbolContext &context, + Address *addr) override; lldb::SearchDepth GetDepth() override; Modified: vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverFileLine.h ============================================================================== --- vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverFileLine.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverFileLine.h Wed Oct 23 17:53:01 2019 (r353952) @@ -35,8 +35,8 @@ class BreakpointResolverFileLine : public BreakpointRe ~BreakpointResolverFileLine() override; Searcher::CallbackReturn SearchCallback(SearchFilter &filter, - SymbolContext &context, Address *addr, - bool containing) override; + SymbolContext &context, + Address *addr) override; lldb::SearchDepth GetDepth() override; Modified: vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverFileRegex.h ============================================================================== --- vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverFileRegex.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverFileRegex.h Wed Oct 23 17:53:01 2019 (r353952) @@ -24,7 +24,7 @@ namespace lldb_private { class BreakpointResolverFileRegex : public BreakpointResolver { public: BreakpointResolverFileRegex( - Breakpoint *bkpt, RegularExpression ®ex, + Breakpoint *bkpt, RegularExpression regex, const std::unordered_set &func_name_set, bool exact_match); static BreakpointResolver * @@ -37,8 +37,8 @@ class BreakpointResolverFileRegex : public BreakpointR ~BreakpointResolverFileRegex() override; Searcher::CallbackReturn SearchCallback(SearchFilter &filter, - SymbolContext &context, Address *addr, - bool containing) override; + SymbolContext &context, + Address *addr) override; lldb::SearchDepth GetDepth() override; Modified: vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverName.h ============================================================================== --- vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverName.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverName.h Wed Oct 23 17:53:01 2019 (r353952) @@ -44,7 +44,7 @@ class BreakpointResolverName : public BreakpointResolv // Creates a function breakpoint by regular expression. Takes over control // of the lifespan of func_regex. - BreakpointResolverName(Breakpoint *bkpt, RegularExpression &func_regex, + BreakpointResolverName(Breakpoint *bkpt, RegularExpression func_regex, lldb::LanguageType language, lldb::addr_t offset, bool skip_prologue); @@ -58,8 +58,8 @@ class BreakpointResolverName : public BreakpointResolv ~BreakpointResolverName() override; Searcher::CallbackReturn SearchCallback(SearchFilter &filter, - SymbolContext &context, Address *addr, - bool containing) override; + SymbolContext &context, + Address *addr) override; lldb::SearchDepth GetDepth() override; Modified: vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverScripted.h ============================================================================== --- vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverScripted.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Breakpoint/BreakpointResolverScripted.h Wed Oct 23 17:53:01 2019 (r353952) @@ -26,8 +26,7 @@ class BreakpointResolverScripted : public BreakpointRe BreakpointResolverScripted(Breakpoint *bkpt, const llvm::StringRef class_name, lldb::SearchDepth depth, - StructuredDataImpl *args_data, - ScriptInterpreter &script_interp); + StructuredDataImpl *args_data); ~BreakpointResolverScripted() override; @@ -39,8 +38,8 @@ class BreakpointResolverScripted : public BreakpointRe StructuredData::ObjectSP SerializeToStructuredData() override; Searcher::CallbackReturn SearchCallback(SearchFilter &filter, - SymbolContext &context, Address *addr, - bool containing) override; + SymbolContext &context, + Address *addr) override; lldb::SearchDepth GetDepth() override; Modified: vendor/lldb/dist/include/lldb/Core/Address.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/Address.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Core/Address.h Wed Oct 23 17:53:01 2019 (r353952) @@ -338,6 +338,23 @@ class Address { (public) bool ResolveAddressUsingFileSections(lldb::addr_t addr, const SectionList *sections); + /// Resolve this address to its containing function and optionally get + /// that function's address range. + /// + /// \param[out] sym_ctx + /// The symbol context describing the function in which this address lies + /// + /// \parm[out] addr_range_ptr + /// Pointer to the AddressRange to fill in with the function's address + /// range. Caller may pass null if they don't need the address range. + /// + /// \return + /// Returns \b false if the function/symbol could not be resolved + /// or if the address range was requested and could not be resolved; + /// returns \b true otherwise. + bool ResolveFunctionScope(lldb_private::SymbolContext &sym_ctx, + lldb_private::AddressRange *addr_range_ptr = nullptr); + /// Set the address to represent \a load_addr. /// /// The address will attempt to find a loaded section within \a target that Modified: vendor/lldb/dist/include/lldb/Core/AddressResolverFileLine.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/AddressResolverFileLine.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Core/AddressResolverFileLine.h Wed Oct 23 17:53:01 2019 (r353952) @@ -34,8 +34,8 @@ class AddressResolverFileLine : public AddressResolver ~AddressResolverFileLine() override; Searcher::CallbackReturn SearchCallback(SearchFilter &filter, - SymbolContext &context, Address *addr, - bool containing) override; + SymbolContext &context, + Address *addr) override; lldb::SearchDepth GetDepth() override; Modified: vendor/lldb/dist/include/lldb/Core/AddressResolverName.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/AddressResolverName.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Core/AddressResolverName.h Wed Oct 23 17:53:01 2019 (r353952) @@ -31,7 +31,7 @@ class AddressResolverName : public AddressResolver { ( // Creates a function breakpoint by regular expression. Takes over control // of the lifespan of func_regex. - AddressResolverName(RegularExpression &func_regex); + AddressResolverName(RegularExpression func_regex); AddressResolverName(const char *class_name, const char *method, AddressResolver::MatchType type); @@ -39,8 +39,8 @@ class AddressResolverName : public AddressResolver { ( ~AddressResolverName() override; Searcher::CallbackReturn SearchCallback(SearchFilter &filter, - SymbolContext &context, Address *addr, - bool containing) override; + SymbolContext &context, + Address *addr) override; lldb::SearchDepth GetDepth() override; Modified: vendor/lldb/dist/include/lldb/Core/Debugger.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/Debugger.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Core/Debugger.h Wed Oct 23 17:53:01 2019 (r353952) @@ -17,6 +17,7 @@ #include "lldb/Core/FormatEntity.h" #include "lldb/Core/IOHandler.h" #include "lldb/Core/SourceManager.h" +#include "lldb/Core/StreamFile.h" #include "lldb/Core/UserSettingsController.h" #include "lldb/Host/HostThread.h" #include "lldb/Host/Terminal.h" @@ -113,20 +114,29 @@ class Debugger : public std::enable_shared_from_thisGetFile(); } + + File &GetErrorFile() { return m_error_stream_sp->GetFile(); } + + StreamFile &GetOutputStream() { return *m_output_stream_sp; } + + StreamFile &GetErrorStream() { return *m_error_stream_sp; } + repro::DataRecorder *GetInputRecorder(); - void SetInputFileHandle(FILE *fh, bool tranfer_ownership, - repro::DataRecorder *recorder = nullptr); + void SetInputFile(lldb::FileSP file, repro::DataRecorder *recorder = nullptr); - void SetOutputFileHandle(FILE *fh, bool tranfer_ownership); + void SetOutputFile(lldb::FileSP file); - void SetErrorFileHandle(FILE *fh, bool tranfer_ownership); + void SetErrorFile(lldb::FileSP file); void SaveInputTerminalState(); @@ -174,7 +184,7 @@ class Debugger : public std::enable_shared_from_this collection; + typedef collection::const_iterator const_iterator; + /// Default constructor. /// /// Initialize this object with an empty file list. @@ -76,6 +79,15 @@ class FileSpecList { (public) /// \b true if the file was appended, \b false otherwise. bool AppendIfUnique(const FileSpec &file); + /// Inserts a new FileSpec into the FileSpecList constructed in-place with + /// the given arguments. + /// + /// \param[in] args + /// Arguments to create the FileSpec + template void EmplaceBack(Args &&... args) { + m_files.emplace_back(std::forward(args)...); + } + /// Clears the file list. void Clear(); @@ -182,9 +194,10 @@ class FileSpecList { (public) static size_t GetFilesMatchingPartialPath(const char *path, bool dir_okay, FileSpecList &matches); + const_iterator begin() const { return m_files.begin(); } + const_iterator end() const { return m_files.end(); } + protected: - typedef std::vector - collection; ///< The collection type for the file list. collection m_files; ///< A collection of FileSpec objects. }; Modified: vendor/lldb/dist/include/lldb/Core/FormatEntity.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/FormatEntity.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Core/FormatEntity.h Wed Oct 23 17:53:01 2019 (r353952) @@ -199,7 +199,7 @@ class FormatEntity { (public) llvm::StringRef &variable_name, llvm::StringRef &variable_format); - static size_t AutoComplete(lldb_private::CompletionRequest &request); + static void AutoComplete(lldb_private::CompletionRequest &request); // Format the current elements into the stream \a s. // Modified: vendor/lldb/dist/include/lldb/Core/IOHandler.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/IOHandler.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Core/IOHandler.h Wed Oct 23 17:53:01 2019 (r353952) @@ -10,6 +10,7 @@ #define liblldb_IOHandler_h_ #include "lldb/Core/ValueObjectList.h" +#include "lldb/Utility/CompletionRequest.h" #include "lldb/Utility/ConstString.h" #include "lldb/Utility/Flags.h" #include "lldb/Utility/Predicate.h" @@ -57,8 +58,7 @@ class IOHandler { (public) IOHandler(Debugger &debugger, IOHandler::Type type); IOHandler(Debugger &debugger, IOHandler::Type type, - const lldb::StreamFileSP &input_sp, - const lldb::StreamFileSP &output_sp, + const lldb::FileSP &input_sp, const lldb::StreamFileSP &output_sp, const lldb::StreamFileSP &error_sp, uint32_t flags, repro::DataRecorder *data_recorder); @@ -122,11 +122,11 @@ class IOHandler { (public) FILE *GetErrorFILE(); - lldb::StreamFileSP &GetInputStreamFile(); + lldb::FileSP &GetInputFileSP(); - lldb::StreamFileSP &GetOutputStreamFile(); + lldb::StreamFileSP &GetOutputStreamFileSP(); - lldb::StreamFileSP &GetErrorStreamFile(); + lldb::StreamFileSP &GetErrorStreamFileSP(); Debugger &GetDebugger() { return m_debugger; } @@ -164,7 +164,7 @@ class IOHandler { (public) protected: Debugger &m_debugger; - lldb::StreamFileSP m_input_sp; + lldb::FileSP m_input_sp; lldb::StreamFileSP m_output_sp; lldb::StreamFileSP m_error_sp; repro::DataRecorder *m_data_recorder; @@ -198,10 +198,8 @@ class IOHandlerDelegate { (public) virtual void IOHandlerDeactivated(IOHandler &io_handler) {} - virtual int IOHandlerComplete(IOHandler &io_handler, const char *current_line, - const char *cursor, const char *last_char, - int skip_first_n_matches, int max_matches, - StringList &matches, StringList &descriptions); + virtual void IOHandlerComplete(IOHandler &io_handler, + CompletionRequest &request); virtual const char *IOHandlerGetFixIndentationCharacters() { return nullptr; } @@ -334,7 +332,7 @@ class IOHandlerEditline : public IOHandler { (public) repro::DataRecorder *data_recorder); IOHandlerEditline(Debugger &debugger, IOHandler::Type type, - const lldb::StreamFileSP &input_sp, + const lldb::FileSP &input_sp, const lldb::StreamFileSP &output_sp, const lldb::StreamFileSP &error_sp, uint32_t flags, const char *editline_name, // Used for saving history files @@ -350,7 +348,7 @@ class IOHandlerEditline : public IOHandler { (public) const char *, bool, bool, uint32_t, IOHandlerDelegate &) = delete; - IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::StreamFileSP &, + IOHandlerEditline(Debugger &, IOHandler::Type, const lldb::FileSP &, const lldb::StreamFileSP &, const lldb::StreamFileSP &, uint32_t, const char *, const char *, const char *, bool, bool, uint32_t, IOHandlerDelegate &) = delete; @@ -415,11 +413,7 @@ class IOHandlerEditline : public IOHandler { (public) static int FixIndentationCallback(Editline *editline, const StringList &lines, int cursor_position, void *baton); - static int AutoCompleteCallback(const char *current_line, const char *cursor, - const char *last_char, - int skip_first_n_matches, int max_matches, - StringList &matches, StringList &descriptions, - void *baton); + static void AutoCompleteCallback(CompletionRequest &request, void *baton); #endif protected: @@ -437,6 +431,7 @@ class IOHandlerEditline : public IOHandler { (public) bool m_interrupt_exits; bool m_editing; // Set to true when fetching a line manually (not using // libedit) + std::string m_line_buffer; }; // The order of base classes is important. Look at the constructor of @@ -450,10 +445,8 @@ class IOHandlerConfirm : public IOHandlerDelegate, pub bool GetResponse() const { return m_user_response; } - int IOHandlerComplete(IOHandler &io_handler, const char *current_line, - const char *cursor, const char *last_char, - int skip_first_n_matches, int max_matches, - StringList &matches, StringList &descriptions) override; + void IOHandlerComplete(IOHandler &io_handler, + CompletionRequest &request) override; void IOHandlerInputComplete(IOHandler &io_handler, std::string &data) override; Modified: vendor/lldb/dist/include/lldb/Core/LoadedModuleInfoList.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/LoadedModuleInfoList.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Core/LoadedModuleInfoList.h Wed Oct 23 17:53:01 2019 (r353952) @@ -84,9 +84,6 @@ class LoadedModuleInfoList { (public) } bool operator==(LoadedModuleInfo const &rhs) const { - if (e_num != rhs.e_num) - return false; - for (size_t i = 0; i < e_num; ++i) { if (m_has[i] != rhs.m_has[i]) return false; Modified: vendor/lldb/dist/include/lldb/Core/Mangled.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/Mangled.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Core/Mangled.h Wed Oct 23 17:53:01 2019 (r353952) @@ -49,24 +49,10 @@ class Mangled { (public) /// Default constructor. /// /// Initialize with both mangled and demangled names empty. - Mangled(); + Mangled() = default; /// Construct with name. /// - /// Constructor with an optional string and a boolean indicating if it is - /// the mangled version. - /// - /// \param[in] name - /// The already const name to copy into this object. - /// - /// \param[in] is_mangled - /// If \b true then \a name is a mangled name, if \b false then - /// \a name is demangled. - Mangled(ConstString name, bool is_mangled); - Mangled(llvm::StringRef name, bool is_mangled); - - /// Construct with name. - /// /// Constructor with an optional string and auto-detect if \a name is /// mangled or not. /// @@ -75,12 +61,6 @@ class Mangled { (public) explicit Mangled(ConstString name); explicit Mangled(llvm::StringRef name); - - /// Destructor - /// - /// Releases its ref counts on the mangled and demangled strings that live - /// in the global string pool. - ~Mangled(); /// Convert to pointer operator. /// Modified: vendor/lldb/dist/include/lldb/Core/Module.h ============================================================================== --- vendor/lldb/dist/include/lldb/Core/Module.h Wed Oct 23 17:52:50 2019 (r353951) +++ vendor/lldb/dist/include/lldb/Core/Module.h Wed Oct 23 17:53:01 2019 (r353952) @@ -49,7 +49,6 @@ class Symbol; class SymbolContext; class SymbolContextList; class SymbolFile; -class SymbolVendor; class Symtab; class Target; class TypeList; @@ -67,8 +66,8 @@ class VariableList; /// accessors are called. For example the object file (ObjectFile) /// representation will only be parsed if the object file is requested using /// the Module::GetObjectFile() is called. The debug symbols will only be -/// parsed if the symbol vendor (SymbolVendor) is requested using the -/// Module::GetSymbolVendor() is called. +/// parsed if the symbol file (SymbolFile) is requested using the +/// Module::GetSymbolFile() method. /// /// The module will parse more detailed information as more queries are made. class Module : public std::enable_shared_from_this, @@ -247,13 +246,13 @@ class Module : public std::enable_shared_from_this Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1D83159DD0; Wed, 23 Oct 2019 17:53:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yyf04vhRz4TVp; Wed, 23 Oct 2019 17:53:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B931388; Wed, 23 Oct 2019 17:53:12 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NHrC92078676; Wed, 23 Oct 2019 17:53:12 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHrCiu078675; Wed, 23 Oct 2019 17:53:12 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231753.x9NHrCiu078675@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:53:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353953 - vendor/lldb/lldb-r375505 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/lldb/lldb-r375505 X-SVN-Commit-Revision: 353953 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:53:13 -0000 Author: dim Date: Wed Oct 23 17:53:12 2019 New Revision: 353953 URL: https://svnweb.freebsd.org/changeset/base/353953 Log: Tag stripped lldb trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub. Added: vendor/lldb/lldb-r375505/ - copied from r353952, vendor/lldb/dist/ From owner-svn-src-all@freebsd.org Wed Oct 23 17:53:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1CF69159E35; Wed, 23 Oct 2019 17:53:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yyf656nNz4Td8; Wed, 23 Oct 2019 17:53:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 89DED389; Wed, 23 Oct 2019 17:53:18 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NHrITb078739; Wed, 23 Oct 2019 17:53:18 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHrFQR078722; Wed, 23 Oct 2019 17:53:15 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231753.x9NHrFQR078722@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:53:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353954 - in vendor/llvm-openmp/dist/runtime/src: . thirdparty/ittnotify X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in vendor/llvm-openmp/dist/runtime/src: . thirdparty/ittnotify X-SVN-Commit-Revision: 353954 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:53:19 -0000 Author: dim Date: Wed Oct 23 17:53:14 2019 New Revision: 353954 URL: https://svnweb.freebsd.org/changeset/base/353954 Log: Vendor import of stripped LLVM openmp trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub: https://llvm.org/svn/llvm-project/openmp/trunk@375505 Added: vendor/llvm-openmp/dist/runtime/src/thirdparty/ittnotify/ittnotify_static.cpp Deleted: vendor/llvm-openmp/dist/runtime/src/kmp_taskq.cpp vendor/llvm-openmp/dist/runtime/src/thirdparty/ittnotify/ittnotify_static.c Modified: vendor/llvm-openmp/dist/runtime/src/kmp.h vendor/llvm-openmp/dist/runtime/src/kmp_affinity.cpp vendor/llvm-openmp/dist/runtime/src/kmp_affinity.h vendor/llvm-openmp/dist/runtime/src/kmp_csupport.cpp vendor/llvm-openmp/dist/runtime/src/kmp_ftn_os.h vendor/llvm-openmp/dist/runtime/src/kmp_global.cpp vendor/llvm-openmp/dist/runtime/src/kmp_gsupport.cpp vendor/llvm-openmp/dist/runtime/src/kmp_lock.cpp vendor/llvm-openmp/dist/runtime/src/kmp_lock.h vendor/llvm-openmp/dist/runtime/src/kmp_os.h vendor/llvm-openmp/dist/runtime/src/kmp_platform.h vendor/llvm-openmp/dist/runtime/src/kmp_runtime.cpp vendor/llvm-openmp/dist/runtime/src/kmp_stub.cpp vendor/llvm-openmp/dist/runtime/src/kmp_taskdeps.cpp vendor/llvm-openmp/dist/runtime/src/kmp_wait_release.h vendor/llvm-openmp/dist/runtime/src/ompt-general.cpp vendor/llvm-openmp/dist/runtime/src/ompt-internal.h vendor/llvm-openmp/dist/runtime/src/ompt-specific.cpp vendor/llvm-openmp/dist/runtime/src/ompt-specific.h vendor/llvm-openmp/dist/runtime/src/thirdparty/ittnotify/ittnotify_config.h vendor/llvm-openmp/dist/runtime/src/z_Linux_asm.S vendor/llvm-openmp/dist/runtime/src/z_Linux_util.cpp Modified: vendor/llvm-openmp/dist/runtime/src/kmp.h ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp.h Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp.h Wed Oct 23 17:53:14 2019 (r353954) @@ -2181,10 +2181,9 @@ struct kmp_dephash_entry { typedef struct kmp_dephash { kmp_dephash_entry_t **buckets; size_t size; -#ifdef KMP_DEBUG + size_t generation; kmp_uint32 nelements; kmp_uint32 nconflicts; -#endif } kmp_dephash_t; typedef struct kmp_task_affinity_info { @@ -3342,7 +3341,7 @@ extern int __kmp_aux_set_affinity_mask_proc(int proc, extern int __kmp_aux_unset_affinity_mask_proc(int proc, void **mask); extern int __kmp_aux_get_affinity_mask_proc(int proc, void **mask); extern void __kmp_balanced_affinity(kmp_info_t *th, int team_size); -#if KMP_OS_LINUX +#if KMP_OS_LINUX || KMP_OS_FREEBSD extern int kmp_set_thread_affinity_mask_initial(void); #endif #endif /* KMP_AFFINITY_SUPPORTED */ Modified: vendor/llvm-openmp/dist/runtime/src/kmp_affinity.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_affinity.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_affinity.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -1968,7 +1968,7 @@ static void __kmp_dispatch_set_hierarchy_values() { __kmp_hier_max_units[kmp_hier_layer_e::LAYER_THREAD + 1] = nPackages * nCoresPerPkg * __kmp_nThreadsPerCore; __kmp_hier_max_units[kmp_hier_layer_e::LAYER_L1 + 1] = __kmp_ncores; -#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) +#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS) if (__kmp_mic_type >= mic3) __kmp_hier_max_units[kmp_hier_layer_e::LAYER_L2 + 1] = __kmp_ncores / 2; else @@ -1982,7 +1982,7 @@ static void __kmp_dispatch_set_hierarchy_values() { __kmp_hier_threads_per[kmp_hier_layer_e::LAYER_THREAD + 1] = 1; __kmp_hier_threads_per[kmp_hier_layer_e::LAYER_L1 + 1] = __kmp_nThreadsPerCore; -#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_WINDOWS) +#if KMP_ARCH_X86_64 && (KMP_OS_LINUX || KMP_OS_FREEBSD || KMP_OS_WINDOWS) if (__kmp_mic_type >= mic3) __kmp_hier_threads_per[kmp_hier_layer_e::LAYER_L2 + 1] = 2 * __kmp_nThreadsPerCore; Modified: vendor/llvm-openmp/dist/runtime/src/kmp_affinity.h ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_affinity.h Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_affinity.h Wed Oct 23 17:53:14 2019 (r353954) @@ -160,6 +160,7 @@ class KMPHwlocAffinity : public KMPAffinity { (public) }; #endif /* KMP_USE_HWLOC */ +#if KMP_OS_LINUX || KMP_OS_FREEBSD #if KMP_OS_LINUX /* On some of the older OS's that we build on, these constants aren't present in #included from . They must be the same on @@ -234,6 +235,10 @@ class KMPHwlocAffinity : public KMPAffinity { (public) #endif /* __NR_sched_getaffinity */ #error Unknown or unsupported architecture #endif /* KMP_ARCH_* */ +#elif KMP_OS_FREEBSD +#include +#include +#endif class KMPNativeAffinity : public KMPAffinity { class Mask : public KMPAffinity::Mask { typedef unsigned char mask_t; @@ -294,8 +299,13 @@ class KMPNativeAffinity : public KMPAffinity { int get_system_affinity(bool abort_on_error) override { KMP_ASSERT2(KMP_AFFINITY_CAPABLE(), "Illegal get affinity operation when not capable"); +#if KMP_OS_LINUX int retval = syscall(__NR_sched_getaffinity, 0, __kmp_affin_mask_size, mask); +#elif KMP_OS_FREEBSD + int retval = + pthread_getaffinity_np(pthread_self(), __kmp_affin_mask_size, reinterpret_cast(mask)); +#endif if (retval >= 0) { return 0; } @@ -308,8 +318,13 @@ class KMPNativeAffinity : public KMPAffinity { int set_system_affinity(bool abort_on_error) const override { KMP_ASSERT2(KMP_AFFINITY_CAPABLE(), "Illegal get affinity operation when not capable"); +#if KMP_OS_LINUX int retval = syscall(__NR_sched_setaffinity, 0, __kmp_affin_mask_size, mask); +#elif KMP_OS_FREEBSD + int retval = + pthread_setaffinity_np(pthread_self(), __kmp_affin_mask_size, reinterpret_cast(mask)); +#endif if (retval >= 0) { return 0; } @@ -347,7 +362,7 @@ class KMPNativeAffinity : public KMPAffinity { } api_type get_api_type() const override { return NATIVE_OS; } }; -#endif /* KMP_OS_LINUX */ +#endif /* KMP_OS_LINUX || KMP_OS_FREEBSD */ #if KMP_OS_WINDOWS class KMPNativeAffinity : public KMPAffinity { Modified: vendor/llvm-openmp/dist/runtime/src/kmp_csupport.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_csupport.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_csupport.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -545,7 +545,8 @@ void __kmpc_end_serialized_parallel(ident_t *loc, kmp_ if (ompt_enabled.ompt_callback_parallel_end) { ompt_callbacks.ompt_callback(ompt_callback_parallel_end)( &(serial_team->t.ompt_team_info.parallel_data), parent_task_data, - ompt_parallel_invoker_program, OMPT_LOAD_RETURN_ADDRESS(global_tid)); + ompt_parallel_invoker_program | ompt_parallel_team, + OMPT_LOAD_RETURN_ADDRESS(global_tid)); } __ompt_lw_taskteam_unlink(this_thr); this_thr->th.ompt_thread_info.state = ompt_state_overhead; @@ -676,7 +677,8 @@ void __kmpc_flush(ident_t *loc) { #endif // KMP_COMPILER_ICC } #endif // KMP_MIC -#elif (KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || KMP_ARCH_MIPS64) +#elif (KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || KMP_ARCH_MIPS64 || \ + KMP_ARCH_RISCV64) // Nothing to see here move along #elif KMP_ARCH_PPC64 // Nothing needed here (we have a real MB above). Modified: vendor/llvm-openmp/dist/runtime/src/kmp_ftn_os.h ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_ftn_os.h Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_ftn_os.h Wed Oct 23 17:53:14 2019 (r353954) @@ -633,5 +633,25 @@ GOMP_loop_ull_doacross_guided_start #define KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START \ GOMP_loop_ull_doacross_runtime_start +#define KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT \ + GOMP_loop_nonmonotonic_dynamic_next +#define KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START \ + GOMP_loop_nonmonotonic_dynamic_start +#define KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT \ + GOMP_loop_nonmonotonic_guided_next +#define KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_START \ + GOMP_loop_nonmonotonic_guided_start +#define KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT \ + GOMP_loop_ull_nonmonotonic_dynamic_next +#define KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START \ + GOMP_loop_ull_nonmonotonic_dynamic_start +#define KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT \ + GOMP_loop_ull_nonmonotonic_guided_next +#define KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START \ + GOMP_loop_ull_nonmonotonic_guided_start +#define KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC \ + GOMP_parallel_loop_nonmonotonic_dynamic +#define KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED \ + GOMP_parallel_loop_nonmonotonic_guided #endif /* KMP_FTN_OS_H */ Modified: vendor/llvm-openmp/dist/runtime/src/kmp_global.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_global.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_global.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -431,7 +431,7 @@ std::atomic __kmp_thread_pool_active_nth = ATOMIC /* ------------------------------------------------- * GLOBAL/ROOT STATE */ KMP_ALIGN_CACHE -kmp_global_t __kmp_global = {{0}}; +kmp_global_t __kmp_global; /* ----------------------------------------------- */ /* GLOBAL SYNCHRONIZATION LOCKS */ Modified: vendor/llvm-openmp/dist/runtime/src/kmp_gsupport.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_gsupport.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_gsupport.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -22,7 +22,7 @@ extern "C" { #endif // __cplusplus #define MKLOC(loc, routine) \ - static ident_t(loc) = {0, KMP_IDENT_KMPC, 0, 0, ";unknown;unknown;0;0;;"}; + static ident_t loc = {0, KMP_IDENT_KMPC, 0, 0, ";unknown;unknown;0;0;;"}; #include "kmp_ftn_os.h" @@ -622,10 +622,16 @@ LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_STAT LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_STATIC_NEXT), {}) LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DYNAMIC_START), kmp_sch_dynamic_chunked) +LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START), + kmp_sch_dynamic_chunked) LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_DYNAMIC_NEXT), {}) +LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT), {}) LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_GUIDED_START), kmp_sch_guided_chunked) +LOOP_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_START), + kmp_sch_guided_chunked) LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_GUIDED_NEXT), {}) +LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT), {}) LOOP_RUNTIME_START(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_RUNTIME_START), kmp_sch_runtime) LOOP_NEXT(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_RUNTIME_NEXT), {}) @@ -892,6 +898,16 @@ LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_U LOOP_START_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_START), kmp_sch_guided_chunked) LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_GUIDED_NEXT), {}) +LOOP_START_ULL( + KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START), + kmp_sch_dynamic_chunked) +LOOP_NEXT_ULL( + KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT), {}) +LOOP_START_ULL( + KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START), + kmp_sch_guided_chunked) +LOOP_NEXT_ULL( + KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT), {}) LOOP_RUNTIME_START_ULL( KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_START), kmp_sch_runtime) LOOP_NEXT_ULL(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_LOOP_ULL_RUNTIME_NEXT), {}) @@ -1487,6 +1503,12 @@ PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALL kmp_sch_static, OMPT_LOOP_PRE, OMPT_LOOP_POST) PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_DYNAMIC), kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST) +PARALLEL_LOOP( + KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED), + kmp_sch_guided_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST) +PARALLEL_LOOP( + KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC), + kmp_sch_dynamic_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST) PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_GUIDED), kmp_sch_guided_chunked, OMPT_LOOP_PRE, OMPT_LOOP_POST) PARALLEL_LOOP(KMP_EXPAND_NAME(KMP_API_NAME_GOMP_PARALLEL_LOOP_RUNTIME), @@ -1941,6 +1963,26 @@ KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_GUIDED_START, 45, "GOMP_4.5"); KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_DOACROSS_RUNTIME_START, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_START, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_DYNAMIC_NEXT, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_START, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_NONMONOTONIC_GUIDED_NEXT, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_START, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_DYNAMIC_NEXT, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_START, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_LOOP_ULL_NONMONOTONIC_GUIDED_NEXT, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_DYNAMIC, 45, + "GOMP_4.5"); +KMP_VERSION_SYMBOL(KMP_API_NAME_GOMP_PARALLEL_LOOP_NONMONOTONIC_GUIDED, 45, "GOMP_4.5"); #endif // KMP_USE_VERSION_SYMBOLS Modified: vendor/llvm-openmp/dist/runtime/src/kmp_lock.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_lock.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_lock.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -2943,10 +2943,10 @@ static int (*direct_test_check[])(kmp_dyna_lock_t *, k #undef expand // Exposes only one set of jump tables (*lock or *lock_with_checks). -void (*(*__kmp_direct_destroy))(kmp_dyna_lock_t *) = 0; -int (*(*__kmp_direct_set))(kmp_dyna_lock_t *, kmp_int32) = 0; -int (*(*__kmp_direct_unset))(kmp_dyna_lock_t *, kmp_int32) = 0; -int (*(*__kmp_direct_test))(kmp_dyna_lock_t *, kmp_int32) = 0; +void (**__kmp_direct_destroy)(kmp_dyna_lock_t *) = 0; +int (**__kmp_direct_set)(kmp_dyna_lock_t *, kmp_int32) = 0; +int (**__kmp_direct_unset)(kmp_dyna_lock_t *, kmp_int32) = 0; +int (**__kmp_direct_test)(kmp_dyna_lock_t *, kmp_int32) = 0; // Jump tables for the indirect lock functions #define expand(l, op) (void (*)(kmp_user_lock_p)) __kmp_##op##_##l##_##lock, @@ -2993,10 +2993,10 @@ static int (*indirect_test_check[])(kmp_user_lock_p, k #undef expand // Exposes only one jump tables (*lock or *lock_with_checks). -void (*(*__kmp_indirect_destroy))(kmp_user_lock_p) = 0; -int (*(*__kmp_indirect_set))(kmp_user_lock_p, kmp_int32) = 0; -int (*(*__kmp_indirect_unset))(kmp_user_lock_p, kmp_int32) = 0; -int (*(*__kmp_indirect_test))(kmp_user_lock_p, kmp_int32) = 0; +void (**__kmp_indirect_destroy)(kmp_user_lock_p) = 0; +int (**__kmp_indirect_set)(kmp_user_lock_p, kmp_int32) = 0; +int (**__kmp_indirect_unset)(kmp_user_lock_p, kmp_int32) = 0; +int (**__kmp_indirect_test)(kmp_user_lock_p, kmp_int32) = 0; // Lock index table. kmp_indirect_lock_table_t __kmp_i_lock_table; Modified: vendor/llvm-openmp/dist/runtime/src/kmp_lock.h ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_lock.h Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_lock.h Wed Oct 23 17:53:14 2019 (r353954) @@ -1122,18 +1122,18 @@ typedef struct { // Function tables for direct locks. Set/unset/test differentiate functions // with/without consistency checking. extern void (*__kmp_direct_init[])(kmp_dyna_lock_t *, kmp_dyna_lockseq_t); -extern void (*(*__kmp_direct_destroy))(kmp_dyna_lock_t *); -extern int (*(*__kmp_direct_set))(kmp_dyna_lock_t *, kmp_int32); -extern int (*(*__kmp_direct_unset))(kmp_dyna_lock_t *, kmp_int32); -extern int (*(*__kmp_direct_test))(kmp_dyna_lock_t *, kmp_int32); +extern void (**__kmp_direct_destroy)(kmp_dyna_lock_t *); +extern int (**__kmp_direct_set)(kmp_dyna_lock_t *, kmp_int32); +extern int (**__kmp_direct_unset)(kmp_dyna_lock_t *, kmp_int32); +extern int (**__kmp_direct_test)(kmp_dyna_lock_t *, kmp_int32); // Function tables for indirect locks. Set/unset/test differentiate functions // with/withuot consistency checking. extern void (*__kmp_indirect_init[])(kmp_user_lock_p); -extern void (*(*__kmp_indirect_destroy))(kmp_user_lock_p); -extern int (*(*__kmp_indirect_set))(kmp_user_lock_p, kmp_int32); -extern int (*(*__kmp_indirect_unset))(kmp_user_lock_p, kmp_int32); -extern int (*(*__kmp_indirect_test))(kmp_user_lock_p, kmp_int32); +extern void (**__kmp_indirect_destroy)(kmp_user_lock_p); +extern int (**__kmp_indirect_set)(kmp_user_lock_p, kmp_int32); +extern int (**__kmp_indirect_unset)(kmp_user_lock_p, kmp_int32); +extern int (**__kmp_indirect_test)(kmp_user_lock_p, kmp_int32); // Extracts direct lock tag from a user lock pointer #define KMP_EXTRACT_D_TAG(l) \ Modified: vendor/llvm-openmp/dist/runtime/src/kmp_os.h ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_os.h Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_os.h Wed Oct 23 17:53:14 2019 (r353954) @@ -69,7 +69,7 @@ #error Unknown compiler #endif -#if (KMP_OS_LINUX || KMP_OS_WINDOWS) && !KMP_OS_CNK +#if (KMP_OS_LINUX || KMP_OS_WINDOWS || KMP_OS_FREEBSD) && !KMP_OS_CNK #define KMP_AFFINITY_SUPPORTED 1 #if KMP_OS_WINDOWS && KMP_ARCH_X86_64 #define KMP_GROUP_AFFINITY 1 @@ -165,7 +165,8 @@ typedef unsigned long long kmp_uint64; #if KMP_ARCH_X86 || KMP_ARCH_ARM || KMP_ARCH_MIPS #define KMP_SIZE_T_SPEC KMP_UINT32_SPEC -#elif KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 +#elif KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \ + KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 #define KMP_SIZE_T_SPEC KMP_UINT64_SPEC #else #error "Can't determine size_t printf format specifier." @@ -840,7 +841,7 @@ extern kmp_real64 __kmp_xchg_real64(volatile kmp_real6 #endif /* KMP_OS_WINDOWS */ #if KMP_ARCH_PPC64 || KMP_ARCH_ARM || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS || \ - KMP_ARCH_MIPS64 + KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 #define KMP_MB() __sync_synchronize() #endif Modified: vendor/llvm-openmp/dist/runtime/src/kmp_platform.h ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_platform.h Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_platform.h Wed Oct 23 17:53:14 2019 (r353954) @@ -98,6 +98,7 @@ #define KMP_ARCH_PPC64 (KMP_ARCH_PPC64_LE || KMP_ARCH_PPC64_BE) #define KMP_ARCH_MIPS 0 #define KMP_ARCH_MIPS64 0 +#define KMP_ARCH_RISCV64 0 #if KMP_OS_WINDOWS #if defined(_M_AMD64) || defined(__x86_64) @@ -135,6 +136,9 @@ #undef KMP_ARCH_MIPS #define KMP_ARCH_MIPS 1 #endif +#elif defined __riscv && __riscv_xlen == 64 +#undef KMP_ARCH_RISCV64 +#define KMP_ARCH_RISCV64 1 #endif #endif @@ -199,7 +203,7 @@ // TODO: Fixme - This is clever, but really fugly #if (1 != \ KMP_ARCH_X86 + KMP_ARCH_X86_64 + KMP_ARCH_ARM + KMP_ARCH_PPC64 + \ - KMP_ARCH_AARCH64 + KMP_ARCH_MIPS + KMP_ARCH_MIPS64) + KMP_ARCH_AARCH64 + KMP_ARCH_MIPS + KMP_ARCH_MIPS64 + KMP_ARCH_RISCV64) #error Unknown or unsupported architecture #endif Modified: vendor/llvm-openmp/dist/runtime/src/kmp_runtime.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_runtime.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_runtime.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -1190,8 +1190,8 @@ void __kmp_serialized_parallel(ident_t *loc, kmp_int32 ompt_callbacks.ompt_callback(ompt_callback_parallel_begin)( &(parent_task_info->task_data), &(parent_task_info->frame), - &ompt_parallel_data, team_size, ompt_parallel_invoker_program, - codeptr); + &ompt_parallel_data, team_size, + ompt_parallel_invoker_program | ompt_parallel_team, codeptr); } } #endif // OMPT_SUPPORT @@ -1481,9 +1481,13 @@ int __kmp_fork_call(ident_t *loc, int gtid, int team_size = master_set_numthreads ? master_set_numthreads : get__nproc_2(parent_team, master_tid); + int flags = OMPT_INVOKER(call_context) | + ((microtask == (microtask_t)__kmp_teams_master) + ? ompt_parallel_league + : ompt_parallel_team); ompt_callbacks.ompt_callback(ompt_callback_parallel_begin)( - parent_task_data, ompt_frame, &ompt_parallel_data, team_size, - OMPT_INVOKER(call_context), return_address); + parent_task_data, ompt_frame, &ompt_parallel_data, team_size, flags, + return_address); } master_th->th.ompt_thread_info.state = ompt_state_overhead; } @@ -1512,19 +1516,17 @@ int __kmp_fork_call(ident_t *loc, int gtid, // AC: we are in serialized parallel __kmpc_serialized_parallel(loc, gtid); KMP_DEBUG_ASSERT(parent_team->t.t_serialized > 1); - // AC: need this in order enquiry functions work - // correctly, will restore at join time - parent_team->t.t_serialized--; + #if OMPT_SUPPORT void *dummy; - void **exit_runtime_p; + void **exit_frame_p; ompt_lw_taskteam_t lw_taskteam; if (ompt_enabled.enabled) { __ompt_lw_taskteam_init(&lw_taskteam, master_th, gtid, &ompt_parallel_data, return_address); - exit_runtime_p = &(lw_taskteam.ompt_task_info.frame.exit_frame.ptr); + exit_frame_p = &(lw_taskteam.ompt_task_info.frame.exit_frame.ptr); __ompt_lw_taskteam_link(&lw_taskteam, master_th, 0); // don't use lw_taskteam after linking. content was swaped @@ -1532,19 +1534,23 @@ int __kmp_fork_call(ident_t *loc, int gtid, /* OMPT implicit task begin */ implicit_task_data = OMPT_CUR_TASK_DATA(master_th); if (ompt_enabled.ompt_callback_implicit_task) { - ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( - ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), - implicit_task_data, 1, __kmp_tid_from_gtid(gtid), ompt_task_implicit); // TODO: Can this be ompt_task_initial? OMPT_CUR_TASK_INFO(master_th) ->thread_num = __kmp_tid_from_gtid(gtid); + ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( + ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), + implicit_task_data, 1, + OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); } /* OMPT state */ master_th->th.ompt_thread_info.state = ompt_state_work_parallel; } else { - exit_runtime_p = &dummy; + exit_frame_p = &dummy; } #endif + // AC: need to decrement t_serialized for enquiry functions to work + // correctly, will restore at join time + parent_team->t.t_serialized--; { KMP_TIME_PARTITIONED_BLOCK(OMP_parallel); @@ -1552,26 +1558,27 @@ int __kmp_fork_call(ident_t *loc, int gtid, __kmp_invoke_microtask(microtask, gtid, 0, argc, parent_team->t.t_argv #if OMPT_SUPPORT , - exit_runtime_p + exit_frame_p #endif ); } #if OMPT_SUPPORT - *exit_runtime_p = NULL; if (ompt_enabled.enabled) { + *exit_frame_p = NULL; OMPT_CUR_TASK_INFO(master_th)->frame.exit_frame = ompt_data_none; if (ompt_enabled.ompt_callback_implicit_task) { ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( ompt_scope_end, NULL, implicit_task_data, 1, - OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); // TODO: Can this be ompt_task_initial? + OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); } + ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th); __ompt_lw_taskteam_unlink(master_th); - if (ompt_enabled.ompt_callback_parallel_end) { ompt_callbacks.ompt_callback(ompt_callback_parallel_end)( - OMPT_CUR_TEAM_DATA(master_th), OMPT_CUR_TASK_DATA(master_th), - OMPT_INVOKER(call_context), return_address); + &ompt_parallel_data, OMPT_CUR_TASK_DATA(master_th), + OMPT_INVOKER(call_context) | ompt_parallel_team, + return_address); } master_th->th.ompt_thread_info.state = ompt_state_overhead; } @@ -1586,6 +1593,15 @@ int __kmp_fork_call(ident_t *loc, int gtid, parent_team->t.t_level++; parent_team->t.t_def_allocator = master_th->th.th_def_allocator; // save +#if OMPT_SUPPORT + if (ompt_enabled.enabled) { + ompt_lw_taskteam_t lw_taskteam; + __ompt_lw_taskteam_init(&lw_taskteam, master_th, gtid, + &ompt_parallel_data, return_address); + __ompt_lw_taskteam_link(&lw_taskteam, master_th, 1, true); + } +#endif + /* Change number of threads in the team if requested */ if (master_set_numthreads) { // The parallel has num_threads clause if (master_set_numthreads < master_th->th.th_teams_size.nth) { @@ -1714,7 +1730,7 @@ int __kmp_fork_call(ident_t *loc, int gtid, #if OMPT_SUPPORT void *dummy; - void **exit_runtime_p; + void **exit_frame_p; ompt_task_info_t *task_info; ompt_lw_taskteam_t lw_taskteam; @@ -1727,19 +1743,21 @@ int __kmp_fork_call(ident_t *loc, int gtid, // don't use lw_taskteam after linking. content was swaped task_info = OMPT_CUR_TASK_INFO(master_th); - exit_runtime_p = &(task_info->frame.exit_frame.ptr); + exit_frame_p = &(task_info->frame.exit_frame.ptr); if (ompt_enabled.ompt_callback_implicit_task) { - ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( - ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), - &(task_info->task_data), 1, __kmp_tid_from_gtid(gtid), ompt_task_implicit); // TODO: Can this be ompt_task_initial? OMPT_CUR_TASK_INFO(master_th) ->thread_num = __kmp_tid_from_gtid(gtid); + ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( + ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), + &(task_info->task_data), 1, + OMPT_CUR_TASK_INFO(master_th)->thread_num, + ompt_task_implicit); } /* OMPT state */ master_th->th.ompt_thread_info.state = ompt_state_work_parallel; } else { - exit_runtime_p = &dummy; + exit_frame_p = &dummy; } #endif @@ -1750,25 +1768,27 @@ int __kmp_fork_call(ident_t *loc, int gtid, parent_team->t.t_argv #if OMPT_SUPPORT , - exit_runtime_p + exit_frame_p #endif ); } #if OMPT_SUPPORT if (ompt_enabled.enabled) { - exit_runtime_p = NULL; + *exit_frame_p = NULL; if (ompt_enabled.ompt_callback_implicit_task) { ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( ompt_scope_end, NULL, &(task_info->task_data), 1, - OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); // TODO: Can this be ompt_task_initial? + OMPT_CUR_TASK_INFO(master_th)->thread_num, + ompt_task_implicit); } - + ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th); __ompt_lw_taskteam_unlink(master_th); if (ompt_enabled.ompt_callback_parallel_end) { ompt_callbacks.ompt_callback(ompt_callback_parallel_end)( - OMPT_CUR_TEAM_DATA(master_th), parent_task_data, - OMPT_INVOKER(call_context), return_address); + &ompt_parallel_data, parent_task_data, + OMPT_INVOKER(call_context) | ompt_parallel_team, + return_address); } master_th->th.ompt_thread_info.state = ompt_state_overhead; } @@ -1800,6 +1820,23 @@ int __kmp_fork_call(ident_t *loc, int gtid, team->t.t_level--; // AC: call special invoker for outer "parallel" of teams construct invoker(gtid); +#if OMPT_SUPPORT + if (ompt_enabled.enabled) { + ompt_task_info_t *task_info = OMPT_CUR_TASK_INFO(master_th); + if (ompt_enabled.ompt_callback_implicit_task) { + ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( + ompt_scope_end, NULL, &(task_info->task_data), 0, + OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_initial); + } + if (ompt_enabled.ompt_callback_parallel_end) { + ompt_callbacks.ompt_callback(ompt_callback_parallel_end)( + &ompt_parallel_data, parent_task_data, + OMPT_INVOKER(call_context) | ompt_parallel_league, + return_address); + } + master_th->th.ompt_thread_info.state = ompt_state_overhead; + } +#endif } else { argv = args; for (i = argc - 1; i >= 0; --i) @@ -1813,7 +1850,7 @@ int __kmp_fork_call(ident_t *loc, int gtid, #if OMPT_SUPPORT void *dummy; - void **exit_runtime_p; + void **exit_frame_p; ompt_task_info_t *task_info; ompt_lw_taskteam_t lw_taskteam; @@ -1824,14 +1861,15 @@ int __kmp_fork_call(ident_t *loc, int gtid, __ompt_lw_taskteam_link(&lw_taskteam, master_th, 0); // don't use lw_taskteam after linking. content was swaped task_info = OMPT_CUR_TASK_INFO(master_th); - exit_runtime_p = &(task_info->frame.exit_frame.ptr); + exit_frame_p = &(task_info->frame.exit_frame.ptr); /* OMPT implicit task begin */ implicit_task_data = OMPT_CUR_TASK_DATA(master_th); if (ompt_enabled.ompt_callback_implicit_task) { ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( ompt_scope_begin, OMPT_CUR_TEAM_DATA(master_th), - implicit_task_data, 1, __kmp_tid_from_gtid(gtid), ompt_task_implicit); // TODO: Can this be ompt_task_initial? + implicit_task_data, 1, __kmp_tid_from_gtid(gtid), + ompt_task_implicit); OMPT_CUR_TASK_INFO(master_th) ->thread_num = __kmp_tid_from_gtid(gtid); } @@ -1839,7 +1877,7 @@ int __kmp_fork_call(ident_t *loc, int gtid, /* OMPT state */ master_th->th.ompt_thread_info.state = ompt_state_work_parallel; } else { - exit_runtime_p = &dummy; + exit_frame_p = &dummy; } #endif @@ -1849,18 +1887,19 @@ int __kmp_fork_call(ident_t *loc, int gtid, __kmp_invoke_microtask(microtask, gtid, 0, argc, args #if OMPT_SUPPORT , - exit_runtime_p + exit_frame_p #endif ); } #if OMPT_SUPPORT if (ompt_enabled.enabled) { - *exit_runtime_p = NULL; + *exit_frame_p = NULL; if (ompt_enabled.ompt_callback_implicit_task) { ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( ompt_scope_end, NULL, &(task_info->task_data), 1, - OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); // TODO: Can this be ompt_task_initial? + OMPT_CUR_TASK_INFO(master_th)->thread_num, + ompt_task_implicit); } ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th); @@ -1868,7 +1907,8 @@ int __kmp_fork_call(ident_t *loc, int gtid, if (ompt_enabled.ompt_callback_parallel_end) { ompt_callbacks.ompt_callback(ompt_callback_parallel_end)( &ompt_parallel_data, parent_task_data, - OMPT_INVOKER(call_context), return_address); + OMPT_INVOKER(call_context) | ompt_parallel_team, + return_address); } master_th->th.ompt_thread_info.state = ompt_state_overhead; } @@ -2225,12 +2265,11 @@ static inline void __kmp_join_restore_state(kmp_info_t static inline void __kmp_join_ompt(int gtid, kmp_info_t *thread, kmp_team_t *team, ompt_data_t *parallel_data, - fork_context_e fork_context, void *codeptr) { + int flags, void *codeptr) { ompt_task_info_t *task_info = __ompt_get_task_info_object(0); if (ompt_enabled.ompt_callback_parallel_end) { ompt_callbacks.ompt_callback(ompt_callback_parallel_end)( - parallel_data, &(task_info->task_data), OMPT_INVOKER(fork_context), - codeptr); + parallel_data, &(task_info->task_data), flags, codeptr); } task_info->frame.enter_frame = ompt_data_none; @@ -2263,6 +2302,7 @@ void __kmp_join_call(ident_t *loc, int gtid master_th->th.th_ident = loc; #if OMPT_SUPPORT + void *team_microtask = (void *)team->t.t_pkfn; if (ompt_enabled.enabled) { master_th->th.ompt_thread_info.state = ompt_state_overhead; } @@ -2352,10 +2392,25 @@ void __kmp_join_call(ident_t *loc, int gtid if (master_th->th.th_teams_microtask && !exit_teams && team->t.t_pkfn != (microtask_t)__kmp_teams_master && team->t.t_level == master_th->th.th_teams_level + 1) { - // AC: We need to leave the team structure intact at the end of parallel - // inside the teams construct, so that at the next parallel same (hot) team - // works, only adjust nesting levels - +// AC: We need to leave the team structure intact at the end of parallel +// inside the teams construct, so that at the next parallel same (hot) team +// works, only adjust nesting levels +#if OMPT_SUPPORT + ompt_data_t ompt_parallel_data = ompt_data_none; + if (ompt_enabled.enabled) { + ompt_task_info_t *task_info = __ompt_get_task_info_object(0); + if (ompt_enabled.ompt_callback_implicit_task) { + int ompt_team_size = team->t.t_nproc; + ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( + ompt_scope_end, NULL, &(task_info->task_data), ompt_team_size, + OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); + } + task_info->frame.exit_frame = ompt_data_none; + task_info->task_data = ompt_data_none; + ompt_parallel_data = *OMPT_CUR_TEAM_DATA(master_th); + __ompt_lw_taskteam_unlink(master_th); + } +#endif /* Decrement our nested depth level */ team->t.t_level--; team->t.t_active_level--; @@ -2394,8 +2449,8 @@ void __kmp_join_call(ident_t *loc, int gtid #if OMPT_SUPPORT if (ompt_enabled.enabled) { - __kmp_join_ompt(gtid, master_th, parent_team, parallel_data, fork_context, - codeptr); + __kmp_join_ompt(gtid, master_th, parent_team, &ompt_parallel_data, + OMPT_INVOKER(fork_context) | ompt_parallel_team, codeptr); } #endif @@ -2424,12 +2479,14 @@ void __kmp_join_call(ident_t *loc, int gtid if (ompt_enabled.enabled) { ompt_task_info_t *task_info = __ompt_get_task_info_object(0); if (ompt_enabled.ompt_callback_implicit_task) { - int ompt_team_size = team->t.t_nproc; + int flags = (team_microtask == (void *)__kmp_teams_master) + ? ompt_task_initial + : ompt_task_implicit; + int ompt_team_size = (flags == ompt_task_initial) ? 0 : team->t.t_nproc; ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( ompt_scope_end, NULL, &(task_info->task_data), ompt_team_size, - OMPT_CUR_TASK_INFO(master_th)->thread_num, ompt_task_implicit); // TODO: Can this be ompt_task_initial? + OMPT_CUR_TASK_INFO(master_th)->thread_num, flags); } - task_info->frame.exit_frame = ompt_data_none; task_info->task_data = ompt_data_none; } @@ -2503,8 +2560,12 @@ void __kmp_join_call(ident_t *loc, int gtid __kmp_release_bootstrap_lock(&__kmp_forkjoin_lock); #if OMPT_SUPPORT + int flags = + OMPT_INVOKER(fork_context) | + ((team_microtask == (void *)__kmp_teams_master) ? ompt_parallel_league + : ompt_parallel_team); if (ompt_enabled.enabled) { - __kmp_join_ompt(gtid, master_th, parent_team, parallel_data, fork_context, + __kmp_join_ompt(gtid, master_th, parent_team, parallel_data, flags, codeptr); } #endif @@ -4432,7 +4493,7 @@ static void __kmp_initialize_team(kmp_team_t *team, in KF_TRACE(10, ("__kmp_initialize_team: exit: team=%p\n", team)); } -#if KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED +#if (KMP_OS_LINUX || KMP_OS_FREEBSD) && KMP_AFFINITY_SUPPORTED /* Sets full mask for thread and returns old mask, no changes to structures. */ static void __kmp_set_thread_affinity_mask_full_tmp(kmp_affin_mask_t *old_mask) { @@ -4980,7 +5041,7 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, i __kmp_partition_places(team); #endif } else { // team->t.t_nproc < new_nproc -#if KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED +#if (KMP_OS_LINUX || KMP_OS_FREEBSD) && KMP_AFFINITY_SUPPORTED kmp_affin_mask_t *old_mask; if (KMP_AFFINITY_CAPABLE()) { KMP_CPU_ALLOC(old_mask); @@ -5029,7 +5090,7 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, i __kmp_reinitialize_team(team, new_icvs, NULL); } -#if KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED +#if (KMP_OS_LINUX || KMP_OS_FREEBSD) && KMP_AFFINITY_SUPPORTED /* Temporarily set full mask for master thread before creation of workers. The reason is that workers inherit the affinity from master, so if a lot of workers are created on the single core quickly, they @@ -5064,7 +5125,7 @@ __kmp_allocate_team(kmp_root_t *root, int new_nproc, i } } -#if KMP_OS_LINUX && KMP_AFFINITY_SUPPORTED +#if (KMP_OS_LINUX || KMP_OS_FREEBSD) && KMP_AFFINITY_SUPPORTED if (KMP_AFFINITY_CAPABLE()) { /* Restore initial master thread's affinity mask */ __kmp_set_system_affinity(old_mask, TRUE); @@ -5600,7 +5661,7 @@ void __kmp_free_thread(kmp_info_t *this_th) { void *__kmp_launch_thread(kmp_info_t *this_thr) { int gtid = this_thr->th.th_info.ds.ds_gtid; /* void *stack_data;*/ - kmp_team_t *(*volatile pteam); + kmp_team_t **volatile pteam; KMP_MB(); KA_TRACE(10, ("__kmp_launch_thread: T#%d start\n", gtid)); @@ -5618,18 +5679,15 @@ void *__kmp_launch_thread(kmp_info_t *this_thr) { this_thr->th.ompt_thread_info.state = ompt_state_overhead; this_thr->th.ompt_thread_info.wait_id = 0; this_thr->th.ompt_thread_info.idle_frame = OMPT_GET_FRAME_ADDRESS(0); + this_thr->th.ompt_thread_info.parallel_flags = 0; if (ompt_enabled.ompt_callback_thread_begin) { ompt_callbacks.ompt_callback(ompt_callback_thread_begin)( ompt_thread_worker, thread_data); } - } -#endif - -#if OMPT_SUPPORT - if (ompt_enabled.enabled) { this_thr->th.ompt_thread_info.state = ompt_state_idle; } #endif + /* This is the place where threads wait for work */ while (!TCR_4(__kmp_global.g.g_done)) { KMP_DEBUG_ASSERT(this_thr == __kmp_threads[gtid]); @@ -5647,7 +5705,7 @@ void *__kmp_launch_thread(kmp_info_t *this_thr) { } #endif - pteam = (kmp_team_t * (*))(&this_thr->th.th_team); + pteam = &this_thr->th.th_team; /* have we been allocated? */ if (TCR_SYNC_PTR(*pteam) && !TCR_4(__kmp_global.g.g_done)) { @@ -6956,16 +7014,16 @@ int __kmp_invoke_task_func(int gtid) { #if OMPT_SUPPORT void *dummy; - void **exit_runtime_p; + void **exit_frame_p; ompt_data_t *my_task_data; ompt_data_t *my_parallel_data; int ompt_team_size; if (ompt_enabled.enabled) { - exit_runtime_p = &( + exit_frame_p = &( team->t.t_implicit_task_taskdata[tid].ompt_task_info.frame.exit_frame.ptr); } else { - exit_runtime_p = &dummy; + exit_frame_p = &dummy; } my_task_data = @@ -6975,7 +7033,7 @@ int __kmp_invoke_task_func(int gtid) { ompt_team_size = team->t.t_nproc; ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( ompt_scope_begin, my_parallel_data, my_task_data, ompt_team_size, - __kmp_tid_from_gtid(gtid), ompt_task_implicit); // TODO: Can this be ompt_task_initial? + __kmp_tid_from_gtid(gtid), ompt_task_implicit); OMPT_CUR_TASK_INFO(this_thr)->thread_num = __kmp_tid_from_gtid(gtid); } #endif @@ -6994,11 +7052,12 @@ int __kmp_invoke_task_func(int gtid) { tid, (int)team->t.t_argc, (void **)team->t.t_argv #if OMPT_SUPPORT , - exit_runtime_p + exit_frame_p #endif ); #if OMPT_SUPPORT - *exit_runtime_p = NULL; + *exit_frame_p = NULL; + this_thr->th.ompt_thread_info.parallel_flags |= ompt_parallel_team; #endif #if KMP_STATS_ENABLED @@ -7077,7 +7136,22 @@ int __kmp_invoke_teams_master(int gtid) { (void *)__kmp_teams_master); #endif __kmp_run_before_invoked_task(gtid, 0, this_thr, team); +#if OMPT_SUPPORT + int tid = __kmp_tid_from_gtid(gtid); + ompt_data_t *task_data = + &team->t.t_implicit_task_taskdata[tid].ompt_task_info.task_data; + ompt_data_t *parallel_data = &team->t.ompt_team_info.parallel_data; + if (ompt_enabled.ompt_callback_implicit_task) { + ompt_callbacks.ompt_callback(ompt_callback_implicit_task)( + ompt_scope_begin, parallel_data, task_data, team->t.t_nproc, tid, + ompt_task_initial); + OMPT_CUR_TASK_INFO(this_thr)->thread_num = tid; + } +#endif __kmp_teams_master(gtid); +#if OMPT_SUPPORT + this_thr->th.ompt_thread_info.parallel_flags |= ompt_parallel_league; +#endif __kmp_run_after_invoked_task(gtid, 0, this_thr, team); return 1; } @@ -7118,19 +7192,32 @@ void __kmp_push_num_teams(ident_t *id, int gtid, int n thr->th.th_set_nproc = thr->th.th_teams_size.nteams = num_teams; // Remember the number of threads for inner parallel regions + if (!TCR_4(__kmp_init_middle)) + __kmp_middle_initialize(); // get internal globals calculated + KMP_DEBUG_ASSERT(__kmp_avail_proc); + KMP_DEBUG_ASSERT(__kmp_dflt_team_nth); if (num_threads == 0) { - if (!TCR_4(__kmp_init_middle)) - __kmp_middle_initialize(); // get __kmp_avail_proc calculated num_threads = __kmp_avail_proc / num_teams; + // adjust num_threads w/o warning as it is not user setting + // num_threads = min(num_threads, nthreads-var, thread-limit-var) + // no thread_limit clause specified - do not change thread-limit-var ICV + if (num_threads > __kmp_dflt_team_nth) { + num_threads = __kmp_dflt_team_nth; // honor nthreads-var ICV + } + if (num_threads > thr->th.th_current_task->td_icvs.thread_limit) { + num_threads = thr->th.th_current_task->td_icvs.thread_limit; + } // prevent team size to exceed thread-limit-var if (num_teams * num_threads > __kmp_teams_max_nth) { - // adjust num_threads w/o warning as it is not user setting num_threads = __kmp_teams_max_nth / num_teams; } } else { // This thread will be the master of the league masters // Store new thread limit; old limit is saved in th_cg_roots list thr->th.th_current_task->td_icvs.thread_limit = num_threads; - + // num_threads = min(num_threads, nthreads-var) + if (num_threads > __kmp_dflt_team_nth) { + num_threads = __kmp_dflt_team_nth; // honor nthreads-var ICV + } if (num_teams * num_threads > __kmp_teams_max_nth) { int new_threads = __kmp_teams_max_nth / num_teams; if (!__kmp_reserve_warn) { // user asked for too many threads @@ -8023,7 +8110,8 @@ __kmp_determine_reduction_method( int atomic_available = FAST_REDUCTION_ATOMIC_METHOD_GENERATED; -#if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || KMP_ARCH_MIPS64 +#if KMP_ARCH_X86_64 || KMP_ARCH_PPC64 || KMP_ARCH_AARCH64 || \ + KMP_ARCH_MIPS64 || KMP_ARCH_RISCV64 #if KMP_OS_LINUX || KMP_OS_DRAGONFLY || KMP_OS_FREEBSD || KMP_OS_NETBSD || \ KMP_OS_OPENBSD || KMP_OS_WINDOWS || KMP_OS_DARWIN || KMP_OS_HURD Modified: vendor/llvm-openmp/dist/runtime/src/kmp_stub.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_stub.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_stub.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -164,7 +164,7 @@ void *kmp_aligned_malloc(size_t sz, size_t a) { #if KMP_OS_WINDOWS res = _aligned_malloc(sz, a); #else - if (err = posix_memalign(&res, a, sz)) { + if ((err = posix_memalign(&res, a, sz))) { errno = err; // can be EINVAL or ENOMEM res = NULL; } @@ -277,7 +277,7 @@ void __kmps_get_schedule(kmp_sched_t *kind, int *modif kmp_proc_bind_t __kmps_get_proc_bind(void) { i; - return 0; + return proc_bind_false; } // __kmps_get_proc_bind double __kmps_get_wtime(void) { Modified: vendor/llvm-openmp/dist/runtime/src/kmp_taskdeps.cpp ============================================================================== --- vendor/llvm-openmp/dist/runtime/src/kmp_taskdeps.cpp Wed Oct 23 17:53:12 2019 (r353953) +++ vendor/llvm-openmp/dist/runtime/src/kmp_taskdeps.cpp Wed Oct 23 17:53:14 2019 (r353954) @@ -54,12 +54,64 @@ static inline kmp_depnode_t *__kmp_node_ref(kmp_depnod enum { KMP_DEPHASH_OTHER_SIZE = 97, KMP_DEPHASH_MASTER_SIZE = 997 }; +size_t sizes[] = { 997, 2003, 4001, 8191, 16001, 32003, 64007, 131071, 270029 }; +const size_t MAX_GEN = 8; + static inline kmp_int32 __kmp_dephash_hash(kmp_intptr_t addr, size_t hsize) { // TODO alternate to try: set = (((Addr64)(addrUsefulBits * 9.618)) % // m_num_sets ); return ((addr >> 6) ^ (addr >> 2)) % hsize; } +static kmp_dephash_t *__kmp_dephash_extend(kmp_info_t *thread, + kmp_dephash_t *current_dephash) { + kmp_dephash_t *h; + + size_t gen = current_dephash->generation + 1; + if (gen >= MAX_GEN) + return current_dephash; + size_t new_size = sizes[gen]; + + kmp_int32 size_to_allocate = + new_size * sizeof(kmp_dephash_entry_t *) + sizeof(kmp_dephash_t); + +#if USE_FAST_MEMORY + h = (kmp_dephash_t *)__kmp_fast_allocate(thread, size_to_allocate); +#else + h = (kmp_dephash_t *)__kmp_thread_malloc(thread, size_to_allocate); +#endif + + h->size = new_size; + h->nelements = current_dephash->nelements; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Wed Oct 23 17:53:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 228F0159E4E; Wed, 23 Oct 2019 17:53:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yyf96V65z4Thb; Wed, 23 Oct 2019 17:53:21 +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 8066E38B; Wed, 23 Oct 2019 17:53:21 +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 x9NHrL8Y078785; Wed, 23 Oct 2019 17:53:21 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHrLS1078784; Wed, 23 Oct 2019 17:53:21 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910231753.x9NHrLS1078784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Wed, 23 Oct 2019 17:53:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-vendor@freebsd.org Subject: svn commit: r353955 - vendor/llvm-openmp/openmp-r375505 X-SVN-Group: vendor X-SVN-Commit-Author: dim X-SVN-Commit-Paths: vendor/llvm-openmp/openmp-r375505 X-SVN-Commit-Revision: 353955 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:53:22 -0000 Author: dim Date: Wed Oct 23 17:53:20 2019 New Revision: 353955 URL: https://svnweb.freebsd.org/changeset/base/353955 Log: Tag stripped LLVM openmp trunk r375505, the last commit before the upstream Subversion repository was made read-only, and the LLVM project migrated to GitHub. Added: vendor/llvm-openmp/openmp-r375505/ - copied from r353954, vendor/llvm-openmp/dist/ From owner-svn-src-all@freebsd.org Wed Oct 23 17:58:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B58515A0D9; Wed, 23 Oct 2019 17:58:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yylw2pLrz4V52; Wed, 23 Oct 2019 17:58:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 43B92398; Wed, 23 Oct 2019 17:58:20 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NHwKFj079094; Wed, 23 Oct 2019 17:58:20 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NHwK3Z079093; Wed, 23 Oct 2019 17:58:20 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910231758.x9NHwK3Z079093@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 23 Oct 2019 17:58:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353956 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353956 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 17:58:20 -0000 Author: markj Date: Wed Oct 23 17:58:19 2019 New Revision: 353956 URL: https://svnweb.freebsd.org/changeset/base/353956 Log: Verify identity after checking for WAITFAIL in vm_page_busy_acquire(). A caller that does not guarantee that a page's identity won't change while sleeping for a busy lock must specify either NOWAIT or WAITFAIL. Reported by: syzkaller Reviewed by: alc, kib Discussed with: jeff Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22124 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Wed Oct 23 17:53:20 2019 (r353955) +++ head/sys/vm/vm_page.c Wed Oct 23 17:58:19 2019 (r353956) @@ -900,9 +900,11 @@ vm_page_busy_acquire(vm_page_t m, int allocflags) (allocflags & VM_ALLOC_SBUSY) != 0, locked); if (locked) VM_OBJECT_WLOCK(obj); - MPASS(m->object == obj || m->object == NULL); if ((allocflags & VM_ALLOC_WAITFAIL) != 0) return (FALSE); + KASSERT(m->object == obj || m->object == NULL, + ("vm_page_busy_acquire: page %p does not belong to %p", + m, obj)); } } From owner-svn-src-all@freebsd.org Wed Oct 23 18:00:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0CC2A15A1BD; Wed, 23 Oct 2019 18:00:23 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yypG6c3Dz4VGF; Wed, 23 Oct 2019 18:00:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C54E83B5; Wed, 23 Oct 2019 18:00:22 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NI0M7Z079308; Wed, 23 Oct 2019 18:00:22 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NI0Mb7079307; Wed, 23 Oct 2019 18:00:22 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910231800.x9NI0Mb7079307@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 23 Oct 2019 18:00:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353957 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353957 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 18:00:23 -0000 Author: markj Date: Wed Oct 23 18:00:22 2019 New Revision: 353957 URL: https://svnweb.freebsd.org/changeset/base/353957 Log: Check for bogus_page in vnode_pager_generic_getpages_done(). We now assert that a page is busy when updating its validity-tracking state, but bogus_page is not busied during a getpages operation. Reported by: syzkaller Reviewed by: alc, kib Discussed with: jeff MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22124 Modified: head/sys/vm/vnode_pager.c Modified: head/sys/vm/vnode_pager.c ============================================================================== --- head/sys/vm/vnode_pager.c Wed Oct 23 17:58:19 2019 (r353956) +++ head/sys/vm/vnode_pager.c Wed Oct 23 18:00:22 2019 (r353957) @@ -1149,6 +1149,8 @@ vnode_pager_generic_getpages_done(struct buf *bp) nextoff = tfoff + PAGE_SIZE; mt = bp->b_pages[i]; + if (mt == bogus_page) + continue; if (nextoff <= object->un_pager.vnp.vnp_size) { /* From owner-svn-src-all@freebsd.org Wed Oct 23 18:27:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6522015AAB1; Wed, 23 Oct 2019 18:27:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yzPb1y0Zz4WPd; Wed, 23 Oct 2019 18:27:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 22957934; Wed, 23 Oct 2019 18:27:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NIRUEv097240; Wed, 23 Oct 2019 18:27:30 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NIRU5V097239; Wed, 23 Oct 2019 18:27:30 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910231827.x9NIRU5V097239@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 23 Oct 2019 18:27:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353958 - head/lib/libthr/arch/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/lib/libthr/arch/amd64/amd64 X-SVN-Commit-Revision: 353958 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 18:27:31 -0000 Author: cem Date: Wed Oct 23 18:27:30 2019 New Revision: 353958 URL: https://svnweb.freebsd.org/changeset/base/353958 Log: libthr: Add missing END() directive for umtx_op_err (amd64) Like r353929, related to D22122. No functional change. Reviewed by: emaste, kib (earlier version both) Modified: head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S Modified: head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S ============================================================================== --- head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S Wed Oct 23 18:00:22 2019 (r353957) +++ head/lib/libthr/arch/amd64/amd64/_umtx_op_err.S Wed Oct 23 18:27:30 2019 (r353958) @@ -29,8 +29,11 @@ #include #include -#define RSYSCALL_ERR(x) ENTRY(__CONCAT(x, _err)); \ - mov __CONCAT($SYS_,x),%rax; KERNCALL; ret; +#define RSYSCALL_ERR(x) ENTRY(__CONCAT(x, _err)); \ + mov __CONCAT($SYS_,x),%rax; \ + KERNCALL; \ + ret; \ + END(__CONCAT(x, _err)); #define KERNCALL movq %rcx, %r10; syscall From owner-svn-src-all@freebsd.org Wed Oct 23 18:31:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1BF6315AD29; Wed, 23 Oct 2019 18:31:46 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: from mail-pf1-x443.google.com (mail-pf1-x443.google.com [IPv6:2607:f8b0:4864:20::443]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yzVT2xW0z4Wml; Wed, 23 Oct 2019 18:31:45 +0000 (UTC) (envelope-from yaneurabeya@gmail.com) Received: by mail-pf1-x443.google.com with SMTP id a2so13446989pfo.10; Wed, 23 Oct 2019 11:31:45 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=content-transfer-encoding:from:mime-version:subject:date:message-id :references:cc:in-reply-to:to; bh=utngffvqN5T5nmneHNaOQKwmzWtANAp+ypb7SpFoUjg=; b=gRsAL289RUrOc3M2AO8ZjU6zxLFW4J8MuKTzw5qEczVPcXsQ1CUSH2vrw6qkvTcOOX wJ1qhS94ZXMedhm6TUIim22h0SC3Bwc2Hk16epju7DabQPfqw0y3lwlI4hMPKaoZNct/ LvkJa0Fd48muDDc7Cl+uvBa2eAWnKB6p3Q2pzDXV/Y4WCZeH0zHGzAX8Ay1RSoqj4HE8 M6B5wV8PMpEOFp29r+0DksMtrMxqYBso9hhYGHIQyKDaUrSiiTSQYiKafYDN4WFG/oO6 6aVG9BUu84lpI5IODwd7k7R5jWi0CJEoacAMeak7yDJzzljI6lfZfQ1IEy53pxjLcXed Ol8g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:content-transfer-encoding:from:mime-version :subject:date:message-id:references:cc:in-reply-to:to; bh=utngffvqN5T5nmneHNaOQKwmzWtANAp+ypb7SpFoUjg=; b=Q3bcFQH45CET8RbKCYqVv09rWhb0neX3pEsSKxacUyUwFPB1oUVLiyLc5tr41pnyZI aI1eClHvNzLt0Lxo1oDJ/NS+M64Q9Kxe9pPvPYSMdtrY/XIm/RerCsfzJY50TfkR6jy+ qmUp9Q1Wvh5ZxMT0dFul/Zpw79tC2wXe4zCcFkAsDTwGee9QlNl+cx2+ytte+ZBWN6nA clgWOb8WcbjbTl/qu0LS/u5DvPCN1QJZUdHV4XaeEeyLckJmwWE4VyH6OUdzi69NKDgK eL4eTjBIihW//WLG1rJiltLYli60VSYY+rL4XU6yUTZNI//E4T7GwH2CcU4QeBdT2JxB 1/DQ== X-Gm-Message-State: APjAAAXUtUmbyLEo77dMPCHKxdFtNE+b1kmeCW7+T6fNl+bpXNGbkPsX dePp4Bxz7/nebmzD1y1mVd03Bm8O X-Google-Smtp-Source: APXvYqw+68YsQkiFY0IjE+kEyMIAgPyj+kEmBQlDFhyaaWU5Pjt/OFiZCjVwWlBPVibxYrNIZxjt1w== X-Received: by 2002:a62:750d:: with SMTP id q13mr12138665pfc.58.1571855503387; Wed, 23 Oct 2019 11:31:43 -0700 (PDT) Received: from ?IPv6:2607:fb90:b2b2:fc25:25fc:8f78:cb92:220a? ([2607:fb90:b2b2:fc25:25fc:8f78:cb92:220a]) by smtp.gmail.com with ESMTPSA id c66sm5487635pfb.25.2019.10.23.11.31.42 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 23 Oct 2019 11:31:42 -0700 (PDT) Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable From: Enji Cooper Mime-Version: 1.0 (1.0) Subject: Re: svn commit: r353937 - in head/share: man/man5 mk Date: Wed, 23 Oct 2019 11:31:41 -0700 Message-Id: <2B855247-5097-442D-8D4A-77D68D2F6186@gmail.com> References: <201910231702.x9NH2jQv045130@repo.freebsd.org> Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org In-Reply-To: <201910231702.x9NH2jQv045130@repo.freebsd.org> To: Dimitry Andric X-Mailer: iPhone Mail (17A878) X-Rspamd-Queue-Id: 46yzVT2xW0z4Wml X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=gRsAL289; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of yaneurabeya@gmail.com designates 2607:f8b0:4864:20::443 as permitted sender) smtp.mailfrom=yaneurabeya@gmail.com X-Spamd-Result: default: False [-2.50 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; FREEMAIL_FROM(0.00)[gmail.com]; MV_CASE(0.50)[]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; FROM_EQ_ENVFROM(0.00)[]; IP_SCORE(0.00)[ip: (-0.68), ipnet: 2607:f8b0::/32(-2.42), asn: 15169(-2.06), country: US(-0.05)]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; MID_RHS_MATCH_FROM(0.00)[]; DWL_DNSWL_NONE(0.00)[gmail.com.dwl.dnswl.org : 127.0.5.0]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; IP_SCORE_FREEMAIL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[3.4.4.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 18:31:46 -0000 > On Oct 23, 2019, at 10:02, Dimitry Andric wrote: >=20 > =EF=BB=BFAuthor: dim > Date: Wed Oct 23 17:02:45 2019 > New Revision: 353937 > URL: https://svnweb.freebsd.org/changeset/base/353937 >=20 > Log: > Build toolchain components as dynamically linked executables by default >=20 > Summary: > Historically, we have built toolchain components such as cc, ld, etc as > statically linked executables. One of the reasons being that you could > sometimes save yourself from botched upgrades, by e.g. recompiling a > "known good" libc and reinstalling it. >=20 > In this day and age, we have boot environments, virtual machine > snapshots, cloud backups, and other much more reliable methods to > restore systems to working order. So I think the time is ripe to flip > this default, and link the toolchain components dynamically, just like > almost all other executables on FreeBSD. >=20 > Maybe at some point they can even become PIE executables by default! :) There might be a different reason for this being the case than the one posed= . Using dynamic binaries instead of static binaries might actually regress per= formance in a way you don=E2=80=99t expect, depending on -j values, etc. Sta= tic binaries avoid the dynamic linker, which (obviously) results in a perf h= it at scale, at the potential cost of the in-memory image. Static binaries c= ould also better optimize away less optimal code paths, which could result i= n worse performing code. Did you calculate the perf trade offs for the static binaries at low -j vs h= igh -j, system and user time, etc? Cheers, -Enji PS Thank you for keeping the SHARED_TOOLCHAIN option.= From owner-svn-src-all@freebsd.org Wed Oct 23 18:45:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CE0615AFC0; Wed, 23 Oct 2019 18:45:16 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from vtr.rulingia.com (vtr.rulingia.com [IPv6:2001:19f0:5801:ebe:5400:1ff:fe53:30fd]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "vtr.rulingia.com", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46yzp24938z4XM7; Wed, 23 Oct 2019 18:45:13 +0000 (UTC) (envelope-from peter@rulingia.com) Received: from server.rulingia.com (ppp239-208.static.internode.on.net [59.167.239.208]) by vtr.rulingia.com (8.15.2/8.15.2) with ESMTPS id x9NIiwlk027097 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 24 Oct 2019 05:45:03 +1100 (AEDT) (envelope-from peter@rulingia.com) X-Bogosity: Ham, spamicity=0.000000 Received: from server.rulingia.com (localhost.rulingia.com [127.0.0.1]) by server.rulingia.com (8.15.2/8.15.2) with ESMTPS id x9NIiqL5008843 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Thu, 24 Oct 2019 05:44:52 +1100 (AEDT) (envelope-from peter@server.rulingia.com) Received: (from peter@localhost) by server.rulingia.com (8.15.2/8.15.2/Submit) id x9NIiqhP008842; Thu, 24 Oct 2019 05:44:52 +1100 (AEDT) (envelope-from peter) Date: Thu, 24 Oct 2019 05:44:52 +1100 From: Peter Jeremy To: Andrew Turner Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353640 - head/sys/kern Message-ID: <20191023184452.GA8725@server.rulingia.com> References: <201910161321.x9GDL2ee021543@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="PEIAKu/WMn1b1Hv9" Content-Disposition: inline In-Reply-To: <201910161321.x9GDL2ee021543@repo.freebsd.org> X-PGP-Key: http://www.rulingia.com/keys/peter.pgp User-Agent: Mutt/1.12.1 (2019-06-15) X-Rspamd-Queue-Id: 46yzp24938z4XM7 X-Spamd-Bar: ------- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of peter@rulingia.com designates 2001:19f0:5801:ebe:5400:1ff:fe53:30fd as permitted sender) smtp.mailfrom=peter@rulingia.com X-Spamd-Result: default: False [-7.67 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+mx]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; DMARC_NA(0.00)[rulingia.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-3.27)[ip: (-9.91), ipnet: 2001:19f0:5800::/38(-4.95), asn: 20473(-1.43), country: US(-0.05)]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:20473, ipnet:2001:19f0:5800::/38, country:US]; RCVD_TLS_ALL(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 18:45:16 -0000 --PEIAKu/WMn1b1Hv9 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On 2019-Oct-16 13:21:02 +0000, Andrew Turner wrote: >Author: andrew >Date: Wed Oct 16 13:21:01 2019 >New Revision: 353640 >URL: https://svnweb.freebsd.org/changeset/base/353640 > >Log: > Stop leaking information from the kernel through timespec > =20 > The timespec struct holds a seconds value in a time_t and a nanoseconds > value in a long. On most architectures these are the same size, however > on 32-bit architectures other than i386 time_t is 8 bytes and long is > 4 bytes. > =20 > Most ABIs will then pad a struct holding an 8 byte and 4 byte value to > 16 bytes with 4 bytes of padding. When copying one of these structs the > compiler is free to copy the padding if it wishes. Are there any other structs passed from kernel to userland that include padding? --=20 Peter Jeremy --PEIAKu/WMn1b1Hv9 Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQKTBAEBCgB9FiEE7rKYbDBnHnTmXCJ+FqWXoOSiCzQFAl2wn59fFIAAAAAALgAo aXNzdWVyLWZwckBub3RhdGlvbnMub3BlbnBncC5maWZ0aGhvcnNlbWFuLm5ldEVF QjI5ODZDMzA2NzFFNzRFNjVDMjI3RTE2QTU5N0EwRTRBMjBCMzQACgkQFqWXoOSi CzT0aQ//XQLIKUlNQEau0wTr8TItxH/cVTV9Xnxr/V5x2U80JSP2GKa4DrFvCbfA 1bq63ofZgvfVogKUcLdCrT2nb84FrYgnIYCIAquwJkzum/UJfqtAxldeqQ+EFX3m B/vrv/JPmv48GhKzlERAAlu7eAN6z7PREl+Wgc4YDkOsp+D+wpF1TtafY8/WJFHn Vc3skMKN0AuDj3eRysgF7qARYN9JOYaMGXuoa9eO4n9X0yM5C+ypzv9n1ohWpWSZ LbLUxYwcXTdaprXggFQxoBBCayEdcSMBJO6502LMSceaUUTpxz7qFZZrDcWR4MPa ErEgp7JwK+En+MAzww8MXCMeFJN4oNuQd4JXd/3XYeG5NyHRa1mOdWAZe3b52VoQ RVMOVUu63tKLNkZNO/Tj5fg1SaaPfVf9WKtgeT8UROgHUXsNwkb2Y/dgUvlMbQbq YKO55xxTrQASKDxaW/Zo6gb3Nt8fuEd2f2aw5k98Kyg55ulMPzgi67FWYXwyd+Xk KCHsAGwcPhRqu/Dgk2Q81gWGUFuORGGuwu5uPoz64sZiDtDCblslHZzJvAIWegUc jGRv2VAbhwxxsEDucEyOKvAPACk1WfjyTN/DLso33S6gqrFK2qdYLl6iurGodhZX 5Z0c2k5FSUcYM9kF8ev4QfmVQb4HCEL5lDBL4qHRfvS9izZxKWo= =1fyl -----END PGP SIGNATURE----- --PEIAKu/WMn1b1Hv9-- From owner-svn-src-all@freebsd.org Wed Oct 23 19:03:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3DA615B375; Wed, 23 Oct 2019 19:03:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z0Bb6D67z4Y8N; Wed, 23 Oct 2019 19:03:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9ECE01088; Wed, 23 Oct 2019 19:03:03 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NJ33nt020910; Wed, 23 Oct 2019 19:03:03 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NJ33dI020909; Wed, 23 Oct 2019 19:03:03 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910231903.x9NJ33dI020909@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Wed, 23 Oct 2019 19:03:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353959 - head/sys/amd64/include X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/amd64/include X-SVN-Commit-Revision: 353959 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 19:03:04 -0000 Author: cem Date: Wed Oct 23 19:03:03 2019 New Revision: 353959 URL: https://svnweb.freebsd.org/changeset/base/353959 Log: amd64: Add CFI directives for libc syscall stubs No functional change (in program code). Additional DWARF metadata is generated in the .eh_frame section. Also, it is now a compile-time requirement that machine/asm.h ENTRY() and END() macros are paired. (This is subject to ongoing discussion and may change.) This DWARF metadata allows llvm-libunwind to unwind program stacks when the program is executing the function. The goal is to collect accurate userspace stacktraces when programs have entered syscalls. (The motivation for "Call Frame Information," or CFI for short -- not to be confused with Control Flow Integrity -- is to sufficiently annotate assembly functions such that stack unwinders can unwind out of the local frame without the requirement of a dedicated framepointer register; i.e., -fomit-frame-pointer. This is necessary for C++ exception handling or collecting backtraces.) For the curious, a more thorough description of the metadata and some examples may be found at [1] and documentation at [2]. You can also look at 'cc -S -o - foo.c | less' and search for '.cfi_' to see the CFI directives generated by your C compiler. [1]: https://www.imperialviolet.org/2017/01/18/cfi.html [2]: https://sourceware.org/binutils/docs/as/CFI-directives.html Reviewed by: emaste, kib (with reservations) Differential Revision: https://reviews.freebsd.org/D22122 Modified: head/sys/amd64/include/asm.h Modified: head/sys/amd64/include/asm.h ============================================================================== --- head/sys/amd64/include/asm.h Wed Oct 23 18:27:30 2019 (r353958) +++ head/sys/amd64/include/asm.h Wed Oct 23 19:03:03 2019 (r353959) @@ -60,25 +60,36 @@ #define _START_ENTRY .text; .p2align 4,0x90 #define _ENTRY(x) _START_ENTRY; \ - .globl CNAME(x); .type CNAME(x),@function; CNAME(x): + .globl CNAME(x); .type CNAME(x),@function; CNAME(x):; \ + .cfi_startproc #ifdef PROF #define ALTENTRY(x) _ENTRY(x); \ - pushq %rbp; movq %rsp,%rbp; \ + pushq %rbp; \ + .cfi_def_cfa_offset 16; \ + .cfi_offset %rbp, -16; \ + movq %rsp,%rbp; \ call PIC_PLT(HIDENAME(mcount)); \ popq %rbp; \ + .cfi_restore %rbp; \ + .cfi_def_cfa_offset 8; \ jmp 9f #define ENTRY(x) _ENTRY(x); \ - pushq %rbp; movq %rsp,%rbp; \ + pushq %rbp; \ + .cfi_def_cfa_offset 16; \ + .cfi_offset %rbp, -16; \ + movq %rsp,%rbp; \ call PIC_PLT(HIDENAME(mcount)); \ popq %rbp; \ + .cfi_restore %rbp; \ + .cfi_def_cfa_offset 8; \ 9: #else #define ALTENTRY(x) _ENTRY(x) #define ENTRY(x) _ENTRY(x) #endif -#define END(x) .size x, . - x +#define END(x) .size x, . - x; .cfi_endproc /* * WEAK_REFERENCE(): create a weak reference alias from sym. * The macro is not a general asm macro that takes arbitrary names, From owner-svn-src-all@freebsd.org Wed Oct 23 19:17:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3557815B59D; Wed, 23 Oct 2019 19:17:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z0Vv0Sdpz4Ycj; Wed, 23 Oct 2019 19:17:11 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E72F71275; Wed, 23 Oct 2019 19:17:10 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NJHAlL027055; Wed, 23 Oct 2019 19:17:10 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NJHAeJ027054; Wed, 23 Oct 2019 19:17:10 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <201910231917.x9NJHAeJ027054@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 23 Oct 2019 19:17:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353960 - head/sys/amd64/amd64 X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/amd64/amd64 X-SVN-Commit-Revision: 353960 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 19:17:11 -0000 Author: mjg Date: Wed Oct 23 19:17:10 2019 New Revision: 353960 URL: https://svnweb.freebsd.org/changeset/base/353960 Log: amd64 pmap: per-domain pv chunk list This significantly reduces contention since chunks get created and removed all the time. See the review for sample results. Reviewed by: kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D21976 Modified: head/sys/amd64/amd64/pmap.c Modified: head/sys/amd64/amd64/pmap.c ============================================================================== --- head/sys/amd64/amd64/pmap.c Wed Oct 23 19:03:03 2019 (r353959) +++ head/sys/amd64/amd64/pmap.c Wed Oct 23 19:17:10 2019 (r353960) @@ -165,6 +165,12 @@ __FBSDID("$FreeBSD$"); #include #include +#ifdef NUMA +#define PMAP_MEMDOM MAXMEMDOM +#else +#define PMAP_MEMDOM 1 +#endif + static __inline boolean_t pmap_type_guest(pmap_t pmap) { @@ -420,8 +426,30 @@ static int pmap_initialized; * Data for the pv entry allocation mechanism. * Updates to pv_invl_gen are protected by the pv list lock but reads are not. */ -static TAILQ_HEAD(pch, pv_chunk) pv_chunks = TAILQ_HEAD_INITIALIZER(pv_chunks); -static struct mtx __exclusive_cache_line pv_chunks_mutex; +#ifdef NUMA +static __inline int +pc_to_domain(struct pv_chunk *pc) +{ + + return (_vm_phys_domain(DMAP_TO_PHYS((vm_offset_t)pc))); +} +#else +static __inline int +pc_to_domain(struct pv_chunk *pc __unused) +{ + + return (0); +} +#endif + +struct pv_chunks_list { + struct mtx pvc_lock; + TAILQ_HEAD(pch, pv_chunk) pvc_list; + int active_reclaims; +} __aligned(CACHE_LINE_SIZE); + +struct pv_chunks_list __exclusive_cache_line pv_chunks[PMAP_MEMDOM]; + #ifdef NUMA struct pmap_large_md_page { struct rwlock pv_lock; @@ -2044,10 +2072,12 @@ pmap_init(void) } /* - * Initialize the pv chunk list mutex. + * Initialize pv chunk lists. */ - mtx_init(&pv_chunks_mutex, "pmap pv chunk list", NULL, MTX_DEF); - + for (i = 0; i < PMAP_MEMDOM; i++) { + mtx_init(&pv_chunks[i].pvc_lock, "pmap pv chunk list", NULL, MTX_DEF); + TAILQ_INIT(&pv_chunks[i].pvc_list); + } pmap_init_pv_table(); pmap_initialized = 1; @@ -4150,8 +4180,9 @@ reclaim_pv_chunk_leave_pmap(pmap_t pmap, pmap_t locked * exacerbating the shortage of free pv entries. */ static vm_page_t -reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp) +reclaim_pv_chunk_domain(pmap_t locked_pmap, struct rwlock **lockp, int domain) { + struct pv_chunks_list *pvc; struct pv_chunk *pc, *pc_marker, *pc_marker_end; struct pv_chunk_header pc_marker_b, pc_marker_end_b; struct md_page *pvh; @@ -4166,7 +4197,6 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l uint64_t inuse; int bit, field, freed; bool start_di; - static int active_reclaims = 0; PMAP_LOCK_ASSERT(locked_pmap, MA_OWNED); KASSERT(lockp != NULL, ("reclaim_pv_chunk: lockp is NULL")); @@ -4186,10 +4216,11 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l */ start_di = pmap_not_in_di(); - mtx_lock(&pv_chunks_mutex); - active_reclaims++; - TAILQ_INSERT_HEAD(&pv_chunks, pc_marker, pc_lru); - TAILQ_INSERT_TAIL(&pv_chunks, pc_marker_end, pc_lru); + pvc = &pv_chunks[domain]; + mtx_lock(&pvc->pvc_lock); + pvc->active_reclaims++; + TAILQ_INSERT_HEAD(&pvc->pvc_list, pc_marker, pc_lru); + TAILQ_INSERT_TAIL(&pvc->pvc_list, pc_marker_end, pc_lru); while ((pc = TAILQ_NEXT(pc_marker, pc_lru)) != pc_marker_end && SLIST_EMPTY(&free)) { next_pmap = pc->pc_pmap; @@ -4202,7 +4233,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l */ goto next_chunk; } - mtx_unlock(&pv_chunks_mutex); + mtx_unlock(&pvc->pvc_lock); /* * A pv_chunk can only be removed from the pc_lru list @@ -4219,17 +4250,17 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l PMAP_LOCK(pmap); if (start_di) pmap_delayed_invl_start(); - mtx_lock(&pv_chunks_mutex); + mtx_lock(&pvc->pvc_lock); continue; } else if (pmap != locked_pmap) { if (PMAP_TRYLOCK(pmap)) { if (start_di) pmap_delayed_invl_start(); - mtx_lock(&pv_chunks_mutex); + mtx_lock(&pvc->pvc_lock); continue; } else { pmap = NULL; /* pmap is not locked */ - mtx_lock(&pv_chunks_mutex); + mtx_lock(&pvc->pvc_lock); pc = TAILQ_NEXT(pc_marker, pc_lru); if (pc == NULL || pc->pc_pmap != next_pmap) @@ -4286,7 +4317,7 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l } } if (freed == 0) { - mtx_lock(&pv_chunks_mutex); + mtx_lock(&pvc->pvc_lock); goto next_chunk; } /* Every freed mapping is for a 4 KB page. */ @@ -4303,19 +4334,19 @@ reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **l /* Entire chunk is free; return it. */ m_pc = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)pc)); dump_drop_page(m_pc->phys_addr); - mtx_lock(&pv_chunks_mutex); - TAILQ_REMOVE(&pv_chunks, pc, pc_lru); + mtx_lock(&pvc->pvc_lock); + TAILQ_REMOVE(&pvc->pvc_list, pc, pc_lru); break; } TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); - mtx_lock(&pv_chunks_mutex); + mtx_lock(&pvc->pvc_lock); /* One freed pv entry in locked_pmap is sufficient. */ if (pmap == locked_pmap) break; next_chunk: - TAILQ_REMOVE(&pv_chunks, pc_marker, pc_lru); - TAILQ_INSERT_AFTER(&pv_chunks, pc, pc_marker, pc_lru); - if (active_reclaims == 1 && pmap != NULL) { + TAILQ_REMOVE(&pvc->pvc_list, pc_marker, pc_lru); + TAILQ_INSERT_AFTER(&pvc->pvc_list, pc, pc_marker, pc_lru); + if (pvc->active_reclaims == 1 && pmap != NULL) { /* * Rotate the pv chunks list so that we do not * scan the same pv chunks that could not be @@ -4323,17 +4354,17 @@ next_chunk: * and/or superpage mapping) on every * invocation of reclaim_pv_chunk(). */ - while ((pc = TAILQ_FIRST(&pv_chunks)) != pc_marker) { + while ((pc = TAILQ_FIRST(&pvc->pvc_list)) != pc_marker) { MPASS(pc->pc_pmap != NULL); - TAILQ_REMOVE(&pv_chunks, pc, pc_lru); - TAILQ_INSERT_TAIL(&pv_chunks, pc, pc_lru); + TAILQ_REMOVE(&pvc->pvc_list, pc, pc_lru); + TAILQ_INSERT_TAIL(&pvc->pvc_list, pc, pc_lru); } } } - TAILQ_REMOVE(&pv_chunks, pc_marker, pc_lru); - TAILQ_REMOVE(&pv_chunks, pc_marker_end, pc_lru); - active_reclaims--; - mtx_unlock(&pv_chunks_mutex); + TAILQ_REMOVE(&pvc->pvc_list, pc_marker, pc_lru); + TAILQ_REMOVE(&pvc->pvc_list, pc_marker_end, pc_lru); + pvc->active_reclaims--; + mtx_unlock(&pvc->pvc_lock); reclaim_pv_chunk_leave_pmap(pmap, locked_pmap, start_di); if (m_pc == NULL && !SLIST_EMPTY(&free)) { m_pc = SLIST_FIRST(&free); @@ -4345,6 +4376,23 @@ next_chunk: return (m_pc); } +static vm_page_t +reclaim_pv_chunk(pmap_t locked_pmap, struct rwlock **lockp) +{ + vm_page_t m; + int i, domain; + + domain = PCPU_GET(domain); + for (i = 0; i < vm_ndomains; i++) { + m = reclaim_pv_chunk_domain(locked_pmap, lockp, domain); + if (m != NULL) + break; + domain = (domain + 1) % vm_ndomains; + } + + return (m); +} + /* * free the pv_entry back to the free list */ @@ -4394,29 +4442,37 @@ free_pv_chunk_dequeued(struct pv_chunk *pc) static void free_pv_chunk(struct pv_chunk *pc) { + struct pv_chunks_list *pvc; - mtx_lock(&pv_chunks_mutex); - TAILQ_REMOVE(&pv_chunks, pc, pc_lru); - mtx_unlock(&pv_chunks_mutex); + pvc = &pv_chunks[pc_to_domain(pc)]; + mtx_lock(&pvc->pvc_lock); + TAILQ_REMOVE(&pvc->pvc_list, pc, pc_lru); + mtx_unlock(&pvc->pvc_lock); free_pv_chunk_dequeued(pc); } static void free_pv_chunk_batch(struct pv_chunklist *batch) { + struct pv_chunks_list *pvc; struct pv_chunk *pc, *npc; + int i; - if (TAILQ_EMPTY(batch)) - return; - - mtx_lock(&pv_chunks_mutex); - TAILQ_FOREACH(pc, batch, pc_list) { - TAILQ_REMOVE(&pv_chunks, pc, pc_lru); + for (i = 0; i < vm_ndomains; i++) { + if (TAILQ_EMPTY(&batch[i])) + continue; + pvc = &pv_chunks[i]; + mtx_lock(&pvc->pvc_lock); + TAILQ_FOREACH(pc, &batch[i], pc_list) { + TAILQ_REMOVE(&pvc->pvc_list, pc, pc_lru); + } + mtx_unlock(&pvc->pvc_lock); } - mtx_unlock(&pv_chunks_mutex); - TAILQ_FOREACH_SAFE(pc, batch, pc_list, npc) { - free_pv_chunk_dequeued(pc); + for (i = 0; i < vm_ndomains; i++) { + TAILQ_FOREACH_SAFE(pc, &batch[i], pc_list, npc) { + free_pv_chunk_dequeued(pc); + } } } @@ -4431,6 +4487,7 @@ free_pv_chunk_batch(struct pv_chunklist *batch) static pv_entry_t get_pv_entry(pmap_t pmap, struct rwlock **lockp) { + struct pv_chunks_list *pvc; int bit, field; pv_entry_t pv; struct pv_chunk *pc; @@ -4482,9 +4539,10 @@ retry: pc->pc_map[0] = PC_FREE0 & ~1ul; /* preallocated bit 0 */ pc->pc_map[1] = PC_FREE1; pc->pc_map[2] = PC_FREE2; - mtx_lock(&pv_chunks_mutex); - TAILQ_INSERT_TAIL(&pv_chunks, pc, pc_lru); - mtx_unlock(&pv_chunks_mutex); + pvc = &pv_chunks[_vm_phys_domain(m->phys_addr)]; + mtx_lock(&pvc->pvc_lock); + TAILQ_INSERT_TAIL(&pvc->pvc_list, pc, pc_lru); + mtx_unlock(&pvc->pvc_lock); pv = &pc->pc_pventry[0]; TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); PV_STAT(atomic_add_long(&pv_entry_count, 1)); @@ -4530,10 +4588,11 @@ popcnt_pc_map_pq(uint64_t *map) static void reserve_pv_entries(pmap_t pmap, int needed, struct rwlock **lockp) { - struct pch new_tail; + struct pv_chunks_list *pvc; + struct pch new_tail[PMAP_MEMDOM]; struct pv_chunk *pc; vm_page_t m; - int avail, free; + int avail, free, i; bool reclaimed; PMAP_LOCK_ASSERT(pmap, MA_OWNED); @@ -4545,7 +4604,8 @@ reserve_pv_entries(pmap_t pmap, int needed, struct rwl * reclaim_pv_chunk() could recycle one of these chunks. In * contrast, these chunks must be added to the pmap upon allocation. */ - TAILQ_INIT(&new_tail); + for (i = 0; i < PMAP_MEMDOM; i++) + TAILQ_INIT(&new_tail[i]); retry: avail = 0; TAILQ_FOREACH(pc, &pmap->pm_pvchunk, pc_list) { @@ -4580,7 +4640,7 @@ retry: pc->pc_map[1] = PC_FREE1; pc->pc_map[2] = PC_FREE2; TAILQ_INSERT_HEAD(&pmap->pm_pvchunk, pc, pc_list); - TAILQ_INSERT_TAIL(&new_tail, pc, pc_lru); + TAILQ_INSERT_TAIL(&new_tail[pc_to_domain(pc)], pc, pc_lru); PV_STAT(atomic_add_int(&pv_entry_spare, _NPCPV)); /* @@ -4591,10 +4651,13 @@ retry: if (reclaimed) goto retry; } - if (!TAILQ_EMPTY(&new_tail)) { - mtx_lock(&pv_chunks_mutex); - TAILQ_CONCAT(&pv_chunks, &new_tail, pc_lru); - mtx_unlock(&pv_chunks_mutex); + for (i = 0; i < vm_ndomains; i++) { + if (TAILQ_EMPTY(&new_tail[i])) + continue; + pvc = &pv_chunks[i]; + mtx_lock(&pvc->pvc_lock); + TAILQ_CONCAT(&pvc->pvc_list, &new_tail[i], pc_lru); + mtx_unlock(&pvc->pvc_lock); } } @@ -7020,7 +7083,7 @@ pmap_remove_pages(pmap_t pmap) pt_entry_t *pte, tpte; pt_entry_t PG_M, PG_RW, PG_V; struct spglist free; - struct pv_chunklist free_chunks; + struct pv_chunklist free_chunks[PMAP_MEMDOM]; vm_page_t m, mpte, mt; pv_entry_t pv; struct md_page *pvh; @@ -7028,7 +7091,7 @@ pmap_remove_pages(pmap_t pmap) struct rwlock *lock; int64_t bit; uint64_t inuse, bitmask; - int allfree, field, freed, idx; + int allfree, field, freed, i, idx; boolean_t superpage; vm_paddr_t pa; @@ -7056,7 +7119,8 @@ pmap_remove_pages(pmap_t pmap) PG_V = pmap_valid_bit(pmap); PG_RW = pmap_rw_bit(pmap); - TAILQ_INIT(&free_chunks); + for (i = 0; i < PMAP_MEMDOM; i++) + TAILQ_INIT(&free_chunks[i]); SLIST_INIT(&free); PMAP_LOCK(pmap); TAILQ_FOREACH_SAFE(pc, &pmap->pm_pvchunk, pc_list, npc) { @@ -7184,14 +7248,14 @@ pmap_remove_pages(pmap_t pmap) PV_STAT(atomic_subtract_long(&pv_entry_count, freed)); if (allfree) { TAILQ_REMOVE(&pmap->pm_pvchunk, pc, pc_list); - TAILQ_INSERT_TAIL(&free_chunks, pc, pc_list); + TAILQ_INSERT_TAIL(&free_chunks[pc_to_domain(pc)], pc, pc_list); } } if (lock != NULL) rw_wunlock(lock); pmap_invalidate_all(pmap); pmap_pkru_deassign_all(pmap); - free_pv_chunk_batch(&free_chunks); + free_pv_chunk_batch((struct pv_chunklist *)&free_chunks); PMAP_UNLOCK(pmap); vm_page_free_pages_toq(&free, true); } From owner-svn-src-all@freebsd.org Wed Oct 23 19:23:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2FA315B82C; Wed, 23 Oct 2019 19:23:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z0fC6Dznz4Z3X; Wed, 23 Oct 2019 19:23:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B98161448; Wed, 23 Oct 2019 19:23:31 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NJNVXa032772; Wed, 23 Oct 2019 19:23:31 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NJNV5w032771; Wed, 23 Oct 2019 19:23:31 GMT (envelope-from imp@FreeBSD.org) Message-Id: <201910231923.x9NJNV5w032771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Wed, 23 Oct 2019 19:23:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353961 - head/usr.bin/dtc X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/usr.bin/dtc X-SVN-Commit-Revision: 353961 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 19:23:32 -0000 Author: imp Date: Wed Oct 23 19:23:31 2019 New Revision: 353961 URL: https://svnweb.freebsd.org/changeset/base/353961 Log: exit requires stdlib.h to be included to use. FreeBSD 10.3 requires this, and dtc is a bootstrap tool so it needs to compile there. Modified: head/usr.bin/dtc/dtb.cc Modified: head/usr.bin/dtc/dtb.cc ============================================================================== --- head/usr.bin/dtc/dtb.cc Wed Oct 23 19:17:10 2019 (r353960) +++ head/usr.bin/dtc/dtb.cc Wed Oct 23 19:23:31 2019 (r353961) @@ -36,6 +36,7 @@ #include #include #include +#include #include #include From owner-svn-src-all@freebsd.org Wed Oct 23 19:35:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3BB1115BA43; Wed, 23 Oct 2019 19:35:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z0vz0fNmz4ZTP; Wed, 23 Oct 2019 19:35:27 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9C2E1602; Wed, 23 Oct 2019 19:35:26 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NJZQeH038657; Wed, 23 Oct 2019 19:35:26 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NJZQLT038656; Wed, 23 Oct 2019 19:35:26 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <201910231935.x9NJZQLT038656@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 23 Oct 2019 19:35:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353962 - head/sys/arm64/conf X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/sys/arm64/conf X-SVN-Commit-Revision: 353962 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 19:35:27 -0000 Author: emaste Date: Wed Oct 23 19:35:26 2019 New Revision: 353962 URL: https://svnweb.freebsd.org/changeset/base/353962 Log: arm64: enable options NUMA in GENERIC As with amd64 NUMA is required for reasonable operation on big-iron arm64 systems and is expected to have no significant impact on small systems. Enable it now for wider testing in advance of FreeBSD 13.0. You can use the 'vm.ndomains' sysctl to see if multiple domains are in use - for example (from Cavium/Marvell ThunderX2): # sysctl vm.ndomains vm.ndomains: 2 No objection: manu Sponsored by: The FreeBSD Foundation Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Wed Oct 23 19:23:31 2019 (r353961) +++ head/sys/arm64/conf/GENERIC Wed Oct 23 19:35:26 2019 (r353962) @@ -25,6 +25,7 @@ makeoptions DEBUG=-g # Build kernel with gdb(1) debug makeoptions WITH_CTF=1 # Run ctfconvert(1) for DTrace support options SCHED_ULE # ULE scheduler +options NUMA # Non-Uniform Memory Architecture support options PREEMPTION # Enable kernel thread preemption options VIMAGE # Subsystem virtualization, e.g. VNET options INET # InterNETworking From owner-svn-src-all@freebsd.org Wed Oct 23 20:37:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 910F615CF0A; Wed, 23 Oct 2019 20:37:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z2HJ3LJGz4f4L; Wed, 23 Oct 2019 20:37:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5724A2110; Wed, 23 Oct 2019 20:37:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NKbGFn074601; Wed, 23 Oct 2019 20:37:16 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NKbGVI074600; Wed, 23 Oct 2019 20:37:16 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910232037.x9NKbGVI074600@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 23 Oct 2019 20:37:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353963 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353963 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 20:37:16 -0000 Author: bz Date: Wed Oct 23 20:37:15 2019 New Revision: 353963 URL: https://svnweb.freebsd.org/changeset/base/353963 Log: frag6: whitespace changes Remove trailing white space, add a blank line, and compress a comment. No functional changes. MFC after: 10 days Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Wed Oct 23 19:35:26 2019 (r353962) +++ head/sys/netinet6/frag6.c Wed Oct 23 20:37:15 2019 (r353963) @@ -106,7 +106,7 @@ VNET_DEFINE_STATIC(bool, frag6_on); #define V_frag6_on VNET(frag6_on) #endif -/* System wide (global) maximum and count of packets in reassembly queues. */ +/* System wide (global) maximum and count of packets in reassembly queues. */ static int ip6_maxfrags; static volatile u_int frag6_nfrags = 0; @@ -215,7 +215,7 @@ ip6_deletefraghdr(struct mbuf *m, int offset, int wait if (m->m_len >= offset + sizeof(struct ip6_frag)) { /* This is the only possible case with !PULLDOWN_TEST. */ - ip6 = mtod(m, struct ip6_hdr *); + ip6 = mtod(m, struct ip6_hdr *); bcopy(ip6, (char *)ip6 + sizeof(struct ip6_frag), offset); m->m_data += sizeof(struct ip6_frag); @@ -395,9 +395,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); #endif - /* - * Store receive network interface pointer for later. - */ + /* Store receive network interface pointer for later. */ srcifp = m->m_pkthdr.rcvif; dstifp = NULL; @@ -598,7 +596,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) /* Set a valid receive interface pointer. */ merr->m_pkthdr.rcvif = srcifp; - + /* Adjust pointer. */ ip6err = mtod(merr, struct ip6_hdr *); @@ -697,6 +695,7 @@ insert: frag6_enq(ip6af, af6->ip6af_up, bucket); atomic_add_int(&frag6_nfrags, 1); q6->ip6q_nfrag++; + plen = 0; for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; af6 = af6->ip6af_down) { From owner-svn-src-all@freebsd.org Wed Oct 23 20:39:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD8FF15CFD0; Wed, 23 Oct 2019 20:39:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z2Kj5ZRQz4fK0; Wed, 23 Oct 2019 20:39:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A234C2139; Wed, 23 Oct 2019 20:39:21 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NKdLZJ074863; Wed, 23 Oct 2019 20:39:21 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NKdLuR074862; Wed, 23 Oct 2019 20:39:21 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910232039.x9NKdLuR074862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 23 Oct 2019 20:39:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353964 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 353964 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 20:39:21 -0000 Author: markj Date: Wed Oct 23 20:39:21 2019 New Revision: 353964 URL: https://svnweb.freebsd.org/changeset/base/353964 Log: Modify release_page() to handle a missing fault page. r353890 introduced a case where we may call release_page() with fs.m == NULL, since the fault handler may now lock the vnode prior to allocating a page for a page-in. Reported by: jhb Reviewed by: kib MFC with: r353890 Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D22120 Modified: head/sys/vm/vm_fault.c Modified: head/sys/vm/vm_fault.c ============================================================================== --- head/sys/vm/vm_fault.c Wed Oct 23 20:37:15 2019 (r353963) +++ head/sys/vm/vm_fault.c Wed Oct 23 20:39:21 2019 (r353964) @@ -154,11 +154,13 @@ static inline void release_page(struct faultstate *fs) { - vm_page_xunbusy(fs->m); - vm_page_lock(fs->m); - vm_page_deactivate(fs->m); - vm_page_unlock(fs->m); - fs->m = NULL; + if (fs->m != NULL) { + vm_page_xunbusy(fs->m); + vm_page_lock(fs->m); + vm_page_deactivate(fs->m); + vm_page_unlock(fs->m); + fs->m = NULL; + } } static inline void From owner-svn-src-all@freebsd.org Wed Oct 23 23:01:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADA7D15F4E5; Wed, 23 Oct 2019 23:01:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z5TW25fjz3HGw; Wed, 23 Oct 2019 23:01:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C3313CCC; Wed, 23 Oct 2019 23:01:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NN1Jdx062895; Wed, 23 Oct 2019 23:01:19 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NN1ITc062893; Wed, 23 Oct 2019 23:01:18 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910232301.x9NN1ITc062893@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 23 Oct 2019 23:01:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353965 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353965 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 23:01:19 -0000 Author: bz Date: Wed Oct 23 23:01:18 2019 New Revision: 353965 URL: https://svnweb.freebsd.org/changeset/base/353965 Log: frag6: replace KAME hand-rolled queues with queue(9) TAILQs Remove the KAME custom circular queue for fragments and fragmented packets and replace them with a standard TAILQ. This make the code a lot more understandable and maintainable and removes further hand-rolled code from the the tree using a standard interface instead. Hide the still public structures under #ifdef _KERNEL as there is no use for them in user space. The naming is a bit confusing now as struct ip6q and the ip6q[] buckets array are not the same anymore; sadly struct ip6q is also used by the MAC framework and we cannot rename it. Submitted by: jtl (initally) MFC after: 3 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D16847 (jtl's original) Modified: head/sys/netinet6/frag6.c head/sys/netinet6/ip6_var.h Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Wed Oct 23 20:39:21 2019 (r353964) +++ head/sys/netinet6/frag6.c Wed Oct 23 23:01:18 2019 (r353965) @@ -3,6 +3,7 @@ * * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. * All rights reserved. + * Copyright (c) 2019 Netflix, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -45,6 +46,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -72,28 +74,20 @@ __FBSDID("$FreeBSD$"); #define IP6REASS_NHASH (1 << IP6REASS_NHASH_LOG2) #define IP6REASS_HMASK (IP6REASS_NHASH - 1) -static void frag6_enq(struct ip6asfrag *, struct ip6asfrag *, - uint32_t bucket __unused); -static void frag6_deq(struct ip6asfrag *, uint32_t bucket __unused); -static void frag6_insque_head(struct ip6q *, struct ip6q *, - uint32_t bucket); -static void frag6_remque(struct ip6q *, uint32_t bucket); -static void frag6_freef(struct ip6q *, uint32_t bucket); - +TAILQ_HEAD(ip6qhead, ip6q); struct ip6qbucket { - struct ip6q ip6q; + struct ip6qhead packets; struct mtx lock; int count; }; -struct ip6asfrag { - struct ip6asfrag *ip6af_down; - struct ip6asfrag *ip6af_up; +struct ip6asfrag { + TAILQ_ENTRY(ip6asfrag) ip6af_tq; struct mbuf *ip6af_m; int ip6af_offset; /* offset in ip6af_m to next header */ int ip6af_frglen; /* fragmentable part length */ int ip6af_off; /* fragment offset */ - u_int16_t ip6af_mff; /* more fragment bit in frag off */ + bool ip6af_mff; /* more fragment bit in frag off */ }; #define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m)) @@ -132,7 +126,7 @@ VNET_DEFINE_STATIC(uint32_t, ip6qb_hashseed); #define IP6QB_TRYLOCK(_b) mtx_trylock(&V_ip6qb[(_b)].lock) #define IP6QB_LOCK_ASSERT(_b) mtx_assert(&V_ip6qb[(_b)].lock, MA_OWNED) #define IP6QB_UNLOCK(_b) mtx_unlock(&V_ip6qb[(_b)].lock) -#define IP6QB_HEAD(_b) (&V_ip6qb[(_b)].ip6q) +#define IP6QB_HEAD(_b) (&V_ip6qb[(_b)].packets) /* * By default, limit the number of IP6 fragments across all reassembly @@ -240,17 +234,15 @@ static void frag6_freef(struct ip6q *q6, uint32_t bucket) { struct ip6_hdr *ip6; - struct ip6asfrag *af6, *down6; + struct ip6asfrag *af6; struct mbuf *m; IP6QB_LOCK_ASSERT(bucket); - for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; - af6 = down6) { + while ((af6 = TAILQ_FIRST(&q6->ip6q_frags)) != NULL) { m = IP6_REASS_MBUF(af6); - down6 = af6->ip6af_down; - frag6_deq(af6, bucket); + TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); /* * Return ICMP time exceeded error for the 1st fragment. @@ -272,7 +264,9 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) free(af6, M_FRAG6); } - frag6_remque(q6, bucket); + + TAILQ_REMOVE(IP6QB_HEAD(bucket), q6, ip6q_tq); + V_ip6qb[bucket].count--; atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag); #ifdef MAC mac_ip6q_destroy(q6); @@ -288,10 +282,11 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) static void frag6_cleanup(void *arg __unused, struct ifnet *ifp) { - struct ip6q *q6, *q6n, *head; + struct ip6qhead *head; + struct ip6q *q6; struct ip6asfrag *af6; struct mbuf *m; - int i; + uint32_t bucket; KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); @@ -305,15 +300,13 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) #endif CURVNET_SET_QUIET(ifp->if_vnet); - for (i = 0; i < IP6REASS_NHASH; i++) { - IP6QB_LOCK(i); - head = IP6QB_HEAD(i); + for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { + IP6QB_LOCK(bucket); + head = IP6QB_HEAD(bucket); /* Scan fragment list. */ - for (q6 = head->ip6q_next; q6 != head; q6 = q6n) { - q6n = q6->ip6q_next; + TAILQ_FOREACH(q6, head, ip6q_tq) { + TAILQ_FOREACH(af6, &q6->ip6q_frags, ip6af_tq) { - for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; - af6 = af6->ip6af_down) { m = IP6_REASS_MBUF(af6); /* clear no longer valid rcvif pointer */ @@ -321,7 +314,7 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) m->m_pkthdr.rcvif = NULL; } } - IP6QB_UNLOCK(i); + IP6QB_UNLOCK(bucket); } CURVNET_RESTORE(); } @@ -362,14 +355,14 @@ EVENTHANDLER_DEFINE(ifnet_departure_event, frag6_clean int frag6_input(struct mbuf **mp, int *offp, int proto) { - struct ifnet *dstifp; - struct ifnet *srcifp; - struct in6_ifaddr *ia6; + struct mbuf *m, *t; struct ip6_hdr *ip6; struct ip6_frag *ip6f; - struct ip6q *head, *q6; - struct ip6asfrag *af6, *af6dwn, *ip6af; - struct mbuf *m, *t; + struct ip6qhead *head; + struct ip6q *q6; + struct ip6asfrag *af6, *ip6af, *af6tmp; + struct in6_ifaddr *ia6; + struct ifnet *dstifp, *srcifp; uint32_t hashkey[(sizeof(struct in6_addr) * 2 + sizeof(ip6f->ip6f_ident)) / sizeof(uint32_t)]; uint32_t bucket, *hashkeyp; @@ -466,8 +459,8 @@ frag6_input(struct mbuf **mp, int *offp, int proto) *hashkeyp = ip6f->ip6f_ident; bucket = jenkins_hash32(hashkey, nitems(hashkey), V_ip6qb_hashseed); bucket &= IP6REASS_HMASK; - head = IP6QB_HEAD(bucket); IP6QB_LOCK(bucket); + head = IP6QB_HEAD(bucket); /* * Enforce upper bound on number of fragments for the entire system. @@ -479,7 +472,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) else if (atomic_load_int(&frag6_nfrags) >= (u_int)ip6_maxfrags) goto dropfrag; - for (q6 = head->ip6q_next; q6 != head; q6 = q6->ip6q_next) + TAILQ_FOREACH(q6, head, ip6q_tq) if (ip6f->ip6f_ident == q6->ip6q_ident && IN6_ARE_ADDR_EQUAL(&ip6->ip6_src, &q6->ip6q_src) && IN6_ARE_ADDR_EQUAL(&ip6->ip6_dst, &q6->ip6q_dst) @@ -490,7 +483,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) break; only_frag = false; - if (q6 == head) { + if (q6 == NULL) { /* A first fragment to arrive creates a reassembly queue. */ only_frag = true; @@ -522,13 +515,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) } mac_ip6q_create(m, q6); #endif - frag6_insque_head(q6, head, bucket); /* ip6q_nxt will be filled afterwards, from 1st fragment. */ - q6->ip6q_down = q6->ip6q_up = (struct ip6asfrag *)q6; -#ifdef notyet - q6->ip6q_nxtp = (u_char *)nxtp; -#endif + TAILQ_INIT(&q6->ip6q_frags); q6->ip6q_ident = ip6f->ip6f_ident; q6->ip6q_ttl = IPV6_FRAGTTL; q6->ip6q_src = ip6->ip6_src; @@ -537,7 +526,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) (ntohl(ip6->ip6_flow) >> 20) & IPTOS_ECN_MASK; q6->ip6q_unfrglen = -1; /* The 1st fragment has not arrived. */ - q6->ip6q_nfrag = 0; + /* Add the fragemented packet to the bucket. */ + TAILQ_INSERT_HEAD(head, q6, ip6q_tq); + V_ip6qb[bucket].count++; } /* @@ -577,9 +568,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) * fragment already stored in the reassembly queue. */ if (fragoff == 0) { - for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; - af6 = af6dwn) { - af6dwn = af6->ip6af_down; + TAILQ_FOREACH_SAFE(af6, &q6->ip6q_frags, ip6af_tq, af6tmp) { if (q6->ip6q_unfrglen + af6->ip6af_off + af6->ip6af_frglen > IPV6_MAXPACKET) { @@ -591,7 +580,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) erroff = af6->ip6af_offset; /* Dequeue the fragment. */ - frag6_deq(af6, bucket); + TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); free(af6, M_FRAG6); /* Set a valid receive interface pointer. */ @@ -620,15 +609,19 @@ frag6_input(struct mbuf **mp, int *offp, int proto) M_NOWAIT | M_ZERO); if (ip6af == NULL) goto dropfrag; - ip6af->ip6af_mff = ip6f->ip6f_offlg & IP6F_MORE_FRAG; + ip6af->ip6af_mff = (ip6f->ip6f_offlg & IP6F_MORE_FRAG) ? true : false; ip6af->ip6af_off = fragoff; ip6af->ip6af_frglen = frgpartlen; ip6af->ip6af_offset = offset; IP6_REASS_MBUF(ip6af) = m; if (only_frag) { - af6 = (struct ip6asfrag *)q6; - goto insert; + /* + * Do a manual insert rather than a hard-to-understand cast + * to a different type relying on data structure order to work. + */ + TAILQ_INSERT_HEAD(&q6->ip6q_frags, ip6af, ip6af_tq); + goto postinsert; } /* Do duplicate, condition, and boundry checks. */ @@ -653,8 +646,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) } /* Find a fragmented part which begins after this one does. */ - for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; - af6 = af6->ip6af_down) + TAILQ_FOREACH(af6, &q6->ip6q_frags, ip6af_tq) if (af6->ip6af_off > ip6af->ip6af_off) break; @@ -666,14 +658,18 @@ frag6_input(struct mbuf **mp, int *offp, int proto) * drop the existing fragment and leave the fragmentation queue * unchanged, as allowed by the RFC. (RFC 8200, 4.5) */ - if (af6->ip6af_up != (struct ip6asfrag *)q6) { - if (af6->ip6af_up->ip6af_off + af6->ip6af_up->ip6af_frglen - + if (af6 != NULL) + af6tmp = TAILQ_PREV(af6, ip6fraghead, ip6af_tq); + else + af6tmp = TAILQ_LAST(&q6->ip6q_frags, ip6fraghead); + if (af6tmp != NULL) { + if (af6tmp->ip6af_off + af6tmp->ip6af_frglen - ip6af->ip6af_off > 0) { free(ip6af, M_FRAG6); goto dropfrag; } } - if (af6 != (struct ip6asfrag *)q6) { + if (af6 != NULL) { if (ip6af->ip6af_off + ip6af->ip6af_frglen - af6->ip6af_off > 0) { free(ip6af, M_FRAG6); @@ -681,10 +677,8 @@ frag6_input(struct mbuf **mp, int *offp, int proto) } } -insert: #ifdef MAC - if (!only_frag) - mac_ip6q_update(m, q6); + mac_ip6q_update(m, q6); #endif /* @@ -692,13 +686,16 @@ insert: * If not complete, check fragment limit. Move to front of packet * queue, as we are the most recently active fragmented packet. */ - frag6_enq(ip6af, af6->ip6af_up, bucket); + if (af6 != NULL) + TAILQ_INSERT_BEFORE(af6, ip6af, ip6af_tq); + else + TAILQ_INSERT_TAIL(&q6->ip6q_frags, ip6af, ip6af_tq); +postinsert: atomic_add_int(&frag6_nfrags, 1); q6->ip6q_nfrag++; plen = 0; - for (af6 = q6->ip6q_down; af6 != (struct ip6asfrag *)q6; - af6 = af6->ip6af_down) { + TAILQ_FOREACH(af6, &q6->ip6q_frags, ip6af_tq) { if (af6->ip6af_off != plen) { if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) { IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag); @@ -709,7 +706,8 @@ insert: } plen += af6->ip6af_frglen; } - if (af6->ip6af_up->ip6af_mff) { + af6 = TAILQ_LAST(&q6->ip6q_frags, ip6fraghead); + if (af6->ip6af_mff) { if (q6->ip6q_nfrag > V_ip6_maxfragsperpacket) { IP6STAT_ADD(ip6s_fragdropped, q6->ip6q_nfrag); frag6_freef(q6, bucket); @@ -719,25 +717,22 @@ insert: } /* Reassembly is complete; concatenate fragments. */ - ip6af = q6->ip6q_down; + ip6af = TAILQ_FIRST(&q6->ip6q_frags); t = m = IP6_REASS_MBUF(ip6af); - af6 = ip6af->ip6af_down; - frag6_deq(ip6af, bucket); - while (af6 != (struct ip6asfrag *)q6) { + TAILQ_REMOVE(&q6->ip6q_frags, ip6af, ip6af_tq); + while ((af6 = TAILQ_FIRST(&q6->ip6q_frags)) != NULL) { m->m_pkthdr.csum_flags &= IP6_REASS_MBUF(af6)->m_pkthdr.csum_flags; m->m_pkthdr.csum_data += IP6_REASS_MBUF(af6)->m_pkthdr.csum_data; - af6dwn = af6->ip6af_down; - frag6_deq(af6, bucket); + TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); while (t->m_next) t = t->m_next; m_adj(IP6_REASS_MBUF(af6), af6->ip6af_offset); m_demote_pkthdr(IP6_REASS_MBUF(af6)); m_cat(t, IP6_REASS_MBUF(af6)); free(af6, M_FRAG6); - af6 = af6dwn; } while (m->m_pkthdr.csum_data & 0xffff0000) @@ -753,9 +748,11 @@ insert: ip6->ip6_flow |= htonl(IPTOS_ECN_CE << 20); nxt = q6->ip6q_nxt; + TAILQ_REMOVE(head, q6, ip6q_tq); + V_ip6qb[bucket].count--; + atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag); + if (ip6_deletefraghdr(m, offset, M_NOWAIT) != 0) { - frag6_remque(q6, bucket); - atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag); #ifdef MAC mac_ip6q_destroy(q6); #endif @@ -769,8 +766,6 @@ insert: m_copyback(m, ip6_get_prevhdr(m, offset), sizeof(uint8_t), (caddr_t)&nxt); - frag6_remque(q6, bucket); - atomic_subtract_int(&frag6_nfrags, q6->ip6q_nfrag); #ifdef MAC mac_ip6q_reassemble(q6, m); mac_ip6q_destroy(q6); @@ -833,7 +828,8 @@ void frag6_slowtimo(void) { VNET_ITERATOR_DECL(vnet_iter); - struct ip6q *head, *q6; + struct ip6qhead *head; + struct ip6q *q6, *q6tmp; uint32_t bucket; VNET_LIST_RLOCK_NOSLEEP(); @@ -842,25 +838,13 @@ frag6_slowtimo(void) for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { IP6QB_LOCK(bucket); head = IP6QB_HEAD(bucket); - q6 = head->ip6q_next; - if (q6 == NULL) { - /* - * XXXJTL: This should never happen. This - * should turn into an assertion. - */ - IP6QB_UNLOCK(bucket); - continue; - } - while (q6 != head) { - --q6->ip6q_ttl; - q6 = q6->ip6q_next; - if (q6->ip6q_prev->ip6q_ttl == 0) { + TAILQ_FOREACH_SAFE(q6, head, ip6q_tq, q6tmp) + if (--q6->ip6q_ttl == 0) { IP6STAT_ADD(ip6s_fragtimeout, - q6->ip6q_prev->ip6q_nfrag); + q6->ip6q_nfrag); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(q6->ip6q_prev, bucket); + frag6_freef(q6, bucket); } - } /* * If we are over the maximum number of fragments * (due to the limit being lowered), drain off @@ -873,11 +857,10 @@ frag6_slowtimo(void) while ((V_ip6_maxfragpackets == 0 || (V_ip6_maxfragpackets > 0 && V_ip6qb[bucket].count > V_ip6_maxfragbucketsize)) && - head->ip6q_prev != head) { - IP6STAT_ADD(ip6s_fragoverflow, - q6->ip6q_prev->ip6q_nfrag); + (q6 = TAILQ_LAST(head, ip6qhead)) != NULL) { + IP6STAT_ADD(ip6s_fragoverflow, q6->ip6q_nfrag); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(head->ip6q_prev, bucket); + frag6_freef(q6, bucket); } IP6QB_UNLOCK(bucket); } @@ -890,12 +873,11 @@ frag6_slowtimo(void) atomic_load_int(&V_frag6_nfragpackets) > (u_int)V_ip6_maxfragpackets) { IP6QB_LOCK(bucket); - head = IP6QB_HEAD(bucket); - if (head->ip6q_prev != head) { - IP6STAT_ADD(ip6s_fragoverflow, - q6->ip6q_prev->ip6q_nfrag); + q6 = TAILQ_LAST(IP6QB_HEAD(bucket), ip6qhead); + if (q6 != NULL) { + IP6STAT_ADD(ip6s_fragoverflow, q6->ip6q_nfrag); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(head->ip6q_prev, bucket); + frag6_freef(q6, bucket); } IP6QB_UNLOCK(bucket); bucket = (bucket + 1) % IP6REASS_NHASH; @@ -930,14 +912,12 @@ frag6_change(void *tag) void frag6_init(void) { - struct ip6q *q6; uint32_t bucket; V_ip6_maxfragpackets = IP6_MAXFRAGPACKETS; frag6_set_bucketsize(); for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { - q6 = IP6QB_HEAD(bucket); - q6->ip6q_next = q6->ip6q_prev = q6; + TAILQ_INIT(IP6QB_HEAD(bucket)); mtx_init(&V_ip6qb[bucket].lock, "ip6qlock", NULL, MTX_DEF); V_ip6qb[bucket].count = 0; } @@ -960,16 +940,15 @@ frag6_init(void) static void frag6_drain_one(void) { - struct ip6q *head; + struct ip6q *q6; uint32_t bucket; for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { IP6QB_LOCK(bucket); - head = IP6QB_HEAD(bucket); - while (head->ip6q_next != head) { + while ((q6 = TAILQ_FIRST(IP6QB_HEAD(bucket))) != NULL) { IP6STAT_INC(ip6s_fragdropped); /* XXX in6_ifstat_inc(ifp, ifs6_reass_fail) */ - frag6_freef(head->ip6q_next, bucket); + frag6_freef(q6, bucket); } IP6QB_UNLOCK(bucket); } @@ -1008,60 +987,3 @@ frag6_destroy(void) } } #endif - -/* - * Put an ip fragment on a reassembly chain. - * Like insque, but pointers in middle of structure. - */ -static void -frag6_enq(struct ip6asfrag *af6, struct ip6asfrag *up6, - uint32_t bucket __unused) -{ - - IP6QB_LOCK_ASSERT(bucket); - - af6->ip6af_up = up6; - af6->ip6af_down = up6->ip6af_down; - up6->ip6af_down->ip6af_up = af6; - up6->ip6af_down = af6; -} - -/* - * To frag6_enq as remque is to insque. - */ -static void -frag6_deq(struct ip6asfrag *af6, uint32_t bucket __unused) -{ - - IP6QB_LOCK_ASSERT(bucket); - - af6->ip6af_up->ip6af_down = af6->ip6af_down; - af6->ip6af_down->ip6af_up = af6->ip6af_up; -} - -static void -frag6_insque_head(struct ip6q *new, struct ip6q *old, uint32_t bucket) -{ - - IP6QB_LOCK_ASSERT(bucket); - KASSERT(IP6QB_HEAD(bucket) == old, - ("%s: attempt to insert at head of wrong bucket" - " (bucket=%u, old=%p)", __func__, bucket, old)); - - new->ip6q_prev = old; - new->ip6q_next = old->ip6q_next; - old->ip6q_next->ip6q_prev= new; - old->ip6q_next = new; - V_ip6qb[bucket].count++; -} - -static void -frag6_remque(struct ip6q *p6, uint32_t bucket) -{ - - IP6QB_LOCK_ASSERT(bucket); - - p6->ip6q_prev->ip6q_next = p6->ip6q_next; - p6->ip6q_next->ip6q_prev = p6->ip6q_prev; - V_ip6qb[bucket].count--; -} Modified: head/sys/netinet6/ip6_var.h ============================================================================== --- head/sys/netinet6/ip6_var.h Wed Oct 23 20:39:21 2019 (r353964) +++ head/sys/netinet6/ip6_var.h Wed Oct 23 23:01:18 2019 (r353965) @@ -68,25 +68,27 @@ #include -struct ip6asfrag; +#ifdef _KERNEL +struct ip6asfrag; /* frag6.c */ +TAILQ_HEAD(ip6fraghead, ip6asfrag); + /* * IP6 reassembly queue structure. Each fragment * being reassembled is attached to one of these structures. */ struct ip6q { - struct ip6asfrag *ip6q_down; - struct ip6asfrag *ip6q_up; + struct ip6fraghead ip6q_frags; u_int32_t ip6q_ident; u_int8_t ip6q_nxt; u_int8_t ip6q_ecn; u_int8_t ip6q_ttl; struct in6_addr ip6q_src, ip6q_dst; - struct ip6q *ip6q_next; - struct ip6q *ip6q_prev; + TAILQ_ENTRY(ip6q) ip6q_tq; int ip6q_unfrglen; /* len of unfragmentable part */ int ip6q_nfrag; /* # of fragments */ struct label *ip6q_label; }; +#endif /* _KERNEL */ /* * IP6 reinjecting structure. From owner-svn-src-all@freebsd.org Wed Oct 23 23:10:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41D5C15F7EC; Wed, 23 Oct 2019 23:10:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z5gn0nZJz3Hhf; Wed, 23 Oct 2019 23:10:13 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F36C63E70; Wed, 23 Oct 2019 23:10:12 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NNAC4g063384; Wed, 23 Oct 2019 23:10:12 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NNAC97063383; Wed, 23 Oct 2019 23:10:12 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910232310.x9NNAC97063383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Wed, 23 Oct 2019 23:10:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353966 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 353966 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 23:10:13 -0000 Author: bz Date: Wed Oct 23 23:10:12 2019 New Revision: 353966 URL: https://svnweb.freebsd.org/changeset/base/353966 Log: frag6: add "big picture" Add some ASCII relation of how the bits plug together. The terminology difference of "fragmented packets" and "fragment packets" is subtle. While here clear up more whitespace and comments. No functional change. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Wed Oct 23 23:01:18 2019 (r353965) +++ head/sys/netinet6/frag6.c Wed Oct 23 23:10:12 2019 (r353966) @@ -69,6 +69,22 @@ __FBSDID("$FreeBSD$"); #include #endif +/* + * A "big picture" of how IPv6 fragment queues are all linked together. + * + * struct ip6qbucket ip6qb[...]; hashed buckets + * |||||||| + * | + * +--- TAILQ(struct ip6q, packets) *q6; tailq entries holding + * |||||||| fragmented packets + * | (1 per original packet) + * | + * +--- TAILQ(struct ip6asfrag, ip6q_frags) *af6; tailq entries of IPv6 + * | *ip6af;fragment packets + * | for one original packet + * + *mbuf + */ + /* Reassembly headers are stored in hash buckets. */ #define IP6REASS_NHASH_LOG2 10 #define IP6REASS_NHASH (1 << IP6REASS_NHASH_LOG2) @@ -84,10 +100,10 @@ struct ip6qbucket { struct ip6asfrag { TAILQ_ENTRY(ip6asfrag) ip6af_tq; struct mbuf *ip6af_m; - int ip6af_offset; /* offset in ip6af_m to next header */ - int ip6af_frglen; /* fragmentable part length */ - int ip6af_off; /* fragment offset */ - bool ip6af_mff; /* more fragment bit in frag off */ + int ip6af_offset; /* Offset in ip6af_m to next header. */ + int ip6af_frglen; /* Fragmentable part length. */ + int ip6af_off; /* Fragment offset. */ + bool ip6af_mff; /* More fragment bit in frag off. */ }; #define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m)) @@ -309,7 +325,7 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) m = IP6_REASS_MBUF(af6); - /* clear no longer valid rcvif pointer */ + /* Clear no longer valid rcvif pointer. */ if (m->m_pkthdr.rcvif == ifp) m->m_pkthdr.rcvif = NULL; } @@ -563,6 +579,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) IP6QB_UNLOCK(bucket); return (IPPROTO_DONE); } + /* * If it is the first fragment, do the above check for each * fragment already stored in the reassembly queue. From owner-svn-src-all@freebsd.org Wed Oct 23 23:20:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C2F415FBDE; Wed, 23 Oct 2019 23:20:50 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z5w22j1rz3JF2; Wed, 23 Oct 2019 23:20:50 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 29068409F; Wed, 23 Oct 2019 23:20:50 +0000 (UTC) (envelope-from erj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9NNKnxp071117; Wed, 23 Oct 2019 23:20:49 GMT (envelope-from erj@FreeBSD.org) Received: (from erj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9NNKnEZ071116; Wed, 23 Oct 2019 23:20:49 GMT (envelope-from erj@FreeBSD.org) Message-Id: <201910232320.x9NNKnEZ071116@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: erj set sender to erj@FreeBSD.org using -f From: Eric Joyner Date: Wed, 23 Oct 2019 23:20:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r353967 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: erj X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 353967 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Oct 2019 23:20:50 -0000 Author: erj Date: Wed Oct 23 23:20:49 2019 New Revision: 353967 URL: https://svnweb.freebsd.org/changeset/base/353967 Log: iflib: call ether_ifdetach and netmap_detach before stop From Jake: Calling ether_ifdetach after iflib_stop leads to a potential race where a stale ifp pointer can remain in the route entry list for IPv6 traffic. This will potentially cause a page fault or other system instability if the ifp pointer is accessed. Move both iflib_netmap_detach and ether_ifdetach to be called prior to iflib_stop. This avoids the race above, and helps ensure that other ifp references are removed before stopping the interface. Submitted by: Jacob Keller Reviewed by: erj@, gallatin@, jhb@ MFC after: 3 days Sponsored by: Intel Corporation Differential Revision: https://reviews.freebsd.org/D22071 Modified: head/sys/net/iflib.c Modified: head/sys/net/iflib.c ============================================================================== --- head/sys/net/iflib.c Wed Oct 23 23:10:12 2019 (r353966) +++ head/sys/net/iflib.c Wed Oct 23 23:20:49 2019 (r353967) @@ -703,6 +703,7 @@ static int iflib_altq_if_transmit(if_t ifp, struct mbu #endif static int iflib_register(if_ctx_t); static void iflib_deregister(if_ctx_t); +static void iflib_unregister_vlan_handlers(if_ctx_t ctx); static void iflib_init_locked(if_ctx_t ctx); static void iflib_add_device_sysctl_pre(if_ctx_t ctx); static void iflib_add_device_sysctl_post(if_ctx_t ctx); @@ -5007,6 +5008,9 @@ iflib_pseudo_deregister(if_ctx_t ctx) struct taskqgroup *tqg; iflib_fl_t fl; + /* Unregister VLAN event handlers early */ + iflib_unregister_vlan_handlers(ctx); + ether_ifdetach(ifp); /* XXX drain any dependent tasks */ tqg = qgroup_if_io_tqg; @@ -5080,12 +5084,16 @@ iflib_device_deregister(if_ctx_t ctx) ctx->ifc_flags |= IFC_IN_DETACH; STATE_UNLOCK(ctx); + /* Unregister VLAN handlers before calling iflib_stop() */ + iflib_unregister_vlan_handlers(ctx); + + iflib_netmap_detach(ifp); + ether_ifdetach(ifp); + CTX_LOCK(ctx); iflib_stop(ctx); CTX_UNLOCK(ctx); - iflib_netmap_detach(ifp); - ether_ifdetach(ifp); iflib_rem_pfil(ctx); if (ctx->ifc_led_dev != NULL) led_destroy(ctx->ifc_led_dev); @@ -5375,13 +5383,8 @@ iflib_register(if_ctx_t ctx) } static void -iflib_deregister(if_ctx_t ctx) +iflib_unregister_vlan_handlers(if_ctx_t ctx) { - if_t ifp = ctx->ifc_ifp; - - /* Remove all media */ - ifmedia_removeall(&ctx->ifc_media); - /* Unregister VLAN events */ if (ctx->ifc_vlan_attach_event != NULL) { EVENTHANDLER_DEREGISTER(vlan_config, ctx->ifc_vlan_attach_event); @@ -5391,6 +5394,19 @@ iflib_deregister(if_ctx_t ctx) EVENTHANDLER_DEREGISTER(vlan_unconfig, ctx->ifc_vlan_detach_event); ctx->ifc_vlan_detach_event = NULL; } + +} + +static void +iflib_deregister(if_ctx_t ctx) +{ + if_t ifp = ctx->ifc_ifp; + + /* Remove all media */ + ifmedia_removeall(&ctx->ifc_media); + + /* Ensure that VLAN event handlers are unregistered */ + iflib_unregister_vlan_handlers(ctx); /* Release kobject reference */ kobj_delete((kobj_t) ctx, NULL); From owner-svn-src-all@freebsd.org Thu Oct 24 02:22:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE7C6170FC7; Thu, 24 Oct 2019 02:22: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46z9y455lpz46dR; Thu, 24 Oct 2019 02:22:52 +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 93C8E73CC; Thu, 24 Oct 2019 02:22:52 +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 x9O2MqaS081130; Thu, 24 Oct 2019 02:22:52 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2MqZf081129; Thu, 24 Oct 2019 02:22:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240222.x9O2MqZf081129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:22:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353968 - stable/12/stand/efi/libefi X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/efi/libefi X-SVN-Commit-Revision: 353968 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:22:52 -0000 Author: kevans Date: Thu Oct 24 02:22:52 2019 New Revision: 353968 URL: https://svnweb.freebsd.org/changeset/base/353968 Log: MFC r339796: Simplify the EFI delay() function by calling BS->Stall() Modified: stable/12/stand/efi/libefi/delay.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/libefi/delay.c ============================================================================== --- stable/12/stand/efi/libefi/delay.c Wed Oct 23 23:20:49 2019 (r353967) +++ stable/12/stand/efi/libefi/delay.c Thu Oct 24 02:22:52 2019 (r353968) @@ -33,15 +33,5 @@ __FBSDID("$FreeBSD$"); void delay(int usecs) { - static EFI_EVENT ev = 0; - UINTN junk; - - if (!ev) { - if (BS->CreateEvent(EVT_TIMER, TPL_APPLICATION, 0, 0, &ev) - != EFI_SUCCESS) - return; - } - - BS->SetTimer(ev, TimerRelative, usecs * 10); - BS->WaitForEvent(1, &ev, &junk); + BS->Stall(usecs); } From owner-svn-src-all@freebsd.org Thu Oct 24 02:27:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCB39171EB2; Thu, 24 Oct 2019 02:27:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zB394sD2z47fc; Thu, 24 Oct 2019 02:27:17 +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 79E6573D0; Thu, 24 Oct 2019 02:27:17 +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 x9O2RHoU081498; Thu, 24 Oct 2019 02:27:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2RGGi081491; Thu, 24 Oct 2019 02:27:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240227.x9O2RGGi081491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:27:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353971 - in stable/12/stand/efi: include include/Guid include/Protocol libefi loader X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand/efi: include include/Guid include/Protocol libefi loader X-SVN-Commit-Revision: 353971 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:27:17 -0000 Author: kevans Date: Thu Oct 24 02:27:16 2019 New Revision: 353971 URL: https://svnweb.freebsd.org/changeset/base/353971 Log: MFC r342054-r342055, r342742: loader diagnostics r342054: Print an error message in efi_main.c if we can't allocate memory for the heap With the default Qemu parameters, only 128MB RAM gets given to a VM. This causes the loader to be unable to allocate the 64MB it needs for the heap. This change makes the cause of the error more obvious. r342055: Cast error message in efi_main.c to CHAR16* to avoid build error r342742: loader.efi: efi variable rework and lsefi command added This update does add diag and debug capabilities to interpret the efi variables, configuration and protocols (lsefi). The side effect is that we add/update bunch of related headers. Added: stable/12/stand/efi/include/Guid/ - copied from r342742, head/stand/efi/include/Guid/ stable/12/stand/efi/include/Protocol/ - copied from r342742, head/stand/efi/include/Protocol/ stable/12/stand/efi/include/efigpt.h - copied unchanged from r342742, head/stand/efi/include/efigpt.h stable/12/stand/efi/include/efiip.h - copied unchanged from r342742, head/stand/efi/include/efiip.h stable/12/stand/efi/include/efipoint.h - copied unchanged from r342742, head/stand/efi/include/efipoint.h stable/12/stand/efi/include/efitcp.h - copied unchanged from r342742, head/stand/efi/include/efitcp.h stable/12/stand/efi/include/efiudp.h - copied unchanged from r342742, head/stand/efi/include/efiudp.h Modified: stable/12/stand/efi/include/efi.h stable/12/stand/efi/include/efiapi.h stable/12/stand/efi/include/eficon.h stable/12/stand/efi/include/efidef.h stable/12/stand/efi/include/efilib.h stable/12/stand/efi/include/efipciio.h stable/12/stand/efi/libefi/env.c stable/12/stand/efi/loader/efi_main.c stable/12/stand/efi/loader/main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/include/efi.h ============================================================================== --- stable/12/stand/efi/include/efi.h Thu Oct 24 02:25:33 2019 (r353970) +++ stable/12/stand/efi/include/efi.h Thu Oct 24 02:27:16 2019 (r353971) @@ -43,8 +43,10 @@ Revision History #include "efibind.h" #include "efidef.h" #include "efidevp.h" +#include "efipciio.h" #include "efiprot.h" #include "eficon.h" +#include "eficonsctl.h" #include "efiser.h" #include "efi_nii.h" #include "efipxebc.h" @@ -53,6 +55,11 @@ Revision History #include "efifs.h" #include "efierr.h" #include "efigop.h" +#include "efiip.h" +#include "efiudp.h" +#include "efitcp.h" +#include "efipoint.h" +#include "efiuga.h" /* * FreeBSD UUID Modified: stable/12/stand/efi/include/efiapi.h ============================================================================== --- stable/12/stand/efi/include/efiapi.h Thu Oct 24 02:25:33 2019 (r353970) +++ stable/12/stand/efi/include/efiapi.h Thu Oct 24 02:27:16 2019 (r353971) @@ -218,9 +218,13 @@ VOID { 0x8BE4DF61, 0x93CA, 0x11d2, {0xAA, 0x0D, 0x00, 0xE0, 0x98, 0x03, 0x2B, 0x8C} } // Variable attributes -#define EFI_VARIABLE_NON_VOLATILE 0x00000001 -#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 -#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 +#define EFI_VARIABLE_NON_VOLATILE 0x00000001 +#define EFI_VARIABLE_BOOTSERVICE_ACCESS 0x00000002 +#define EFI_VARIABLE_RUNTIME_ACCESS 0x00000004 +#define EFI_VARIABLE_HARDWARE_ERROR_RECORD 0x00000008 +#define EFI_VARIABLE_AUTHENTICATED_WRITE_ACCESS 0x00000010 +#define EFI_VARIABLE_TIME_BASED_AUTHENTICATED_WRITE_ACCESS 0x00000020 +#define EFI_VARIABLE_APPEND_WRITE 0x00000040 // Variable size limitation #define EFI_MAXIMUM_VARIABLE_SIZE 1024 @@ -911,4 +915,282 @@ typedef struct _EFI_SYSTEM_TABLE { } EFI_SYSTEM_TABLE; +/* + * unlisted GUID's.. + */ +#define EFI_EBC_INTERPRETER_PROTOCOL_GUID \ +{ 0x13AC6DD1, 0x73D0, 0x11D4, {0xB0, 0x6B, 0x00, 0xAA, 0x00, 0xBD, 0x6D, 0xE7} } + +#define EFI_DRIVER_CONFIGURATION2_PROTOCOL_GUID \ +{ 0xbfd7dc1d, 0x24f1, 0x40d9, {0x82, 0xe7, 0x2e, 0x09, 0xbb, 0x6b, 0x4e, 0xbe} } + +#define EFI_DRIVER_CONFIGURATION_PROTOCOL_GUID \ +{ 0x107a772b, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } + +#define EFI_DRIVER_BINDING_PROTOCOL_GUID \ + { 0x18A031AB, 0xB443, 0x4D1A, \ + { 0xA5, 0xC0, 0x0C, 0x09, 0x26, 0x1E, 0x9F, 0x71 } \ + } + +#define EFI_TAPE_IO_PROTOCOL_GUID \ + { 0x1e93e633, 0xd65a, 0x459e, \ + { 0xab, 0x84, 0x93, 0xd9, 0xec, 0x26, 0x6d, 0x18 } \ + } + +#define EFI_SCSI_IO_PROTOCOL_GUID \ + { 0x932f47e6, 0x2362, 0x4002, \ + { 0x80, 0x3e, 0x3c, 0xd5, 0x4b, 0x13, 0x8f, 0x85 } \ + } + +#define EFI_USB2_HC_PROTOCOL_GUID \ + { 0x3e745226, 0x9818, 0x45b6, \ + { 0xa2, 0xac, 0xd7, 0xcd, 0x0e, 0x8b, 0xa2, 0xbc } \ + } + +#define EFI_DEBUG_SUPPORT_PROTOCOL_GUID \ + { 0x2755590C, 0x6F3C, 0x42FA, \ + { 0x9E, 0xA4, 0xA3, 0xBA, 0x54, 0x3C, 0xDA, 0x25 } \ + } + +#define EFI_DEBUGPORT_PROTOCOL_GUID \ + { 0xEBA4E8D2, 0x3858, 0x41EC, \ + { 0xA2, 0x81, 0x26, 0x47, 0xBA, 0x96, 0x60, 0xD0 } \ + } + +#define EFI_DECOMPRESS_PROTOCOL_GUID \ + { 0xd8117cfe, 0x94a6, 0x11d4, \ + { 0x9a, 0x3a, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d } \ + } + +#define EFI_ACPI_TABLE_PROTOCOL_GUID \ + { 0xffe06bdd, 0x6107, 0x46a6, \ + { 0x7b, 0xb2, 0x5a, 0x9c, 0x7e, 0xc5, 0x27, 0x5c} \ + } + +#define EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID \ + { 0x587e72d7, 0xcc50, 0x4f79, \ + { 0x82, 0x09, 0xca, 0x29, 0x1f, 0xc1, 0xa1, 0x0f } \ + } + +#define EFI_HII_DATABASE_PROTOCOL_GUID \ + { 0xef9fc172, 0xa1b2, 0x4693, \ + { 0xb3, 0x27, 0x6d, 0x32, 0xfc, 0x41, 0x60, 0x42 } \ + } + +#define EFI_HII_STRING_PROTOCOL_GUID \ + { 0xfd96974, 0x23aa, 0x4cdc, \ + { 0xb9, 0xcb, 0x98, 0xd1, 0x77, 0x50, 0x32, 0x2a } \ + } + +#define EFI_HII_IMAGE_PROTOCOL_GUID \ + { 0x31a6406a, 0x6bdf, 0x4e46, \ + { 0xb2, 0xa2, 0xeb, 0xaa, 0x89, 0xc4, 0x9, 0x20 } \ + } + +#define EFI_HII_FONT_PROTOCOL_GUID \ + { 0xe9ca4775, 0x8657, 0x47fc, \ + { 0x97, 0xe7, 0x7e, 0xd6, 0x5a, 0x8, 0x43, 0x24 } \ + } +#define EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID \ + { 0x330d4706, 0xf2a0, 0x4e4f, \ + { 0xa3, 0x69, 0xb6, 0x6f, 0xa8, 0xd5, 0x43, 0x85 } \ + } + +#define EFI_COMPONENT_NAME_PROTOCOL_GUID \ +{ 0x107a772c, 0xd5e1, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } + +#define EFI_COMPONENT_NAME2_PROTOCOL_GUID \ + { 0x6a7a5cff, 0xe8d9, 0x4f70, \ + { 0xba, 0xda, 0x75, 0xab, 0x30, 0x25, 0xce, 0x14} \ + } + +#define EFI_USB_IO_PROTOCOL_GUID \ + { 0x2B2F68D6, 0x0CD2, 0x44cf, \ + { 0x8E, 0x8B, 0xBB, 0xA2, 0x0B, 0x1B, 0x5B, 0x75 } \ + } +#define EFI_HCDP_TABLE_GUID \ + { 0xf951938d, 0x620b, 0x42ef, \ + { 0x82, 0x79, 0xa8, 0x4b, 0x79, 0x61, 0x78, 0x98 } \ + } + +#define EFI_DEVICE_TREE_GUID \ + { 0xb1b621d5, 0xf19c, 0x41a5, \ + { 0x83, 0x0b, 0xd9, 0x15, 0x2c, 0x69, 0xaa, 0xe0 } \ + } + +#define EFI_VENDOR_APPLE_GUID \ + { 0x2B0585EB, 0xD8B8, 0x49A9, \ + { 0x8B, 0x8C, 0xE2, 0x1B, 0x01, 0xAE, 0xF2, 0xB7 } \ + } + +#define EFI_CONSOLE_IN_DEVICE_GUID \ +{ 0xd3b36f2b, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } + +#define EFI_CONSOLE_OUT_DEVICE_GUID \ +{ 0xd3b36f2c, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } + +#define EFI_STANDARD_ERROR_DEVICE_GUID \ +{ 0xd3b36f2d, 0xd551, 0x11d4, {0x9a, 0x46, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } + +#define EFI_UNICODE_COLLATION2_PROTOCOL_GUID \ +{ 0xa4c751fc, 0x23ae, 0x4c3e, {0x92, 0xe9, 0x49, 0x64, 0xcf, 0x63, 0xf3, 0x49} } + +#define EFI_FORM_BROWSER2_PROTOCOL_GUID \ +{ 0xb9d4c360, 0xbcfb, 0x4f9b, {0x92, 0x98, 0x53, 0xc1, 0x36, 0x98, 0x22, 0x58} } + +#define EFI_ARP_SERVICE_BINDING_PROTOCOL_GUID \ +{ 0xf44c00ee, 0x1f2c, 0x4a00, {0xaa, 0x9, 0x1c, 0x9f, 0x3e, 0x8, 0x0, 0xa3} } + +#define EFI_ARP_PROTOCOL_GUID \ +{ 0xf4b427bb, 0xba21, 0x4f16, {0xbc, 0x4e, 0x43, 0xe4, 0x16, 0xab, 0x61, 0x9c} } + +#define EFI_IP4_CONFIG_PROTOCOL_GUID \ +{ 0x3b95aa31, 0x3793, 0x434b, {0x86, 0x67, 0xc8, 0x07, 0x08, 0x92, 0xe0, 0x5e} } + +#define EFI_IP6_CONFIG_PROTOCOL_GUID \ +{ 0x937fe521, 0x95ae, 0x4d1a, {0x89, 0x29, 0x48, 0xbc, 0xd9, 0x0a, 0xd3, 0x1a} } + +#define EFI_MANAGED_NETWORK_SERVICE_BINDING_PROTOCOL_GUID \ +{ 0xf36ff770, 0xa7e1, 0x42cf, {0x9e, 0xd2, 0x56, 0xf0, 0xf2, 0x71, 0xf4, 0x4c} } + +#define EFI_MANAGED_NETWORK_PROTOCOL_GUID \ +{ 0x7ab33a91, 0xace5, 0x4326, {0xb5, 0x72, 0xe7, 0xee, 0x33, 0xd3, 0x9f, 0x16} } + +#define EFI_MTFTP4_SERVICE_BINDING_PROTOCOL_GUID \ +{ 0x2FE800BE, 0x8F01, 0x4aa6, {0x94, 0x6B, 0xD7, 0x13, 0x88, 0xE1, 0x83, 0x3F} } + +#define EFI_MTFTP4_PROTOCOL_GUID \ +{ 0x78247c57, 0x63db, 0x4708, {0x99, 0xc2, 0xa8, 0xb4, 0xa9, 0xa6, 0x1f, 0x6b} } + +#define EFI_MTFTP6_SERVICE_BINDING_PROTOCOL_GUID \ +{ 0xd9760ff3, 0x3cca, 0x4267, {0x80, 0xf9, 0x75, 0x27, 0xfa, 0xfa, 0x42, 0x23} } + +#define EFI_MTFTP6_PROTOCOL_GUID \ +{ 0xbf0a78ba, 0xec29, 0x49cf, {0xa1, 0xc9, 0x7a, 0xe5, 0x4e, 0xab, 0x6a, 0x51} } + +#define EFI_DHCP4_PROTOCOL_GUID \ +{ 0x8a219718, 0x4ef5, 0x4761, {0x91, 0xc8, 0xc0, 0xf0, 0x4b, 0xda, 0x9e, 0x56} } + +#define EFI_DHCP4_SERVICE_BINDING_PROTOCOL_GUID \ +{ 0x9d9a39d8, 0xbd42, 0x4a73, {0xa4, 0xd5, 0x8e, 0xe9, 0x4b, 0xe1, 0x13, 0x80} } + +#define EFI_DHCP6_SERVICE_BINDING_PROTOCOL_GUID \ +{ 0x9fb9a8a1, 0x2f4a, 0x43a6, {0x88, 0x9c, 0xd0, 0xf7, 0xb6, 0xc4, 0x7a, 0xd5} } + +#define EFI_DHCP6_PROTOCOL_GUID \ +{ 0x87c8bad7, 0x595, 0x4053, {0x82, 0x97, 0xde, 0xde, 0x39, 0x5f, 0x5d, 0x5b} } + +#define EFI_SCSI_PASS_THRU_PROTOCOL_GUID \ +{ 0xa59e8fcf, 0xbda0, 0x43bb, {0x90, 0xb1, 0xd3, 0x73, 0x2e, 0xca, 0xa8, 0x77} } + +#define EFI_EXT_SCSI_PASS_THRU_PROTOCOL_GUID \ +{ 0x143b7632, 0xb81b, 0x4cb7, {0xab, 0xd3, 0xb6, 0x25, 0xa5, 0xb9, 0xbf, 0xfe} } + +#define EFI_DISK_INFO_PROTOCOL_GUID \ +{ 0xd432a67f, 0x14dc, 0x484b, {0xb3, 0xbb, 0x3f, 0x2, 0x91, 0x84, 0x93, 0x27} } + +#define EFI_ISA_IO_PROTOCOL_GUID \ +{ 0x7ee2bd44, 0x3da0, 0x11d4, { 0x9a, 0x38, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } + +#define EFI_VLAN_CONFIG_PROTOCOL_GUID \ +{ 0x9e23d768, 0xd2f3, 0x4366, {0x9f, 0xc3, 0x3a, 0x7a, 0xba, 0x86, 0x43, 0x74} } + +#define EFI_IDE_CONTROLLER_INIT_PROTOCOL_GUID \ +{ 0xa1e37052, 0x80d9, 0x4e65, {0xa3, 0x17, 0x3e, 0x9a, 0x55, 0xc4, 0x3e, 0xc9} } + +#define EFI_ISA_ACPI_PROTOCOL_GUID \ +{ 0x64a892dc, 0x5561, 0x4536, {0x92, 0xc7, 0x79, 0x9b, 0xfc, 0x18, 0x33, 0x55} } + +#define EFI_PCI_ENUMERATION_COMPLETE_GUID \ +{ 0x30cfe3e7, 0x3de1, 0x4586, {0xbe, 0x20, 0xde, 0xab, 0xa1, 0xb3, 0xb7, 0x93} } + +#define EFI_DRIVER_DIAGNOSTICS_PROTOCOL_GUID \ +{ 0x0784924f, 0xe296, 0x11d4, {0x9a, 0x49, 0x0, 0x90, 0x27, 0x3f, 0xc1, 0x4d } } + +#define EFI_DRIVER_DIAGNOSTICS2_PROTOCOL_GUID \ +{ 0x4d330321, 0x025f, 0x4aac, {0x90, 0xd8, 0x5e, 0xd9, 0x00, 0x17, 0x3b, 0x63} } + +#define EFI_CAPSULE_ARCH_PROTOCOL_GUID \ +{ 0x5053697e, 0x2cbc, 0x4819, {0x90, 0xd9, 0x05, 0x80, 0xde, 0xee, 0x57, 0x54} } + +#define EFI_MONOTONIC_COUNTER_ARCH_PROTOCOL_GUID \ +{0x1da97072, 0xbddc, 0x4b30, {0x99, 0xf1, 0x72, 0xa0, 0xb5, 0x6f, 0xff, 0x2a} } + +#define EFI_REALTIME_CLOCK_ARCH_PROTOCOL_GUID \ +{0x27cfac87, 0x46cc, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } + +#define EFI_MP_SERVICES_PROTOCOL_GUID \ +{ 0x3fdda605, 0xa76e, 0x4f46, {0xad, 0x29, 0x12, 0xf4, 0x53, 0x1b, 0x3d, 0x08} } + +#define EFI_VARIABLE_ARCH_PROTOCOL_GUID \ +{ 0x1e5668e2, 0x8481, 0x11d4, {0xbc, 0xf1, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } } + +#define EFI_VARIABLE_WRITE_ARCH_PROTOCOL_GUID \ +{ 0x6441f818, 0x6362, 0x4e44, {0xb5, 0x70, 0x7d, 0xba, 0x31, 0xdd, 0x24, 0x53} } + +#define EFI_WATCHDOG_TIMER_ARCH_PROTOCOL_GUID \ +{ 0x6441f818, 0x6362, 0x4e44, {0xb5, 0x70, 0x7d, 0xba, 0x31, 0xdd, 0x24, 0x53} } + +#define EFI_ACPI_SUPPORT_PROTOCOL_GUID \ +{ 0x6441f818, 0x6362, 0x4e44, {0xb5, 0x70, 0x7d, 0xba, 0x31, 0xdd, 0x24, 0x53} } + +#define EFI_BDS_ARCH_PROTOCOL_GUID \ +{ 0x665e3ff6, 0x46cc, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } + +#define EFI_METRONOME_ARCH_PROTOCOL_GUID \ +{ 0x26baccb2, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } } + +#define EFI_TIMER_ARCH_PROTOCOL_GUID \ +{ 0x26baccb3, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } } + +#define EFI_DPC_PROTOCOL_GUID \ +{ 0x480f8ae9, 0xc46, 0x4aa9, { 0xbc, 0x89, 0xdb, 0x9f, 0xba, 0x61, 0x98, 0x6} } + +#define EFI_PRINT2_PROTOCOL_GUID \ +{ 0xf05976ef, 0x83f1, 0x4f3d, {0x86, 0x19, 0xf7, 0x59, 0x5d, 0x41, 0xe5, 0x38} } + +#define EFI_RESET_ARCH_PROTOCOL_GUID \ +{ 0x27cfac88, 0x46cc, 0x11d4, {0x9a, 0x38, 0x00, 0x90, 0x27, 0x3f, 0xc1, 0x4d} } + +#define EFI_CPU_ARCH_PROTOCOL_GUID \ +{ 0x26baccb1, 0x6f42, 0x11d4, {0xbc, 0xe7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81 } } + +#define EFI_CPU_IO2_PROTOCOL_GUID \ +{ 0xad61f191, 0xae5f, 0x4c0e, {0xb9, 0xfa, 0xe8, 0x69, 0xd2, 0x88, 0xc6, 0x4f} } + +#define EFI_LEGACY_8259_PROTOCOL_GUID \ +{ 0x38321dba, 0x4fe0, 0x4e17, {0x8a, 0xec, 0x41, 0x30, 0x55, 0xea, 0xed, 0xc1} } + +#define EFI_SECURITY_ARCH_PROTOCOL_GUID \ +{ 0xa46423e3, 0x4617, 0x49f1, {0xb9, 0xff, 0xd1, 0xbf, 0xa9, 0x11, 0x58, 0x39} } + +#define EFI_SECURITY2_ARCH_PROTOCOL_GUID \ +{ 0x94ab2f58, 0x1438, 0x4ef1, {0x91, 0x52, 0x18, 0x94, 0x1a, 0x3a, 0x0e, 0x68} } + +#define EFI_RUNTIME_ARCH_PROTOCOL_GUID \ +{ 0xb7dfb4e1, 0x52f, 0x449f, {0x87, 0xbe, 0x98, 0x18, 0xfc, 0x91, 0xb7, 0x33} } + +#define EFI_STATUS_CODE_RUNTIME_PROTOCOL_GUID \ +{ 0xd2b2b828, 0x826, 0x48a7, {0xb3, 0xdf, 0x98, 0x3c, 0x0, 0x60, 0x24, 0xf0} } + +#define EFI_DATA_HUB_PROTOCOL_GUID \ +{ 0xae80d021, 0x618e, 0x11d4, {0xbc, 0xd7, 0x0, 0x80, 0xc7, 0x3c, 0x88, 0x81} } + +#define PCD_PROTOCOL_GUID \ +{ 0x11b34006, 0xd85b, 0x4d0a, { 0xa2, 0x90, 0xd5, 0xa5, 0x71, 0x31, 0xe, 0xf7} } + +#define EFI_PCD_PROTOCOL_GUID \ +{ 0x13a3f0f6, 0x264a, 0x3ef0, {0xf2, 0xe0, 0xde, 0xc5, 0x12, 0x34, 0x2f, 0x34} } + +#define EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL_GUID \ +{ 0x8f644fa9, 0xe850, 0x4db1, {0x9c, 0xe2, 0xb, 0x44, 0x69, 0x8e, 0x8d, 0xa4 } } + +#define EFI_FIRMWARE_VOLUME2_PROTOCOL_GUID \ +{ 0x220e73b6, 0x6bdb, 0x4413, { 0x84, 0x5, 0xb9, 0x74, 0xb1, 0x8, 0x61, 0x9a } } + +#define EFI_FIRMWARE_VOLUME_DISPATCH_PROTOCOL_GUID \ +{ 0x7aa35a69, 0x506c, 0x444f, {0xa7, 0xaf, 0x69, 0x4b, 0xf5, 0x6f, 0x71, 0xc8} } + +#define LZMA_COMPRESS_GUID \ +{ 0xee4e5898, 0x3914, 0x4259, {0x9d, 0x6e, 0xdc, 0x7b, 0xd7, 0x94, 0x03, 0xcf} } #endif Modified: stable/12/stand/efi/include/eficon.h ============================================================================== --- stable/12/stand/efi/include/eficon.h Thu Oct 24 02:25:33 2019 (r353970) +++ stable/12/stand/efi/include/eficon.h Thu Oct 24 02:27:16 2019 (r353971) @@ -263,29 +263,57 @@ typedef struct { // Scan codes for base line keys // -#define SCAN_NULL 0x0000 -#define SCAN_UP 0x0001 -#define SCAN_DOWN 0x0002 -#define SCAN_RIGHT 0x0003 -#define SCAN_LEFT 0x0004 -#define SCAN_HOME 0x0005 -#define SCAN_END 0x0006 -#define SCAN_INSERT 0x0007 -#define SCAN_DELETE 0x0008 -#define SCAN_PAGE_UP 0x0009 -#define SCAN_PAGE_DOWN 0x000A -#define SCAN_F1 0x000B -#define SCAN_F2 0x000C -#define SCAN_F3 0x000D -#define SCAN_F4 0x000E -#define SCAN_F5 0x000F -#define SCAN_F6 0x0010 -#define SCAN_F7 0x0011 -#define SCAN_F8 0x0012 -#define SCAN_F9 0x0013 -#define SCAN_F10 0x0014 -#define SCAN_ESC 0x0017 +#define SCAN_NULL 0x0000 +#define SCAN_UP 0x0001 +#define SCAN_DOWN 0x0002 +#define SCAN_RIGHT 0x0003 +#define SCAN_LEFT 0x0004 +#define SCAN_HOME 0x0005 +#define SCAN_END 0x0006 +#define SCAN_INSERT 0x0007 +#define SCAN_DELETE 0x0008 +#define SCAN_PAGE_UP 0x0009 +#define SCAN_PAGE_DOWN 0x000A +#define SCAN_F1 0x000B +#define SCAN_F2 0x000C +#define SCAN_F3 0x000D +#define SCAN_F4 0x000E +#define SCAN_F5 0x000F +#define SCAN_F6 0x0010 +#define SCAN_F7 0x0011 +#define SCAN_F8 0x0012 +#define SCAN_F9 0x0013 +#define SCAN_F10 0x0014 +#define SCAN_ESC 0x0017 +// +// EFI Scan code Ex +// +#define SCAN_F11 0x0015 +#define SCAN_F12 0x0016 +#define SCAN_F13 0x0068 +#define SCAN_F14 0x0069 +#define SCAN_F15 0x006A +#define SCAN_F16 0x006B +#define SCAN_F17 0x006C +#define SCAN_F18 0x006D +#define SCAN_F19 0x006E +#define SCAN_F20 0x006F +#define SCAN_F21 0x0070 +#define SCAN_F22 0x0071 +#define SCAN_F23 0x0072 +#define SCAN_F24 0x0073 +#define SCAN_MUTE 0x007F +#define SCAN_VOLUME_UP 0x0080 +#define SCAN_VOLUME_DOWN 0x0081 +#define SCAN_BRIGHTNESS_UP 0x0100 +#define SCAN_BRIGHTNESS_DOWN 0x0101 +#define SCAN_SUSPEND 0x0102 +#define SCAN_HIBERNATE 0x0103 +#define SCAN_TOGGLE_DISPLAY 0x0104 +#define SCAN_RECOVERY 0x0105 +#define SCAN_EJECT 0x0106 + typedef EFI_STATUS (EFIAPI *EFI_INPUT_RESET) ( @@ -305,5 +333,195 @@ typedef struct _SIMPLE_INPUT_INTERFACE { EFI_INPUT_READ_KEY ReadKeyStroke; EFI_EVENT WaitForKey; } SIMPLE_INPUT_INTERFACE; + +#define EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID \ + {0xdd9e7534, 0x7762, 0x4698, {0x8c, 0x14, 0xf5, 0x85, \ + 0x17, 0xa6, 0x25, 0xaa} } + +INTERFACE_DECL(_EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL); + +typedef UINT8 EFI_KEY_TOGGLE_STATE; +// +// Any Shift or Toggle State that is valid should have +// high order bit set. +// +typedef struct EFI_KEY_STATE { + UINT32 KeyShiftState; + EFI_KEY_TOGGLE_STATE KeyToggleState; +} EFI_KEY_STATE; + +typedef struct { + EFI_INPUT_KEY Key; + EFI_KEY_STATE KeyState; +} EFI_KEY_DATA; + +// +// Shift state +// +#define EFI_SHIFT_STATE_VALID 0x80000000 +#define EFI_RIGHT_SHIFT_PRESSED 0x00000001 +#define EFI_LEFT_SHIFT_PRESSED 0x00000002 +#define EFI_RIGHT_CONTROL_PRESSED 0x00000004 +#define EFI_LEFT_CONTROL_PRESSED 0x00000008 +#define EFI_RIGHT_ALT_PRESSED 0x00000010 +#define EFI_LEFT_ALT_PRESSED 0x00000020 +#define EFI_RIGHT_LOGO_PRESSED 0x00000040 +#define EFI_LEFT_LOGO_PRESSED 0x00000080 +#define EFI_MENU_KEY_PRESSED 0x00000100 +#define EFI_SYS_REQ_PRESSED 0x00000200 + +// +// Toggle state +// +#define EFI_TOGGLE_STATE_VALID 0x80 +#define EFI_KEY_STATE_EXPOSED 0x40 +#define EFI_SCROLL_LOCK_ACTIVE 0x01 +#define EFI_NUM_LOCK_ACTIVE 0x02 +#define EFI_CAPS_LOCK_ACTIVE 0x04 + +// +// EFI Key Notfication Function +// +typedef +EFI_STATUS +(EFIAPI *EFI_KEY_NOTIFY_FUNCTION) ( + IN EFI_KEY_DATA *KeyData + ); + +typedef +EFI_STATUS +(EFIAPI *EFI_INPUT_RESET_EX) ( + IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, + IN BOOLEAN ExtendedVerification + ) +/*++ + + Routine Description: + Reset the input device and optionaly run diagnostics + + Arguments: + This - Protocol instance pointer. + ExtendedVerification - Driver may perform diagnostics on reset. + + Returns: + EFI_SUCCESS - The device was reset. + EFI_DEVICE_ERROR - The device is not functioning properly and could + not be reset. + +--*/ +; + +typedef +EFI_STATUS +(EFIAPI *EFI_INPUT_READ_KEY_EX) ( + IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, + OUT EFI_KEY_DATA *KeyData + ) +/*++ + + Routine Description: + Reads the next keystroke from the input device. The WaitForKey Event can + be used to test for existance of a keystroke via WaitForEvent () call. + + Arguments: + This - Protocol instance pointer. + KeyData - A pointer to a buffer that is filled in with the keystroke + state data for the key that was pressed. + + Returns: + EFI_SUCCESS - The keystroke information was returned. + EFI_NOT_READY - There was no keystroke data availiable. + EFI_DEVICE_ERROR - The keystroke information was not returned due to + hardware errors. + EFI_INVALID_PARAMETER - KeyData is NULL. +--*/ +; + +typedef +EFI_STATUS +(EFIAPI *EFI_SET_STATE) ( + IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, + IN EFI_KEY_TOGGLE_STATE *KeyToggleState + ) +/*++ + + Routine Description: + Set certain state for the input device. + + Arguments: + This - Protocol instance pointer. + KeyToggleState - A pointer to the EFI_KEY_TOGGLE_STATE to set the + state for the input device. + + Returns: + EFI_SUCCESS - The device state was set successfully. + EFI_DEVICE_ERROR - The device is not functioning correctly and could + not have the setting adjusted. + EFI_UNSUPPORTED - The device does not have the ability to set its state. + EFI_INVALID_PARAMETER - KeyToggleState is NULL. + +--*/ +; + +typedef +EFI_STATUS +(EFIAPI *EFI_REGISTER_KEYSTROKE_NOTIFY) ( + IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, + IN EFI_KEY_DATA *KeyData, + IN EFI_KEY_NOTIFY_FUNCTION KeyNotificationFunction, + OUT EFI_HANDLE *NotifyHandle + ) +/*++ + + Routine Description: + Register a notification function for a particular keystroke for the input device. + + Arguments: + This - Protocol instance pointer. + KeyData - A pointer to a buffer that is filled in with the keystroke + information data for the key that was pressed. + KeyNotificationFunction - Points to the function to be called when the key + sequence is typed specified by KeyData. + NotifyHandle - Points to the unique handle assigned to the registered notification. + + Returns: + EFI_SUCCESS - The notification function was registered successfully. + EFI_OUT_OF_RESOURCES - Unable to allocate resources for necesssary data structures. + EFI_INVALID_PARAMETER - KeyData or NotifyHandle is NULL. + +--*/ +; + +typedef +EFI_STATUS +(EFIAPI *EFI_UNREGISTER_KEYSTROKE_NOTIFY) ( + IN struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *This, + IN EFI_HANDLE NotificationHandle + ) +/*++ + + Routine Description: + Remove a registered notification function from a particular keystroke. + + Arguments: + This - Protocol instance pointer. + NotificationHandle - The handle of the notification function being unregistered. + + Returns: + EFI_SUCCESS - The notification function was unregistered successfully. + EFI_INVALID_PARAMETER - The NotificationHandle is invalid. + EFI_NOT_FOUND - Can not find the matching entry in database. + +--*/ +; + +typedef struct _EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL { + EFI_INPUT_RESET_EX Reset; + EFI_INPUT_READ_KEY_EX ReadKeyStrokeEx; + EFI_EVENT WaitForKeyEx; + EFI_SET_STATE SetState; + EFI_REGISTER_KEYSTROKE_NOTIFY RegisterKeyNotify; + EFI_UNREGISTER_KEYSTROKE_NOTIFY UnregisterKeyNotify; +} EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL; #endif Modified: stable/12/stand/efi/include/efidef.h ============================================================================== --- stable/12/stand/efi/include/efidef.h Thu Oct 24 02:25:33 2019 (r353970) +++ stable/12/stand/efi/include/efidef.h Thu Oct 24 02:27:16 2019 (r353971) @@ -121,6 +121,19 @@ typedef struct { UINT8 Addr[32]; } EFI_MAC_ADDRESS; +typedef struct { + UINT32 ReceivedQueueTimeoutValue; + UINT32 TransmitQueueTimeoutValue; + UINT16 ProtocolTypeFilter; + BOOLEAN EnableUnicastReceive; + BOOLEAN EnableMulticastReceive; + BOOLEAN EnableBroadcastReceive; + BOOLEAN EnablePromiscuousReceive; + BOOLEAN FlushQueuesOnReset; + BOOLEAN EnableReceiveTimestamps; + BOOLEAN DisableBackgroundPolling; +} EFI_MANAGED_NETWORK_CONFIG_DATA; + // // Memory // Copied: stable/12/stand/efi/include/efigpt.h (from r342742, head/stand/efi/include/efigpt.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/efi/include/efigpt.h Thu Oct 24 02:27:16 2019 (r353971, copy of r342742, head/stand/efi/include/efigpt.h) @@ -0,0 +1,69 @@ +/* $FreeBSD$ */ +#ifndef _EFI_GPT_H +#define _EFI_GPT_H +/*++ + +Copyright (c) 1998 Intel Corporation + +Module Name: + + EfiGpt.h + +Abstract: + Include file for EFI partitioning scheme + + + +Revision History + +--*/ + +#define PRIMARY_PART_HEADER_LBA 1 + +typedef struct { + EFI_TABLE_HEADER Header; + EFI_LBA MyLBA; + EFI_LBA AlternateLBA; + EFI_LBA FirstUsableLBA; + EFI_LBA LastUsableLBA; + EFI_GUID DiskGUID; + EFI_LBA PartitionEntryLBA; + UINT32 NumberOfPartitionEntries; + UINT32 SizeOfPartitionEntry; + UINT32 PartitionEntryArrayCRC32; +} EFI_PARTITION_TABLE_HEADER; + +#define EFI_PTAB_HEADER_ID "EFI PART" + +typedef struct { + EFI_GUID PartitionTypeGUID; + EFI_GUID UniquePartitionGUID; + EFI_LBA StartingLBA; + EFI_LBA EndingLBA; + UINT64 Attributes; + CHAR16 PartitionName[36]; +} EFI_PARTITION_ENTRY; + +// +// EFI Partition Attributes +// +#define EFI_PART_USED_BY_EFI 0x0000000000000001 +#define EFI_PART_REQUIRED_TO_FUNCTION 0x0000000000000002 +#define EFI_PART_USED_BY_OS 0x0000000000000004 +#define EFI_PART_REQUIRED_BY_OS 0x0000000000000008 +#define EFI_PART_BACKUP_REQUIRED 0x0000000000000010 +#define EFI_PART_USER_DATA 0x0000000000000020 +#define EFI_PART_CRITICAL_USER_DATA 0x0000000000000040 +#define EFI_PART_REDUNDANT_PARTITION 0x0000000000000080 + +#define EFI_PART_TYPE_UNUSED_GUID \ + { 0x00000000, 0x0000, 0x0000, {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00} } + +#define EFI_PART_TYPE_EFI_SYSTEM_PART_GUID \ + { 0xc12a7328, 0xf81f, 0x11d2, {0xba, 0x4b, 0x00, 0xa0, 0xc9, 0x3e, 0xc9, 0x3b} } + +#define EFI_PART_TYPE_LEGACY_MBR_GUID \ + { 0x024dee41, 0x33e7, 0x11d3, {0x9d, 0x69, 0x00, 0x08, 0xc7, 0x81, 0xf3, 0x9f} } + +#endif + Copied: stable/12/stand/efi/include/efiip.h (from r342742, head/stand/efi/include/efiip.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/efi/include/efiip.h Thu Oct 24 02:27:16 2019 (r353971, copy of r342742, head/stand/efi/include/efiip.h) @@ -0,0 +1,460 @@ +/* $FreeBSD$ */ +#ifndef _EFI_IP_H +#define _EFI_IP_H + +/*++ +Copyright (c) 2013 Intel Corporation + +--*/ + +#define EFI_IP4_SERVICE_BINDING_PROTOCOL \ + {0xc51711e7,0xb4bf,0x404a,{0xbf,0xb8,0x0a,0x04, 0x8e,0xf1,0xff,0xe4}} + +#define EFI_IP4_PROTOCOL \ + {0x41d94cd2,0x35b6,0x455a,{0x82,0x58,0xd4,0xe5,0x13,0x34,0xaa,0xdd}} + +#define EFI_IP6_SERVICE_BINDING_PROTOCOL \ + {0xec835dd3,0xfe0f,0x617b,{0xa6,0x21,0xb3,0x50,0xc3,0xe1,0x33,0x88}} + +#define EFI_IP6_PROTOCOL \ + {0x2c8759d5,0x5c2d,0x66ef,{0x92,0x5f,0xb6,0x6c,0x10,0x19,0x57,0xe2}} + +INTERFACE_DECL(_EFI_IP4); +INTERFACE_DECL(_EFI_IP6); + +typedef struct { + EFI_HANDLE InstanceHandle; + EFI_IPv4_ADDRESS Ip4Address; + EFI_IPv4_ADDRESS SubnetMask; +} EFI_IP4_ADDRESS_PAIR; + +typedef struct { + EFI_HANDLE DriverHandle; + UINT32 AddressCount; + EFI_IP4_ADDRESS_PAIR AddressPairs[1]; +} EFI_IP4_VARIABLE_DATA; + +typedef struct { + UINT8 DefaultProtocol; + BOOLEAN AcceptAnyProtocol; + BOOLEAN AcceptIcmpErrors; + BOOLEAN AcceptBroadcast; + BOOLEAN AcceptPromiscuous; + BOOLEAN UseDefaultAddress; + EFI_IPv4_ADDRESS StationAddress; + EFI_IPv4_ADDRESS SubnetMask; + UINT8 TypeOfService; + UINT8 TimeToLive; + BOOLEAN DoNotFragment; + BOOLEAN RawData; + UINT32 ReceiveTimeout; + UINT32 TransmitTimeout; +} EFI_IP4_CONFIG_DATA; + +typedef struct { + EFI_IPv4_ADDRESS SubnetAddress; + EFI_IPv4_ADDRESS SubnetMask; + EFI_IPv4_ADDRESS GatewayAddress; +} EFI_IP4_ROUTE_TABLE; + +typedef struct { + UINT8 Type; + UINT8 Code; +} EFI_IP4_ICMP_TYPE; + +typedef struct { + BOOLEAN IsStarted; + UINT32 MaxPacketSize; + EFI_IP4_CONFIG_DATA ConfigData; + BOOLEAN IsConfigured; + UINT32 GroupCount; + EFI_IPv4_ADDRESS *GroupTable; + UINT32 RouteCount; + EFI_IP4_ROUTE_TABLE *RouteTable; + UINT32 IcmpTypeCount; + EFI_IP4_ICMP_TYPE *IcmpTypeList; +} EFI_IP4_MODE_DATA; + +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_GET_MODE_DATA) ( + IN struct _EFI_IP4 *This, + OUT EFI_IP4_MODE_DATA *Ip4ModeData OPTIONAL, + OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData OPTIONAL, + OUT EFI_SIMPLE_NETWORK_MODE *SnpModeData OPTIONAL + ); + +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CONFIGURE) ( + IN struct _EFI_IP4 *This, + IN EFI_IP4_CONFIG_DATA *IpConfigData OPTIONAL + ); + +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_GROUPS) ( + IN struct _EFI_IP4 *This, + IN BOOLEAN JoinFlag, + IN EFI_IPv4_ADDRESS *GroupAddress OPTIONAL + ); + +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_ROUTES) ( + IN struct _EFI_IP4 *This, + IN BOOLEAN DeleteRoute, + IN EFI_IPv4_ADDRESS *SubnetAddress, + IN EFI_IPv4_ADDRESS *SubnetMask, + IN EFI_IPv4_ADDRESS *GatewayAddress + ); + +#pragma pack(1) +typedef struct { + UINT8 HeaderLength:4; + UINT8 Version:4; + UINT8 TypeOfService; + UINT16 TotalLength; + UINT16 Identification; + UINT16 Fragmentation; + UINT8 TimeToLive; + UINT8 Protocol; + UINT16 Checksum; + EFI_IPv4_ADDRESS SourceAddress; + EFI_IPv4_ADDRESS DestinationAddress; +} EFI_IP4_HEADER; +#pragma pack() + +typedef struct { + UINT32 FragmentLength; + VOID *FragmentBuffer; +} EFI_IP4_FRAGMENT_DATA; + +typedef struct { + EFI_TIME TimeStamp; + EFI_EVENT RecycleSignal; + UINT32 HeaderLength; + EFI_IP4_HEADER *Header; + UINT32 OptionsLength; + VOID *Options; + UINT32 DataLength; + UINT32 FragmentCount; + EFI_IP4_FRAGMENT_DATA FragmentTable[1]; +} EFI_IP4_RECEIVE_DATA; + +typedef struct { + EFI_IPv4_ADDRESS SourceAddress; + EFI_IPv4_ADDRESS GatewayAddress; + UINT8 Protocol; + UINT8 TypeOfService; + UINT8 TimeToLive; + BOOLEAN DoNotFragment; +} EFI_IP4_OVERRIDE_DATA; + +typedef struct { + EFI_IPv4_ADDRESS DestinationAddress; + EFI_IP4_OVERRIDE_DATA *OverrideData; + UINT32 OptionsLength; + VOID *OptionsBuffer; + UINT32 TotalDataLength; + UINT32 FragmentCount; + EFI_IP4_FRAGMENT_DATA FragmentTable[1]; +} EFI_IP4_TRANSMIT_DATA; + +typedef struct { + EFI_EVENT Event; + EFI_STATUS Status; + union { + EFI_IP4_RECEIVE_DATA *RxData; + EFI_IP4_TRANSMIT_DATA *TxData; + } Packet; +} EFI_IP4_COMPLETION_TOKEN; + +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_TRANSMIT) ( + IN struct _EFI_IP4 *This, + IN EFI_IP4_COMPLETION_TOKEN *Token + ); + +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_RECEIVE) ( + IN struct _EFI_IP4 *This, + IN EFI_IP4_COMPLETION_TOKEN *Token + ); + +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CANCEL)( + IN struct _EFI_IP4 *This, + IN EFI_IP4_COMPLETION_TOKEN *Token OPTIONAL + ); + +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_POLL) ( + IN struct _EFI_IP4 *This + ); + +typedef struct _EFI_IP4 { + EFI_IP4_GET_MODE_DATA GetModeData; + EFI_IP4_CONFIGURE Configure; + EFI_IP4_GROUPS Groups; + EFI_IP4_ROUTES Routes; + EFI_IP4_TRANSMIT Transmit; + EFI_IP4_RECEIVE Receive; + EFI_IP4_CANCEL Cancel; + EFI_IP4_POLL Poll; +} EFI_IP4; + +typedef struct { + UINT8 DefaultProtocol; + BOOLEAN AcceptAnyProtocol; + BOOLEAN AcceptIcmpErrors; + BOOLEAN AcceptPromiscuous; + EFI_IPv6_ADDRESS DestinationAddress; + EFI_IPv6_ADDRESS StationAddress; + UINT8 TrafficClass; + UINT8 HopLimit; + UINT32 FlowLabel; + UINT32 ReceiveTimeout; + UINT32 TransmitTimeout; +} EFI_IP6_CONFIG_DATA; + +typedef struct { + EFI_IPv6_ADDRESS Address; + UINT8 PrefixLength; +} EFI_IP6_ADDRESS_INFO; + +typedef struct { + EFI_IPv6_ADDRESS Gateway; + EFI_IPv6_ADDRESS Destination; + UINT8 PrefixLength; +} EFI_IP6_ROUTE_TABLE; + +typedef enum { + EfiNeighborInComplete, + EfiNeighborReachable, + EfiNeighborStale, + EfiNeighborDelay, + EfiNeighborProbe +} EFI_IP6_NEIGHBOR_STATE; + +typedef struct { + EFI_IPv6_ADDRESS Neighbor; + EFI_MAC_ADDRESS LinkAddress; + EFI_IP6_NEIGHBOR_STATE State; +} EFI_IP6_NEIGHBOR_CACHE; + +typedef struct { + UINT8 Type; + UINT8 Code; +} EFI_IP6_ICMP_TYPE; + +//*********************************************************** +// ICMPv6 type definitions for error messages +//*********************************************************** +#define ICMP_V6_DEST_UNREACHABLE 0x1 +#define ICMP_V6_PACKET_TOO_BIG 0x2 +#define ICMP_V6_TIME_EXCEEDED 0x3 +#define ICMP_V6_PARAMETER_PROBLEM 0x4 + +//*********************************************************** +// ICMPv6 type definition for informational messages +//*********************************************************** +#define ICMP_V6_ECHO_REQUEST 0x80 +#define ICMP_V6_ECHO_REPLY 0x81 +#define ICMP_V6_LISTENER_QUERY 0x82 +#define ICMP_V6_LISTENER_REPORT 0x83 +#define ICMP_V6_LISTENER_DONE 0x84 +#define ICMP_V6_ROUTER_SOLICIT 0x85 +#define ICMP_V6_ROUTER_ADVERTISE 0x86 +#define ICMP_V6_NEIGHBOR_SOLICIT 0x87 +#define ICMP_V6_NEIGHBOR_ADVERTISE 0x88 +#define ICMP_V6_REDIRECT 0x89 +#define ICMP_V6_LISTENER_REPORT_2 0x8F + +//*********************************************************** +// ICMPv6 code definitions for ICMP_V6_DEST_UNREACHABLE +//*********************************************************** +#define ICMP_V6_NO_ROUTE_TO_DEST 0x0 +#define ICMP_V6_COMM_PROHIBITED 0x1 +#define ICMP_V6_BEYOND_SCOPE 0x2 +#define ICMP_V6_ADDR_UNREACHABLE 0x3 +#define ICMP_V6_PORT_UNREACHABLE 0x4 +#define ICMP_V6_SOURCE_ADDR_FAILED 0x5 +#define ICMP_V6_ROUTE_REJECTED 0x6 + +//*********************************************************** +// ICMPv6 code definitions for ICMP_V6_TIME_EXCEEDED +//*********************************************************** +#define ICMP_V6_TIMEOUT_HOP_LIMIT 0x0 +#define ICMP_V6_TIMEOUT_REASSEMBLE 0x1 + +//*********************************************************** +// ICMPv6 code definitions for ICMP_V6_PARAMETER_PROBLEM +//*********************************************************** +#define ICMP_V6_ERRONEOUS_HEADER 0x0 *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Oct 24 03:04:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 61BA2150728; Thu, 24 Oct 2019 03:04:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zBtF2drGz4F8X; Thu, 24 Oct 2019 03:04:37 +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 2693A7AED; Thu, 24 Oct 2019 03:04:37 +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 x9O34bVl006747; Thu, 24 Oct 2019 03:04:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O34au0006744; Thu, 24 Oct 2019 03:04:36 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240304.x9O34au0006744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353984 - in stable/12/stand: common fdt X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: common fdt X-SVN-Commit-Revision: 353984 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:04:37 -0000 Author: kevans Date: Thu Oct 24 03:04:36 2019 New Revision: 353984 URL: https://svnweb.freebsd.org/changeset/base/353984 Log: MFC r348194, r348196, r348204, r348207: loader/fdt pnpmatch r348194: loader: Add pnp functions for autoloading modules based on linker.hints This adds some new commands to loader : - pnpmatch This takes a pnpinfo string as argument and tries to find a kernel module associated with it. -v and -d option are available and are the same as in devmatch (v is verbose, d dumps the hints). - pnpload This takes a pnpinfo string as argument and tries to load a kernel module associated with it. - pnpautoload This will attempt to load every kernel module for each buses. Each buses are probed, the probe function will generate pnpinfo string and load kernel module associated with it if it exists. Only simplebus for FDT system is implemented for now. Since we need the dtb and overlays to be applied before searching the tree fdt_devmatch_next will load and apply the dtb + overlays. All the pnp parsing code comes from devmatch and is the same at 99%. r348196: loader: Remove unused variable r348204: Remove yet another unused variable. r348207: Initialize a variable to fix build with GCC. Modified: stable/12/stand/common/module.c stable/12/stand/fdt/fdt_loader_cmd.c stable/12/stand/fdt/fdt_platform.h Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/module.c ============================================================================== --- stable/12/stand/common/module.c Thu Oct 24 03:01:40 2019 (r353983) +++ stable/12/stand/common/module.c Thu Oct 24 03:04:36 2019 (r353984) @@ -39,6 +39,10 @@ __FBSDID("$FreeBSD$"); #include #include +#if defined(LOADER_FDT_SUPPORT) +#include +#endif + #include "bootstrap.h" #define MDIR_REMOVED 0x0001 @@ -52,18 +56,18 @@ struct moduledir { STAILQ_ENTRY(moduledir) d_link; }; -static int file_load(char *, vm_offset_t, struct preloaded_file **); -static int file_load_dependencies(struct preloaded_file *); -static char * file_search(const char *, char **); -static struct kernel_module *file_findmodule(struct preloaded_file *, char *, - struct mod_depend *); -static int file_havepath(const char *); -static char *mod_searchmodule(char *, struct mod_depend *); -static void file_insert_tail(struct preloaded_file *); -static void file_remove(struct preloaded_file *); -struct file_metadata *metadata_next(struct file_metadata *, int); -static void moduledir_readhints(struct moduledir *); -static void moduledir_rebuild(void); +static int file_load(char *filename, vm_offset_t dest, struct preloaded_file **result); +static int file_load_dependencies(struct preloaded_file *base_mod); +static char * file_search(const char *name, char **extlist); +static struct kernel_module * file_findmodule(struct preloaded_file *fp, char *modname, struct mod_depend *verinfo); +static int file_havepath(const char *name); +static char *mod_searchmodule(char *name, struct mod_depend *verinfo); +static char * mod_searchmodule_pnpinfo(const char *bus, const char *pnpinfo); +static void file_insert_tail(struct preloaded_file *mp); +static void file_remove(struct preloaded_file *fp); +struct file_metadata* metadata_next(struct file_metadata *base_mp, int type); +static void moduledir_readhints(struct moduledir *mdp); +static void moduledir_rebuild(void); /* load address should be tweaked by first module loaded (kernel) */ static vm_offset_t loadaddr = 0; @@ -344,6 +348,186 @@ command_lsmod(int argc, char *argv[]) return(CMD_OK); } +COMMAND_SET(pnpmatch, "pnpmatch", "list matched modules based on pnpinfo", command_pnpmatch); + +static int pnp_dump_flag = 0; +static int pnp_unbound_flag = 0; +static int pnp_verbose_flag = 0; + +static int +command_pnpmatch(int argc, char *argv[]) +{ + char *module; + int ch; + + pnp_verbose_flag = 0; + pnp_dump_flag = 0; + optind = 1; + optreset = 1; + while ((ch = getopt(argc, argv, "vd")) != -1) { + switch(ch) { + case 'v': + pnp_verbose_flag = 1; + break; + case 'd': + pnp_dump_flag = 1; + break; + case '?': + default: + /* getopt has already reported an error */ + return(CMD_OK); + } + } + argv += (optind - 1); + argc -= (optind - 1); + + module = mod_searchmodule_pnpinfo(argv[1], argv[2]); + if (module) + printf("Matched module: %s\n", module); + else if(argv[1]) + printf("No module matches %s\n", argv[1]); + + return (CMD_OK); +} + +COMMAND_SET(pnpload, "pnpload", "load matched modules based on pnpinfo", command_pnpload); + +static int +command_pnpload(int argc, char *argv[]) +{ + char *module; + int ch, error; + + pnp_verbose_flag = 0; + pnp_dump_flag = 0; + optind = 1; + optreset = 1; + while ((ch = getopt(argc, argv, "vd")) != -1) { + switch(ch) { + case 'v': + pnp_verbose_flag = 1; + break; + case 'd': + pnp_dump_flag = 1; + break; + case '?': + default: + /* getopt has already reported an error */ + return(CMD_OK); + } + } + argv += (optind - 1); + argc -= (optind - 1); + + if (argc != 2) + return (CMD_ERROR); + + module = mod_searchmodule_pnpinfo(argv[1], argv[2]); + + error = mod_load(module, NULL, 0, NULL); + if (error == EEXIST) { + snprintf(command_errbuf, sizeof(command_errbuf), + "warning: module '%s' already loaded", argv[1]); + return (CMD_WARN); + } + + return (error == 0 ? CMD_OK : CMD_CRIT); +} + +#if defined(LOADER_FDT_SUPPORT) +static void +pnpautoload_simplebus(void) { + const char *pnpstring; + const char *compatstr; + char *pnpinfo = NULL; + char *module = NULL; + int tag = 0, len, pnplen; + int error; + + while (1) { + pnpstring = fdt_devmatch_next(&tag, &len); + if (pnpstring == NULL) + return; + + compatstr = pnpstring; + for (pnplen = 0; pnplen != len; compatstr = pnpstring + pnplen) { + pnplen += strlen(compatstr) + 1; + asprintf(&pnpinfo, "compat=%s", compatstr); + + module = mod_searchmodule_pnpinfo("simplebus", pnpinfo); + if (module) { + error = mod_loadkld(module, 0, NULL); + if (error) + printf("Cannot load module %s\n", module); + break; + } + } + free(pnpinfo); + free(module); + } +} +#endif + +struct pnp_bus { + const char *name; + void (*load)(void); +}; + +struct pnp_bus pnp_buses[] = { +#if defined(LOADER_FDT_SUPPORT) + {"simplebus", pnpautoload_simplebus}, +#endif +}; + +COMMAND_SET(pnpautoload, "pnpautoload", "auto load modules based on pnpinfo", command_pnpautoload); + +static int +command_pnpautoload(int argc, char *argv[]) +{ + int i; + int verbose; + int ch, match; + + pnp_verbose_flag = 0; + pnp_dump_flag = 0; + verbose = 0; + optind = 1; + optreset = 1; + match = 0; + while ((ch = getopt(argc, argv, "v")) != -1) { + switch(ch) { + case 'v': + verbose = 1; + break; + case '?': + default: + /* getopt has already reported an error */ + return(CMD_OK); + } + } + argv += (optind - 1); + argc -= (optind - 1); + + if (argc > 2) + return (CMD_ERROR); + + for (i = 0; i < nitems(pnp_buses); i++) { + if (argc == 2 && strcmp(argv[1], pnp_buses[i].name) != 0) { + if (verbose) + printf("Skipping bus %s\n", pnp_buses[i].name); + continue; + } + if (verbose) + printf("Autoloading modules for simplebus\n"); + pnp_buses[i].load(); + match = 1; + } + if (match == 0) + printf("Unsupported bus %s\n", argv[1]); + + return (CMD_OK); +} + /* * File level interface, functions file_* */ @@ -908,6 +1092,284 @@ bad: return result; } +static int +getint(void **ptr) +{ + int *p = *ptr; + int rv; + + p = (int *)roundup2((intptr_t)p, sizeof(int)); + rv = *p++; + *ptr = p; + return rv; +} + +static void +getstr(void **ptr, char *val) +{ + int *p = *ptr; + char *c = (char *)p; + int len = *(uint8_t *)c; + + memcpy(val, c + 1, len); + val[len] = 0; + c += len + 1; + *ptr = (void *)c; +} + +static int +pnpval_as_int(const char *val, const char *pnpinfo) +{ + int rv; + char key[256]; + char *cp; + + if (pnpinfo == NULL) + return -1; + + cp = strchr(val, ';'); + key[0] = ' '; + if (cp == NULL) + strlcpy(key + 1, val, sizeof(key) - 1); + else { + memcpy(key + 1, val, cp - val); + key[cp - val + 1] = '\0'; + } + strlcat(key, "=", sizeof(key)); + if (strncmp(key + 1, pnpinfo, strlen(key + 1)) == 0) + rv = strtol(pnpinfo + strlen(key + 1), NULL, 0); + else { + cp = strstr(pnpinfo, key); + if (cp == NULL) + rv = -1; + else + rv = strtol(cp + strlen(key), NULL, 0); + } + return rv; +} + +static void +quoted_strcpy(char *dst, const char *src) +{ + char q = ' '; + + if (*src == '\'' || *src == '"') + q = *src++; + while (*src && *src != q) + *dst++ = *src++; // XXX backtick quoting + *dst++ = '\0'; + // XXX overflow +} + +static char * +pnpval_as_str(const char *val, const char *pnpinfo) +{ + static char retval[256]; + char key[256]; + char *cp; + + if (pnpinfo == NULL) { + *retval = '\0'; + return retval; + } + + cp = strchr(val, ';'); + key[0] = ' '; + if (cp == NULL) + strlcpy(key + 1, val, sizeof(key) - 1); + else { + memcpy(key + 1, val, cp - val); + key[cp - val + 1] = '\0'; + } + strlcat(key, "=", sizeof(key)); + if (strncmp(key + 1, pnpinfo, strlen(key + 1)) == 0) + quoted_strcpy(retval, pnpinfo + strlen(key + 1)); + else { + cp = strstr(pnpinfo, key); + if (cp == NULL) + strcpy(retval, "MISSING"); + else + quoted_strcpy(retval, cp + strlen(key)); + } + return retval; +} + +static char * +devmatch_search_hints(struct moduledir *mdp, const char *bus, const char *dev, const char *pnpinfo) +{ + char val1[256], val2[256]; + int ival, len, ents, i, notme, mask, bit, v, found; + void *ptr, *walker, *hints_end; + char *lastmod = NULL, *cp, *s; + + moduledir_readhints(mdp); + found = 0; + if (mdp->d_hints == NULL) + goto bad; + walker = mdp->d_hints; + hints_end = walker + mdp->d_hintsz; + while (walker < hints_end && !found) { + len = getint(&walker); + ival = getint(&walker); + ptr = walker; + switch (ival) { + case MDT_VERSION: + getstr(&ptr, val1); + ival = getint(&ptr); + getstr(&ptr, val2); + if (pnp_dump_flag || pnp_verbose_flag) + printf("Version: if %s.%d kmod %s\n", val1, ival, val2); + break; + case MDT_MODULE: + getstr(&ptr, val1); + getstr(&ptr, val2); + if (lastmod) + free(lastmod); + lastmod = strdup(val2); + if (pnp_dump_flag || pnp_verbose_flag) + printf("module %s in %s\n", val1, val1); + break; + case MDT_PNP_INFO: + if (!pnp_dump_flag && !pnp_unbound_flag && lastmod && strcmp(lastmod, "kernel") == 0) + break; + getstr(&ptr, val1); + getstr(&ptr, val2); + ents = getint(&ptr); + if (pnp_dump_flag || pnp_verbose_flag) + printf("PNP info for bus %s format %s %d entries (%s)\n", + val1, val2, ents, lastmod); + if (strcmp(val1, "usb") == 0) { + if (pnp_verbose_flag) + printf("Treating usb as uhub -- bug in source table still?\n"); + strcpy(val1, "uhub"); + } + if (bus && strcmp(val1, bus) != 0) { + if (pnp_verbose_flag) + printf("Skipped because table for bus %s, looking for %s\n", + val1, bus); + break; + } + for (i = 0; i < ents; i++) { + if (pnp_verbose_flag) + printf("---------- Entry %d ----------\n", i); + if (pnp_dump_flag) + printf(" "); + cp = val2; + notme = 0; + mask = -1; + bit = -1; + do { + switch (*cp) { + /* All integer fields */ + case 'I': + case 'J': + case 'G': + case 'L': + case 'M': + ival = getint(&ptr); + if (pnp_dump_flag) { + printf("%#x:", ival); + break; + } + if (bit >= 0 && ((1 << bit) & mask) == 0) + break; + v = pnpval_as_int(cp + 2, pnpinfo); + if (pnp_verbose_flag) + printf("Matching %s (%c) table=%#x tomatch=%#x\n", + cp + 2, *cp, v, ival); + switch (*cp) { + case 'J': + if (ival == -1) + break; + /*FALLTHROUGH*/ + case 'I': + if (v != ival) + notme++; + break; + case 'G': + if (v < ival) + notme++; + break; + case 'L': + if (v > ival) + notme++; + break; + case 'M': + mask = ival; + break; + } + break; + /* String fields */ + case 'D': + case 'Z': + getstr(&ptr, val1); + if (pnp_dump_flag) { + printf("'%s':", val1); + break; + } + if (*cp == 'D') + break; + s = pnpval_as_str(cp + 2, pnpinfo); + if (strcmp(s, val1) != 0) + notme++; + break; + /* Key override fields, required to be last in the string */ + case 'T': + /* + * This is imperfect and only does one key and will be redone + * to be more general for multiple keys. Currently, nothing + * does that. + */ + if (pnp_dump_flag) /* No per-row data stored */ + break; + if (cp[strlen(cp) - 1] == ';') /* Skip required ; at end */ + cp[strlen(cp) - 1] = '\0'; /* in case it's not there */ + if ((s = strstr(pnpinfo, cp + 2)) == NULL) + notme++; + else if (s > pnpinfo && s[-1] != ' ') + notme++; + break; + default: + printf("Unknown field type %c\n:", *cp); + break; + } + bit++; + cp = strchr(cp, ';'); + if (cp) + cp++; + } while (cp && *cp); + if (pnp_dump_flag) + printf("\n"); + else if (!notme) { + if (!pnp_unbound_flag) { + if (pnp_verbose_flag) + printf("Matches --- %s ---\n", lastmod); + } + found++; + } + } + break; + default: + break; + } + walker = (void *)(len - sizeof(int) + (intptr_t)walker); + } + if (pnp_unbound_flag && found == 0 && *pnpinfo) { + if (pnp_verbose_flag) + printf("------------------------- "); + printf("%s on %s pnpinfo %s", *dev ? dev : "unattached", bus, pnpinfo); + if (pnp_verbose_flag) + printf(" -------------------------"); + printf("\n"); + } + if (found != 0) + return (lastmod); + free(lastmod); + +bad: + return (NULL); +} + /* * Attempt to locate the file containing the module (name) */ @@ -924,6 +1386,26 @@ mod_searchmodule(char *name, struct mod_depend *verinf result = NULL; STAILQ_FOREACH(mdp, &moduledir_list, d_link) { result = mod_search_hints(mdp, name, verinfo); + if (result) + break; + } + + return(result); +} + +static char * +mod_searchmodule_pnpinfo(const char *bus, const char *pnpinfo) +{ + struct moduledir *mdp; + char *result; + + moduledir_rebuild(); + /* + * Now we ready to lookup module in the given directories + */ + result = NULL; + STAILQ_FOREACH(mdp, &moduledir_list, d_link) { + result = devmatch_search_hints(mdp, bus, NULL, pnpinfo); if (result) break; } Modified: stable/12/stand/fdt/fdt_loader_cmd.c ============================================================================== --- stable/12/stand/fdt/fdt_loader_cmd.c Thu Oct 24 03:01:40 2019 (r353983) +++ stable/12/stand/fdt/fdt_loader_cmd.c Thu Oct 24 03:04:36 2019 (r353984) @@ -67,6 +67,8 @@ static struct fdt_header *fdt_to_load = NULL; static struct fdt_header *fdtp = NULL; /* Size of FDT blob */ static size_t fdtp_size = 0; +/* Have we loaded all the needed overlays */ +static int fdt_overlays_applied = 0; static int fdt_load_dtb(vm_offset_t va); static void fdt_print_overlay_load_error(int err, const char *filename); @@ -439,6 +441,9 @@ fdt_apply_overlays() if ((fdtp == NULL) || (fdtp_size == 0)) return; + if (fdt_overlays_applied) + return; + max_overlay_size = 0; for (fp = file_findfile(NULL, "dtbo"); fp != NULL; fp = fp->f_next) { if (max_overlay_size < fp->f_size) @@ -507,6 +512,7 @@ fdt_apply_overlays() fdtp_size = current_fdtp_size; } free(overlay); + fdt_overlays_applied = 1; } int @@ -1858,4 +1864,66 @@ fdt_cmd_nyi(int argc, char *argv[]) printf("command not yet implemented\n"); return (CMD_ERROR); +} + +const char * +fdt_devmatch_next(int *tag, int *compatlen) +{ + const struct fdt_property *p; + const struct fdt_property *status; + int o, len = -1; + static int depth = 0; + + if (fdtp == NULL) { + fdt_setup_fdtp(); + fdt_apply_overlays(); + } + + if (*tag != 0) { + o = *tag; + /* We are at the end of the DTB */ + if (o < 0) + return (NULL); + } else { + o = fdt_path_offset(fdtp, "/"); + if (o < 0) { + printf("Can't find dtb\n"); + return (NULL); + } + depth = 0; + } + + /* Find the next node with a compatible property */ + while (1) { + p = NULL; + if (o >= 0 && depth >= 0) { + /* skip disabled nodes */ + status = fdt_get_property(fdtp, o, "status", &len); + if (len > 0) { + if (strcmp(status->data, "disabled") == 0) { + o = fdt_next_node(fdtp, o, &depth); + if (o < 0) /* End of tree */ + return (NULL); + continue; + } + } + + p = fdt_get_property(fdtp, o, "compatible", &len); + } + if (p) + break; + o = fdt_next_node(fdtp, o, &depth); + if (o < 0) /* End of tree */ + return (NULL); + } + + /* Prepare next node for next call */ + o = fdt_next_node(fdtp, o, &depth); + *tag = o; + + if (len >= 0) { + *compatlen = len; + return (p->data); + } + return (NULL); } Modified: stable/12/stand/fdt/fdt_platform.h ============================================================================== --- stable/12/stand/fdt/fdt_platform.h Thu Oct 24 03:01:40 2019 (r353983) +++ stable/12/stand/fdt/fdt_platform.h Thu Oct 24 03:04:36 2019 (r353984) @@ -55,4 +55,7 @@ int fdt_platform_load_dtb(void); void fdt_platform_load_overlays(void); void fdt_platform_fixups(void); +/* Devmatch/pnp function */ +const char *fdt_devmatch_next(int *tag, int *compatlen); + #endif /* FDT_PLATFORM_H */ From owner-svn-src-all@freebsd.org Thu Oct 24 03:24:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1FFB61543A5; Thu, 24 Oct 2019 03:24:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCK86tgYz4JHr; Thu, 24 Oct 2019 03:24:28 +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 CF7267EB2; Thu, 24 Oct 2019 03:24:28 +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 x9O3OSe8018879; Thu, 24 Oct 2019 03:24:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3OSLv018878; Thu, 24 Oct 2019 03:24:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240324.x9O3OSLv018878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:24:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353992 - stable/12/stand/efi/libefi X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/efi/libefi X-SVN-Commit-Revision: 353992 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:24:29 -0000 Author: kevans Date: Thu Oct 24 03:24:28 2019 New Revision: 353992 URL: https://svnweb.freebsd.org/changeset/base/353992 Log: MFC r351695-r351696 r351695: loader.efi: some systems do not translate scan code 0x8 to backspace Add scancode translation for backspace. r351696: loader.efi: use and prefer coninex interface Add support for EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL. Modified: stable/12/stand/efi/libefi/efi_console.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/libefi/efi_console.c ============================================================================== --- stable/12/stand/efi/libefi/efi_console.c Thu Oct 24 03:21:30 2019 (r353991) +++ stable/12/stand/efi/libefi/efi_console.c Thu Oct 24 03:24:28 2019 (r353992) @@ -32,8 +32,10 @@ __FBSDID("$FreeBSD$"); #include "bootstrap.h" +static EFI_GUID simple_input_ex_guid = EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL_GUID; static SIMPLE_TEXT_OUTPUT_INTERFACE *conout; static SIMPLE_INPUT_INTERFACE *conin; +static EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *coninex; #ifdef TERM_EMU #define DEFAULT_FGCOLOR EFI_LIGHTGRAY @@ -115,6 +117,8 @@ efi_cons_probe(struct console *cp) static int efi_cons_init(int arg) { + EFI_STATUS status; + #ifdef TERM_EMU conout->SetAttribute(conout, EFI_TEXT_ATTR(DEFAULT_FGCOLOR, DEFAULT_BGCOLOR)); @@ -125,7 +129,11 @@ efi_cons_init(int arg) bg_c = DEFAULT_BGCOLOR; #endif conout->EnableCursor(conout, TRUE); - return 0; + status = BS->OpenProtocol(ST->ConsoleInHandle, &simple_input_ex_guid, + (void **)&coninex, IH, NULL, EFI_OPEN_PROTOCOL_GET_PROTOCOL); + if (status != EFI_SUCCESS) + coninex = NULL; + return (0); } static void @@ -478,27 +486,30 @@ keybuf_inschar(EFI_INPUT_KEY *key) { switch (key->ScanCode) { - case 0x1: /* UP */ + case SCAN_UP: /* UP */ keybuf[0] = 0x1b; /* esc */ keybuf[1] = '['; keybuf[2] = 'A'; break; - case 0x2: /* DOWN */ + case SCAN_DOWN: /* DOWN */ keybuf[0] = 0x1b; /* esc */ keybuf[1] = '['; keybuf[2] = 'B'; break; - case 0x3: /* RIGHT */ + case SCAN_RIGHT: /* RIGHT */ keybuf[0] = 0x1b; /* esc */ keybuf[1] = '['; keybuf[2] = 'C'; break; - case 0x4: /* LEFT */ + case SCAN_LEFT: /* LEFT */ keybuf[0] = 0x1b; /* esc */ keybuf[1] = '['; keybuf[2] = 'D'; break; - case 0x17: + case SCAN_DELETE: + keybuf[0] = CHAR_BACKSPACE; + break; + case SCAN_ESC: keybuf[0] = 0x1b; /* esc */ break; default: @@ -521,6 +532,40 @@ efi_readkey(void) return (false); } +static bool +efi_readkey_ex(void) +{ + EFI_STATUS status; + EFI_INPUT_KEY *kp; + EFI_KEY_DATA key_data; + uint32_t kss; + + status = coninex->ReadKeyStrokeEx(coninex, &key_data); + if (status == EFI_SUCCESS) { + kss = key_data.KeyState.KeyShiftState; + kp = &key_data.Key; + if (kss & EFI_SHIFT_STATE_VALID) { + + /* + * quick mapping to control chars, replace with + * map lookup later. + */ + if (kss & EFI_RIGHT_CONTROL_PRESSED || + kss & EFI_LEFT_CONTROL_PRESSED) { + if (kp->UnicodeChar >= 'a' && + kp->UnicodeChar <= 'z') { + kp->UnicodeChar -= 'a'; + kp->UnicodeChar++; + } + } + } + + keybuf_inschar(kp); + return (true); + } + return (false); +} + int efi_cons_getchar(void) { @@ -531,8 +576,13 @@ efi_cons_getchar(void) key_pending = 0; - if (efi_readkey()) - return (keybuf_getchar()); + if (coninex == NULL) { + if (efi_readkey()) + return (keybuf_getchar()); + } else { + if (efi_readkey_ex()) + return (keybuf_getchar()); + } return (-1); } @@ -540,6 +590,7 @@ efi_cons_getchar(void) int efi_cons_poll(void) { + EFI_STATUS status; if (keybuf_ischar() || key_pending) return (1); @@ -549,10 +600,21 @@ efi_cons_poll(void) * WaitForKey(). * CheckEvent() can clear the signaled state. */ - if (conin->WaitForKey == NULL) - key_pending = efi_readkey(); - else - key_pending = BS->CheckEvent(conin->WaitForKey) == EFI_SUCCESS; + if (coninex != NULL) { + if (coninex->WaitForKeyEx == NULL) { + key_pending = efi_readkey_ex(); + } else { + status = BS->CheckEvent(coninex->WaitForKeyEx); + key_pending = status == EFI_SUCCESS; + } + } else { + if (conin->WaitForKey == NULL) { + key_pending = efi_readkey(); + } else { + status = BS->CheckEvent(conin->WaitForKey); + key_pending = status == EFI_SUCCESS; + } + } return (key_pending); } From owner-svn-src-all@freebsd.org Thu Oct 24 03:27:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 886BE154B52; Thu, 24 Oct 2019 03:27:53 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCP52rwHz4Jjh; Thu, 24 Oct 2019 03:27:53 +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 438D97EC2; Thu, 24 Oct 2019 03:27:53 +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 x9O3RrKm019156; Thu, 24 Oct 2019 03:27:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3RqQk019155; Thu, 24 Oct 2019 03:27:52 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240327.x9O3RqQk019155@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:27:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353994 - in stable/12/stand: . i386/loader X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: . i386/loader X-SVN-Commit-Revision: 353994 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:27:53 -0000 Author: kevans Date: Thu Oct 24 03:27:52 2019 New Revision: 353994 URL: https://svnweb.freebsd.org/changeset/base/353994 Log: MFC r352032: loader: --gc-sections needs sections to work with --gc-sections is not really useful unless we generate sections with -ffunction-sections -fdata-sections While there, i386/loader would win from --gc-sections too. Modified: stable/12/stand/defs.mk stable/12/stand/i386/loader/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/defs.mk ============================================================================== --- stable/12/stand/defs.mk Thu Oct 24 03:26:45 2019 (r353993) +++ stable/12/stand/defs.mk Thu Oct 24 03:27:52 2019 (r353994) @@ -65,6 +65,7 @@ CFLAGS+= -Ddouble=jagged-little-pill -Dfloat=floaty-mc # Experience has shown that problems arise between ~520k to ~530k. CFLAGS.clang+= -Oz CFLAGS.gcc+= -Os +CFLAGS+= -ffunction-sections -fdata-sections .endif # GELI Support, with backward compat hooks (mostly) Modified: stable/12/stand/i386/loader/Makefile ============================================================================== --- stable/12/stand/i386/loader/Makefile Thu Oct 24 03:26:45 2019 (r353993) +++ stable/12/stand/i386/loader/Makefile Thu Oct 24 03:27:52 2019 (r353994) @@ -47,7 +47,7 @@ HELP_FILES= ${.CURDIR}/help.i386 CLEANFILES+= ${LOADER} ${LOADER}.bin CFLAGS+= -Wall -LDFLAGS+= -static -Ttext 0x0 +LDFLAGS+= -static -Ttext 0x0 -Wl,--gc-sections # i386 standalone support library LIBI386= ${BOOTOBJ}/i386/libi386/libi386.a From owner-svn-src-all@freebsd.org Thu Oct 24 03:08:12 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DE07151402; Thu, 24 Oct 2019 03:08:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zByN0T2Kz4Fgy; Thu, 24 Oct 2019 03:08:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E912C7AF9; Thu, 24 Oct 2019 03:08:11 +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 x9O38BCf007056; Thu, 24 Oct 2019 03:08:11 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O38BXP007055; Thu, 24 Oct 2019 03:08:11 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240308.x9O38BXP007055@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:08:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353986 - stable/12/stand/libsa/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/libsa/zfs X-SVN-Commit-Revision: 353986 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:08:12 -0000 Author: kevans Date: Thu Oct 24 03:08:11 2019 New Revision: 353986 URL: https://svnweb.freebsd.org/changeset/base/353986 Log: MFC r348381: Unexpand be32dec(). Modified: stable/12/stand/libsa/zfs/zfsimpl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/zfs/zfsimpl.c ============================================================================== --- stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:06:37 2019 (r353985) +++ stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:08:11 2019 (r353986) @@ -31,6 +31,7 @@ __FBSDID("$FreeBSD$"); * Stand-alone ZFS file reader. */ +#include #include #include #include @@ -195,10 +196,7 @@ zfs_free(void *ptr, size_t size) static int xdr_int(const unsigned char **xdr, int *ip) { - *ip = ((*xdr)[0] << 24) - | ((*xdr)[1] << 16) - | ((*xdr)[2] << 8) - | ((*xdr)[3] << 0); + *ip = be32dec(*xdr); (*xdr) += 4; return (0); } @@ -206,10 +204,7 @@ xdr_int(const unsigned char **xdr, int *ip) static int xdr_u_int(const unsigned char **xdr, u_int *ip) { - *ip = ((*xdr)[0] << 24) - | ((*xdr)[1] << 16) - | ((*xdr)[2] << 8) - | ((*xdr)[3] << 0); + *ip = be32dec(*xdr); (*xdr) += 4; return (0); } From owner-svn-src-all@freebsd.org Thu Oct 24 02:32:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B6D0B172E99; Thu, 24 Oct 2019 02:32:23 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zB934Pqmz48Vn; Thu, 24 Oct 2019 02:32:23 +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 61DD9757C; Thu, 24 Oct 2019 02:32:23 +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 x9O2WNMp086579; Thu, 24 Oct 2019 02:32:23 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2WNeh086578; Thu, 24 Oct 2019 02:32:23 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240232.x9O2WNeh086578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:32:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353974 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 353974 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:32:23 -0000 Author: kevans Date: Thu Oct 24 02:32:22 2019 New Revision: 353974 URL: https://svnweb.freebsd.org/changeset/base/353974 Log: Record MFC or r344839, MFC'd in r352788 Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-all@freebsd.org Thu Oct 24 02:33:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 457EF1730AF; Thu, 24 Oct 2019 02:33:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zBB1133bz48cm; Thu, 24 Oct 2019 02:33:13 +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 069E1758D; Thu, 24 Oct 2019 02:33:13 +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 x9O2XC7G087400; Thu, 24 Oct 2019 02:33:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2XCwu087399; Thu, 24 Oct 2019 02:33:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240233.x9O2XCwu087399@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:33:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353975 - stable/12/stand/common X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/common X-SVN-Commit-Revision: 353975 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:33:13 -0000 Author: kevans Date: Thu Oct 24 02:33:12 2019 New Revision: 353975 URL: https://svnweb.freebsd.org/changeset/base/353975 Log: MFC r344268: loader: ptable_close() should check its argument Modified: stable/12/stand/common/part.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/part.c ============================================================================== --- stable/12/stand/common/part.c Thu Oct 24 02:32:22 2019 (r353974) +++ stable/12/stand/common/part.c Thu Oct 24 02:33:12 2019 (r353975) @@ -788,6 +788,9 @@ ptable_close(struct ptable *table) { struct pentry *entry; + if (table == NULL) + return; + while (!STAILQ_EMPTY(&table->entries)) { entry = STAILQ_FIRST(&table->entries); STAILQ_REMOVE_HEAD(&table->entries, entry); From owner-svn-src-all@freebsd.org Thu Oct 24 02:34:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6014C1734CB; Thu, 24 Oct 2019 02:34:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zBCs1rclz48tK; Thu, 24 Oct 2019 02:34:49 +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 228AC758F; Thu, 24 Oct 2019 02:34:49 +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 x9O2YmDx087580; Thu, 24 Oct 2019 02:34:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2Ymbk087579; Thu, 24 Oct 2019 02:34:48 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240234.x9O2Ymbk087579@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:34:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353977 - stable/12/stand/common X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/common X-SVN-Commit-Revision: 353977 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:34:49 -0000 Author: kevans Date: Thu Oct 24 02:34:48 2019 New Revision: 353977 URL: https://svnweb.freebsd.org/changeset/base/353977 Log: MFC r345330: loader: fix loading of kernels with . in path The loader indended to search the kernel file name (only) for . but instead searched the entire path, so paths like "boot/test.elfv2/kernel" would not work. Modified: stable/12/stand/common/load_elf.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/load_elf.c ============================================================================== --- stable/12/stand/common/load_elf.c Thu Oct 24 02:33:57 2019 (r353976) +++ stable/12/stand/common/load_elf.c Thu Oct 24 02:34:48 2019 (r353977) @@ -868,14 +868,16 @@ fake_modname(const char *name) sp++; else sp = name; - ep = strrchr(name, '.'); - if (ep) { - if (ep == name) { - sp = invalid_name; - ep = invalid_name + sizeof(invalid_name) - 1; - } - } else - ep = name + strlen(name); + + ep = strrchr(sp, '.'); + if (ep == NULL) { + ep = sp + strlen(sp); + } + if (ep == sp) { + sp = invalid_name; + ep = invalid_name + sizeof(invalid_name) - 1; + } + len = ep - sp; fp = malloc(len + 1); if (fp == NULL) From owner-svn-src-all@freebsd.org Thu Oct 24 03:30:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B3CE155290; Thu, 24 Oct 2019 03:30:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCSS6lZBz4KKh; Thu, 24 Oct 2019 03:30:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B36197EE9; Thu, 24 Oct 2019 03:30:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O3Um2b020951; Thu, 24 Oct 2019 03:30:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3UmWb020950; Thu, 24 Oct 2019 03:30:48 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240330.x9O3UmWb020950@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:30:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353996 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 353996 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:30:49 -0000 Author: kevans Date: Thu Oct 24 03:30:48 2019 New Revision: 353996 URL: https://svnweb.freebsd.org/changeset/base/353996 Log: MFC r352557, r353161: powerpc/loader stripping (and revert) Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-all@freebsd.org Thu Oct 24 03:09:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA339151882; Thu, 24 Oct 2019 03:09: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zBzv4yJsz4Fxn; Thu, 24 Oct 2019 03:09:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E9347B02; Thu, 24 Oct 2019 03:09:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O39VVK007170; Thu, 24 Oct 2019 03:09:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O39Vr8007169; Thu, 24 Oct 2019 03:09:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240309.x9O39Vr8007169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:09:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353987 - stable/12/stand/common X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/common X-SVN-Commit-Revision: 353987 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:09:31 -0000 Author: kevans Date: Thu Oct 24 03:09:31 2019 New Revision: 353987 URL: https://svnweb.freebsd.org/changeset/base/353987 Log: MFC r348499: Fix comment parsing in interp_simple.c loader.rc has comment lines without a trailing space, which get interpreted as commands. Avoid this by only matching against the backslash character. Modified: stable/12/stand/common/interp_simple.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/interp_simple.c ============================================================================== --- stable/12/stand/common/interp_simple.c Thu Oct 24 03:08:11 2019 (r353986) +++ stable/12/stand/common/interp_simple.c Thu Oct 24 03:09:31 2019 (r353987) @@ -114,7 +114,7 @@ interp_include(const char *filename) line++; flags = 0; /* Discard comments */ - if (strncmp(input+strspn(input, " "), "\\ ", 2) == 0) + if (strncmp(input+strspn(input, " "), "\\", 1) == 0) continue; cp = input; /* Echo? */ From owner-svn-src-all@freebsd.org Thu Oct 24 04:04:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BE65615A63A; Thu, 24 Oct 2019 04:04:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zDCp48LZz4QQb; Thu, 24 Oct 2019 04:04:54 +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 6D0748646; Thu, 24 Oct 2019 04:04:54 +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 x9O44sSG043266; Thu, 24 Oct 2019 04:04:54 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O44sNd043265; Thu, 24 Oct 2019 04:04:54 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240404.x9O44sNd043265@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 04:04:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354009 - stable/12/stand/efi/loader X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/efi/loader X-SVN-Commit-Revision: 354009 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 04:04:54 -0000 Author: kevans Date: Thu Oct 24 04:04:53 2019 New Revision: 354009 URL: https://svnweb.freebsd.org/changeset/base/354009 Log: MFC r349471, r351166: Tweak EFI_STAGING_SIZE r349471: Increase EFI_STAGING_SIZE to 100MB on x64 To avoid failures when the large 18MB nvidia.ko module is being loaded, increase EFI_STAGING_SIZE from 64MB to 100MB on x64 systems. Leave the other platforms at 64MB. r351166: Reduce size of EFI_STAGING_SIZE to 32 on arm Reduce the size of the EFI_STAGING area we allocate on arm to 32. On arm SBC such as the NanoPi-NEOLTS the staging area allocation will fail on the 256MB model with a staging size of 64. Modified: stable/12/stand/efi/loader/copy.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/loader/copy.c ============================================================================== --- stable/12/stand/efi/loader/copy.c Thu Oct 24 04:00:49 2019 (r354008) +++ stable/12/stand/efi/loader/copy.c Thu Oct 24 04:04:53 2019 (r354009) @@ -176,7 +176,13 @@ out: #endif /* __i386__ || __amd64__ */ #ifndef EFI_STAGING_SIZE +#if defined(__amd64__) +#define EFI_STAGING_SIZE 100 +#elif defined(__arm__) +#define EFI_STAGING_SIZE 32 +#else #define EFI_STAGING_SIZE 64 +#endif #endif EFI_PHYSICAL_ADDRESS staging, staging_end; From owner-svn-src-all@freebsd.org Thu Oct 24 03:29:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6933154F29; Thu, 24 Oct 2019 03:29:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCQP5mXPz4K1t; Thu, 24 Oct 2019 03:29:01 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A94DA7EC8; Thu, 24 Oct 2019 03:29:01 +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 x9O3T1m0019264; Thu, 24 Oct 2019 03:29:01 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3T11w019263; Thu, 24 Oct 2019 03:29:01 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240329.x9O3T11w019263@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:29:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353995 - stable/12/stand/libsa X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/libsa X-SVN-Commit-Revision: 353995 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:29:02 -0000 Author: kevans Date: Thu Oct 24 03:29:01 2019 New Revision: 353995 URL: https://svnweb.freebsd.org/changeset/base/353995 Log: MFC r352548: loader: fix typo in zalloc. Modified: stable/12/stand/libsa/zalloc.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/zalloc.c ============================================================================== --- stable/12/stand/libsa/zalloc.c Thu Oct 24 03:27:52 2019 (r353994) +++ stable/12/stand/libsa/zalloc.c Thu Oct 24 03:29:01 2019 (r353995) @@ -125,7 +125,8 @@ znalloc(MemPool *mp, uintptr_t bytes, size_t align) continue; /* - * Cut extra from head and create new memory node from reminder. + * Cut extra from head and create new memory node from + * remainder. */ if (extra != 0) { From owner-svn-src-all@freebsd.org Thu Oct 24 03:41:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0BE5157025; Thu, 24 Oct 2019 03:41:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCjH20M8z4MFV; Thu, 24 Oct 2019 03:41: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 286A68249; Thu, 24 Oct 2019 03:41: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 x9O3ftT6030445; Thu, 24 Oct 2019 03:41:55 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3ftDN030444; Thu, 24 Oct 2019 03:41:55 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240341.x9O3ftDN030444@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:41:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354002 - stable/12/stand/common X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/common X-SVN-Commit-Revision: 354002 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:41:55 -0000 Author: kevans Date: Thu Oct 24 03:41:54 2019 New Revision: 354002 URL: https://svnweb.freebsd.org/changeset/base/354002 Log: MFC r341276: When handling CMD_CRIT error set command_errmsg to NULL after we dump it out, so that it does not result in error message printed twice. OK load doodoo can't find 'doodoo' can't find 'doodoo' OK Modified: stable/12/stand/common/interp_forth.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/interp_forth.c ============================================================================== --- stable/12/stand/common/interp_forth.c Thu Oct 24 03:40:20 2019 (r354001) +++ stable/12/stand/common/interp_forth.c Thu Oct 24 03:41:54 2019 (r354002) @@ -142,6 +142,7 @@ bf_command(FICL_VM *vm) switch (result) { case CMD_CRIT: printf("%s\n", command_errmsg); + command_errmsg = NULL; break; case CMD_FATAL: panic("%s", command_errmsg); From owner-svn-src-all@freebsd.org Thu Oct 24 03:19:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E32DF15354B; Thu, 24 Oct 2019 03:19:45 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCCj5fNrz4HJ7; Thu, 24 Oct 2019 03:19:45 +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 A6AD87CE6; Thu, 24 Oct 2019 03:19:45 +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 x9O3Jjrn013357; Thu, 24 Oct 2019 03:19:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3Jjkc013356; Thu, 24 Oct 2019 03:19:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240319.x9O3Jjkc013356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:19:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353989 - stable/12/stand/libsa/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/libsa/zfs X-SVN-Commit-Revision: 353989 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:19:46 -0000 Author: kevans Date: Thu Oct 24 03:19:45 2019 New Revision: 353989 URL: https://svnweb.freebsd.org/changeset/base/353989 Log: MFC r349217: Tell loader to ignore newer features enabled on the root pool. There are many new features in ZoF. Most, if not all, do not effect read only usage. Encryption in particular is enabled at the pool level but used at the dataset level. The loader obviously will not be able to boot if the boot dataset is encrypted, but should not care if some other dataset in the root pool is encrypted. Modified: stable/12/stand/libsa/zfs/zfsimpl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/zfs/zfsimpl.c ============================================================================== --- stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:16:23 2019 (r353988) +++ stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:19:45 2019 (r353989) @@ -117,6 +117,12 @@ static const char *features_for_read[] = { "org.illumos:skein", "org.zfsonlinux:large_dnode", "com.joyent:multi_vdev_crash_dump", + "com.delphix:spacemap_histogram", + "com.delphix:zpool_checkpoint", + "com.delphix:spacemap_v2", + "com.datto:encryption", + "org.zfsonlinux:allocation_classes", + "com.datto:resilver_defer", "com.delphix:device_removal", "com.delphix:obsolete_counts", NULL From owner-svn-src-all@freebsd.org Thu Oct 24 03:20:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5A3F91536D5; Thu, 24 Oct 2019 03:20: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCDX1kGHz4HRH; Thu, 24 Oct 2019 03:20:28 +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 1E6147CED; Thu, 24 Oct 2019 03:20:28 +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 x9O3KSOU013490; Thu, 24 Oct 2019 03:20:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3KSNK013489; Thu, 24 Oct 2019 03:20:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240320.x9O3KSNK013489@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:20:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353990 - stable/12/stand/efi/libefi X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/efi/libefi X-SVN-Commit-Revision: 353990 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:20:28 -0000 Author: kevans Date: Thu Oct 24 03:20:27 2019 New Revision: 353990 URL: https://svnweb.freebsd.org/changeset/base/353990 Log: MFC r349201: efinet: Defer exclusively opening the network handles Don't commit to exclusive access to the network device handle by efinet until the loader has decided to load something through the network. This allows for the possibility of other users of the network device. Modified: stable/12/stand/efi/libefi/efinet.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/libefi/efinet.c ============================================================================== --- stable/12/stand/efi/libefi/efinet.c Thu Oct 24 03:19:45 2019 (r353989) +++ stable/12/stand/efi/libefi/efinet.c Thu Oct 24 03:20:27 2019 (r353990) @@ -108,7 +108,25 @@ efinet_match(struct netif *nif, void *machdep_hint) static int efinet_probe(struct netif *nif, void *machdep_hint) { + EFI_SIMPLE_NETWORK *net; + EFI_HANDLE h; + EFI_STATUS status; + h = nif->nif_driver->netif_ifs[nif->nif_unit].dif_private; + /* + * Open the network device in exclusive mode. Without this + * we will be racing with the UEFI network stack. It will + * pull packets off the network leading to lost packets. + */ + status = BS->OpenProtocol(h, &sn_guid, (void **)&net, + IH, NULL, EFI_OPEN_PROTOCOL_EXCLUSIVE); + if (status != EFI_SUCCESS) { + printf("Unable to open network interface %d for " + "exclusive access: %lu\n", nif->nif_unit, + EFI_ERROR_CODE(status)); + return (efi_status_to_errno(status)); + } + return (0); } @@ -269,7 +287,6 @@ efinet_dev_init() struct netif_dif *dif; struct netif_stats *stats; EFI_DEVICE_PATH *devpath, *node; - EFI_SIMPLE_NETWORK *net; EFI_HANDLE *handles, *handles2; EFI_STATUS status; UINTN sz; @@ -304,19 +321,6 @@ efinet_dev_init() if (DevicePathType(node) != MESSAGING_DEVICE_PATH || DevicePathSubType(node) != MSG_MAC_ADDR_DP) continue; - - /* - * Open the network device in exclusive mode. Without this - * we will be racing with the UEFI network stack. It will - * pull packets off the network leading to lost packets. - */ - status = BS->OpenProtocol(handles[i], &sn_guid, (void **)&net, - IH, NULL, EFI_OPEN_PROTOCOL_EXCLUSIVE); - if (status != EFI_SUCCESS) { - printf("Unable to open network interface %d for " - "exclusive access: %lu\n", i, - EFI_ERROR_CODE(status)); - } handles2[nifs] = handles[i]; nifs++; From owner-svn-src-all@freebsd.org Thu Oct 24 03:51:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A721A1586A4; Thu, 24 Oct 2019 03:51:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCwQ3yh0z4NTl; Thu, 24 Oct 2019 03:51:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69FE883FC; Thu, 24 Oct 2019 03:51:34 +0000 (UTC) (envelope-from jhibbits@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O3pY5s037174; Thu, 24 Oct 2019 03:51:34 GMT (envelope-from jhibbits@FreeBSD.org) Received: (from jhibbits@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3pYHS037171; Thu, 24 Oct 2019 03:51:34 GMT (envelope-from jhibbits@FreeBSD.org) Message-Id: <201910240351.x9O3pYHS037171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhibbits set sender to jhibbits@FreeBSD.org using -f From: Justin Hibbits Date: Thu, 24 Oct 2019 03:51:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354005 - in head/sys/powerpc: include mpc85xx X-SVN-Group: head X-SVN-Commit-Author: jhibbits X-SVN-Commit-Paths: in head/sys/powerpc: include mpc85xx X-SVN-Commit-Revision: 354005 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:51:34 -0000 Author: jhibbits Date: Thu Oct 24 03:51:33 2019 New Revision: 354005 URL: https://svnweb.freebsd.org/changeset/base/354005 Log: powerpc/booke: Simplify the MPC85XX PCIe root complex driver Summary: Due to bugs in the enumeration code, fsl_pcib_init() was not configuring sub-bridges properly, so devices hanging off a separate bridge would not be found. Since the generic PCI code already supports probing child buses, just delete this code and initialize only the device itself, letting the generic code handle all the additional probing and initializing. This also deletes setup for some PCI peripherals found on some MPC85XX evaluation boards. The code can be resurrected if needed, but overly complicated this code in the first place. Reviewed by: bdragon Differential Revision: https://reviews.freebsd.org/D22050 Modified: head/sys/powerpc/include/resource.h head/sys/powerpc/mpc85xx/pci_mpc85xx.c Modified: head/sys/powerpc/include/resource.h ============================================================================== --- head/sys/powerpc/include/resource.h Thu Oct 24 03:48:28 2019 (r354004) +++ head/sys/powerpc/include/resource.h Thu Oct 24 03:51:33 2019 (r354005) @@ -40,5 +40,6 @@ #define SYS_RES_DRQ 2 /* isa dma lines */ #define SYS_RES_MEMORY 3 /* i/o memory */ #define SYS_RES_IOPORT 4 /* i/o ports */ +#define PCI_RES_BUS 5 /* PCI bus numbers */ #endif /* !_MACHINE_RESOURCE_H_ */ Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c ============================================================================== --- head/sys/powerpc/mpc85xx/pci_mpc85xx.c Thu Oct 24 03:48:28 2019 (r354004) +++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c Thu Oct 24 03:51:33 2019 (r354005) @@ -144,10 +144,6 @@ struct fsl_pcib_softc { int sc_busnr; int sc_pcie; uint8_t sc_pcie_capreg; /* PCI-E Capability Reg Set */ - - /* Devices that need special attention. */ - int sc_devfn_tundra; - int sc_devfn_via_ide; }; struct fsl_pcib_err_dr { @@ -187,7 +183,6 @@ static int fsl_pcib_decode_win(phandle_t, struct fsl_p static void fsl_pcib_err_init(device_t); static void fsl_pcib_inbound(struct fsl_pcib_softc *, int, int, uint64_t, uint64_t, uint64_t); -static int fsl_pcib_init(struct fsl_pcib_softc *, int, int); static void fsl_pcib_outbound(struct fsl_pcib_softc *, int, int, uint64_t, uint64_t, uint64_t); @@ -277,8 +272,8 @@ fsl_pcib_attach(device_t dev) { struct fsl_pcib_softc *sc; phandle_t node; - uint32_t cfgreg; - int error, maxslot, rid; + uint32_t cfgreg, brctl; + int error, rid; uint8_t ltssm, capptr; sc = device_get_softc(dev); @@ -336,16 +331,18 @@ fsl_pcib_attach(device_t dev) PCIM_CMD_PORTEN; fsl_pcib_cfgwrite(sc, 0, 0, 0, PCIR_COMMAND, cfgreg, 2); - sc->sc_devfn_tundra = -1; - sc->sc_devfn_via_ide = -1; + /* Reset the bus. Needed for Radeon video cards. */ + brctl = fsl_pcib_read_config(sc->sc_dev, 0, 0, 0, + PCIR_BRIDGECTL_1, 1); + brctl |= PCIB_BCR_SECBUS_RESET; + fsl_pcib_write_config(sc->sc_dev, 0, 0, 0, + PCIR_BRIDGECTL_1, brctl, 1); + DELAY(100000); + brctl &= ~PCIB_BCR_SECBUS_RESET; + fsl_pcib_write_config(sc->sc_dev, 0, 0, 0, + PCIR_BRIDGECTL_1, brctl, 1); + DELAY(100000); - - /* - * Scan bus using firmware configured, 0 based bus numbering. - */ - maxslot = (sc->sc_pcie) ? 0 : PCI_SLOTMAX; - fsl_pcib_init(sc, sc->sc_busnr, maxslot); - if (sc->sc_pcie) { ltssm = fsl_pcib_cfgread(sc, 0, 0, 0, PCIR_LTSSM, 1); if (ltssm < LTSSM_STAT_L0) { @@ -513,10 +510,7 @@ fsl_pcib_read_config(device_t dev, u_int bus, u_int sl if (bus == sc->sc_busnr && !sc->sc_pcie && slot < 10) return (~0); devfn = DEVFN(bus, slot, func); - if (devfn == sc->sc_devfn_tundra) - return (~0); - if (devfn == sc->sc_devfn_via_ide && reg == PCIR_INTPIN) - return (1); + return (fsl_pcib_cfgread(sc, bus, slot, func, reg, bytes)); } @@ -529,126 +523,6 @@ fsl_pcib_write_config(device_t dev, u_int bus, u_int s if (bus == sc->sc_busnr && !sc->sc_pcie && slot < 10) return; fsl_pcib_cfgwrite(sc, bus, slot, func, reg, val, bytes); -} - -static void -fsl_pcib_init_via(struct fsl_pcib_softc *sc, uint16_t device, int bus, - int slot, int fn) -{ - - if (device == 0x0686) { - fsl_pcib_write_config(sc->sc_dev, bus, slot, fn, 0x52, 0x34, 1); - fsl_pcib_write_config(sc->sc_dev, bus, slot, fn, 0x77, 0x00, 1); - fsl_pcib_write_config(sc->sc_dev, bus, slot, fn, 0x83, 0x98, 1); - fsl_pcib_write_config(sc->sc_dev, bus, slot, fn, 0x85, 0x03, 1); - } else if (device == 0x0571) { - sc->sc_devfn_via_ide = DEVFN(bus, slot, fn); - fsl_pcib_write_config(sc->sc_dev, bus, slot, fn, 0x40, 0x0b, 1); - } -} - -static int -fsl_pcib_init(struct fsl_pcib_softc *sc, int bus, int maxslot) -{ - int secbus; - int old_pribus, old_secbus, old_subbus; - int new_pribus, new_secbus, new_subbus; - int slot, func, maxfunc; - uint16_t vendor, device; - uint8_t brctl, command, hdrtype, subclass; - - secbus = bus; - for (slot = 0; slot <= maxslot; slot++) { - maxfunc = 0; - for (func = 0; func <= maxfunc; func++) { - hdrtype = fsl_pcib_read_config(sc->sc_dev, bus, slot, - func, PCIR_HDRTYPE, 1); - - if ((hdrtype & PCIM_HDRTYPE) > PCI_MAXHDRTYPE) - continue; - - if (func == 0 && (hdrtype & PCIM_MFDEV)) - maxfunc = PCI_FUNCMAX; - - vendor = fsl_pcib_read_config(sc->sc_dev, bus, slot, - func, PCIR_VENDOR, 2); - device = fsl_pcib_read_config(sc->sc_dev, bus, slot, - func, PCIR_DEVICE, 2); - - if (vendor == 0x1957 && device == 0x3fff) { - sc->sc_devfn_tundra = DEVFN(bus, slot, func); - continue; - } - - command = fsl_pcib_read_config(sc->sc_dev, bus, slot, - func, PCIR_COMMAND, 1); - command &= ~(PCIM_CMD_MEMEN | PCIM_CMD_PORTEN); - fsl_pcib_write_config(sc->sc_dev, bus, slot, func, - PCIR_COMMAND, command, 1); - - if (vendor == 0x1106) - fsl_pcib_init_via(sc, device, bus, slot, func); - - /* - * Handle PCI-PCI bridges - */ - subclass = fsl_pcib_read_config(sc->sc_dev, bus, slot, - func, PCIR_SUBCLASS, 1); - - /* Allow all DEVTYPE 1 devices */ - if (hdrtype != PCIM_HDRTYPE_BRIDGE) - continue; - - brctl = fsl_pcib_read_config(sc->sc_dev, bus, slot, func, - PCIR_BRIDGECTL_1, 1); - brctl |= PCIB_BCR_SECBUS_RESET; - fsl_pcib_write_config(sc->sc_dev, bus, slot, func, - PCIR_BRIDGECTL_1, brctl, 1); - DELAY(100000); - brctl &= ~PCIB_BCR_SECBUS_RESET; - fsl_pcib_write_config(sc->sc_dev, bus, slot, func, - PCIR_BRIDGECTL_1, brctl, 1); - DELAY(100000); - - secbus++; - - /* Read currect bus register configuration */ - old_pribus = fsl_pcib_read_config(sc->sc_dev, bus, - slot, func, PCIR_PRIBUS_1, 1); - old_secbus = fsl_pcib_read_config(sc->sc_dev, bus, - slot, func, PCIR_SECBUS_1, 1); - old_subbus = fsl_pcib_read_config(sc->sc_dev, bus, - slot, func, PCIR_SUBBUS_1, 1); - - if (bootverbose) - printf("PCI: reading firmware bus numbers for " - "secbus = %d (bus/sec/sub) = (%d/%d/%d)\n", - secbus, old_pribus, old_secbus, old_subbus); - - new_pribus = bus; - new_secbus = secbus; - - secbus = fsl_pcib_init(sc, secbus, - (subclass == PCIS_BRIDGE_PCI) ? PCI_SLOTMAX : 0); - - new_subbus = secbus; - - if (bootverbose) - printf("PCI: translate firmware bus numbers " - "for secbus %d (%d/%d/%d) -> (%d/%d/%d)\n", - secbus, old_pribus, old_secbus, old_subbus, - new_pribus, new_secbus, new_subbus); - - fsl_pcib_write_config(sc->sc_dev, bus, slot, func, - PCIR_PRIBUS_1, new_pribus, 1); - fsl_pcib_write_config(sc->sc_dev, bus, slot, func, - PCIR_SECBUS_1, new_secbus, 1); - fsl_pcib_write_config(sc->sc_dev, bus, slot, func, - PCIR_SUBBUS_1, new_subbus, 1); - } - } - - return (secbus); } static void From owner-svn-src-all@freebsd.org Thu Oct 24 04:05:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0415915AA69; Thu, 24 Oct 2019 04:05:55 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zDDy5vcgz4QqT; Thu, 24 Oct 2019 04:05:54 +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 A9ECA864A; Thu, 24 Oct 2019 04:05:54 +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 x9O45sck043384; Thu, 24 Oct 2019 04:05:54 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O45rdB043379; Thu, 24 Oct 2019 04:05:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240405.x9O45rdB043379@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 04:05:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354010 - in stable/12/stand: forth lua X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: forth lua X-SVN-Commit-Revision: 354010 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 04:05:55 -0000 Author: kevans Date: Thu Oct 24 04:05:53 2019 New Revision: 354010 URL: https://svnweb.freebsd.org/changeset/base/354010 Log: MFC r352599, r352601: loader interp color reset fixes r352599: loader_4th: menu items need to reset color attribute, not switch to white Forth menu kernel and BE entries, instead of resetting the color attribute, are switching to white color. r352601: loader_lua: lua color changes should end with reset The color change should have reset sequence, not switch to white. Modified: stable/12/stand/forth/menu.4th stable/12/stand/forth/menu.rc stable/12/stand/lua/color.lua stable/12/stand/lua/logo-beastie.lua stable/12/stand/lua/logo-orb.lua stable/12/stand/lua/menu.lua Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/forth/menu.4th ============================================================================== --- stable/12/stand/forth/menu.4th Thu Oct 24 04:04:53 2019 (r354009) +++ stable/12/stand/forth/menu.4th Thu Oct 24 04:05:53 2019 (r354010) @@ -397,7 +397,7 @@ also menu-infrastructure definitions setenv \ Assign third to ansi_caption[x][y] - kerncapbuf 0 s" @[1mK@[37mernel: " [char] @ escc! strcat + kerncapbuf 0 s" @[1mK@[mernel: " [char] @ escc! strcat kernmenuidx @ [char] 0 = if s" default/@[32m" else @@ -405,7 +405,7 @@ also menu-infrastructure definitions then [char] @ escc! strcat 2over strcat - s" @[37m" [char] @ escc! strcat + s" @[m" [char] @ escc! strcat kernidx @ kernmenuidx @ ansi_caption[x][y] setenv Modified: stable/12/stand/forth/menu.rc ============================================================================== --- stable/12/stand/forth/menu.rc Thu Oct 24 04:04:53 2019 (r354009) +++ stable/12/stand/forth/menu.rc Thu Oct 24 04:05:53 2019 (r354010) @@ -72,7 +72,7 @@ s" currdev" getenv dup 0> [if] drop 4 s" zfs:" compare set mainmenu_caption[7]="Select Boot [E]nvironment..." set mainmenu_command[7]="3 goto_menu" set mainmenu_keycode[7]=101 - set mainansi_caption[7]="Select Boot ^[1mE^[37mnvironment..." + set mainansi_caption[7]="Select Boot ^[1mE^[mnvironment..." s" chain_disk" getenv? [if] set mainmenu_caption[8]="Chain[L]oad ${chain_disk}" Modified: stable/12/stand/lua/color.lua ============================================================================== --- stable/12/stand/lua/color.lua Thu Oct 24 04:04:53 2019 (r354009) +++ stable/12/stand/lua/color.lua Thu Oct 24 04:05:53 2019 (r354010) @@ -42,7 +42,7 @@ color.MAGENTA = 5 color.CYAN = 6 color.WHITE = 7 -color.DEFAULT = 0 +color.DEFAULT = 9 color.BRIGHT = 1 color.DIM = 2 @@ -67,7 +67,7 @@ function color.resetfg() if color.disabled then return '' end - return color.escapefg(color.WHITE) + return color.escapefg(color.DEFAULT) end function color.escapebg(color_value) @@ -81,7 +81,7 @@ function color.resetbg() if color.disabled then return '' end - return color.escapebg(color.BLACK) + return color.escapebg(color.DEFAULT) end function color.escape(fg_color, bg_color, attribute) @@ -101,7 +101,7 @@ function color.default() if color.disabled then return "" end - return color.escape(color.WHITE, color.BLACK, color.DEFAULT) + return color.escape(color.DEFAULT, color.DEFAULT) end function color.highlight(str) Modified: stable/12/stand/lua/logo-beastie.lua ============================================================================== --- stable/12/stand/lua/logo-beastie.lua Thu Oct 24 04:04:53 2019 (r354009) +++ stable/12/stand/lua/logo-beastie.lua Thu Oct 24 04:05:53 2019 (r354010) @@ -48,7 +48,7 @@ local beastie_color = { " \\ / /\\", " \027[36m______\027[31m( (_ / \\______/", " \027[36m,' ,-----' |", -" `--{__________)\027[37m" +" `--{__________)\027[m" } drawer.addLogo("beastie", { Modified: stable/12/stand/lua/logo-orb.lua ============================================================================== --- stable/12/stand/lua/logo-orb.lua Thu Oct 24 04:04:53 2019 (r354009) +++ stable/12/stand/lua/logo-orb.lua Thu Oct 24 04:05:53 2019 (r354010) @@ -44,7 +44,7 @@ local orb_color = { " -- \027[31;1m-.\027[31m", " `:` \027[31;1m`:`", " \027[31;1m.-- `--.", -" .---.....----.\027[37m" +" .---.....----.\027[m" } drawer.addLogo("orb", { Modified: stable/12/stand/lua/menu.lua ============================================================================== --- stable/12/stand/lua/menu.lua Thu Oct 24 04:04:53 2019 (r354009) +++ stable/12/stand/lua/menu.lua Thu Oct 24 04:05:53 2019 (r354010) @@ -47,10 +47,10 @@ local return_menu_entry = { local function OnOff(str, value) if value then return str .. color.escapefg(color.GREEN) .. "On" .. - color.escapefg(color.WHITE) + color.resetfg() else return str .. color.escapefg(color.RED) .. "off" .. - color.escapefg(color.WHITE) + color.resetfg() end end From owner-svn-src-all@freebsd.org Thu Oct 24 04:08:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C915915B1B7; Thu, 24 Oct 2019 04:08: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zDHs4prxz4RLR; Thu, 24 Oct 2019 04:08:25 +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 895598653; Thu, 24 Oct 2019 04:08:25 +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 x9O48PWa043568; Thu, 24 Oct 2019 04:08:25 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O48Px8043567; Thu, 24 Oct 2019 04:08:25 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240408.x9O48Px8043567@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 04:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354011 - in stable/12/stand: efi/libefi libsa X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: efi/libefi libsa X-SVN-Commit-Revision: 354011 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 04:08:25 -0000 Author: kevans Date: Thu Oct 24 04:08:24 2019 New Revision: 354011 URL: https://svnweb.freebsd.org/changeset/base/354011 Log: MFC r349928: Allow efi loader to get network params from uboot Summary: efi loader does not work with static network parameters. It always uses BOOTP/DHCP and also uses RARP as a fallback. Problems with DHCP servers can cause the loader to fail to populate network parameters. Modified: stable/12/stand/efi/libefi/efinet.c stable/12/stand/libsa/net.h Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/libefi/efinet.c ============================================================================== --- stable/12/stand/efi/libefi/efinet.c Thu Oct 24 04:05:53 2019 (r354010) +++ stable/12/stand/efi/libefi/efinet.c Thu Oct 24 04:08:24 2019 (r354011) @@ -40,6 +40,8 @@ __FBSDID("$FreeBSD$"); #include #include +#include "dev_net.h" + static EFI_GUID sn_guid = EFI_SIMPLE_NETWORK_PROTOCOL; static void efinet_end(struct netif *); @@ -198,7 +200,75 @@ efinet_get(struct iodesc *desc, void **pkt, time_t tim return (ret); } +/* + * Loader uses BOOTP/DHCP and also uses RARP as a fallback to populate + * network parameters and problems with DHCP servers can cause the loader + * to fail to populate them. Allow the device to ask about the basic + * network parameters and if present use them. + */ static void +efi_env_net_params(struct iodesc *desc) +{ + char *envstr; + in_addr_t ipaddr, mask, gwaddr, serveraddr; + n_long rootaddr; + + if ((envstr = getenv("rootpath")) != NULL) + strlcpy(rootpath, envstr, sizeof(rootpath)); + + /* + * Get network parameters. + */ + envstr = getenv("ipaddr"); + ipaddr = (envstr != NULL) ? inet_addr(envstr) : 0; + + envstr = getenv("netmask"); + mask = (envstr != NULL) ? inet_addr(envstr) : 0; + + envstr = getenv("gatewayip"); + gwaddr = (envstr != NULL) ? inet_addr(envstr) : 0; + + envstr = getenv("serverip"); + serveraddr = (envstr != NULL) ? inet_addr(envstr) : 0; + + /* No network params. */ + if (ipaddr == 0 && mask == 0 && gwaddr == 0 && serveraddr == 0) + return; + + /* Partial network params. */ + if (ipaddr == 0 || mask == 0 || gwaddr == 0 || serveraddr == 0) { + printf("Incomplete network settings from U-Boot\n"); + return; + } + + /* + * Set network parameters. + */ + myip.s_addr = ipaddr; + netmask = mask; + gateip.s_addr = gwaddr; + servip.s_addr = serveraddr; + + /* + * There must be a rootpath. It may be ip:/path or it may be just the + * path in which case the ip needs to be serverip. + */ + rootaddr = net_parse_rootpath(); + if (rootaddr == INADDR_NONE) + rootaddr = serveraddr; + rootip.s_addr = rootaddr; + +#ifdef EFINET_DEBUG + printf("%s: ip=%s\n", __func__, inet_ntoa(myip)); + printf("%s: mask=%s\n", __func__, intoa(netmask)); + printf("%s: gateway=%s\n", __func__, inet_ntoa(gateip)); + printf("%s: server=%s\n", __func__, inet_ntoa(servip)); +#endif + + desc->myip = myip; +} + +static void efinet_init(struct iodesc *desc, void *machdep_hint) { struct netif *nif = desc->io_netif; @@ -206,6 +276,9 @@ efinet_init(struct iodesc *desc, void *machdep_hint) EFI_HANDLE h; EFI_STATUS status; UINT32 mask; + + /* Attempt to get netboot params from env */ + efi_env_net_params(desc); if (nif->nif_driver->netif_ifs[nif->nif_unit].dif_unit < 0) { printf("Invalid network interface %d\n", nif->nif_unit); Modified: stable/12/stand/libsa/net.h ============================================================================== --- stable/12/stand/libsa/net.h Thu Oct 24 04:05:53 2019 (r354010) +++ stable/12/stand/libsa/net.h Thu Oct 24 04:08:24 2019 (r354011) @@ -91,6 +91,7 @@ extern struct in_addr rootip; extern struct in_addr swapip; extern struct in_addr gateip; extern struct in_addr nameip; +extern struct in_addr servip; extern n_long netmask; extern u_int intf_mtu; From owner-svn-src-all@freebsd.org Thu Oct 24 03:52:35 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3151715894C; Thu, 24 Oct 2019 03:52:35 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCxb1JFRz4Njr; Thu, 24 Oct 2019 03:52:35 +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 0C6478462; Thu, 24 Oct 2019 03:52:35 +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 x9O3qZPb037272; Thu, 24 Oct 2019 03:52:35 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3qWfB037260; Thu, 24 Oct 2019 03:52:32 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240352.x9O3qWfB037260@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:52:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354006 - in stable/12/stand: common efi/libefi efi/loader i386/libi386 libsa/zfs mips/beri/loader uboot/common uboot/lib usb/storage userboot/userboot X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: common efi/libefi efi/loader i386/libi386 libsa/zfs mips/beri/loader uboot/common uboot/lib usb/storage userboot/userboot X-SVN-Commit-Revision: 354006 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:52:35 -0000 Author: kevans Date: Thu Oct 24 03:52:32 2019 New Revision: 354006 URL: https://svnweb.freebsd.org/changeset/base/354006 Log: MFC r345477, r346675, r346984, r348748 r345477: Distinguish between "no partition" and "choose best partition" with a constant. The values of the d_slice and d_partition fields of a disk_devdesc have a few values with special meanings in the disk_open() routine. Through various evolutions of the loader code over time, a d_partition value of -1 has meant both "use the first ufs partition found in the bsd label" and "don't open a bsd partition at all, open the raw slice." This defines a new special value of -2 to mean open the raw slice, and it gives symbolic names to all the special values used in d_slice and d_partition, and adjusts all existing uses of those fields to use the new constants. The phab review for this timed out without being accepted, but I'm still citing it below because there is useful commentary there. r346675: Restore the ability to open a raw disk or partition in loader(8). The disk_open() function searches for "the best partition" when slice and partition information is not provided as part of the device name. As of r345477 the slice and partition fields of a disk_devdesc are initialized to D_SLICEWILD and D_PARTWILD; in the past they were initialized to -1, which was sometimes interpreted as meaning 'wildcard' and sometimes as 'open the raw partition' depending on the context. So as an unintended side effect of r345477 it became basically impossible to ever open a disk or partition without doing the 'best partition' search. One visible effect of that was the inability to open the raw disk to read the partition table correctly in zfs_probe_dev(), leading to failures to find the zfs pool unless it was on the first partition. Now instead of always initializing slice and partition to wildcards, the disk_parsedev() function initializes them based on the presence of a path/file name following the device. If there is any path or filename following the ':' that ends the device name, then slice and partition are initialized to D_SLICEWILD and D_PARTWILD. If there is nothing after the ':' then it is considered to be a request to open the raw device or partition itself (not a file stored within it), and the fields are initialized to D_SLICENONE and D_PARTNONE. With this change in place, all the tests in src/tools/boot are succesful again, including the recently-added cases of booting from a zfs pool on a partition other than slice 1 of the device. r346984: Use D_PARTISGPT rather than bare 255 These three cases dovetail with other places in the code where we use or set D_PARTISGPT when we mean that the partitioning scheme is GPT. Use this #define to make the code easier to undertand. r348748: loader: disk_open() should honor D_PARTNONE The D_PARTNONE is documented to make it possible to open raw MBR partition, but the current disk_open() does not really implement this statement. The current code is checking partition against -1 (D_PARTNONE) but does attempt to open partition table in case we do have FreeBSD MBR partition type. Instead, we should check -2 (D_PARTWILD). In case we do have MBR + BSD label, this code is only working because by default, the first BSD partiton is created starting with relative sector 0, and we can still access the BSD table from that MBR slice. PR: 236981 Modified: stable/12/stand/common/disk.c stable/12/stand/common/disk.h stable/12/stand/efi/libefi/efipart.c stable/12/stand/efi/loader/main.c stable/12/stand/i386/libi386/biosdisk.c stable/12/stand/libsa/zfs/zfs.c stable/12/stand/mips/beri/loader/beri_disk_cfi.c stable/12/stand/mips/beri/loader/beri_disk_sdcard.c stable/12/stand/uboot/common/main.c stable/12/stand/uboot/lib/disk.c stable/12/stand/usb/storage/umass_loader.c stable/12/stand/userboot/userboot/main.c stable/12/stand/userboot/userboot/userboot_disk.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/disk.c ============================================================================== --- stable/12/stand/common/disk.c Thu Oct 24 03:51:33 2019 (r354005) +++ stable/12/stand/common/disk.c Thu Oct 24 03:52:32 2019 (r354006) @@ -142,15 +142,8 @@ ptable_print(void *arg, const char *pname, const struc dev.dd.d_dev = pa->dev->dd.d_dev; dev.dd.d_unit = pa->dev->dd.d_unit; dev.d_slice = part->index; - dev.d_partition = -1; + dev.d_partition = D_PARTNONE; if (disk_open(&dev, partsize, sectsize) == 0) { - /* - * disk_open() for partition -1 on a bsd slice assumes - * you want the first bsd partition. Reset things so - * that we're looking at the start of the raw slice. - */ - dev.d_partition = -1; - dev.d_offset = part->start; table = ptable_open(&dev, partsize, sectsize, ptblread); if (table != NULL) { snprintf(line, sizeof(line), " %s%s", @@ -262,16 +255,16 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize */ memcpy(&partdev, dev, sizeof(partdev)); partdev.d_offset = 0; - partdev.d_slice = -1; - partdev.d_partition = -1; + partdev.d_slice = D_SLICENONE; + partdev.d_partition = D_PARTNONE; dev->d_offset = 0; table = NULL; slice = dev->d_slice; partition = dev->d_partition; - DPRINTF("%s unit %d, slice %d, partition %d => %p", - disk_fmtdev(dev), dev->dd.d_unit, dev->d_slice, dev->d_partition, od); + DPRINTF("%s unit %d, slice %d, partition %d => %p", disk_fmtdev(dev), + dev->dd.d_unit, dev->d_slice, dev->d_partition, od); /* Determine disk layout. */ od->table = ptable_open(&partdev, mediasize / sectorsize, sectorsize, @@ -311,22 +304,30 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize od->entrysize = part.end - part.start + 1; slice = part.index; if (ptable_gettype(od->table) == PTABLE_GPT) { - partition = 255; + partition = D_PARTISGPT; goto out; /* Nothing more to do */ - } else if (partition == 255) { + } else if (partition == D_PARTISGPT) { /* * When we try to open GPT partition, but partition - * table isn't GPT, reset d_partition value to -1 - * and try to autodetect appropriate value. + * table isn't GPT, reset partition value to + * D_PARTWILD and try to autodetect appropriate value. */ - partition = -1; + partition = D_PARTWILD; } + /* - * If d_partition < 0 and we are looking at a BSD slice, + * If partition is D_PARTNONE, then disk_open() was called + * to open raw MBR slice. + */ + if (partition == D_PARTNONE) + goto out; + + /* + * If partition is D_PARTWILD and we are looking at a BSD slice, * then try to read BSD label, otherwise return the * whole MBR slice. */ - if (partition == -1 && + if (partition == D_PARTWILD && part.type != PART_FREEBSD) goto out; /* Try to read BSD label */ @@ -338,7 +339,7 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize goto out; } /* - * If slice contains BSD label and d_partition < 0, then + * If slice contains BSD label and partition < 0, then * assume the 'a' partition. Otherwise just return the * whole MBR slice, because it can contain ZFS. */ @@ -391,9 +392,9 @@ disk_fmtdev(struct disk_devdesc *dev) char *cp; cp = buf + sprintf(buf, "%s%d", dev->dd.d_dev->dv_name, dev->dd.d_unit); - if (dev->d_slice >= 0) { + if (dev->d_slice > D_SLICENONE) { #ifdef LOADER_GPT_SUPPORT - if (dev->d_partition == 255) { + if (dev->d_partition == D_PARTISGPT) { sprintf(cp, "p%d:", dev->d_slice); return (buf); } else @@ -402,7 +403,7 @@ disk_fmtdev(struct disk_devdesc *dev) cp += sprintf(cp, "s%d", dev->d_slice); #endif } - if (dev->d_partition >= 0) + if (dev->d_partition > D_PARTNONE) cp += sprintf(cp, "%c", dev->d_partition + 'a'); strcat(cp, ":"); return (buf); @@ -416,7 +417,21 @@ disk_parsedev(struct disk_devdesc *dev, const char *de char *cp; np = devspec; - unit = slice = partition = -1; + unit = -1; + /* + * If there is path/file info after the device info, then any missing + * slice or partition info should be considered a request to search for + * an appropriate partition. Otherwise we want to open the raw device + * itself and not try to fill in missing info by searching. + */ + if ((cp = strchr(np, ':')) != NULL && cp[1] != '\0') { + slice = D_SLICEWILD; + partition = D_PARTWILD; + } else { + slice = D_SLICENONE; + partition = D_PARTNONE; + } + if (*np != '\0' && *np != ':') { unit = strtol(np, &cp, 10); if (cp == np) @@ -430,7 +445,7 @@ disk_parsedev(struct disk_devdesc *dev, const char *de /* we don't support nested partitions on GPT */ if (*cp != '\0' && *cp != ':') return (EINVAL); - partition = 255; + partition = D_PARTISGPT; } else #endif #ifdef LOADER_MBR_SUPPORT Modified: stable/12/stand/common/disk.h ============================================================================== --- stable/12/stand/common/disk.h Thu Oct 24 03:51:33 2019 (r354005) +++ stable/12/stand/common/disk.h Thu Oct 24 03:52:32 2019 (r354006) @@ -32,33 +32,36 @@ * * Whole disk access: * - * d_slice = -1 - * d_partition = -1 + * d_slice = D_SLICENONE + * d_partition = * * Whole MBR slice: * * d_slice = MBR slice number (typically 1..4) - * d_partition = -1 + * d_partition = D_PARTNONE * * BSD disklabel partition within an MBR slice: * * d_slice = MBR slice number (typically 1..4) - * d_partition = disklabel partition (typically 0..19) + * d_partition = disklabel partition (typically 0..19 or D_PARTWILD) * * BSD disklabel partition on the true dedicated disk: * - * d_slice = -1 - * d_partition = disklabel partition (typically 0..19) + * d_slice = D_SLICENONE + * d_partition = disklabel partition (typically 0..19 or D_PARTWILD) * * GPT partition: * * d_slice = GPT partition number (typically 1..N) - * d_partition = 255 + * d_partition = D_PARTISGPT * - * For both MBR and GPT, to automatically find the 'best' slice or partition, - * set d_slice to zero. This uses the partition type to decide which partition - * to use according to the following list of preferences: + * For MBR, setting d_partition to D_PARTWILD will automatically use the first + * partition within the slice. * + * For both MBR and GPT, to automatically find the 'best' slice and partition, + * set d_slice to D_SLICEWILD. This uses the partition type to decide which + * partition to use according to the following list of preferences: + * * FreeBSD (active) * FreeBSD (inactive) * Linux (active) @@ -80,6 +83,12 @@ #ifndef _DISK_H #define _DISK_H + +#define D_SLICENONE -1 +#define D_SLICEWILD 0 +#define D_PARTNONE -1 +#define D_PARTWILD -2 +#define D_PARTISGPT 255 struct disk_devdesc { struct devdesc dd; /* Must be first. */ Modified: stable/12/stand/efi/libefi/efipart.c ============================================================================== --- stable/12/stand/efi/libefi/efipart.c Thu Oct 24 03:51:33 2019 (r354005) +++ stable/12/stand/efi/libefi/efipart.c Thu Oct 24 03:52:32 2019 (r354006) @@ -748,8 +748,8 @@ efipart_print_common(struct devsw *dev, pdinfo_list_t pd->pd_blkio = blkio; pd_dev.dd.d_dev = dev; pd_dev.dd.d_unit = pd->pd_unit; - pd_dev.d_slice = -1; - pd_dev.d_partition = -1; + pd_dev.d_slice = D_SLICENONE; + pd_dev.d_partition = D_PARTNONE; ret = disk_open(&pd_dev, blkio->Media->BlockSize * (blkio->Media->LastBlock + 1), blkio->Media->BlockSize); Modified: stable/12/stand/efi/loader/main.c ============================================================================== --- stable/12/stand/efi/loader/main.c Thu Oct 24 03:51:33 2019 (r354005) +++ stable/12/stand/efi/loader/main.c Thu Oct 24 03:52:32 2019 (r354006) @@ -220,12 +220,12 @@ set_currdev_pdinfo(pdinfo_t *dp) 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; + currdev.d_slice = D_SLICENONE; + currdev.d_partition = D_PARTNONE; } else { currdev.dd.d_unit = dp->pd_parent->pd_unit; currdev.d_slice = dp->pd_unit; - currdev.d_partition = 255; /* Assumes GPT */ + currdev.d_partition = D_PARTISGPT; /* XXX Assumes GPT */ } set_currdev_devdesc((struct devdesc *)&currdev); } else { Modified: stable/12/stand/i386/libi386/biosdisk.c ============================================================================== --- stable/12/stand/i386/libi386/biosdisk.c Thu Oct 24 03:51:33 2019 (r354005) +++ stable/12/stand/i386/libi386/biosdisk.c Thu Oct 24 03:52:32 2019 (r354006) @@ -691,8 +691,8 @@ bd_print_common(struct devsw *dev, bdinfo_list_t *bdi, devd.dd.d_dev = dev; devd.dd.d_unit = i; - devd.d_slice = -1; - devd.d_partition = -1; + devd.d_slice = D_SLICENONE; + devd.d_partition = D_PARTNONE; if (disk_open(&devd, bd->bd_sectorsize * bd->bd_sectors, bd->bd_sectorsize) == 0) { @@ -745,8 +745,8 @@ bd_disk_get_sectors(struct disk_devdesc *dev) disk.dd.d_dev = dev->dd.d_dev; disk.dd.d_unit = dev->dd.d_unit; - disk.d_slice = -1; - disk.d_partition = -1; + disk.d_slice = D_SLICENONE; + disk.d_partition = D_PARTNONE; disk.d_offset = 0; size = bd->bd_sectors * bd->bd_sectorsize; Modified: stable/12/stand/libsa/zfs/zfs.c ============================================================================== --- stable/12/stand/libsa/zfs/zfs.c Thu Oct 24 03:51:33 2019 (r354005) +++ stable/12/stand/libsa/zfs/zfs.c Thu Oct 24 03:52:32 2019 (r354006) @@ -590,7 +590,7 @@ zfs_probe_dev(const char *devname, uint64_t *pool_guid int slice = dev->d_slice; free(dev); - if (partition != -1 && slice != -1) { + if (partition != D_PARTNONE && slice != D_SLICENONE) { ret = zfs_probe(pa.fd, pool_guid); if (ret == 0) return (0); Modified: stable/12/stand/mips/beri/loader/beri_disk_cfi.c ============================================================================== --- stable/12/stand/mips/beri/loader/beri_disk_cfi.c Thu Oct 24 03:51:33 2019 (r354005) +++ stable/12/stand/mips/beri/loader/beri_disk_cfi.c Thu Oct 24 03:52:32 2019 (r354006) @@ -129,8 +129,8 @@ beri_cfi_disk_print(int verbose) return (ret); dev.dd.d_dev = &beri_cfi_disk; dev.dd.d_unit = 0; - dev.d_slice = -1; - dev.d_partition = -1; + dev.d_slice = D_SLICENONE; + dev.d_partition = D_PARTNONE; if (disk_open(&dev, cfi_get_mediasize(), cfi_get_sectorsize()) == 0) { snprintf(line, sizeof(line), " cfi%d", 0); ret = disk_print(&dev, line, verbose); Modified: stable/12/stand/mips/beri/loader/beri_disk_sdcard.c ============================================================================== --- stable/12/stand/mips/beri/loader/beri_disk_sdcard.c Thu Oct 24 03:51:33 2019 (r354005) +++ stable/12/stand/mips/beri/loader/beri_disk_sdcard.c Thu Oct 24 03:52:32 2019 (r354006) @@ -135,8 +135,8 @@ beri_sdcard_disk_print(int verbose) return (ret); dev.dd.d_dev = &beri_sdcard_disk; dev.dd.d_unit = 0; - dev.d_slice = -1; - dev.d_partition = -1; + dev.d_slice = D_SLICENONE; + dev.d_partition = D_PARTNONE; if (disk_open(&dev, altera_sdcard_get_mediasize(), altera_sdcard_get_sectorsize()) == 0) { snprintf(line, sizeof(line), " sdcard%d", 0); Modified: stable/12/stand/uboot/common/main.c ============================================================================== --- stable/12/stand/uboot/common/main.c Thu Oct 24 03:51:33 2019 (r354005) +++ stable/12/stand/uboot/common/main.c Thu Oct 24 03:52:32 2019 (r354006) @@ -213,8 +213,8 @@ get_load_device(int *type, int *unit, int *slice, int *type = DEV_TYP_NONE; *unit = -1; - *slice = 0; - *partition = -1; + *slice = D_SLICEWILD; + *partition = D_PARTWILD; devstr = ub_env_get("loaderdev"); if (devstr == NULL) { @@ -295,7 +295,7 @@ get_load_device(int *type, int *unit, int *slice, int if (p == endp) { *type = DEV_TYP_NONE; *unit = -1; - *slice = 0; + *slice = D_SLICEWILD; return; } @@ -309,7 +309,7 @@ get_load_device(int *type, int *unit, int *slice, int if (*p != '.') { *type = DEV_TYP_NONE; *unit = -1; - *slice = 0; + *slice = D_SLICEWILD; return; } @@ -329,8 +329,8 @@ get_load_device(int *type, int *unit, int *slice, int /* Junk beyond partition number. */ *type = DEV_TYP_NONE; *unit = -1; - *slice = 0; - *partition = -1; + *slice = D_SLICEWILD; + *partition = D_PARTWILD; } static void @@ -339,15 +339,20 @@ print_disk_probe_info() char slice[32]; char partition[32]; - if (currdev.d_disk.d_slice > 0) - sprintf(slice, "%d", currdev.d_disk.d_slice); + if (currdev.d_disk.d_slice == D_SLICENONE) + strlcpy(slice, "", sizeof(slice)); + else if (currdev.d_disk.d_slice == D_SLICEWILD) + strlcpy(slice, "", sizeof(slice)); else - strcpy(slice, ""); + snprintf(slice, sizeof(slice), "%d", currdev.d_disk.d_slice); - if (currdev.d_disk.d_partition >= 0) - sprintf(partition, "%d", currdev.d_disk.d_partition); + if (currdev.d_disk.d_partition == D_PARTNONE) + strlcpy(partition, "", sizeof(partition)); + else if (currdev.d_disk.d_partition == D_PARTWILD) + strlcpy(partition, "", sizeof(partition)); else - strcpy(partition, ""); + snprintf(partition, sizeof(partition), "%d", + currdev.d_disk.d_partition); printf(" Checking unit=%d slice=%s partition=%s...", currdev.dd.d_unit, slice, partition); Modified: stable/12/stand/uboot/lib/disk.c ============================================================================== --- stable/12/stand/uboot/lib/disk.c Thu Oct 24 03:51:33 2019 (r354005) +++ stable/12/stand/uboot/lib/disk.c Thu Oct 24 03:52:32 2019 (r354006) @@ -254,8 +254,8 @@ stor_print(int verbose) for (i = 0; i < stor_info_no; i++) { dev.dd.d_dev = &uboot_storage; dev.dd.d_unit = i; - dev.d_slice = -1; - dev.d_partition = -1; + dev.d_slice = D_SLICENONE; + dev.d_partition = D_PARTNONE; snprintf(line, sizeof(line), "\tdisk%d (%s)\n", i, ub_stor_type(SI(&dev).type)); if ((ret = pager_output(line)) != 0) Modified: stable/12/stand/usb/storage/umass_loader.c ============================================================================== --- stable/12/stand/usb/storage/umass_loader.c Thu Oct 24 03:51:33 2019 (r354005) +++ stable/12/stand/usb/storage/umass_loader.c Thu Oct 24 03:52:32 2019 (r354006) @@ -196,8 +196,8 @@ umass_disk_print(int verbose) return (ret); dev.d_dev = &umass_disk; dev.d_unit = 0; - dev.d_slice = -1; - dev.d_partition = -1; + dev.d_slice = D_SLICENONE; + dev.d_partition = D_PARTNONE; if (umass_disk_open_sub(&dev) == 0) { ret = disk_print(&dev, " umass0", verbose); Modified: stable/12/stand/userboot/userboot/main.c ============================================================================== --- stable/12/stand/userboot/userboot/main.c Thu Oct 24 03:51:33 2019 (r354005) +++ stable/12/stand/userboot/userboot/main.c Thu Oct 24 03:52:32 2019 (r354006) @@ -240,15 +240,15 @@ extract_currdev(void) if (userboot_disk_maxunit > 0) { dev.dd.d_dev = &userboot_disk; dev.dd.d_unit = 0; - dev.d_slice = 0; - dev.d_partition = 0; + dev.d_slice = D_SLICEWILD; + dev.d_partition = D_PARTWILD; /* * If we cannot auto-detect the partition type then * access the disk as a raw device. */ if (dev.dd.d_dev->dv_open(NULL, &dev)) { - dev.d_slice = -1; - dev.d_partition = -1; + dev.d_slice = D_SLICENONE; + dev.d_partition = D_PARTNONE; } dd = &dev.dd; } else { Modified: stable/12/stand/userboot/userboot/userboot_disk.c ============================================================================== --- stable/12/stand/userboot/userboot/userboot_disk.c Thu Oct 24 03:51:33 2019 (r354005) +++ stable/12/stand/userboot/userboot/userboot_disk.c Thu Oct 24 03:52:32 2019 (r354006) @@ -137,8 +137,8 @@ userdisk_print(int verbose) break; dev.dd.d_dev = &userboot_disk; dev.dd.d_unit = i; - dev.d_slice = -1; - dev.d_partition = -1; + dev.d_slice = D_SLICENONE; + dev.d_partition = D_PARTNONE; if (disk_open(&dev, ud_info[i].mediasize, ud_info[i].sectorsize) == 0) { snprintf(line, sizeof(line), " disk%d", i); From owner-svn-src-all@freebsd.org Thu Oct 24 02:28:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 047F11721A2; Thu, 24 Oct 2019 02:28:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zB4X5GCsz47nZ; Thu, 24 Oct 2019 02:28:28 +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 9880273D1; Thu, 24 Oct 2019 02:28:28 +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 x9O2SS7p081604; Thu, 24 Oct 2019 02:28:28 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2SSCN081603; Thu, 24 Oct 2019 02:28:28 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240228.x9O2SSCN081603@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:28:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353972 - stable/12/stand/i386/libfirewire X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/i386/libfirewire X-SVN-Commit-Revision: 353972 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:28:29 -0000 Author: kevans Date: Thu Oct 24 02:28:28 2019 New Revision: 353972 URL: https://svnweb.freebsd.org/changeset/base/353972 Log: MFC r342865: biospci_write_config args were backwards biospci_write_config args swapped length and value to write. Some hardware coped just fine, while other hardware had issues. PR: 155441 Modified: stable/12/stand/i386/libfirewire/firewire.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/i386/libfirewire/firewire.c ============================================================================== --- stable/12/stand/i386/libfirewire/firewire.c Thu Oct 24 02:27:16 2019 (r353971) +++ stable/12/stand/i386/libfirewire/firewire.c Thu Oct 24 02:28:28 2019 (r353972) @@ -107,9 +107,9 @@ fw_probe(int index, struct fwohci_softc *sc) } biospci_write_config(sc->locator, - 0x4 /* command */, - 0x6 /* enable bus master and memory mapped I/O */, - BIOSPCI_16BITS); + 0x4 /* command */, + BIOSPCI_16BITS, + 0x6 /* enable bus master and memory mapped I/O */); biospci_read_config(sc->locator, 0x00 /*devid*/, BIOSPCI_32BITS, &sc->devid); From owner-svn-src-all@freebsd.org Thu Oct 24 02:49:14 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A942175D13; Thu, 24 Oct 2019 02:49:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zBXV25p4z4C9G; Thu, 24 Oct 2019 02:49:14 +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 2723F774C; Thu, 24 Oct 2019 02:49:14 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O2nEtR093829; Thu, 24 Oct 2019 02:49:14 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2nDEi093828; Thu, 24 Oct 2019 02:49:13 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240249.x9O2nDEi093828@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:49:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353981 - stable/12/stand/i386/zfsboot X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/i386/zfsboot X-SVN-Commit-Revision: 353981 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:49:14 -0000 Author: kevans Date: Thu Oct 24 02:49:13 2019 New Revision: 353981 URL: https://svnweb.freebsd.org/changeset/base/353981 Log: MFC r346969: zfsboot: to detect disk size, use GPT information first If we do have GPT on disk, read the disk size from it and do not call int13. Since int13 does report bogus informatiopn too often, rather trust the partition table. We are using the same strategy with loader. Modified: stable/12/stand/i386/zfsboot/zfsboot.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/i386/zfsboot/zfsboot.c ============================================================================== --- stable/12/stand/i386/zfsboot/zfsboot.c Thu Oct 24 02:46:36 2019 (r353980) +++ stable/12/stand/i386/zfsboot/zfsboot.c Thu Oct 24 02:49:13 2019 (r353981) @@ -478,6 +478,33 @@ copy_dsk(struct zfsdsk *zdsk) } /* + * Get disk size from GPT. + */ +static uint64_t +drvsize_gpt(struct dsk *dskp) +{ +#ifdef GPT + struct gpt_hdr hdr; + char *sec; + + sec = dmadat->secbuf; + if (drvread(dskp, sec, 1, 1)) + return (0); + + memcpy(&hdr, sec, sizeof(hdr)); + if (memcmp(hdr.hdr_sig, GPT_HDR_SIG, sizeof(hdr.hdr_sig)) != 0 || + hdr.hdr_lba_self != 1 || hdr.hdr_revision < 0x00010000 || + hdr.hdr_entsz < sizeof(struct gpt_ent) || + DEV_BSIZE % hdr.hdr_entsz != 0) { + return (0); + } + return (hdr.hdr_lba_alt + 1); +#else + return (0); +#endif +} + +/* * Get disk size from eax=0x800 and 0x4800. We need to probe both * because 0x4800 may not be available and we would like to get more * or less correct disk size - if it is possible at all. @@ -492,6 +519,11 @@ drvsize_ext(struct zfsdsk *zdsk) int cyl, hds, sec; dskp = &zdsk->dsk; + + /* Try to read disk size from GPT */ + size = drvsize_gpt(dskp); + if (size != 0) + return (size); v86.ctl = V86_FLAGS; v86.addr = 0x13; From owner-svn-src-all@freebsd.org Thu Oct 24 02:25:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8BDE71718FE; Thu, 24 Oct 2019 02:25: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zB1737stz476y; Thu, 24 Oct 2019 02:25:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4ACE773CE; Thu, 24 Oct 2019 02:25:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O2PVFc081312; Thu, 24 Oct 2019 02:25:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2PVXM081311; Thu, 24 Oct 2019 02:25:31 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240225.x9O2PVXM081311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:25:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353969 - stable/12/stand X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand X-SVN-Commit-Revision: 353969 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:25:31 -0000 Author: kevans Date: Thu Oct 24 02:25:30 2019 New Revision: 353969 URL: https://svnweb.freebsd.org/changeset/base/353969 Log: MFC r341433: Move inclusion of src.opts.mk later. src.opts.mk includes bsd.own.mk. This in turn defines CTFCONVERT_CMD depending on the MK_CTF value. We then set MK_CTF to no, which has no real effect. The solution is to set all the MK_foo values before including src.opts.mk. This should stop the cdboot binary from exploding in size for releases built WITH_CTF=yes in src.conf. Modified: stable/12/stand/defs.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/defs.mk ============================================================================== --- stable/12/stand/defs.mk Thu Oct 24 02:22:52 2019 (r353968) +++ stable/12/stand/defs.mk Thu Oct 24 02:25:30 2019 (r353969) @@ -1,12 +1,12 @@ # $FreeBSD$ -.include - -WARNS?=1 - .if !defined(__BOOT_DEFS_MK__) __BOOT_DEFS_MK__=${MFILE} +# We need to define all the MK_ options before including src.opts.mk +# because it includes bsd.own.mk which needs the right MK_ values, +# espeically MK_CTF. + MK_CTF= no MK_SSP= no MK_PROFILE= no @@ -15,6 +15,10 @@ MAN= NO_PIC= INTERNALLIB= .endif + +.include + +WARNS?= 1 BOOTSRC= ${SRCTOP}/stand EFISRC= ${BOOTSRC}/efi From owner-svn-src-all@freebsd.org Thu Oct 24 03:21:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A53D153AE1; Thu, 24 Oct 2019 03:21: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCFl3YzXz4HnS; Thu, 24 Oct 2019 03:21:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5E7F67D4B; Thu, 24 Oct 2019 03:21:31 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O3LVQv015736; Thu, 24 Oct 2019 03:21:31 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3LUTP015733; Thu, 24 Oct 2019 03:21:30 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240321.x9O3LUTP015733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:21:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353991 - in stable/12: stand/common stand/efi/loader sys/kern sys/sys X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12: stand/common stand/efi/loader sys/kern sys/sys X-SVN-Commit-Revision: 353991 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:21:31 -0000 Author: kevans Date: Thu Oct 24 03:21:30 2019 New Revision: 353991 URL: https://svnweb.freebsd.org/changeset/base/353991 Log: MFC r349343: Use a common kernel path between loader and kernel Modified: stable/12/stand/common/paths.h stable/12/stand/efi/loader/main.c stable/12/sys/kern/kern_mib.c stable/12/sys/sys/boot.h Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/paths.h ============================================================================== --- stable/12/stand/common/paths.h Thu Oct 24 03:20:27 2019 (r353990) +++ stable/12/stand/common/paths.h Thu Oct 24 03:21:30 2019 (r353991) @@ -29,11 +29,14 @@ #ifndef _PATHS_H_ #define _PATHS_H_ +#include /* To get kernel path */ + #define PATH_DOTCONFIG "/boot.config" #define PATH_CONFIG "/boot/config" #define PATH_LOADER "/boot/loader" #define PATH_LOADER_EFI "/boot/loader.efi" #define PATH_LOADER_ZFS "/boot/zfsloader" -#define PATH_KERNEL "/boot/kernel/kernel" +#define PATH_LOADER_CONF "/boot/loader.conf" +#define PATH_DEFAULTS_LOADER_CONF "/boot/defaults/loader.conf" #endif /* _PATHS_H_ */ Modified: stable/12/stand/efi/loader/main.c ============================================================================== --- stable/12/stand/efi/loader/main.c Thu Oct 24 03:20:27 2019 (r353990) +++ stable/12/stand/efi/loader/main.c Thu Oct 24 03:21:30 2019 (r353991) @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -237,8 +238,8 @@ sanity_check_currdev(void) { struct stat st; - return (stat("/boot/defaults/loader.conf", &st) == 0 || - stat("/boot/kernel/kernel", &st) == 0); + return (stat(PATH_DEFAULTS_LOADER_CONF, &st) == 0 || + stat(PATH_KERNEL, &st) == 0); } #ifdef EFI_ZFS_BOOT Modified: stable/12/sys/kern/kern_mib.c ============================================================================== --- stable/12/sys/kern/kern_mib.c Thu Oct 24 03:20:27 2019 (r353990) +++ stable/12/sys/kern/kern_mib.c Thu Oct 24 03:21:30 2019 (r353991) @@ -136,7 +136,7 @@ SYSCTL_INT(_kern, KERN_SAVED_IDS, saved_ids, CTLFLAG_R SYSCTL_NULL_INT_PTR, 0, "Whether saved set-group/user ID is available"); #endif -char kernelname[MAXPATHLEN] = "/boot/kernel/kernel"; /* XXX bloat */ +char kernelname[MAXPATHLEN] = PATH_KERNEL; /* XXX bloat */ SYSCTL_STRING(_kern, KERN_BOOTFILE, bootfile, CTLFLAG_RW | CTLFLAG_MPSAFE, kernelname, sizeof kernelname, "Name of kernel file booted"); Modified: stable/12/sys/sys/boot.h ============================================================================== --- stable/12/sys/sys/boot.h Thu Oct 24 03:20:27 2019 (r353990) +++ stable/12/sys/sys/boot.h Thu Oct 24 03:21:30 2019 (r353991) @@ -32,6 +32,8 @@ #ifndef _SYS_BOOT_H_ #define _SYS_BOOT_H_ +#define PATH_KERNEL "/boot/kernel/kernel" + int boot_env_to_howto(void); void boot_howto_to_env(int howto); int boot_parse_arg(char *v); From owner-svn-src-all@freebsd.org Thu Oct 24 02:43:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4716D174DDA; Thu, 24 Oct 2019 02:43:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zBQ51tDdz4BNn; Thu, 24 Oct 2019 02:43:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 225F57745; Thu, 24 Oct 2019 02:43:41 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O2hfB8093434; Thu, 24 Oct 2019 02:43:41 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2hcbK093423; Thu, 24 Oct 2019 02:43:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240243.x9O2hcbK093423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:43:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353979 - in stable/12/stand/efi: boot1 include libefi loader X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand/efi: boot1 include libefi loader X-SVN-Commit-Revision: 353979 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:43:41 -0000 Author: kevans Date: Thu Oct 24 02:43:38 2019 New Revision: 353979 URL: https://svnweb.freebsd.org/changeset/base/353979 Log: MFC r346345-r346346, r346353, r346407-r346409, r346430, r346573, r346575 r346345: Add a more generic efi_setenv function. efi_setenv allows any UEFI variable to be set. r346346: Add efi_delenv Add an interface to remove / delete UEFI variables. r346353: Minor tweak to the debug Make it clear we're loading from UFS. r346407: Add define for CONST. Newer interfaces take CONST parameters, so define CONST to minimize differences between our headers and the standards docs. r346408: Add UEFI definitions related to converting string to DEVICE_PATH Add definitions from UEFI 2.7 Errata B standards doc for converting a text string to a device path. Added clearly missing 'e' at the end of Device to resolve mismatch in that document in EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL element names. r346409: Add wrapper functions to convert strings to EFI_DEVICE_PATH In anticipation of new functionality, create routines to convert char * and a CHAR16 * to a EFI_DEVICE_PATH EFI_DEVICE_PATH *efi_name_to_devpath(const char *path); EFI_DEVICE_PATH *efi_name_to_devpath16(CHAR16 *path); void efi_devpath_free(EFI_DEVICE_PATH *dp); The first two return an EFI_DEVICE_PATH for the passed in paths. The third frees up the storage the first two return when the caller is done with it. r346430: Start to reduce the number of #ifdef EFI_ZFS_BOOT There's a number of EFI_ZFS_BOOT #ifdefs that aren't needed, or can be eliminated with some trivial #defines. Remove the EFI_ZFS_BOOT ifdefs that aren't needed. Replace libzfs.h include which is not safe to include without EFI_ZFS_BOOT with efizfs.h which is and now conditionally included libzfs.h. Define efizfs_set_preferred away and define efi_zfs_probe to NULL when ZFS is compiled out. r346573: Move setting of console earlier in boot. There's no reason we can't setup the console first thing after the arch flags are setup. We set it undconditionally to efi. This is a good default, and will get us error messages to at least the efi console no matter what. This will also prime the pump so that as other variables are set, they will take effect and the console will be correct as soon as those env vars are set. Also remove the redundant setting of the console to efi when we know the console is efi. r346575: Create boot_img as a global variable Get the information from the image that we're booting and store it in a global variable. Prefer using this to passing it around. Remove the special case for zfs that set the preferred boot handle by having it uses this global variable diretly. Modified: stable/12/stand/efi/boot1/ufs_module.c stable/12/stand/efi/include/efi.h stable/12/stand/efi/include/efidef.h stable/12/stand/efi/include/efidevp.h stable/12/stand/efi/include/efilib.h stable/12/stand/efi/include/efizfs.h stable/12/stand/efi/libefi/devicename.c stable/12/stand/efi/libefi/devpath.c stable/12/stand/efi/libefi/efienv.c stable/12/stand/efi/libefi/efizfs.c stable/12/stand/efi/loader/conf.c stable/12/stand/efi/loader/main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/boot1/ufs_module.c ============================================================================== --- stable/12/stand/efi/boot1/ufs_module.c Thu Oct 24 02:36:42 2019 (r353978) +++ stable/12/stand/efi/boot1/ufs_module.c Thu Oct 24 02:43:38 2019 (r353979) @@ -148,7 +148,7 @@ load(const char *filepath, dev_info_t *dev, void **buf #ifdef EFI_DEBUG { CHAR16 *text = efi_devpath_name(dev->devpath); - DPRINTF("Loading '%s' from %S\n", filepath, text); + DPRINTF("UFS Loading '%s' from %S\n", filepath, text); efi_free_devpath_name(text); } #endif Modified: stable/12/stand/efi/include/efi.h ============================================================================== --- stable/12/stand/efi/include/efi.h Thu Oct 24 02:36:42 2019 (r353978) +++ stable/12/stand/efi/include/efi.h Thu Oct 24 02:43:38 2019 (r353979) @@ -62,6 +62,11 @@ Revision History #include "efiuga.h" /* + * Global variables + */ +extern EFI_LOADED_IMAGE *boot_img; + +/* * FreeBSD UUID */ #define FREEBSD_BOOT_VAR_GUID \ Modified: stable/12/stand/efi/include/efidef.h ============================================================================== --- stable/12/stand/efi/include/efidef.h Thu Oct 24 02:36:42 2019 (r353978) +++ stable/12/stand/efi/include/efidef.h Thu Oct 24 02:43:38 2019 (r353979) @@ -63,6 +63,7 @@ typedef VOID *EFI_EVENT; #define IN #define OUT #define OPTIONAL + #define CONST const #endif Modified: stable/12/stand/efi/include/efidevp.h ============================================================================== --- stable/12/stand/efi/include/efidevp.h Thu Oct 24 02:36:42 2019 (r353978) +++ stable/12/stand/efi/include/efidevp.h Thu Oct 24 02:43:38 2019 (r353979) @@ -433,6 +433,9 @@ typedef union { #define EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID \ { 0x8b843e20, 0x8132, 0x4852, { 0x90, 0xcc, 0x55, 0x1a, 0x4e, 0x4a, 0x7f, 0x1c } } +#define EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID \ + { 0x05c99a21, 0xc70f, 0x4ad2, { 0x8a, 0x5f, 0x35, 0xdf, 0x33, 0x43, 0xf5, 0x1e } } + INTERFACE_DECL(_EFI_DEVICE_PATH_PROTOCOL); typedef @@ -455,6 +458,23 @@ typedef struct _EFI_DEVICE_PATH_TO_TEXT_PROTOCOL { EFI_DEVICE_PATH_TO_TEXT_NODE ConvertDeviceNodeToText; EFI_DEVICE_PATH_TO_TEXT_PATH ConvertDevicePathToText; } EFI_DEVICE_PATH_TO_TEXT_PROTOCOL; + +typedef +struct _EFI_DEVICE_PATH* +(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_NODE) ( + IN CONST CHAR16* TextDeviceNode + ); +typedef +struct _EFI_DEVICE_PATH* +(EFIAPI *EFI_DEVICE_PATH_FROM_TEXT_PATH) ( + IN CONST CHAR16* TextDevicePath + ); + + +typedef struct _EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL { + EFI_DEVICE_PATH_FROM_TEXT_NODE ConvertTextToDeviceNode; + EFI_DEVICE_PATH_FROM_TEXT_PATH ConvertTextToDevicePath; +} EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL; #pragma pack() Modified: stable/12/stand/efi/include/efilib.h ============================================================================== --- stable/12/stand/efi/include/efilib.h Thu Oct 24 02:36:42 2019 (r353978) +++ stable/12/stand/efi/include/efilib.h Thu Oct 24 02:43:38 2019 (r353979) @@ -94,6 +94,9 @@ void efi_free_devpath_name(CHAR16 *); EFI_DEVICE_PATH *efi_devpath_to_media_path(EFI_DEVICE_PATH *); UINTN efi_devpath_length(EFI_DEVICE_PATH *); EFI_HANDLE efi_devpath_to_handle(EFI_DEVICE_PATH *path, EFI_HANDLE *handles, unsigned nhandles); +EFI_DEVICE_PATH *efi_name_to_devpath(const char *path); +EFI_DEVICE_PATH *efi_name_to_devpath16(CHAR16 *path); +void efi_devpath_free(EFI_DEVICE_PATH *dp); int efi_status_to_errno(EFI_STATUS); EFI_STATUS errno_to_efi_status(int errno); @@ -124,9 +127,11 @@ void cpy16to8(const CHAR16 *, char *, size_t); * the loader setting / getting FreeBSD specific variables. */ +EFI_STATUS efi_delenv(EFI_GUID *guid, const char *varname); EFI_STATUS efi_freebsd_getenv(const char *v, void *data, __size_t *len); EFI_STATUS efi_getenv(EFI_GUID *g, const char *v, void *data, __size_t *len); EFI_STATUS efi_global_getenv(const char *v, void *data, __size_t *len); +EFI_STATUS efi_setenv(EFI_GUID *guid, const char *varname, UINT32 attr, void *data, __size_t len); EFI_STATUS efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr); /* guids and names */ Modified: stable/12/stand/efi/include/efizfs.h ============================================================================== --- stable/12/stand/efi/include/efizfs.h Thu Oct 24 02:36:42 2019 (r353978) +++ stable/12/stand/efi/include/efizfs.h Thu Oct 24 02:43:38 2019 (r353979) @@ -33,6 +33,8 @@ #define _EFIZFS_H_ #ifdef EFI_ZFS_BOOT +#include + typedef STAILQ_HEAD(zfsinfo_list, zfsinfo) zfsinfo_list_t; typedef struct zfsinfo @@ -48,8 +50,9 @@ void efi_zfs_probe(void); EFI_HANDLE efizfs_get_handle_by_guid(uint64_t); bool efizfs_get_guid_by_handle(EFI_HANDLE, uint64_t *); zfsinfo_list_t *efizfs_get_zfsinfo_list(void); -void efizfs_set_preferred(EFI_HANDLE); +#else +#define efi_zfs_probe NULL #endif #endif Modified: stable/12/stand/efi/libefi/devicename.c ============================================================================== --- stable/12/stand/efi/libefi/devicename.c Thu Oct 24 02:36:42 2019 (r353978) +++ stable/12/stand/efi/libefi/devicename.c Thu Oct 24 02:43:38 2019 (r353979) @@ -34,12 +34,10 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef EFI_ZFS_BOOT -#include -#endif #include #include +#include static int efi_parsedev(struct devdesc **, const char *, const char **); Modified: stable/12/stand/efi/libefi/devpath.c ============================================================================== --- stable/12/stand/efi/libefi/devpath.c Thu Oct 24 02:36:42 2019 (r353978) +++ stable/12/stand/efi/libefi/devpath.c Thu Oct 24 02:43:38 2019 (r353979) @@ -29,12 +29,15 @@ __FBSDID("$FreeBSD$"); #include #include +#include static EFI_GUID ImageDevicePathGUID = EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID; static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; static EFI_GUID DevicePathToTextGUID = EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID; -static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *textProtocol; +static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *toTextProtocol; +static EFI_GUID DevicePathFromTextGUID = EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID; +static EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *fromTextProtocol; EFI_DEVICE_PATH * efi_lookup_image_devpath(EFI_HANDLE handle) @@ -65,22 +68,20 @@ efi_lookup_devpath(EFI_HANDLE handle) CHAR16 * efi_devpath_name(EFI_DEVICE_PATH *devpath) { - static int once = 1; EFI_STATUS status; if (devpath == NULL) return (NULL); - if (once) { + if (toTextProtocol == NULL) { status = BS->LocateProtocol(&DevicePathToTextGUID, NULL, - (VOID **)&textProtocol); + (VOID **)&toTextProtocol); if (EFI_ERROR(status)) - textProtocol = NULL; - once = 0; + toTextProtocol = NULL; } - if (textProtocol == NULL) + if (toTextProtocol == NULL) return (NULL); - return (textProtocol->ConvertDevicePathToText(devpath, TRUE, TRUE)); + return (toTextProtocol->ConvertDevicePathToText(devpath, TRUE, TRUE)); } void @@ -88,6 +89,46 @@ efi_free_devpath_name(CHAR16 *text) { BS->FreePool(text); +} + +EFI_DEVICE_PATH * +efi_name_to_devpath(const char *path) +{ + EFI_DEVICE_PATH *devpath; + CHAR16 *uv; + size_t ul; + + uv = NULL; + if (utf8_to_ucs2(path, &uv, &ul) != 0) + return (NULL); + devpath = efi_name_to_devpath16(uv); + free(uv); + return (devpath); +} + +EFI_DEVICE_PATH * +efi_name_to_devpath16(CHAR16 *path) +{ + EFI_STATUS status; + + if (path == NULL) + return (NULL); + if (fromTextProtocol == NULL) { + status = BS->LocateProtocol(&DevicePathFromTextGUID, NULL, + (VOID **)&fromTextProtocol); + if (EFI_ERROR(status)) + fromTextProtocol = NULL; + } + if (fromTextProtocol == NULL) + return (NULL); + + return (fromTextProtocol->ConvertTextToDevicePath(path)); +} + +void efi_devpath_free(EFI_DEVICE_PATH *devpath) +{ + + BS->FreePool(devpath); } EFI_DEVICE_PATH * Modified: stable/12/stand/efi/libefi/efienv.c ============================================================================== --- stable/12/stand/efi/libefi/efienv.c Thu Oct 24 02:36:42 2019 (r353978) +++ stable/12/stand/efi/libefi/efienv.c Thu Oct 24 02:43:38 2019 (r353979) @@ -68,7 +68,26 @@ efi_freebsd_getenv(const char *v, void *data, size_t * return (efi_getenv(&FreeBSDBootVarGUID, v, data, len)); } +/* + * efi_setenv -- Sets an env variable. + */ EFI_STATUS +efi_setenv(EFI_GUID *guid, const char *varname, UINT32 attr, void *data, __size_t len) +{ + EFI_STATUS rv; + CHAR16 *uv; + size_t ul; + + uv = NULL; + if (utf8_to_ucs2(varname, &uv, &ul) != 0) + return (EFI_OUT_OF_RESOURCES); + + rv = RS->SetVariable(uv, guid, attr, len, data); + free(uv); + return (rv); +} + +EFI_STATUS efi_setenv_freebsd_wcs(const char *varname, CHAR16 *valstr) { CHAR16 *var = NULL; @@ -84,3 +103,21 @@ efi_setenv_freebsd_wcs(const char *varname, CHAR16 *va return (rv); } +/* + * efi_delenv -- deletes the specified env variable + */ +EFI_STATUS +efi_delenv(EFI_GUID *guid, const char *name) +{ + CHAR16 *var; + size_t len; + EFI_STATUS rv; + + var = NULL; + if (utf8_to_ucs2(name, &var, &len) != 0) + return (EFI_OUT_OF_RESOURCES); + + rv = RS->SetVariable(var, guid, 0, 0, NULL); + free(var); + return rv; +} Modified: stable/12/stand/efi/libefi/efizfs.c ============================================================================== --- stable/12/stand/efi/libefi/efizfs.c Thu Oct 24 02:36:42 2019 (r353978) +++ stable/12/stand/efi/libefi/efizfs.c Thu Oct 24 02:43:38 2019 (r353979) @@ -45,14 +45,6 @@ static zfsinfo_list_t zfsinfo; uint64_t pool_guid; -static EFI_HANDLE preferred; - -void -efizfs_set_preferred(EFI_HANDLE h) -{ - preferred = h; -} - zfsinfo_list_t * efizfs_get_zfsinfo_list(void) { @@ -122,7 +114,7 @@ efi_zfs_probe(void) efipart_hddev.dv_name, hd->pd_unit, pd->pd_unit); if (zfs_probe_dev(devname, &guid) == 0) { insert_zfs(pd->pd_handle, guid); - if (pd->pd_handle == preferred) + if (pd->pd_handle == boot_img->DeviceHandle) pool_guid = guid; } Modified: stable/12/stand/efi/loader/conf.c ============================================================================== --- stable/12/stand/efi/loader/conf.c Thu Oct 24 02:36:42 2019 (r353978) +++ stable/12/stand/efi/loader/conf.c Thu Oct 24 02:43:38 2019 (r353979) @@ -31,9 +31,7 @@ __FBSDID("$FreeBSD$"); #include #include #include -#ifdef EFI_ZFS_BOOT -#include -#endif +#include struct devsw *devsw[] = { &efipart_fddev, Modified: stable/12/stand/efi/loader/main.c ============================================================================== --- stable/12/stand/efi/loader/main.c Thu Oct 24 02:36:42 2019 (r353978) +++ stable/12/stand/efi/loader/main.c Thu Oct 24 02:43:38 2019 (r353979) @@ -50,10 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef EFI_ZFS_BOOT -#include #include "efizfs.h" -#endif #include "loader_efi.h" @@ -91,6 +88,11 @@ static int fail_timeout = 5; */ UINT16 boot_current; +/* + * Image that we booted from. + */ +EFI_LOADED_IMAGE *boot_img; + static bool has_keyboard(void) { @@ -303,7 +305,7 @@ fix_dosisms(char *p) enum { BOOT_INFO_OK = 0, BAD_CHOICE = 1, NOT_SPECIFIC = 2 }; static int -match_boot_info(EFI_LOADED_IMAGE *img __unused, char *boot_info, size_t bisz) +match_boot_info(char *boot_info, size_t bisz) { uint32_t attr; uint16_t fplen; @@ -451,7 +453,7 @@ match_boot_info(EFI_LOADED_IMAGE *img __unused, char * * a drop to the OK boot loader prompt is possible. */ static int -find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, bool is_last, +find_currdev(bool do_bootmgr, bool is_last, char *boot_info, size_t boot_info_sz) { pdinfo_t *dp, *pp; @@ -484,7 +486,7 @@ find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, b * loader.conf. */ if (do_bootmgr) { - rv = match_boot_info(img, boot_info, boot_info_sz); + rv = match_boot_info(boot_info, boot_info_sz); switch (rv) { case BOOT_INFO_OK: /* We found it */ return (0); @@ -517,7 +519,7 @@ find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, b * boot protocol to do so. We fail and let UEFI go on to * the next candidate. */ - dp = efiblk_get_pdinfo_by_handle(img->DeviceHandle); + dp = efiblk_get_pdinfo_by_handle(boot_img->DeviceHandle); if (dp != NULL) { text = efi_devpath_name(dp->pd_devpath); if (text != NULL) { @@ -556,7 +558,7 @@ find_currdev(EFI_LOADED_IMAGE *img, bool do_bootmgr, b * any of the nodes in that path match one of the enumerated * handles. Currently, this handle list is only for netboot. */ - if (efi_handle_lookup(img->DeviceHandle, &dev, &unit, &extra) == 0) { + if (efi_handle_lookup(boot_img->DeviceHandle, &dev, &unit, &extra) == 0) { set_currdev_devsw(dev, unit); if (sanity_check_currdev()) return (0); @@ -754,7 +756,6 @@ main(int argc, CHAR16 *argv[]) size_t sz, bosz = 0, bisz = 0; UINT16 boot_order[100]; char boot_info[4096]; - EFI_LOADED_IMAGE *img; char buf[32]; bool uefi_boot_mgr; @@ -763,33 +764,28 @@ main(int argc, CHAR16 *argv[]) archsw.arch_copyin = efi_copyin; archsw.arch_copyout = efi_copyout; archsw.arch_readin = efi_readin; -#ifdef EFI_ZFS_BOOT - /* Note this needs to be set before ZFS init. */ archsw.arch_zfs_probe = efi_zfs_probe; -#endif /* Get our loaded image protocol interface structure. */ - (void) OpenProtocolByHandle(IH, &imgid, (void **)&img); + (void) OpenProtocolByHandle(IH, &imgid, (void **)&boot_img); -#ifdef EFI_ZFS_BOOT - /* Tell ZFS probe code where we booted from */ - efizfs_set_preferred(img->DeviceHandle); -#endif + /* + * Chicken-and-egg problem; we want to have console output early, but + * some console attributes may depend on reading from eg. the boot + * device, which we can't do yet. We can use printf() etc. once this is + * done. So, we set it to the efi console, then call console init. This + * gets us printf early, but also primes the pump for all future console + * changes to take effect, regardless of where they come from. + */ + setenv("console", "efi", 1); + cons_probe(); + /* Init the time source */ efi_time_init(); has_kbd = has_keyboard(); /* - * XXX Chicken-and-egg problem; we want to have console output - * early, but some console attributes may depend on reading from - * eg. the boot device, which we can't do yet. We can use - * printf() etc. once this is done. - */ - setenv("console", "efi", 1); - cons_probe(); - - /* * Initialise the block cache. Set the upper limit. */ bcache_init(32768, 512); @@ -813,17 +809,15 @@ main(int argc, CHAR16 *argv[]) if ((howto & CON_MASK) == 0) { /* No override, uhowto is controlling and efi cons is perfect */ howto = howto | (uhowto & CON_MASK); - setenv("console", "efi", 1); } else if ((howto & CON_MASK) == (uhowto & CON_MASK)) { /* override matches what UEFI told us, efi console is perfect */ - setenv("console", "efi", 1); } else if ((uhowto & (CON_MASK)) != 0) { /* * We detected a serial console on ConOut. All possible * overrides include serial. We can't really override what efi * gives us, so we use it knowing it's the best choice. */ - setenv("console", "efi", 1); + /* Do nothing */ } else { /* * We detected some kind of serial in the override, but ConOut @@ -887,14 +881,14 @@ main(int argc, CHAR16 *argv[]) /* Determine the devpath of our image so we can prefer it. */ - text = efi_devpath_name(img->FilePath); + text = efi_devpath_name(boot_img->FilePath); if (text != NULL) { printf(" Load Path: %S\n", text); efi_setenv_freebsd_wcs("LoaderPath", text); efi_free_devpath_name(text); } - rv = OpenProtocolByHandle(img->DeviceHandle, &devid, (void **)&imgpath); + rv = OpenProtocolByHandle(boot_img->DeviceHandle, &devid, (void **)&imgpath); if (rv == EFI_SUCCESS) { text = efi_devpath_name(imgpath); if (text != NULL) { @@ -981,7 +975,7 @@ main(int argc, CHAR16 *argv[]) * the boot protocol and also allow an escape hatch for users wishing * to try something different. */ - if (find_currdev(img, uefi_boot_mgr, is_last, boot_info, bisz) != 0) + if (find_currdev(uefi_boot_mgr, is_last, boot_info, bisz) != 0) if (!interactive_interrupt("Failed to find bootable partition")) return (EFI_NOT_FOUND); From owner-svn-src-all@freebsd.org Thu Oct 24 02:30:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6B2161729F8; Thu, 24 Oct 2019 02:30:54 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zB7L2923z48BS; Thu, 24 Oct 2019 02:30:54 +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 168B973F6; Thu, 24 Oct 2019 02:30:54 +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 x9O2UrKM081815; Thu, 24 Oct 2019 02:30:53 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2UrRi081814; Thu, 24 Oct 2019 02:30:53 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240230.x9O2UrRi081814@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:30:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353973 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 353973 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:30:54 -0000 Author: kevans Date: Thu Oct 24 02:30:53 2019 New Revision: 353973 URL: https://svnweb.freebsd.org/changeset/base/353973 Log: Record MFC of r343911, MFC'd in r346718 Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-all@freebsd.org Thu Oct 24 03:32:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2BD10155778; Thu, 24 Oct 2019 03:32:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCTv0MGmz4Kbd; Thu, 24 Oct 2019 03:32:03 +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 E371D7F5C; Thu, 24 Oct 2019 03:32:02 +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 x9O3W26e024949; Thu, 24 Oct 2019 03:32:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3W22N024948; Thu, 24 Oct 2019 03:32:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240332.x9O3W22N024948@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:32:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353997 - stable/12/stand/efi/boot1 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/efi/boot1 X-SVN-Commit-Revision: 353997 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:32:03 -0000 Author: kevans Date: Thu Oct 24 03:32:02 2019 New Revision: 353997 URL: https://svnweb.freebsd.org/changeset/base/353997 Log: MFC r353544: boot1.efi: provide generic exit() and stub getchar() Modified: stable/12/stand/efi/boot1/boot1.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/boot1/boot1.c ============================================================================== --- stable/12/stand/efi/boot1/boot1.c Thu Oct 24 03:30:48 2019 (r353996) +++ stable/12/stand/efi/boot1/boot1.c Thu Oct 24 03:32:02 2019 (r353997) @@ -293,6 +293,18 @@ add_device(dev_info_t **devinfop, dev_info_t *devinfo) dev->next = devinfo; } +void +efi_exit(EFI_STATUS s) +{ + BS->Exit(IH, s, 0, NULL); +} + +void +exit(int error __unused) +{ + efi_exit(EFI_LOAD_ERROR); +} + /* * OK. We totally give up. Exit back to EFI with a sensible status so * it can try the next option on the list. @@ -308,7 +320,12 @@ efi_panic(EFI_STATUS s, const char *fmt, ...) va_end(ap); printf("\n"); - BS->Exit(IH, s, 0, NULL); + efi_exit(s); +} + +int getchar(void) +{ + return (-1); } void From owner-svn-src-all@freebsd.org Thu Oct 24 03:37:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D4201563A4; Thu, 24 Oct 2019 03:37:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCby0gd2z4LHG; Thu, 24 Oct 2019 03:37:18 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F00D780BA; Thu, 24 Oct 2019 03:37:17 +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 x9O3bHYI025331; Thu, 24 Oct 2019 03:37:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3bH9P025330; Thu, 24 Oct 2019 03:37:17 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240337.x9O3bH9P025330@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:37:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353999 - stable/12/stand/i386 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/i386 X-SVN-Commit-Revision: 353999 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:37:18 -0000 Author: kevans Date: Thu Oct 24 03:37:17 2019 New Revision: 353999 URL: https://svnweb.freebsd.org/changeset/base/353999 Log: MFC r340834: Disable build-id in i386 binary boot components A user may enable build-id for all builds by adding LDFLAGS=-Wl,--build-id=sha1 to /etc/make.conf. In this case the build-id note ends added up to mbr and pmbr's .text, which makes it too large (it ends up being 532 bytes). To avoid this explicitly turn off build-id for these components. Modified: stable/12/stand/i386/Makefile.inc Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/i386/Makefile.inc ============================================================================== --- stable/12/stand/i386/Makefile.inc Thu Oct 24 03:32:47 2019 (r353998) +++ stable/12/stand/i386/Makefile.inc Thu Oct 24 03:37:17 2019 (r353999) @@ -2,6 +2,8 @@ # # $FreeBSD$ +.include "bsd.linker.mk" + LOADER_ADDRESS?=0x200000 LDFLAGS+= -nostdlib LDFLAGS.lld+= -Wl,--no-rosegment @@ -23,6 +25,9 @@ LDSCRIPT= ${BOOTSRC}/i386/boot.ldscript # LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-T,${LDSCRIPT},-S,--oformat,binary # LD_FLAGS_BIN=-static -T ${LDSCRIPT} --gc-sections LDFLAGS_BIN=-e start -Ttext ${ORG} -Wl,-N,-S,--oformat,binary +.if ${LINKER_FEATURES:Mbuild-id} != "" +LDFLAGS_BIN+=-Wl,--build-id=none +.endif LD_FLAGS_BIN=-static -N --gc-sections .if ${MACHINE_CPUARCH} == "amd64" From owner-svn-src-all@freebsd.org Thu Oct 24 03:44:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5D89D157733; Thu, 24 Oct 2019 03:44:33 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCmK1p1Qz4MXf; Thu, 24 Oct 2019 03:44:33 +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 21AAE8286; Thu, 24 Oct 2019 03:44:33 +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 x9O3iWML031576; Thu, 24 Oct 2019 03:44:32 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3iWjb031575; Thu, 24 Oct 2019 03:44:32 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240344.x9O3iWjb031575@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:44:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354003 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 354003 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:44:33 -0000 Author: kevans Date: Thu Oct 24 03:44:32 2019 New Revision: 354003 URL: https://svnweb.freebsd.org/changeset/base/354003 Log: MFC r349344: Add missing include of sys/boot.h This change was dropped out in a rebase and I didn't catch that before I committed. Modified: stable/12/sys/kern/kern_mib.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/kern_mib.c ============================================================================== --- stable/12/sys/kern/kern_mib.c Thu Oct 24 03:41:54 2019 (r354002) +++ stable/12/sys/kern/kern_mib.c Thu Oct 24 03:44:32 2019 (r354003) @@ -44,6 +44,7 @@ __FBSDID("$FreeBSD$"); #include "opt_config.h" #include +#include #include #include #include From owner-svn-src-all@freebsd.org Thu Oct 24 02:36:43 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 036F8173961; Thu, 24 Oct 2019 02:36:43 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zBG267TVz498f; Thu, 24 Oct 2019 02:36:42 +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 B2BC37590; Thu, 24 Oct 2019 02:36:42 +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 x9O2agQA087739; Thu, 24 Oct 2019 02:36:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2agZH087738; Thu, 24 Oct 2019 02:36:42 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240236.x9O2agZH087738@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:36:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353978 - in stable/12/stand: common efi/loader X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: common efi/loader X-SVN-Commit-Revision: 353978 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:36:43 -0000 Author: kevans Date: Thu Oct 24 02:36:42 2019 New Revision: 353978 URL: https://svnweb.freebsd.org/changeset/base/353978 Log: MFC r345998-r346002, r346007-r346008: various loader improvements r345998: loader: malloc+bzero is calloc Replace malloc+bzero in module.c with calloc. r345999: loader: file_addmodule should check for memory allocation strdup() can return NULL. r346000: loader: remove pointer checks before free() in module.c free() does check for NULL argument, remove duplicate checks. r346001: loader: file_addmetadata() should check for memory allocation malloc() can return NULL. r346002: loader: mod_loadkld() error: we previously assumed 'last_file' could be null The last_file variable is used to reset the loadaddr variable back to original value; however, it is possible the last_file is NULL, so we can not blindly trust it. But then again, we can just save the original loadaddr and use the saved value for recovery. r346007: loader: add file_remove() function to undo file_insert_tail(). 346002 did miss the fact that we do not only undo the loadaddr, but also we need to remove the inserted module. Implement file_remove() to do the job. r346008: loader: command_lsefi: ret can be used uninitialized Modified: stable/12/stand/common/module.c stable/12/stand/efi/loader/main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/module.c ============================================================================== --- stable/12/stand/common/module.c Thu Oct 24 02:34:48 2019 (r353977) +++ stable/12/stand/common/module.c Thu Oct 24 02:36:42 2019 (r353978) @@ -52,16 +52,18 @@ struct moduledir { STAILQ_ENTRY(moduledir) d_link; }; -static int file_load(char *filename, vm_offset_t dest, struct preloaded_file **result); -static int file_load_dependencies(struct preloaded_file *base_mod); -static char * file_search(const char *name, char **extlist); -static struct kernel_module * file_findmodule(struct preloaded_file *fp, char *modname, struct mod_depend *verinfo); -static int file_havepath(const char *name); -static char *mod_searchmodule(char *name, struct mod_depend *verinfo); -static void file_insert_tail(struct preloaded_file *mp); -struct file_metadata* metadata_next(struct file_metadata *base_mp, int type); -static void moduledir_readhints(struct moduledir *mdp); -static void moduledir_rebuild(void); +static int file_load(char *, vm_offset_t, struct preloaded_file **); +static int file_load_dependencies(struct preloaded_file *); +static char * file_search(const char *, char **); +static struct kernel_module *file_findmodule(struct preloaded_file *, char *, + struct mod_depend *); +static int file_havepath(const char *); +static char *mod_searchmodule(char *, struct mod_depend *); +static void file_insert_tail(struct preloaded_file *); +static void file_remove(struct preloaded_file *); +struct file_metadata *metadata_next(struct file_metadata *, int); +static void moduledir_readhints(struct moduledir *); +static void moduledir_rebuild(void); /* load address should be tweaked by first module loaded (kernel) */ static vm_offset_t loadaddr = 0; @@ -70,10 +72,11 @@ static vm_offset_t loadaddr = 0; static const char *default_searchpath = "/boot/kernel;/boot/modules;/boot/dtb"; #else -static const char *default_searchpath ="/boot/kernel;/boot/modules"; +static const char *default_searchpath = "/boot/kernel;/boot/modules"; #endif -static STAILQ_HEAD(, moduledir) moduledir_list = STAILQ_HEAD_INITIALIZER(moduledir_list); +static STAILQ_HEAD(, moduledir) moduledir_list = + STAILQ_HEAD_INITIALIZER(moduledir_list); struct preloaded_file *preloaded_files = NULL; @@ -534,8 +537,7 @@ mod_load(char *modname, struct mod_depend *verinfo, in mp = file_findmodule(NULL, modname, verinfo); if (mp) { #ifdef moduleargs - if (mp->m_args) - free(mp->m_args); + free(mp->m_args); mp->m_args = unargv(argc, argv); #endif snprintf(command_errbuf, sizeof(command_errbuf), @@ -560,9 +562,10 @@ mod_load(char *modname, struct mod_depend *verinfo, in int mod_loadkld(const char *kldname, int argc, char *argv[]) { - struct preloaded_file *fp, *last_file; - int err; + struct preloaded_file *fp; + int err; char *filename; + vm_offset_t loadaddr_saved; /* * Get fully qualified KLD name @@ -583,22 +586,19 @@ mod_loadkld(const char *kldname, int argc, char *argv[ free(filename); return (0); } - for (last_file = preloaded_files; - last_file != NULL && last_file->f_next != NULL; - last_file = last_file->f_next) - ; do { err = file_load(filename, loadaddr, &fp); if (err) break; fp->f_args = unargv(argc, argv); + loadaddr_saved = loadaddr; loadaddr = fp->f_addr + fp->f_size; - file_insert_tail(fp); /* Add to the list of loaded files */ + file_insert_tail(fp); /* Add to the list of loaded files */ if (file_load_dependencies(fp) != 0) { err = ENOENT; - last_file->f_next = NULL; - loadaddr = last_file->f_addr + last_file->f_size; + file_remove(fp); + loadaddr = loadaddr_saved; fp = NULL; break; } @@ -678,10 +678,12 @@ file_addmetadata(struct preloaded_file *fp, int type, struct file_metadata *md; md = malloc(sizeof(struct file_metadata) - sizeof(md->md_data) + size); - md->md_size = size; - md->md_type = type; - bcopy(p, md->md_data, size); - md->md_next = fp->f_metadata; + if (md != NULL) { + md->md_size = size; + md->md_type = type; + bcopy(p, md->md_data, size); + md->md_next = fp->f_metadata; + } fp->f_metadata = md; } @@ -926,11 +928,14 @@ file_addmodule(struct preloaded_file *fp, char *modnam mp = file_findmodule(fp, modname, &mdepend); if (mp) return (EEXIST); - mp = malloc(sizeof(struct kernel_module)); + mp = calloc(1, sizeof(struct kernel_module)); if (mp == NULL) return (ENOMEM); - bzero(mp, sizeof(struct kernel_module)); mp->m_name = strdup(modname); + if (mp->m_name == NULL) { + free(mp); + return (ENOMEM); + } mp->m_version = version; mp->m_fp = fp; mp->m_next = fp->f_modules; @@ -958,18 +963,14 @@ file_discard(struct preloaded_file *fp) } mp = fp->f_modules; while (mp) { - if (mp->m_name) - free(mp->m_name); + free(mp->m_name); mp1 = mp; mp = mp->m_next; free(mp1); } - if (fp->f_name != NULL) - free(fp->f_name); - if (fp->f_type != NULL) - free(fp->f_type); - if (fp->f_args != NULL) - free(fp->f_args); + free(fp->f_name); + free(fp->f_type); + free(fp->f_args); free(fp); } @@ -980,12 +981,8 @@ file_discard(struct preloaded_file *fp) struct preloaded_file * file_alloc(void) { - struct preloaded_file *fp; - if ((fp = malloc(sizeof(struct preloaded_file))) != NULL) { - bzero(fp, sizeof(struct preloaded_file)); - } - return (fp); + return (calloc(1, sizeof(struct preloaded_file))); } /* @@ -1007,6 +1004,29 @@ file_insert_tail(struct preloaded_file *fp) } } +/* + * Remove module from the chain + */ +static void +file_remove(struct preloaded_file *fp) +{ + struct preloaded_file *cm; + + if (preloaded_files == NULL) + return; + + if (preloaded_files == fp) { + preloaded_files = fp->f_next; + return; + } + for (cm = preloaded_files; cm->f_next != NULL; cm = cm->f_next) { + if (cm->f_next == fp) { + cm->f_next = fp->f_next; + return; + } + } +} + static char * moduledir_fullpath(struct moduledir *mdp, const char *fname) { @@ -1056,10 +1076,8 @@ moduledir_readhints(struct moduledir *mdp) return; bad: close(fd); - if (mdp->d_hints) { - free(mdp->d_hints); - mdp->d_hints = NULL; - } + free(mdp->d_hints); + mdp->d_hints = NULL; mdp->d_flags |= MDIR_NOHINTS; return; } @@ -1120,8 +1138,7 @@ moduledir_rebuild(void) if ((mdp->d_flags & MDIR_REMOVED) == 0) { mdp = STAILQ_NEXT(mdp, d_link); } else { - if (mdp->d_hints) - free(mdp->d_hints); + free(mdp->d_hints); mtmp = mdp; mdp = STAILQ_NEXT(mdp, d_link); STAILQ_REMOVE(&moduledir_list, mtmp, moduledir, d_link); Modified: stable/12/stand/efi/loader/main.c ============================================================================== --- stable/12/stand/efi/loader/main.c Thu Oct 24 02:34:48 2019 (r353977) +++ stable/12/stand/efi/loader/main.c Thu Oct 24 02:36:42 2019 (r353978) @@ -1217,7 +1217,7 @@ command_lsefi(int argc __unused, char *argv[] __unused EFI_HANDLE handle; UINTN bufsz = 0, i, j; EFI_STATUS status; - int ret; + int ret = 0; status = BS->LocateHandle(AllHandles, NULL, NULL, &bufsz, buffer); if (status != EFI_BUFFER_TOO_SMALL) { From owner-svn-src-all@freebsd.org Thu Oct 24 02:46:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E1A2F175603; Thu, 24 Oct 2019 02:46:37 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zBTT5h31z4Bn1; Thu, 24 Oct 2019 02:46:37 +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 A4355774B; Thu, 24 Oct 2019 02:46:37 +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 x9O2kbMD093655; Thu, 24 Oct 2019 02:46:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2kbMB093653; Thu, 24 Oct 2019 02:46:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240246.x9O2kbMB093653@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:46:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353980 - in stable/12/stand: efi/loader fdt X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: efi/loader fdt X-SVN-Commit-Revision: 353980 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:46:38 -0000 Author: kevans Date: Thu Oct 24 02:46:36 2019 New Revision: 353980 URL: https://svnweb.freebsd.org/changeset/base/353980 Log: MFC r346701: loader: fdt: Add fdt_is_setup function When efi_autoload is called it will call fdt_setup_fdtp which setup the dtb and overlays. If a user already loaded at dtb or overlays or just printed the efi provided dtb, this will re-setup everything and also re-applying the overlays. Test that everything is setup before doing it again. Modified: stable/12/stand/efi/loader/autoload.c stable/12/stand/fdt/fdt_loader_cmd.c stable/12/stand/fdt/fdt_platform.h Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/loader/autoload.c ============================================================================== --- stable/12/stand/efi/loader/autoload.c Thu Oct 24 02:43:38 2019 (r353979) +++ stable/12/stand/efi/loader/autoload.c Thu Oct 24 02:46:36 2019 (r353980) @@ -50,7 +50,8 @@ efi_autoload(void) * imply that we're on a platform where FDT is a requirement. If we * fix this, then the error handling here should be fixed accordingly. */ - fdt_setup_fdtp(); + if (fdt_is_setup() == 0) + fdt_setup_fdtp(); #endif return (0); } Modified: stable/12/stand/fdt/fdt_loader_cmd.c ============================================================================== --- stable/12/stand/fdt/fdt_loader_cmd.c Thu Oct 24 02:43:38 2019 (r353979) +++ stable/12/stand/fdt/fdt_loader_cmd.c Thu Oct 24 02:46:36 2019 (r353980) @@ -510,6 +510,16 @@ fdt_apply_overlays() } int +fdt_is_setup(void) +{ + + if (fdtp != NULL) + return (1); + + return (0); +} + +int fdt_setup_fdtp() { struct preloaded_file *bfp; Modified: stable/12/stand/fdt/fdt_platform.h ============================================================================== --- stable/12/stand/fdt/fdt_platform.h Thu Oct 24 02:43:38 2019 (r353979) +++ stable/12/stand/fdt/fdt_platform.h Thu Oct 24 02:46:36 2019 (r353980) @@ -48,6 +48,7 @@ int fdt_load_dtb_addr(struct fdt_header *); int fdt_load_dtb_file(const char *); void fdt_load_dtb_overlays(const char *); int fdt_setup_fdtp(void); +int fdt_is_setup(void); /* The platform library needs to implement these functions */ int fdt_platform_load_dtb(void); From owner-svn-src-all@freebsd.org Thu Oct 24 04:00:51 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A765E159A53; Thu, 24 Oct 2019 04:00:51 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zD771nByz4PmT; Thu, 24 Oct 2019 04:00: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 0618984A6; Thu, 24 Oct 2019 04:00: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 x9O40peD037869; Thu, 24 Oct 2019 04:00:51 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O40n4a037862; Thu, 24 Oct 2019 04:00:49 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240400.x9O40n4a037862@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 04:00:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354008 - in stable/12/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: efi/include efi/include/Protocol efi/libefi efi/loader libsa X-SVN-Commit-Revision: 354008 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 04:00:51 -0000 Author: kevans Date: Thu Oct 24 04:00:49 2019 New Revision: 354008 URL: https://svnweb.freebsd.org/changeset/base/354008 Log: MFC EFI HTTP Support: r349349, r349395, r349404, r349564-r349566, r349613, r350444 r349349: loader: add HTTP support using UEFI Add support for an HTTP "network filesystem" using the UEFI's HTTP stack. This also supports HTTPS, but TianoCore EDK2 implementations currently crash while fetching loader files. Only IPv4 is supported at the moment. IPv6 support is planned for a follow-up changeset. Note that we include some headers from the TianoCore EDK II project in stand/efi/include/Protocol verbatim, including links to the license instead of including the full text because that's their preferred way of communicating it, despite not being normal FreeBSD project practice. r349395: Disconnect EFI HTTP support The EFI HTTP code has been causing boot failures for people, so disable it while a fix is being worked on. r349404: Re-enable loader efi http boot and fix dv_open bug if dv_init failed The code in efihttp.c was assuming that dv_open wouldn't be called if dv_init failed. But the dv_init return value is currently ignored. Add a new variable, `efihttp_init_done` and only proceed in dv_open if it's true. This fixes the loader on systems without efi http support. r349564: Clean efihttp pointer-sign warnings The Http protocol structure is using unsigned char strings, Use type casts where needed. r349565: efihttp: comparison of integers of different signs message.HeaderCount is UINTN (unsigned int), so should be i. r349566: efihttp: mark unused arguments with __unused we do have __unused, lets use it. r349613: efihttp: mac and err can be used uninitialized While there, also check if mac != NULL, and use pointer compare for ipv4 and dns. r350444: Fix EFI loader build when LOADER_NET_SUPPORT=no. Added: stable/12/stand/efi/include/Protocol/Http.h - copied unchanged from r349349, head/stand/efi/include/Protocol/Http.h stable/12/stand/efi/include/Protocol/Ip4Config2.h - copied unchanged from r349349, head/stand/efi/include/Protocol/Ip4Config2.h stable/12/stand/efi/include/Protocol/ServiceBinding.h - copied unchanged from r349349, head/stand/efi/include/Protocol/ServiceBinding.h stable/12/stand/efi/libefi/efihttp.c - copied, changed from r349349, head/stand/efi/libefi/efihttp.c Modified: stable/12/stand/efi/include/efidevp.h stable/12/stand/efi/include/efilib.h stable/12/stand/efi/libefi/Makefile stable/12/stand/efi/loader/conf.c stable/12/stand/libsa/stand.h Directory Properties: stable/12/ (props changed) Copied: stable/12/stand/efi/include/Protocol/Http.h (from r349349, head/stand/efi/include/Protocol/Http.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/efi/include/Protocol/Http.h Thu Oct 24 04:00:49 2019 (r354008, copy of r349349, head/stand/efi/include/Protocol/Http.h) @@ -0,0 +1,523 @@ +/* $FreeBSD$ */ +/** @file + This file defines the EFI HTTP Protocol interface. It is split into + the following two main sections: + HTTP Service Binding Protocol (HTTPSB) + HTTP Protocol (HTTP) + + Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.
+ (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + + @par Revision Reference: + This Protocol is introduced in UEFI Specification 2.5 + +**/ + +#ifndef __EFI_HTTP_PROTOCOL_H__ +#define __EFI_HTTP_PROTOCOL_H__ + +#define EFI_HTTP_SERVICE_BINDING_PROTOCOL_GUID \ + { \ + 0xbdc8e6af, 0xd9bc, 0x4379, {0xa7, 0x2a, 0xe0, 0xc4, 0xe7, 0x5d, 0xae, 0x1c } \ + } + +#define EFI_HTTP_PROTOCOL_GUID \ + { \ + 0x7a59b29b, 0x910b, 0x4171, {0x82, 0x42, 0xa8, 0x5a, 0x0d, 0xf2, 0x5b, 0x5b } \ + } + +typedef struct _EFI_HTTP_PROTOCOL EFI_HTTP_PROTOCOL; + +/// +/// EFI_HTTP_VERSION +/// +typedef enum { + HttpVersion10, + HttpVersion11, + HttpVersionUnsupported +} EFI_HTTP_VERSION; + +/// +/// EFI_HTTP_METHOD +/// +typedef enum { + HttpMethodGet, + HttpMethodPost, + HttpMethodPatch, + HttpMethodOptions, + HttpMethodConnect, + HttpMethodHead, + HttpMethodPut, + HttpMethodDelete, + HttpMethodTrace, + HttpMethodMax +} EFI_HTTP_METHOD; + +/// +/// EFI_HTTP_STATUS_CODE +/// +typedef enum { + HTTP_STATUS_UNSUPPORTED_STATUS = 0, + HTTP_STATUS_100_CONTINUE, + HTTP_STATUS_101_SWITCHING_PROTOCOLS, + HTTP_STATUS_200_OK, + HTTP_STATUS_201_CREATED, + HTTP_STATUS_202_ACCEPTED, + HTTP_STATUS_203_NON_AUTHORITATIVE_INFORMATION, + HTTP_STATUS_204_NO_CONTENT, + HTTP_STATUS_205_RESET_CONTENT, + HTTP_STATUS_206_PARTIAL_CONTENT, + HTTP_STATUS_300_MULTIPLE_CHOICES, + HTTP_STATUS_301_MOVED_PERMANENTLY, + HTTP_STATUS_302_FOUND, + HTTP_STATUS_303_SEE_OTHER, + HTTP_STATUS_304_NOT_MODIFIED, + HTTP_STATUS_305_USE_PROXY, + HTTP_STATUS_307_TEMPORARY_REDIRECT, + HTTP_STATUS_400_BAD_REQUEST, + HTTP_STATUS_401_UNAUTHORIZED, + HTTP_STATUS_402_PAYMENT_REQUIRED, + HTTP_STATUS_403_FORBIDDEN, + HTTP_STATUS_404_NOT_FOUND, + HTTP_STATUS_405_METHOD_NOT_ALLOWED, + HTTP_STATUS_406_NOT_ACCEPTABLE, + HTTP_STATUS_407_PROXY_AUTHENTICATION_REQUIRED, + HTTP_STATUS_408_REQUEST_TIME_OUT, + HTTP_STATUS_409_CONFLICT, + HTTP_STATUS_410_GONE, + HTTP_STATUS_411_LENGTH_REQUIRED, + HTTP_STATUS_412_PRECONDITION_FAILED, + HTTP_STATUS_413_REQUEST_ENTITY_TOO_LARGE, + HTTP_STATUS_414_REQUEST_URI_TOO_LARGE, + HTTP_STATUS_415_UNSUPPORTED_MEDIA_TYPE, + HTTP_STATUS_416_REQUESTED_RANGE_NOT_SATISFIED, + HTTP_STATUS_417_EXPECTATION_FAILED, + HTTP_STATUS_500_INTERNAL_SERVER_ERROR, + HTTP_STATUS_501_NOT_IMPLEMENTED, + HTTP_STATUS_502_BAD_GATEWAY, + HTTP_STATUS_503_SERVICE_UNAVAILABLE, + HTTP_STATUS_504_GATEWAY_TIME_OUT, + HTTP_STATUS_505_HTTP_VERSION_NOT_SUPPORTED, + HTTP_STATUS_308_PERMANENT_REDIRECT +} EFI_HTTP_STATUS_CODE; + +/// +/// EFI_HTTPv4_ACCESS_POINT +/// +typedef struct { + /// + /// Set to TRUE to instruct the EFI HTTP instance to use the default address + /// information in every TCP connection made by this instance. In addition, when set + /// to TRUE, LocalAddress and LocalSubnet are ignored. + /// + BOOLEAN UseDefaultAddress; + /// + /// If UseDefaultAddress is set to FALSE, this defines the local IP address to be + /// used in every TCP connection opened by this instance. + /// + EFI_IPv4_ADDRESS LocalAddress; + /// + /// If UseDefaultAddress is set to FALSE, this defines the local subnet to be used + /// in every TCP connection opened by this instance. + /// + EFI_IPv4_ADDRESS LocalSubnet; + /// + /// This defines the local port to be used in + /// every TCP connection opened by this instance. + /// + UINT16 LocalPort; +} EFI_HTTPv4_ACCESS_POINT; + +/// +/// EFI_HTTPv6_ACCESS_POINT +/// +typedef struct { + /// + /// Local IP address to be used in every TCP connection opened by this instance. + /// + EFI_IPv6_ADDRESS LocalAddress; + /// + /// Local port to be used in every TCP connection opened by this instance. + /// + UINT16 LocalPort; +} EFI_HTTPv6_ACCESS_POINT; + +/// +/// EFI_HTTP_CONFIG_DATA_ACCESS_POINT +/// + + +typedef struct { + /// + /// HTTP version that this instance will support. + /// + EFI_HTTP_VERSION HttpVersion; + /// + /// Time out (in milliseconds) when blocking for requests. + /// + UINT32 TimeOutMillisec; + /// + /// Defines behavior of EFI DNS and TCP protocols consumed by this instance. If + /// FALSE, this instance will use EFI_DNS4_PROTOCOL and EFI_TCP4_PROTOCOL. If TRUE, + /// this instance will use EFI_DNS6_PROTOCOL and EFI_TCP6_PROTOCOL. + /// + BOOLEAN LocalAddressIsIPv6; + + union { + /// + /// When LocalAddressIsIPv6 is FALSE, this points to the local address, subnet, and + /// port used by the underlying TCP protocol. + /// + EFI_HTTPv4_ACCESS_POINT *IPv4Node; + /// + /// When LocalAddressIsIPv6 is TRUE, this points to the local IPv6 address and port + /// used by the underlying TCP protocol. + /// + EFI_HTTPv6_ACCESS_POINT *IPv6Node; + } AccessPoint; +} EFI_HTTP_CONFIG_DATA; + +/// +/// EFI_HTTP_REQUEST_DATA +/// +typedef struct { + /// + /// The HTTP method (e.g. GET, POST) for this HTTP Request. + /// + EFI_HTTP_METHOD Method; + /// + /// The URI of a remote host. From the information in this field, the HTTP instance + /// will be able to determine whether to use HTTP or HTTPS and will also be able to + /// determine the port number to use. If no port number is specified, port 80 (HTTP) + /// is assumed. See RFC 3986 for more details on URI syntax. + /// + CHAR16 *Url; +} EFI_HTTP_REQUEST_DATA; + +/// +/// EFI_HTTP_RESPONSE_DATA +/// +typedef struct { + /// + /// Response status code returned by the remote host. + /// + EFI_HTTP_STATUS_CODE StatusCode; +} EFI_HTTP_RESPONSE_DATA; + +/// +/// EFI_HTTP_HEADER +/// +typedef struct { + /// + /// Null terminated string which describes a field name. See RFC 2616 Section 14 for + /// detailed information about field names. + /// + CHAR8 *FieldName; + /// + /// Null terminated string which describes the corresponding field value. See RFC 2616 + /// Section 14 for detailed information about field values. + /// + CHAR8 *FieldValue; +} EFI_HTTP_HEADER; + +/// +/// EFI_HTTP_MESSAGE +/// +typedef struct { + /// + /// HTTP message data. + /// + union { + /// + /// When the token is used to send a HTTP request, Request is a pointer to storage that + /// contains such data as URL and HTTP method. + /// + EFI_HTTP_REQUEST_DATA *Request; + /// + /// When used to await a response, Response points to storage containing HTTP response + /// status code. + /// + EFI_HTTP_RESPONSE_DATA *Response; + } Data; + /// + /// Number of HTTP header structures in Headers list. On request, this count is + /// provided by the caller. On response, this count is provided by the HTTP driver. + /// + UINTN HeaderCount; + /// + /// Array containing list of HTTP headers. On request, this array is populated by the + /// caller. On response, this array is allocated and populated by the HTTP driver. It + /// is the responsibility of the caller to free this memory on both request and + /// response. + /// + EFI_HTTP_HEADER *Headers; + /// + /// Length in bytes of the HTTP body. This can be zero depending on the HttpMethod type. + /// + UINTN BodyLength; + /// + /// Body associated with the HTTP request or response. This can be NULL depending on + /// the HttpMethod type. + /// + VOID *Body; +} EFI_HTTP_MESSAGE; + + +/// +/// EFI_HTTP_TOKEN +/// +typedef struct { + /// + /// This Event will be signaled after the Status field is updated by the EFI HTTP + /// Protocol driver. The type of Event must be EFI_NOTIFY_SIGNAL. The Task Priority + /// Level (TPL) of Event must be lower than or equal to TPL_CALLBACK. + /// + EFI_EVENT Event; + /// + /// Status will be set to one of the following value if the HTTP request is + /// successfully sent or if an unexpected error occurs: + /// EFI_SUCCESS: The HTTP request was successfully sent to the remote host. + /// EFI_HTTP_ERROR: The response message was successfully received but contains a + /// HTTP error. The response status code is returned in token. + /// EFI_ABORTED: The HTTP request was cancelled by the caller and removed from + /// the transmit queue. + /// EFI_TIMEOUT: The HTTP request timed out before reaching the remote host. + /// EFI_DEVICE_ERROR: An unexpected system or network error occurred. + /// + EFI_STATUS Status; + /// + /// Pointer to storage containing HTTP message data. + /// + EFI_HTTP_MESSAGE *Message; +} EFI_HTTP_TOKEN; + +/** + Returns the operational parameters for the current HTTP child instance. + + The GetModeData() function is used to read the current mode data (operational + parameters) for this HTTP protocol instance. + + @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. + @param[out] HttpConfigData Point to buffer for operational parameters of this + HTTP instance. It is the responsibility of the caller + to allocate the memory for HttpConfigData and + HttpConfigData->AccessPoint.IPv6Node/IPv4Node. In fact, + it is recommended to allocate sufficient memory to record + IPv6Node since it is big enough for all possibilities. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER This is NULL. + HttpConfigData is NULL. + HttpConfigData->AccessPoint.IPv4Node or + HttpConfigData->AccessPoint.IPv6Node is NULL. + @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HTTP_GET_MODE_DATA)( + IN EFI_HTTP_PROTOCOL *This, + OUT EFI_HTTP_CONFIG_DATA *HttpConfigData + ); + +/** + Initialize or brutally reset the operational parameters for this EFI HTTP instance. + + The Configure() function does the following: + When HttpConfigData is not NULL Initialize this EFI HTTP instance by configuring + timeout, local address, port, etc. + When HttpConfigData is NULL, reset this EFI HTTP instance by closing all active + connections with remote hosts, canceling all asynchronous tokens, and flush request + and response buffers without informing the appropriate hosts. + + No other EFI HTTP function can be executed by this instance until the Configure() + function is executed and returns successfully. + + @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. + @param[in] HttpConfigData Pointer to the configure data to configure the instance. + + @retval EFI_SUCCESS Operation succeeded. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + This is NULL. + HttpConfigData->LocalAddressIsIPv6 is FALSE and + HttpConfigData->AccessPoint.IPv4Node is NULL. + HttpConfigData->LocalAddressIsIPv6 is TRUE and + HttpConfigData->AccessPoint.IPv6Node is NULL. + @retval EFI_ALREADY_STARTED Reinitialize this HTTP instance without calling + Configure() with NULL to reset it. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources when + executing Configure(). + @retval EFI_UNSUPPORTED One or more options in ConfigData are not supported + in the implementation. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HTTP_CONFIGURE)( + IN EFI_HTTP_PROTOCOL *This, + IN EFI_HTTP_CONFIG_DATA *HttpConfigData OPTIONAL + ); + +/** + The Request() function queues an HTTP request to this HTTP instance, + similar to Transmit() function in the EFI TCP driver. When the HTTP request is sent + successfully, or if there is an error, Status in token will be updated and Event will + be signaled. + + @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. + @param[in] Token Pointer to storage containing HTTP request token. + + @retval EFI_SUCCESS Outgoing data was processed. + @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred. + @retval EFI_TIMEOUT Data was dropped out of the transmit or receive queue. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + This is NULL. + Token is NULL. + Token->Message is NULL. + Token->Message->Body is not NULL, + Token->Message->BodyLength is non-zero, and + Token->Message->Data is NULL, but a previous call to + Request()has not been completed successfully. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources. + @retval EFI_UNSUPPORTED The HTTP method is not supported in current implementation. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HTTP_REQUEST) ( + IN EFI_HTTP_PROTOCOL *This, + IN EFI_HTTP_TOKEN *Token + ); + +/** + Abort an asynchronous HTTP request or response token. + + The Cancel() function aborts a pending HTTP request or response transaction. If + Token is not NULL and the token is in transmit or receive queues when it is being + cancelled, its Token->Status will be set to EFI_ABORTED and then Token->Event will + be signaled. If the token is not in one of the queues, which usually means that the + asynchronous operation has completed, EFI_NOT_FOUND is returned. If Token is NULL, + all asynchronous tokens issued by Request() or Response() will be aborted. + + @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. + @param[in] Token Point to storage containing HTTP request or response + token. + + @retval EFI_SUCCESS Request and Response queues are successfully flushed. + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_NOT_STARTED This instance hasn't been configured. + @retval EFI_NOT_FOUND The asynchronous request or response token is not + found. + @retval EFI_UNSUPPORTED The implementation does not support this function. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HTTP_CANCEL)( + IN EFI_HTTP_PROTOCOL *This, + IN EFI_HTTP_TOKEN *Token + ); + +/** + The Response() function queues an HTTP response to this HTTP instance, similar to + Receive() function in the EFI TCP driver. When the HTTP Response is received successfully, + or if there is an error, Status in token will be updated and Event will be signaled. + + The HTTP driver will queue a receive token to the underlying TCP instance. When data + is received in the underlying TCP instance, the data will be parsed and Token will + be populated with the response data. If the data received from the remote host + contains an incomplete or invalid HTTP header, the HTTP driver will continue waiting + (asynchronously) for more data to be sent from the remote host before signaling + Event in Token. + + It is the responsibility of the caller to allocate a buffer for Body and specify the + size in BodyLength. If the remote host provides a response that contains a content + body, up to BodyLength bytes will be copied from the receive buffer into Body and + BodyLength will be updated with the amount of bytes received and copied to Body. This + allows the client to download a large file in chunks instead of into one contiguous + block of memory. Similar to HTTP request, if Body is not NULL and BodyLength is + non-zero and all other fields are NULL or 0, the HTTP driver will queue a receive + token to underlying TCP instance. If data arrives in the receive buffer, up to + BodyLength bytes of data will be copied to Body. The HTTP driver will then update + BodyLength with the amount of bytes received and copied to Body. + + If the HTTP driver does not have an open underlying TCP connection with the host + specified in the response URL, Request() will return EFI_ACCESS_DENIED. This is + consistent with RFC 2616 recommendation that HTTP clients should attempt to maintain + an open TCP connection between client and host. + + @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. + @param[in] Token Pointer to storage containing HTTP response token. + + @retval EFI_SUCCESS Allocation succeeded. + @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been + initialized. + @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE: + This is NULL. + Token is NULL. + Token->Message->Headers is NULL. + Token->Message is NULL. + Token->Message->Body is not NULL, + Token->Message->BodyLength is non-zero, and + Token->Message->Data is NULL, but a previous call to + Response() has not been completed successfully. + @retval EFI_OUT_OF_RESOURCES Could not allocate enough system resources. + @retval EFI_ACCESS_DENIED An open TCP connection is not present with the host + specified by response URL. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HTTP_RESPONSE) ( + IN EFI_HTTP_PROTOCOL *This, + IN EFI_HTTP_TOKEN *Token + ); + +/** + The Poll() function can be used by network drivers and applications to increase the + rate that data packets are moved between the communication devices and the transmit + and receive queues. + + In some systems, the periodic timer event in the managed network driver may not poll + the underlying communications device fast enough to transmit and/or receive all data + packets without missing incoming packets or dropping outgoing packets. Drivers and + applications that are experiencing packet loss should try calling the Poll() function + more often. + + @param[in] This Pointer to EFI_HTTP_PROTOCOL instance. + + @retval EFI_SUCCESS Incoming or outgoing data was processed.. + @retval EFI_DEVICE_ERROR An unexpected system or network error occurred + @retval EFI_INVALID_PARAMETER This is NULL. + @retval EFI_NOT_READY No incoming or outgoing data is processed. + @retval EFI_NOT_STARTED This EFI HTTP Protocol instance has not been started. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_HTTP_POLL) ( + IN EFI_HTTP_PROTOCOL *This + ); + +/// +/// The EFI HTTP protocol is designed to be used by EFI drivers and applications to +/// create and transmit HTTP Requests, as well as handle HTTP responses that are +/// returned by a remote host. This EFI protocol uses and relies on an underlying EFI +/// TCP protocol. +/// +struct _EFI_HTTP_PROTOCOL { + EFI_HTTP_GET_MODE_DATA GetModeData; + EFI_HTTP_CONFIGURE Configure; + EFI_HTTP_REQUEST Request; + EFI_HTTP_CANCEL Cancel; + EFI_HTTP_RESPONSE Response; + EFI_HTTP_POLL Poll; +}; + +extern EFI_GUID gEfiHttpServiceBindingProtocolGuid; +extern EFI_GUID gEfiHttpProtocolGuid; + +#endif Copied: stable/12/stand/efi/include/Protocol/Ip4Config2.h (from r349349, head/stand/efi/include/Protocol/Ip4Config2.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/efi/include/Protocol/Ip4Config2.h Thu Oct 24 04:00:49 2019 (r354008, copy of r349349, head/stand/efi/include/Protocol/Ip4Config2.h) @@ -0,0 +1,324 @@ +/* $FreeBSD$ */ +/** @file + This file provides a definition of the EFI IPv4 Configuration II + Protocol. + +Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+This program and the accompanying materials +are licensed and made available under the terms and conditions of the BSD License +which accompanies this distribution. The full text of the license may be found at
+http://opensource.org/licenses/bsd-license.php + +THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, +WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +@par Revision Reference: +This Protocol is introduced in UEFI Specification 2.5 + +**/ +#ifndef __EFI_IP4CONFIG2_PROTOCOL_H__ +#define __EFI_IP4CONFIG2_PROTOCOL_H__ + +/* #include */ + +#define EFI_IP4_CONFIG2_PROTOCOL_GUID \ + { \ + 0x5b446ed1, 0xe30b, 0x4faa, {0x87, 0x1a, 0x36, 0x54, 0xec, 0xa3, 0x60, 0x80 } \ + } + +typedef struct _EFI_IP4_CONFIG2_PROTOCOL EFI_IP4_CONFIG2_PROTOCOL; + + +/// +/// EFI_IP4_CONFIG2_DATA_TYPE +/// +typedef enum { + /// + /// The interface information of the communication device this EFI + /// IPv4 Configuration II Protocol instance manages. This type of + /// data is read only. The corresponding Data is of type + /// EFI_IP4_CONFIG2_INTERFACE_INFO. + /// + Ip4Config2DataTypeInterfaceInfo, + /// + /// The general configuration policy for the EFI IPv4 network stack + /// running on the communication device this EFI IPv4 + /// Configuration II Protocol instance manages. The policy will + /// affect other configuration settings. The corresponding Data is of + /// type EFI_IP4_CONFIG2_POLICY. + /// + Ip4Config2DataTypePolicy, + /// + /// The station addresses set manually for the EFI IPv4 network + /// stack. It is only configurable when the policy is + /// Ip4Config2PolicyStatic. The corresponding Data is of + /// type EFI_IP4_CONFIG2_MANUAL_ADDRESS. When DataSize + /// is 0 and Data is NULL, the existing configuration is cleared + /// from the EFI IPv4 Configuration II Protocol instance. + /// + Ip4Config2DataTypeManualAddress, + /// + /// The gateway addresses set manually for the EFI IPv4 network + /// stack running on the communication device this EFI IPv4 + /// Configuration II Protocol manages. It is not configurable when + /// the policy is Ip4Config2PolicyDhcp. The gateway + /// addresses must be unicast IPv4 addresses. The corresponding + /// Data is a pointer to an array of EFI_IPv4_ADDRESS instances. + /// When DataSize is 0 and Data is NULL, the existing configuration + /// is cleared from the EFI IPv4 Configuration II Protocol instance. + /// + Ip4Config2DataTypeGateway, + /// + /// The DNS server list for the EFI IPv4 network stack running on + /// the communication device this EFI IPv4 Configuration II + /// Protocol manages. It is not configurable when the policy is + /// Ip4Config2PolicyDhcp. The DNS server addresses must be + /// unicast IPv4 addresses. The corresponding Data is a pointer to + /// an array of EFI_IPv4_ADDRESS instances. When DataSize + /// is 0 and Data is NULL, the existing configuration is cleared + /// from the EFI IPv4 Configuration II Protocol instance. + /// + Ip4Config2DataTypeDnsServer, + Ip4Config2DataTypeMaximum +} EFI_IP4_CONFIG2_DATA_TYPE; + +/// +/// EFI_IP4_CONFIG2_INTERFACE_INFO related definitions +/// +#define EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE 32 + +/// +/// EFI_IP4_CONFIG2_INTERFACE_INFO +/// +typedef struct { + /// + /// The name of the interface. It is a NULL-terminated Unicode string. + /// + CHAR16 Name[EFI_IP4_CONFIG2_INTERFACE_INFO_NAME_SIZE]; + /// + /// The interface type of the network interface. See RFC 1700, + /// section "Number Hardware Type". + /// + UINT8 IfType; + /// + /// The size, in bytes, of the network interface's hardware address. + /// + UINT32 HwAddressSize; + /// + /// The hardware address for the network interface. + /// + EFI_MAC_ADDRESS HwAddress; + /// + /// The station IPv4 address of this EFI IPv4 network stack. + /// + EFI_IPv4_ADDRESS StationAddress; + /// + /// The subnet address mask that is associated with the station address. + /// + EFI_IPv4_ADDRESS SubnetMask; + /// + /// Size of the following RouteTable, in bytes. May be zero. + /// + UINT32 RouteTableSize; + /// + /// The route table of the IPv4 network stack runs on this interface. + /// Set to NULL if RouteTableSize is zero. Type EFI_IP4_ROUTE_TABLE is defined in + /// EFI_IP4_PROTOCOL.GetModeData(). + /// + EFI_IP4_ROUTE_TABLE *RouteTable OPTIONAL; +} EFI_IP4_CONFIG2_INTERFACE_INFO; + +/// +/// EFI_IP4_CONFIG2_POLICY +/// +typedef enum { + /// + /// Under this policy, the Ip4Config2DataTypeManualAddress, + /// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration + /// data are required to be set manually. The EFI IPv4 Protocol will get all + /// required configuration such as IPv4 address, subnet mask and + /// gateway settings from the EFI IPv4 Configuration II protocol. + /// + Ip4Config2PolicyStatic, + /// + /// Under this policy, the Ip4Config2DataTypeManualAddress, + /// Ip4Config2DataTypeGateway and Ip4Config2DataTypeDnsServer configuration data are + /// not allowed to set via SetData(). All of these configurations are retrieved from DHCP + /// server or other auto-configuration mechanism. + /// + Ip4Config2PolicyDhcp, + Ip4Config2PolicyMax +} EFI_IP4_CONFIG2_POLICY; + +/// +/// EFI_IP4_CONFIG2_MANUAL_ADDRESS +/// +typedef struct { + /// + /// The IPv4 unicast address. + /// + EFI_IPv4_ADDRESS Address; + /// + /// The subnet mask. + /// + EFI_IPv4_ADDRESS SubnetMask; +} EFI_IP4_CONFIG2_MANUAL_ADDRESS; + +/** + Set the configuration for the EFI IPv4 network stack running on the communication device this EFI + IPv4 Configuration II Protocol instance manages. + + This function is used to set the configuration data of type DataType for the EFI IPv4 network stack + running on the communication device this EFI IPv4 Configuration II Protocol instance manages. + The successfully configured data is valid after system reset or power-off. + The DataSize is used to calculate the count of structure instances in the Data for some + DataType that multiple structure instances are allowed. + This function is always non-blocking. When setting some typeof configuration data, an + asynchronous process is invoked to check the correctness of the data, such as doing address conflict + detection on the manually set local IPv4 address. EFI_NOT_READY is returned immediately to + indicate that such an asynchronous process is invoked and the process is not finished yet. The caller + willing to get the result of the asynchronous process is required to call RegisterDataNotify() + to register an event on the specified configuration data. Once the event is signaled, the caller can call + GetData()to get back the configuration data in order to know the result. For other types of + configuration data that do not require an asynchronous configuration process, the result of the + operation is immediately returned. + + @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. + @param[in] DataType The type of data to set. + @param[in] DataSize Size of the buffer pointed to by Data in bytes. + @param[in] Data The data buffer to set. The type ofthe data buffer is associated + with the DataType. + + @retval EFI_SUCCESS The specified configuration data for the EFI IPv4 network stack is set + successfully. + @retval EFI_INVALID_PARAMETER One or more of the following are TRUE: + This is NULL. + One or more fields in Data and DataSize do not match the + requirement of the data type indicated by DataType. + @retval EFI_WRITE_PROTECTED The specified configuration data is read-only or the specified configuration + data can not be set under the current policy. + @retval EFI_ACCESS_DENIED Another set operation on the specified configuration data is already in process. + @retval EFI_NOT_READY An asynchronous process is invoked to set the specified configuration data and + the process is not finished yet. + @retval EFI_BAD_BUFFER_SIZE The DataSize does not match the size of the type indicated by DataType. + @retval EFI_UNSUPPORTED This DataType is not supported. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_DEVICE_ERROR An unexpected system error or network error occurred. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CONFIG2_SET_DATA) ( + IN EFI_IP4_CONFIG2_PROTOCOL *This, + IN EFI_IP4_CONFIG2_DATA_TYPE DataType, + IN UINTN DataSize, + IN VOID *Data + ); + +/** + Get the configuration data for the EFI IPv4 network stack running on the communication device this + EFI IPv4 Configuration II Protocol instance manages. + + This function returns the configuration data of type DataType for the EFI IPv4 network stack + running on the communication device this EFI IPv4 Configuration II Protocol instance manages. + The caller is responsible for allocating the buffer usedto return the specified configuration data and + the required size will be returned to the caller if the size of the buffer is too small. + EFI_NOT_READY is returned if the specified configuration data is not ready due to an already in + progress asynchronous configuration process. The caller can call RegisterDataNotify() to + register an event on the specified configuration data. Once the asynchronous configuration process is + finished, the event will be signaled and a subsequent GetData() call will return the specified + configuration data. + + @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. + @param[in] DataType The type of data to get. + @param[out] DataSize On input, in bytes, the size of Data. On output, in bytes, the size + of buffer required to store the specified configuration data. + @param[in] Data The data buffer in which the configuration data is returned. The + type of the data buffer is associated with the DataType. Ignored + if DataSize is 0. + + @retval EFI_SUCCESS The specified configuration data is got successfully. + @retval EFI_INVALID_PARAMETER One or more of the followings are TRUE: + This is NULL. + DataSize is NULL. + Data is NULL if *DataSizeis not zero. + @retval EFI_BUFFER_TOO_SMALL The size of Data is too small for the specified configuration data + and the required size is returned in DataSize. + @retval EFI_NOT_READY The specified configuration data is not ready due to an already in + progress asynchronous configuration process. + @retval EFI_NOT_FOUND The specified configuration data is not found. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CONFIG2_GET_DATA) ( + IN EFI_IP4_CONFIG2_PROTOCOL *This, + IN EFI_IP4_CONFIG2_DATA_TYPE DataType, + IN OUT UINTN *DataSize, + IN VOID *Data OPTIONAL + ); + +/** + Register an event that is to be signaled whenever a configuration process on the specified + configuration data is done. + + This function registers an event that is to be signaled whenever a configuration process on the + specified configuration data is done. An event can be registered for different DataType + simultaneously and the caller is responsible for determining which type of configuration data causes + the signaling of the event in such case. + + @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. + @param[in] DataType The type of data to unregister the event for. + @param[in] Event The event to register. + + @retval EFI_SUCCESS The notification event for the specified configuration data is + registered. + @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL. + @retval EFI_UNSUPPORTED The configuration data type specified by DataType is not supported. + @retval EFI_OUT_OF_RESOURCES Required system resources could not be allocated. + @retval EFI_ACCESS_DENIED The Event is already registered for the DataType. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CONFIG2_REGISTER_NOTIFY) ( + IN EFI_IP4_CONFIG2_PROTOCOL *This, + IN EFI_IP4_CONFIG2_DATA_TYPE DataType, + IN EFI_EVENT Event + ); + +/** + Remove a previously registered event for the specified configuration data. + + This function removes a previously registeredevent for the specified configuration data. + + @param[in] This Pointer to the EFI_IP4_CONFIG2_PROTOCOL instance. + @param[in] DataType The type of data to remove the previously registered event for. + @param[in] Event The event to unregister. + + @retval EFI_SUCCESS The event registered for the specified configuration data is removed. + @retval EFI_INVALID_PARAMETER This is NULL or Event is NULL. + @retval EFI_NOT_FOUND The Eventhas not been registered for the specified DataType. +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_IP4_CONFIG2_UNREGISTER_NOTIFY) ( + IN EFI_IP4_CONFIG2_PROTOCOL *This, + IN EFI_IP4_CONFIG2_DATA_TYPE DataType, + IN EFI_EVENT Event + ); + +/// +/// The EFI_IP4_CONFIG2_PROTOCOL is designed to be the central repository for the common +/// configurations and the administrator configurable settings for the EFI IPv4 network stack. +/// An EFI IPv4 Configuration II Protocol instance will be installed on each communication device that +/// the EFI IPv4 network stack runs on. +/// +struct _EFI_IP4_CONFIG2_PROTOCOL { + EFI_IP4_CONFIG2_SET_DATA SetData; + EFI_IP4_CONFIG2_GET_DATA GetData; + EFI_IP4_CONFIG2_REGISTER_NOTIFY RegisterDataNotify; + EFI_IP4_CONFIG2_UNREGISTER_NOTIFY UnregisterDataNotify; +}; + +extern EFI_GUID gEfiIp4Config2ProtocolGuid; + +#endif + Copied: stable/12/stand/efi/include/Protocol/ServiceBinding.h (from r349349, head/stand/efi/include/Protocol/ServiceBinding.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/efi/include/Protocol/ServiceBinding.h Thu Oct 24 04:00:49 2019 (r354008, copy of r349349, head/stand/efi/include/Protocol/ServiceBinding.h) @@ -0,0 +1,95 @@ +/* $FreeBSD$ */ +/** @file + UEFI Service Binding Protocol is defined in UEFI specification. + + The file defines the generic Service Binding Protocol functions. + It provides services that are required to create and destroy child + handles that support a given set of protocols. + + Copyright (c) 2006 - 2018, Intel Corporation. All rights reserved.
+ This program and the accompanying materials + are licensed and made available under the terms and conditions of the BSD License + which accompanies this distribution. The full text of the license may be found at + http://opensource.org/licenses/bsd-license.php + + THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, + WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. + +**/ + +#ifndef __EFI_SERVICE_BINDING_H__ +#define __EFI_SERVICE_BINDING_H__ + +/// +/// Forward reference for pure ANSI compatibility +/// +typedef struct _EFI_SERVICE_BINDING_PROTOCOL EFI_SERVICE_BINDING_PROTOCOL; + +/** + Creates a child handle and installs a protocol. + + The CreateChild() function installs a protocol on ChildHandle. + If ChildHandle is a pointer to NULL, then a new handle is created and returned in ChildHandle. + If ChildHandle is not a pointer to NULL, then the protocol installs on the existing ChildHandle. + + @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance. + @param ChildHandle Pointer to the handle of the child to create. If it is NULL, + then a new handle is created. If it is a pointer to an existing UEFI handle, + then the protocol is added to the existing UEFI handle. + + @retval EFI_SUCCES The protocol was added to ChildHandle. + @retval EFI_INVALID_PARAMETER ChildHandle is NULL. + @retval EFI_OUT_OF_RESOURCES There are not enough resources available to create + the child + @retval other The child handle was not created + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SERVICE_BINDING_CREATE_CHILD)( + IN EFI_SERVICE_BINDING_PROTOCOL *This, + IN OUT EFI_HANDLE *ChildHandle + ); + +/** + Destroys a child handle with a protocol installed on it. + + The DestroyChild() function does the opposite of CreateChild(). It removes a protocol + that was installed by CreateChild() from ChildHandle. If the removed protocol is the + last protocol on ChildHandle, then ChildHandle is destroyed. + + @param This Pointer to the EFI_SERVICE_BINDING_PROTOCOL instance. + @param ChildHandle Handle of the child to destroy + + @retval EFI_SUCCES The protocol was removed from ChildHandle. + @retval EFI_UNSUPPORTED ChildHandle does not support the protocol that is being removed. + @retval EFI_INVALID_PARAMETER Child handle is NULL. + @retval EFI_ACCESS_DENIED The protocol could not be removed from the ChildHandle + because its services are being used. + @retval other The child handle was not destroyed + +**/ +typedef +EFI_STATUS +(EFIAPI *EFI_SERVICE_BINDING_DESTROY_CHILD)( + IN EFI_SERVICE_BINDING_PROTOCOL *This, + IN EFI_HANDLE ChildHandle + ); + +/// +/// The EFI_SERVICE_BINDING_PROTOCOL provides member functions to create and destroy +/// child handles. A driver is responsible for adding protocols to the child handle +/// in CreateChild() and removing protocols in DestroyChild(). It is also required +/// that the CreateChild() function opens the parent protocol BY_CHILD_CONTROLLER +/// to establish the parent-child relationship, and closes the protocol in DestroyChild(). +/// The pseudo code for CreateChild() and DestroyChild() is provided to specify the +/// required behavior, not to specify the required implementation. Each consumer of +/// a software protocol is responsible for calling CreateChild() when it requires the +/// protocol and calling DestroyChild() when it is finished with that protocol. +/// +struct _EFI_SERVICE_BINDING_PROTOCOL { + EFI_SERVICE_BINDING_CREATE_CHILD CreateChild; + EFI_SERVICE_BINDING_DESTROY_CHILD DestroyChild; +}; + +#endif Modified: stable/12/stand/efi/include/efidevp.h ============================================================================== --- stable/12/stand/efi/include/efidevp.h Thu Oct 24 03:57:56 2019 (r354007) +++ stable/12/stand/efi/include/efidevp.h Thu Oct 24 04:00:49 2019 (r354008) @@ -232,6 +232,8 @@ typedef struct _IPv4_DEVICE_PATH { UINT16 RemotePort; UINT16 Protocol; BOOLEAN StaticIpAddress; + EFI_IPv4_ADDRESS GatewayIpAddress; + EFI_IPv4_ADDRESS SubnetMask; } IPv4_DEVICE_PATH; #define MSG_IPv6_DP 0x0d @@ -293,6 +295,26 @@ typedef struct _SATA_DEVICE_PATH { UINT16 PortMultiplierPortNumber; UINT16 Lun; } SATA_DEVICE_PATH; + + +/* DNS Device Path SubType */ +#define MSG_DNS_DP 0x1F +typedef struct { + EFI_DEVICE_PATH Header; + /* Indicates the DNS server address is IPv4 or IPv6 address. */ + UINT8 IsIPv6; + /* Instance of the DNS server address. */ + /* XXX: actually EFI_IP_ADDRESS */ + EFI_IPv4_ADDRESS DnsServerIp[]; +} DNS_DEVICE_PATH; + +/* Uniform Resource Identifiers (URI) Device Path SubType */ +#define MSG_URI_DP 0x18 +typedef struct { + EFI_DEVICE_PATH Header; + /* Instance of the URI pursuant to RFC 3986. */ + CHAR8 Uri[]; +} URI_DEVICE_PATH; #define MEDIA_DEVICE_PATH 0x04 Modified: stable/12/stand/efi/include/efilib.h ============================================================================== --- stable/12/stand/efi/include/efilib.h Thu Oct 24 03:57:56 2019 (r354007) +++ stable/12/stand/efi/include/efilib.h Thu Oct 24 04:00:49 2019 (r354008) @@ -42,6 +42,7 @@ extern EFI_RUNTIME_SERVICES *RS; extern struct devsw efipart_fddev; extern struct devsw efipart_cddev; extern struct devsw efipart_hddev; +extern struct devsw efihttp_dev; extern struct devsw efinet_dev; extern struct netif_driver efinetif; Modified: stable/12/stand/efi/libefi/Makefile ============================================================================== --- stable/12/stand/efi/libefi/Makefile Thu Oct 24 03:57:56 2019 (r354007) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Oct 24 02:33:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3D09017322F; Thu, 24 Oct 2019 02:33:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zBBt0YTLz48j4; Thu, 24 Oct 2019 02:33:58 +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 EB77D758E; Thu, 24 Oct 2019 02:33:57 +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 x9O2Xv3K087486; Thu, 24 Oct 2019 02:33:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2XvF8087485; Thu, 24 Oct 2019 02:33:57 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240233.x9O2XvF8087485@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:33:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353976 - stable/12/stand/common X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/common X-SVN-Commit-Revision: 353976 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:33:58 -0000 Author: kevans Date: Thu Oct 24 02:33:57 2019 New Revision: 353976 URL: https://svnweb.freebsd.org/changeset/base/353976 Log: MFC r344892: stand/common/module: Apply style(9) Modified: stable/12/stand/common/module.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/module.c ============================================================================== --- stable/12/stand/common/module.c Thu Oct 24 02:33:12 2019 (r353975) +++ stable/12/stand/common/module.c Thu Oct 24 02:33:57 2019 (r353976) @@ -102,63 +102,63 @@ COMMAND_SET(load, "load", "load a kernel or module", c static int command_load(int argc, char *argv[]) { - struct preloaded_file *fp; - char *typestr; - char *prefix; - char *skip; - int dflag, dofile, dokld, ch, error; + struct preloaded_file *fp; + char *typestr; + char *prefix; + char *skip; + int dflag, dofile, dokld, ch, error; - dflag = dokld = dofile = 0; - optind = 1; - optreset = 1; - typestr = NULL; - if (argc == 1) { - command_errmsg = "no filename specified"; - return (CMD_CRIT); - } - prefix = skip = NULL; - while ((ch = getopt(argc, argv, "dkp:s:t:")) != -1) { - switch(ch) { - case 'd': - dflag++; - break; - case 'k': - dokld = 1; - break; - case 'p': - prefix = optarg; - break; - case 's': - skip = optarg; - break; - case 't': - typestr = optarg; - dofile = 1; - break; - case '?': - default: - /* getopt has already reported an error */ - return (CMD_OK); + dflag = dokld = dofile = 0; + optind = 1; + optreset = 1; + typestr = NULL; + if (argc == 1) { + command_errmsg = "no filename specified"; + return (CMD_CRIT); } - } - argv += (optind - 1); - argc -= (optind - 1); - - /* - * Request to load a raw file? - */ - if (dofile) { - if ((argc != 2) || (typestr == NULL) || (*typestr == 0)) { - command_errmsg = "invalid load type"; - return (CMD_CRIT); + prefix = skip = NULL; + while ((ch = getopt(argc, argv, "dkp:s:t:")) != -1) { + switch(ch) { + case 'd': + dflag++; + break; + case 'k': + dokld = 1; + break; + case 'p': + prefix = optarg; + break; + case 's': + skip = optarg; + break; + case 't': + typestr = optarg; + dofile = 1; + break; + case '?': + default: + /* getopt has already reported an error */ + return (CMD_OK); + } } + argv += (optind - 1); + argc -= (optind - 1); + /* + * Request to load a raw file? + */ + if (dofile) { + if ((argc != 2) || (typestr == NULL) || (*typestr == 0)) { + command_errmsg = "invalid load type"; + return (CMD_CRIT); + } + #ifdef LOADER_VERIEXEC - if (strncmp(typestr, "manifest", 8) == 0) { - if (dflag > 0) - ve_debug_set(dflag); - return (load_manifest(argv[1], prefix, skip, NULL)); - } + if (strncmp(typestr, "manifest", 8) == 0) { + if (dflag > 0) + ve_debug_set(dflag); + return (load_manifest(argv[1], prefix, skip, NULL)); + } #ifdef LOADER_VERIEXEC_PASS_MANIFEST if (strncmp(typestr, "pass_manifest", 13) == 0) { if (dflag > 0) @@ -168,46 +168,46 @@ command_load(int argc, char *argv[]) #endif #endif - fp = file_findfile(argv[1], typestr); - if (fp) { - snprintf(command_errbuf, sizeof(command_errbuf), - "warning: file '%s' already loaded", argv[1]); - return (CMD_WARN); - } + fp = file_findfile(argv[1], typestr); + if (fp) { + snprintf(command_errbuf, sizeof(command_errbuf), + "warning: file '%s' already loaded", argv[1]); + return (CMD_WARN); + } - if (file_loadraw(argv[1], typestr, 1) != NULL) - return (CMD_OK); + if (file_loadraw(argv[1], typestr, 1) != NULL) + return (CMD_OK); - /* Failing to load mfs_root is never going to end well! */ - if (strcmp("mfs_root", typestr) == 0) - return (CMD_FATAL); + /* Failing to load mfs_root is never going to end well! */ + if (strcmp("mfs_root", typestr) == 0) + return (CMD_FATAL); - return (CMD_ERROR); - } - /* - * Do we have explicit KLD load ? - */ - if (dokld || file_havepath(argv[1])) { - error = mod_loadkld(argv[1], argc - 2, argv + 2); - if (error == EEXIST) { - snprintf(command_errbuf, sizeof(command_errbuf), - "warning: KLD '%s' already loaded", argv[1]); - return (CMD_WARN); + return (CMD_ERROR); } + /* + * Do we have explicit KLD load ? + */ + if (dokld || file_havepath(argv[1])) { + error = mod_loadkld(argv[1], argc - 2, argv + 2); + if (error == EEXIST) { + snprintf(command_errbuf, sizeof(command_errbuf), + "warning: KLD '%s' already loaded", argv[1]); + return (CMD_WARN); + } - return (error == 0 ? CMD_OK : CMD_CRIT); - } - /* - * Looks like a request for a module. - */ - error = mod_load(argv[1], NULL, argc - 2, argv + 2); - if (error == EEXIST) { - snprintf(command_errbuf, sizeof(command_errbuf), - "warning: module '%s' already loaded", argv[1]); - return (CMD_WARN); - } + return (error == 0 ? CMD_OK : CMD_CRIT); + } + /* + * Looks like a request for a module. + */ + error = mod_load(argv[1], NULL, argc - 2, argv + 2); + if (error == EEXIST) { + snprintf(command_errbuf, sizeof(command_errbuf), + "warning: module '%s' already loaded", argv[1]); + return (CMD_WARN); + } - return (error == 0 ? CMD_OK : CMD_CRIT); + return (error == 0 ? CMD_OK : CMD_CRIT); } #ifdef LOADER_GELI_SUPPORT @@ -216,53 +216,53 @@ COMMAND_SET(load_geli, "load_geli", "load a geli key", static int command_load_geli(int argc, char *argv[]) { - char typestr[80]; - char *cp; - int ch, num; + char typestr[80]; + char *cp; + int ch, num; - if (argc < 3) { - command_errmsg = "usage is [-n key#] "; - return(CMD_ERROR); - } + if (argc < 3) { + command_errmsg = "usage is [-n key#] "; + return(CMD_ERROR); + } - num = 0; - optind = 1; - optreset = 1; - while ((ch = getopt(argc, argv, "n:")) != -1) { - switch(ch) { - case 'n': - num = strtol(optarg, &cp, 0); - if (cp == optarg) { - snprintf(command_errbuf, sizeof(command_errbuf), - "bad key index '%s'", optarg); - return(CMD_ERROR); - } - break; - case '?': - default: - /* getopt has already reported an error */ - return(CMD_OK); + num = 0; + optind = 1; + optreset = 1; + while ((ch = getopt(argc, argv, "n:")) != -1) { + switch(ch) { + case 'n': + num = strtol(optarg, &cp, 0); + if (cp == optarg) { + snprintf(command_errbuf, sizeof(command_errbuf), + "bad key index '%s'", optarg); + return(CMD_ERROR); + } + break; + case '?': + default: + /* getopt has already reported an error */ + return(CMD_OK); + } } - } - argv += (optind - 1); - argc -= (optind - 1); - sprintf(typestr, "%s:geli_keyfile%d", argv[1], num); - return (file_loadraw(argv[2], typestr, 1) ? CMD_OK : CMD_ERROR); + argv += (optind - 1); + argc -= (optind - 1); + sprintf(typestr, "%s:geli_keyfile%d", argv[1], num); + return (file_loadraw(argv[2], typestr, 1) ? CMD_OK : CMD_ERROR); } #endif void unload(void) { - struct preloaded_file *fp; + struct preloaded_file *fp; - while (preloaded_files != NULL) { - fp = preloaded_files; - preloaded_files = preloaded_files->f_next; - file_discard(fp); - } - loadaddr = 0; - unsetenv("kernelname"); + while (preloaded_files != NULL) { + fp = preloaded_files; + preloaded_files = preloaded_files->f_next; + file_discard(fp); + } + loadaddr = 0; + unsetenv("kernelname"); } COMMAND_SET(unload, "unload", "unload all modules", command_unload); @@ -270,8 +270,8 @@ COMMAND_SET(unload, "unload", "unload all modules", co static int command_unload(int argc, char *argv[]) { - unload(); - return(CMD_OK); + unload(); + return(CMD_OK); } COMMAND_SET(lsmod, "lsmod", "list loaded modules", command_lsmod); @@ -279,66 +279,66 @@ COMMAND_SET(lsmod, "lsmod", "list loaded modules", com static int command_lsmod(int argc, char *argv[]) { - struct preloaded_file *fp; - struct kernel_module *mp; - struct file_metadata *md; - char lbuf[80]; - int ch, verbose, ret = 0; + struct preloaded_file *fp; + struct kernel_module *mp; + struct file_metadata *md; + char lbuf[80]; + int ch, verbose, ret = 0; - verbose = 0; - optind = 1; - optreset = 1; - while ((ch = getopt(argc, argv, "v")) != -1) { - switch(ch) { - case 'v': - verbose = 1; - break; - case '?': - default: - /* getopt has already reported an error */ - return(CMD_OK); + verbose = 0; + optind = 1; + optreset = 1; + while ((ch = getopt(argc, argv, "v")) != -1) { + switch(ch) { + case 'v': + verbose = 1; + break; + case '?': + default: + /* getopt has already reported an error */ + return(CMD_OK); + } } - } - pager_open(); - for (fp = preloaded_files; fp; fp = fp->f_next) { - snprintf(lbuf, sizeof(lbuf), " %p: ", (void *) fp->f_addr); - pager_output(lbuf); - pager_output(fp->f_name); - snprintf(lbuf, sizeof(lbuf), " (%s, 0x%lx)\n", fp->f_type, - (long)fp->f_size); - if (pager_output(lbuf)) - break; - if (fp->f_args != NULL) { - pager_output(" args: "); - pager_output(fp->f_args); - if (pager_output("\n")) - break; - } - if (fp->f_modules) { - pager_output(" modules: "); - for (mp = fp->f_modules; mp; mp = mp->m_next) { - snprintf(lbuf, sizeof(lbuf), "%s.%d ", mp->m_name, - mp->m_version); + pager_open(); + for (fp = preloaded_files; fp; fp = fp->f_next) { + snprintf(lbuf, sizeof(lbuf), " %p: ", (void *) fp->f_addr); pager_output(lbuf); - } - if (pager_output("\n")) - break; - } - if (verbose) { - /* XXX could add some formatting smarts here to display some better */ - for (md = fp->f_metadata; md != NULL; md = md->md_next) { - snprintf(lbuf, sizeof(lbuf), " 0x%04x, 0x%lx\n", - md->md_type, (long) md->md_size); + pager_output(fp->f_name); + snprintf(lbuf, sizeof(lbuf), " (%s, 0x%lx)\n", fp->f_type, + (long)fp->f_size); if (pager_output(lbuf)) break; - } + if (fp->f_args != NULL) { + pager_output(" args: "); + pager_output(fp->f_args); + if (pager_output("\n")) + break; + } + if (fp->f_modules) { + pager_output(" modules: "); + for (mp = fp->f_modules; mp; mp = mp->m_next) { + snprintf(lbuf, sizeof(lbuf), "%s.%d ", mp->m_name, + mp->m_version); + pager_output(lbuf); + } + if (pager_output("\n")) + break; + } + if (verbose) { + /* XXX could add some formatting smarts here to display some better */ + for (md = fp->f_metadata; md != NULL; md = md->md_next) { + snprintf(lbuf, sizeof(lbuf), " 0x%04x, 0x%lx\n", + md->md_type, (long) md->md_size); + if (pager_output(lbuf)) + break; + } + } + if (ret) + break; } - if (ret) - break; - } - pager_close(); - return(CMD_OK); + pager_close(); + return(CMD_OK); } /* @@ -347,86 +347,86 @@ command_lsmod(int argc, char *argv[]) int file_load(char *filename, vm_offset_t dest, struct preloaded_file **result) { - static int last_file_format = 0; - struct preloaded_file *fp; - int error; - int i; + static int last_file_format = 0; + struct preloaded_file *fp; + int error; + int i; - if (archsw.arch_loadaddr != NULL) - dest = archsw.arch_loadaddr(LOAD_RAW, filename, dest); + if (archsw.arch_loadaddr != NULL) + dest = archsw.arch_loadaddr(LOAD_RAW, filename, dest); - error = EFTYPE; - for (i = last_file_format, fp = NULL; - file_formats[i] && fp == NULL; i++) { - error = (file_formats[i]->l_load)(filename, dest, &fp); - if (error == 0) { - fp->f_loader = last_file_format = i; /* remember the loader */ - *result = fp; - break; - } else if (last_file_format == i && i != 0) { - /* Restart from the beginning */ - i = -1; - last_file_format = 0; - fp = NULL; - continue; + error = EFTYPE; + for (i = last_file_format, fp = NULL; + file_formats[i] && fp == NULL; i++) { + error = (file_formats[i]->l_load)(filename, dest, &fp); + if (error == 0) { + fp->f_loader = last_file_format = i; /* remember the loader */ + *result = fp; + break; + } else if (last_file_format == i && i != 0) { + /* Restart from the beginning */ + i = -1; + last_file_format = 0; + fp = NULL; + continue; + } + if (error == EFTYPE) + continue; /* Unknown to this handler? */ + if (error) { + snprintf(command_errbuf, sizeof(command_errbuf), + "can't load file '%s': %s", filename, strerror(error)); + break; + } } - if (error == EFTYPE) - continue; /* Unknown to this handler? */ - if (error) { - snprintf(command_errbuf, sizeof(command_errbuf), - "can't load file '%s': %s", filename, strerror(error)); - break; - } - } - return (error); + return (error); } static int file_load_dependencies(struct preloaded_file *base_file) { - struct file_metadata *md; - struct preloaded_file *fp; - struct mod_depend *verinfo; - struct kernel_module *mp; - char *dmodname; - int error; + struct file_metadata *md; + struct preloaded_file *fp; + struct mod_depend *verinfo; + struct kernel_module *mp; + char *dmodname; + int error; - md = file_findmetadata(base_file, MODINFOMD_DEPLIST); - if (md == NULL) - return (0); - error = 0; - do { - verinfo = (struct mod_depend*)md->md_data; - dmodname = (char *)(verinfo + 1); - if (file_findmodule(NULL, dmodname, verinfo) == NULL) { - printf("loading required module '%s'\n", dmodname); - error = mod_load(dmodname, verinfo, 0, NULL); - if (error) - break; - /* - * If module loaded via kld name which isn't listed - * in the linker.hints file, we should check if it have - * required version. - */ - mp = file_findmodule(NULL, dmodname, verinfo); - if (mp == NULL) { - snprintf(command_errbuf, sizeof(command_errbuf), - "module '%s' exists but with wrong version", dmodname); - error = ENOENT; - break; - } + md = file_findmetadata(base_file, MODINFOMD_DEPLIST); + if (md == NULL) + return (0); + error = 0; + do { + verinfo = (struct mod_depend*)md->md_data; + dmodname = (char *)(verinfo + 1); + if (file_findmodule(NULL, dmodname, verinfo) == NULL) { + printf("loading required module '%s'\n", dmodname); + error = mod_load(dmodname, verinfo, 0, NULL); + if (error) + break; + /* + * If module loaded via kld name which isn't listed + * in the linker.hints file, we should check if it have + * required version. + */ + mp = file_findmodule(NULL, dmodname, verinfo); + if (mp == NULL) { + snprintf(command_errbuf, sizeof(command_errbuf), + "module '%s' exists but with wrong version", dmodname); + error = ENOENT; + break; + } + } + md = metadata_next(md, MODINFOMD_DEPLIST); + } while (md); + if (!error) + return (0); + /* Load failed; discard everything */ + while (base_file != NULL) { + fp = base_file; + base_file = base_file->f_next; + file_discard(fp); } - md = metadata_next(md, MODINFOMD_DEPLIST); - } while (md); - if (!error) - return (0); - /* Load failed; discard everything */ - while (base_file != NULL) { - fp = base_file; - base_file = base_file->f_next; - file_discard(fp); - } - return (error); + return (error); } /* @@ -436,82 +436,82 @@ file_load_dependencies(struct preloaded_file *base_fil struct preloaded_file * file_loadraw(const char *fname, char *type, int insert) { - struct preloaded_file *fp; - char *name; - int fd, got; - vm_offset_t laddr; + struct preloaded_file *fp; + char *name; + int fd, got; + vm_offset_t laddr; - /* We can't load first */ - if ((file_findfile(NULL, NULL)) == NULL) { - command_errmsg = "can't load file before kernel"; - return(NULL); - } + /* We can't load first */ + if ((file_findfile(NULL, NULL)) == NULL) { + command_errmsg = "can't load file before kernel"; + return(NULL); + } - /* locate the file on the load path */ - name = file_search(fname, NULL); - if (name == NULL) { - snprintf(command_errbuf, sizeof(command_errbuf), - "can't find '%s'", fname); - return(NULL); - } + /* locate the file on the load path */ + name = file_search(fname, NULL); + if (name == NULL) { + snprintf(command_errbuf, sizeof(command_errbuf), + "can't find '%s'", fname); + return(NULL); + } - if ((fd = open(name, O_RDONLY)) < 0) { - snprintf(command_errbuf, sizeof(command_errbuf), - "can't open '%s': %s", name, strerror(errno)); - free(name); - return(NULL); - } + if ((fd = open(name, O_RDONLY)) < 0) { + snprintf(command_errbuf, sizeof(command_errbuf), + "can't open '%s': %s", name, strerror(errno)); + free(name); + return(NULL); + } #ifdef LOADER_VERIEXEC - if (verify_file(fd, name, 0, VE_MUST) < 0) { - sprintf(command_errbuf, "can't verify '%s'", name); - free(name); - close(fd); - return(NULL); - } + if (verify_file(fd, name, 0, VE_MUST) < 0) { + sprintf(command_errbuf, "can't verify '%s'", name); + free(name); + close(fd); + return(NULL); + } #endif - if (archsw.arch_loadaddr != NULL) - loadaddr = archsw.arch_loadaddr(LOAD_RAW, name, loadaddr); + if (archsw.arch_loadaddr != NULL) + loadaddr = archsw.arch_loadaddr(LOAD_RAW, name, loadaddr); - printf("%s ", name); + printf("%s ", name); - laddr = loadaddr; - for (;;) { - /* read in 4k chunks; size is not really important */ - got = archsw.arch_readin(fd, laddr, 4096); - if (got == 0) /* end of file */ - break; - if (got < 0) { /* error */ - snprintf(command_errbuf, sizeof(command_errbuf), - "error reading '%s': %s", name, strerror(errno)); - free(name); - close(fd); - return(NULL); + laddr = loadaddr; + for (;;) { + /* read in 4k chunks; size is not really important */ + got = archsw.arch_readin(fd, laddr, 4096); + if (got == 0) /* end of file */ + break; + if (got < 0) { /* error */ + snprintf(command_errbuf, sizeof(command_errbuf), + "error reading '%s': %s", name, strerror(errno)); + free(name); + close(fd); + return(NULL); + } + laddr += got; } - laddr += got; - } - printf("size=%#jx\n", (uintmax_t)(laddr - loadaddr)); + printf("size=%#jx\n", (uintmax_t)(laddr - loadaddr)); - /* Looks OK so far; create & populate control structure */ - fp = file_alloc(); - fp->f_name = strdup(name); - fp->f_type = strdup(type); - fp->f_args = NULL; - fp->f_metadata = NULL; - fp->f_loader = -1; - fp->f_addr = loadaddr; - fp->f_size = laddr - loadaddr; + /* Looks OK so far; create & populate control structure */ + fp = file_alloc(); + fp->f_name = strdup(name); + fp->f_type = strdup(type); + fp->f_args = NULL; + fp->f_metadata = NULL; + fp->f_loader = -1; + fp->f_addr = loadaddr; + fp->f_size = laddr - loadaddr; - /* recognise space consumption */ - loadaddr = laddr; + /* recognise space consumption */ + loadaddr = laddr; - /* Add to the list of loaded files */ - if (insert != 0) - file_insert_tail(fp); - close(fd); - return(fp); + /* Add to the list of loaded files */ + if (insert != 0) + file_insert_tail(fp); + close(fd); + return(fp); } /* @@ -522,35 +522,35 @@ file_loadraw(const char *fname, char *type, int insert int mod_load(char *modname, struct mod_depend *verinfo, int argc, char *argv[]) { - struct kernel_module *mp; - int err; - char *filename; + struct kernel_module *mp; + int err; + char *filename; - if (file_havepath(modname)) { - printf("Warning: mod_load() called instead of mod_loadkld() for module '%s'\n", modname); - return (mod_loadkld(modname, argc, argv)); - } - /* see if module is already loaded */ - mp = file_findmodule(NULL, modname, verinfo); - if (mp) { + if (file_havepath(modname)) { + printf("Warning: mod_load() called instead of mod_loadkld() for module '%s'\n", modname); + return (mod_loadkld(modname, argc, argv)); + } + /* see if module is already loaded */ + mp = file_findmodule(NULL, modname, verinfo); + if (mp) { #ifdef moduleargs - if (mp->m_args) - free(mp->m_args); - mp->m_args = unargv(argc, argv); + if (mp->m_args) + free(mp->m_args); + mp->m_args = unargv(argc, argv); #endif - snprintf(command_errbuf, sizeof(command_errbuf), - "warning: module '%s' already loaded", mp->m_name); - return (0); - } - /* locate file with the module on the search path */ - filename = mod_searchmodule(modname, verinfo); - if (filename == NULL) { - snprintf(command_errbuf, sizeof(command_errbuf), - "can't find '%s'", modname); - return (ENOENT); - } - err = mod_loadkld(filename, argc, argv); - return (err); + snprintf(command_errbuf, sizeof(command_errbuf), + "warning: module '%s' already loaded", mp->m_name); + return (0); + } + /* locate file with the module on the search path */ + filename = mod_searchmodule(modname, verinfo); + if (filename == NULL) { + snprintf(command_errbuf, sizeof(command_errbuf), + "can't find '%s'", modname); + return (ENOENT); + } + err = mod_loadkld(filename, argc, argv); + return (err); } /* @@ -560,57 +560,57 @@ mod_load(char *modname, struct mod_depend *verinfo, in int mod_loadkld(const char *kldname, int argc, char *argv[]) { - struct preloaded_file *fp, *last_file; - int err; - char *filename; + struct preloaded_file *fp, *last_file; + int err; + char *filename; - /* - * Get fully qualified KLD name - */ - filename = file_search(kldname, kld_ext_list); - if (filename == NULL) { - snprintf(command_errbuf, sizeof(command_errbuf), - "can't find '%s'", kldname); - return (ENOENT); - } - /* - * Check if KLD already loaded - */ - fp = file_findfile(filename, NULL); - if (fp) { - snprintf(command_errbuf, sizeof(command_errbuf), - "warning: KLD '%s' already loaded", filename); - free(filename); - return (0); - } - for (last_file = preloaded_files; - last_file != NULL && last_file->f_next != NULL; - last_file = last_file->f_next) - ; + /* + * Get fully qualified KLD name + */ + filename = file_search(kldname, kld_ext_list); + if (filename == NULL) { + snprintf(command_errbuf, sizeof(command_errbuf), + "can't find '%s'", kldname); + return (ENOENT); + } + /* + * Check if KLD already loaded + */ + fp = file_findfile(filename, NULL); + if (fp) { + snprintf(command_errbuf, sizeof(command_errbuf), + "warning: KLD '%s' already loaded", filename); + free(filename); + return (0); + } + for (last_file = preloaded_files; + last_file != NULL && last_file->f_next != NULL; + last_file = last_file->f_next) + ; - do { - err = file_load(filename, loadaddr, &fp); - if (err) - break; - fp->f_args = unargv(argc, argv); - loadaddr = fp->f_addr + fp->f_size; - file_insert_tail(fp); /* Add to the list of loaded files */ - if (file_load_dependencies(fp) != 0) { - err = ENOENT; - last_file->f_next = NULL; - loadaddr = last_file->f_addr + last_file->f_size; - fp = NULL; - break; + do { + err = file_load(filename, loadaddr, &fp); + if (err) + break; + fp->f_args = unargv(argc, argv); + loadaddr = fp->f_addr + fp->f_size; + file_insert_tail(fp); /* Add to the list of loaded files */ + if (file_load_dependencies(fp) != 0) { + err = ENOENT; + last_file->f_next = NULL; + loadaddr = last_file->f_addr + last_file->f_size; + fp = NULL; + break; + } + } while(0); + if (err == EFTYPE) { + snprintf(command_errbuf, sizeof(command_errbuf), + "don't know how to load module '%s'", filename); } - } while(0); - if (err == EFTYPE) { - snprintf(command_errbuf, sizeof(command_errbuf), - "don't know how to load module '%s'", filename); - } - if (err && fp) - file_discard(fp); - free(filename); - return (err); + if (err && fp) + file_discard(fp); + free(filename); + return (err); } /* @@ -620,14 +620,14 @@ mod_loadkld(const char *kldname, int argc, char *argv[ struct preloaded_file * file_findfile(const char *name, const char *type) { - struct preloaded_file *fp; + struct preloaded_file *fp; - for (fp = preloaded_files; fp != NULL; fp = fp->f_next) { - if (((name == NULL) || !strcmp(name, fp->f_name)) && - ((type == NULL) || !strcmp(type, fp->f_type))) - break; - } - return (fp); + for (fp = preloaded_files; fp != NULL; fp = fp->f_next) { + if (((name == NULL) || !strcmp(name, fp->f_name)) && + ((type == NULL) || !strcmp(type, fp->f_type))) + break; + } + return (fp); } /* @@ -638,35 +638,35 @@ struct kernel_module * file_findmodule(struct preloaded_file *fp, char *modname, struct mod_depend *verinfo) { - struct kernel_module *mp, *best; - int bestver, mver; + struct kernel_module *mp, *best; + int bestver, mver; - if (fp == NULL) { - for (fp = preloaded_files; fp; fp = fp->f_next) { - mp = file_findmodule(fp, modname, verinfo); - if (mp) - return (mp); + if (fp == NULL) { + for (fp = preloaded_files; fp; fp = fp->f_next) { + mp = file_findmodule(fp, modname, verinfo); + if (mp) + return (mp); + } + return (NULL); } - return (NULL); - } - best = NULL; - bestver = 0; - for (mp = fp->f_modules; mp; mp = mp->m_next) { - if (strcmp(modname, mp->m_name) == 0) { - if (verinfo == NULL) - return (mp); - mver = mp->m_version; - if (mver == verinfo->md_ver_preferred) - return (mp); - if (mver >= verinfo->md_ver_minimum && - mver <= verinfo->md_ver_maximum && - mver > bestver) { - best = mp; - bestver = mver; - } + best = NULL; + bestver = 0; + for (mp = fp->f_modules; mp; mp = mp->m_next) { + if (strcmp(modname, mp->m_name) == 0) { + if (verinfo == NULL) + return (mp); + mver = mp->m_version; + if (mver == verinfo->md_ver_preferred) + return (mp); + if (mver >= verinfo->md_ver_minimum && + mver <= verinfo->md_ver_maximum && + mver > bestver) { + best = mp; + bestver = mver; + } + } } - } - return (best); + return (best); } /* * Make a copy of (size) bytes of data from (p), and associate them as @@ -675,14 +675,14 @@ file_findmodule(struct preloaded_file *fp, char *modna void file_addmetadata(struct preloaded_file *fp, int type, size_t size, void *p) { - struct file_metadata *md; + struct file_metadata *md; - md = malloc(sizeof(struct file_metadata) - sizeof(md->md_data) + size); - md->md_size = size; - md->md_type = type; - bcopy(p, md->md_data, size); - md->md_next = fp->f_metadata; - fp->f_metadata = md; + md = malloc(sizeof(struct file_metadata) - sizeof(md->md_data) + size); + md->md_size = size; + md->md_type = type; + bcopy(p, md->md_data, size); + md->md_next = fp->f_metadata; + fp->f_metadata = md; } /* @@ -691,12 +691,12 @@ file_addmetadata(struct preloaded_file *fp, int type, struct file_metadata * file_findmetadata(struct preloaded_file *fp, int type) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Thu Oct 24 02:53:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6C85176707; Thu, 24 Oct 2019 02:53: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.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zBd06Xbsz4CkV; Thu, 24 Oct 2019 02:53: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 AA66B7905; Thu, 24 Oct 2019 02:53: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 x9O2r8VC099498; Thu, 24 Oct 2019 02:53:08 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O2r7nR099492; Thu, 24 Oct 2019 02:53:07 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240253.x9O2r7nR099492@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 02:53:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353982 - in stable/12/stand/efi: boot1 include libefi loader X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand/efi: boot1 include libefi loader X-SVN-Commit-Revision: 353982 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 02:53:09 -0000 Author: kevans Date: Thu Oct 24 02:53:07 2019 New Revision: 353982 URL: https://svnweb.freebsd.org/changeset/base/353982 Log: MFC r346702-r346704, r346879-r346881, r347023, r347059-r347062, r347193-r347194, r347201 r346702: Add efi_freebsd_delenv Add a wrapper around efi_delenv akin to efi_freebsd_getenv and efi_getenv. r346703: Move initialization of the block device handles earlier (we're just snagging them from UEFI BIOS). Call the device type init routines earlier as well, as they don't depend on how the console is setup. This will allow us to read files earlier in boot, so any rare error messages that this might move only to the EFI console will be an acceptable price to pay. Also tweak the order of has_kbd so it resides next to the rest of the console code. It needs to be after we initialize the buffer cache. r346704: Add the proper range of years for Netflix's copyright on this file. Note that I wrote it. r346879: Read in and parse /efi/freebsd/loader.env from the boot device's partition as if it were on the command line. Fetch FreeBSD-LoaderEnv UEFI enviornment variable. If set, read in loader environment variables from it. Otherwise read in /efi/freebsd/loader.env. Both are read relative to the device loader.efi loaded from (they aren't full UEFI device paths) Next fetch FreeBSD-NextLoaderEnv UEFI environment variable. If present, read the file it points to in as above and delete the UEFI environment variable so it only happens once. This lets one set environment variables in the bootloader. Unfortunately, we don't have all the mechanisms in place to parse the file, nor do we have the magic pattern matching in place that loader.conf has. Variables are of the form foo=bar. No quotes are supported, so spaces aren't allowed, for example. Also, variables like foo_load=yes are intercepted when we parse the loader.conf file and things are done based on that. Since those aren't done here, variables that cause an action to happen won't work. r346880: Implement uefi_rootdev If uefi_rootdev is set in the environment, then treat it like a device path. Convert the string to a device path and see if we can find a device that matches. If so, use that device at our root dev no matter what. If it's bad in any way, the boot will fail. r346881: Implement uefi_ignore_boot_mgr env variable. When set, we ignore all the hints that the UEFI boot manager has set for us. We also always fail back to the OK prompt when we can't find the right thing to boot rather than failing back to the UEFI boot manager. This has the side effect of also expanding the cases where we fail back to the OK prompt to include when we're booted under UEFI, but UEFI::BootCurrent isn't set in the environment and we can't find a proper place to boot from. r347023: stand: correct mis-merge from r346879 Small mis-merge from multiple WIP resulted in block io media handles getting double-initialized. This resulted in some installations oddly landing at the mountroot prompt. r347059: Remove stray '*' We're storing an EFI_HANDLE, not an pointer to a handle. Since EFI_HANDLE is a void * anyway, this has little practical effect since the conversion to / from void * and void ** is silent. r347060: When we can't get memory, trying again right away is going to fail. Rather than print N failure messages, bail on the first one. r347061: Substitute boot1 with ${BOOT1} Allow for other names to be built, so parameterize this makefile to avoid hard coding boot1. r347062: Use SRC+= rather than SRC= To allow boot1/Makefile to be included, use SRC+= rathern than SRC= so the including Makefile can add additional sources to the build. r347193: Reach over and pull in devpath.c from libefi This allows us to remove three nearly identical functions because the differences don't matter, and the size difference is trivial. r347194: We only ever need one devinfo per handle. So allocate it outside of looping over the filesystem modules rather than doing a malloc + free each time through the loop. In addition, nothing changes from loop to loop, so setup the new devinfo outside the loop as well. r347201: Simplify boot1 allocation of handles. There's no need to pre-malloc the number of handles. Instead call LocateHandles twice, once to get the size, and once to get the data. Modified: stable/12/stand/efi/boot1/Makefile stable/12/stand/efi/boot1/boot1.c stable/12/stand/efi/boot1/boot_module.h stable/12/stand/efi/include/efilib.h stable/12/stand/efi/libefi/efienv.c stable/12/stand/efi/loader/main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/boot1/Makefile ============================================================================== --- stable/12/stand/efi/boot1/Makefile Thu Oct 24 02:49:13 2019 (r353981) +++ stable/12/stand/efi/boot1/Makefile Thu Oct 24 02:53:07 2019 (r353982) @@ -2,7 +2,8 @@ .include -PROG= boot1.sym +BOOT1?= boot1 +PROG= ${BOOT1}.sym INTERNALPROG= WARNS?= 6 @@ -24,7 +25,7 @@ CWARNFLAGS.zfs_module.c += -Wno-unused-parameter CWARNFLAGS.zfs_module.c += -Wno-unused-function # architecture-specific loader code -SRCS= boot1.c self_reloc.c start.S ufs_module.c +SRCS+= boot1.c self_reloc.c start.S ufs_module.c devpath.c .if ${MK_LOADER_ZFS} != "no" SRCS+= zfs_module.c CFLAGS.zfs_module.c+= -I${ZFSSRC} @@ -51,10 +52,11 @@ CFLAGS+= -DEFI_DEBUG .PATH: ${EFISRC}/loader/arch/${MACHINE} .PATH: ${EFISRC}/loader .PATH: ${LDRSRC} +.PATH: ${EFISRC}/libefi CFLAGS+= -I${LDRSRC} -FILES= boot1.efi boot1.efifat -FILESMODE_boot1.efi= ${BINMODE} +FILES= ${BOOT1}.efi ${BOOT1}.efifat +FILESMODE_${BOOT1}.efi= ${BINMODE} LDSCRIPT= ${EFISRC}/loader/arch/${MACHINE}/ldscript.${MACHINE} LDFLAGS+= -Wl,-T${LDSCRIPT},-Bsymbolic,-znotext -shared @@ -79,7 +81,7 @@ LDADD+= ${LIBEFI} ${LIBSA} DPADD+= ${LDSCRIPT} -boot1.efi: ${PROG} +${BOOT1}.efi: ${PROG} if ${NM} ${.ALLSRC} | grep ' U '; then \ echo "Undefined symbols in ${.ALLSRC}"; \ exit 1; \ @@ -95,7 +97,7 @@ boot1.efi: ${PROG} .include "Makefile.fat" -boot1.efifat: boot1.efi +${BOOT1}.efifat: ${BOOT1}.efi @set -- `ls -l ${.ALLSRC}`; \ x=$$(($$5-${BOOT1_MAXSIZE})); \ if [ $$x -ge 0 ]; then \ @@ -106,6 +108,6 @@ boot1.efifat: boot1.efi xz -d -c ${BOOTSRC}/efi/boot1/fat-${MACHINE}.tmpl.xz > ${.TARGET} ${DD} if=${.ALLSRC} of=${.TARGET} seek=${BOOT1_OFFSET} conv=notrunc -CLEANFILES+= boot1.efi boot1.efifat +CLEANFILES+= ${BOOT1}.efi ${BOOT1}.efifat .include Modified: stable/12/stand/efi/boot1/boot1.c ============================================================================== --- stable/12/stand/efi/boot1/boot1.c Thu Oct 24 02:49:13 2019 (r353981) +++ stable/12/stand/efi/boot1/boot1.c Thu Oct 24 02:53:07 2019 (r353982) @@ -47,8 +47,6 @@ static const boot_module_t *boot_modules[] = }; #define NUM_BOOT_MODULES nitems(boot_modules) -/* The initial number of handles used to query EFI for partitions. */ -#define NUM_HANDLES_INIT 24 static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL; static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; @@ -93,66 +91,6 @@ Calloc(size_t n1, size_t n2, const char *file, int lin } /* - * nodes_match returns TRUE if the imgpath isn't NULL and the nodes match, - * FALSE otherwise. - */ -static BOOLEAN -nodes_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath) -{ - size_t len; - - if (imgpath == NULL || imgpath->Type != devpath->Type || - imgpath->SubType != devpath->SubType) - return (FALSE); - - len = DevicePathNodeLength(imgpath); - if (len != DevicePathNodeLength(devpath)) - return (FALSE); - - return (memcmp(imgpath, devpath, (size_t)len) == 0); -} - -/* - * device_paths_match returns TRUE if the imgpath isn't NULL and all nodes - * in imgpath and devpath match up to their respective occurrences of a - * media node, FALSE otherwise. - */ -static BOOLEAN -device_paths_match(EFI_DEVICE_PATH *imgpath, EFI_DEVICE_PATH *devpath) -{ - - if (imgpath == NULL) - return (FALSE); - - while (!IsDevicePathEnd(imgpath) && !IsDevicePathEnd(devpath)) { - if (IsDevicePathType(imgpath, MEDIA_DEVICE_PATH) && - IsDevicePathType(devpath, MEDIA_DEVICE_PATH)) - return (TRUE); - - if (!nodes_match(imgpath, devpath)) - return (FALSE); - - imgpath = NextDevicePathNode(imgpath); - devpath = NextDevicePathNode(devpath); - } - - return (FALSE); -} - -/* - * devpath_last returns the last non-path end node in devpath. - */ -static EFI_DEVICE_PATH * -devpath_last(EFI_DEVICE_PATH *devpath) -{ - - while (!IsDevicePathEnd(NextDevicePathNode(devpath))) - devpath = NextDevicePathNode(devpath); - - return (devpath); -} - -/* * load_loader attempts to load the loader image data. * * It tries each module and its respective devices, identified by mod->probe, @@ -239,7 +177,7 @@ try_boot(void) buf = NULL; } - if ((status = BS->LoadImage(TRUE, IH, devpath_last(dev->devpath), + if ((status = BS->LoadImage(TRUE, IH, efi_devpath_last_node(dev->devpath), loaderbuf, loadersize, &loaderhandle)) != EFI_SUCCESS) { printf("Failed to load image provided by %s, size: %zu, (%lu)\n", mod->name, loadersize, EFI_ERROR_CODE(status)); @@ -336,27 +274,27 @@ probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, B if (!blkio->Media->LogicalPartition) return (EFI_UNSUPPORTED); - *preferred = device_paths_match(imgpath, devpath); + *preferred = efi_devpath_match(imgpath, devpath); /* Run through each module, see if it can load this partition */ + devinfo = malloc(sizeof(*devinfo)); + if (devinfo == NULL) { + DPRINTF("\nFailed to allocate devinfo\n"); + return (EFI_UNSUPPORTED); + } + devinfo->dev = blkio; + devinfo->devpath = devpath; + devinfo->devhandle = h; + devinfo->preferred = *preferred; + devinfo->next = NULL; + for (i = 0; i < NUM_BOOT_MODULES; i++) { - devinfo = malloc(sizeof(*devinfo)); - if (devinfo == NULL) { - DPRINTF("\nFailed to allocate devinfo\n"); - continue; - } - devinfo->dev = blkio; - devinfo->devpath = devpath; - devinfo->devhandle = h; devinfo->devdata = NULL; - devinfo->preferred = *preferred; - devinfo->next = NULL; - status = boot_modules[i]->probe(devinfo); if (status == EFI_SUCCESS) return (EFI_SUCCESS); - free(devinfo); } + free(devinfo); return (EFI_UNSUPPORTED); } @@ -495,32 +433,17 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) BS->Exit(IH, EFI_OUT_OF_RESOURCES, 0, NULL); #endif - /* Get all the device handles */ - hsize = (UINTN)NUM_HANDLES_INIT * sizeof(EFI_HANDLE); + hsize = 0; + BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, + &hsize, NULL); handles = malloc(hsize); if (handles == NULL) - printf("Failed to allocate %d handles\n", NUM_HANDLES_INIT); - - status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, - &hsize, handles); - switch (status) { - case EFI_SUCCESS: - break; - case EFI_BUFFER_TOO_SMALL: - free(handles); - handles = malloc(hsize); - if (handles == NULL) - efi_panic(EFI_OUT_OF_RESOURCES, "Failed to allocate %d handles\n", - NUM_HANDLES_INIT); - status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, - NULL, &hsize, handles); - if (status != EFI_SUCCESS) - efi_panic(status, "Failed to get device handles\n"); - break; - default: + efi_panic(EFI_OUT_OF_RESOURCES, "Failed to allocate %d handles\n", + hsize); + status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, + NULL, &hsize, handles); + if (status != EFI_SUCCESS) efi_panic(status, "Failed to get device handles\n"); - break; - } /* Scan all partitions, probing with all modules. */ nhandles = hsize / sizeof(*handles); Modified: stable/12/stand/efi/boot1/boot_module.h ============================================================================== --- stable/12/stand/efi/boot1/boot_module.h Thu Oct 24 02:49:13 2019 (r353981) +++ stable/12/stand/efi/boot1/boot_module.h Thu Oct 24 02:53:07 2019 (r353982) @@ -48,7 +48,7 @@ typedef struct dev_info { EFI_BLOCK_IO *dev; EFI_DEVICE_PATH *devpath; - EFI_HANDLE *devhandle; + EFI_HANDLE devhandle; void *devdata; uint64_t partoff; int preferred; Modified: stable/12/stand/efi/include/efilib.h ============================================================================== --- stable/12/stand/efi/include/efilib.h Thu Oct 24 02:49:13 2019 (r353981) +++ stable/12/stand/efi/include/efilib.h Thu Oct 24 02:53:07 2019 (r353982) @@ -128,6 +128,7 @@ void cpy16to8(const CHAR16 *, char *, size_t); */ EFI_STATUS efi_delenv(EFI_GUID *guid, const char *varname); +EFI_STATUS efi_freebsd_delenv(const char *varname); EFI_STATUS efi_freebsd_getenv(const char *v, void *data, __size_t *len); EFI_STATUS efi_getenv(EFI_GUID *g, const char *v, void *data, __size_t *len); EFI_STATUS efi_global_getenv(const char *v, void *data, __size_t *len); Modified: stable/12/stand/efi/libefi/efienv.c ============================================================================== --- stable/12/stand/efi/libefi/efienv.c Thu Oct 24 02:49:13 2019 (r353981) +++ stable/12/stand/efi/libefi/efienv.c Thu Oct 24 02:53:07 2019 (r353982) @@ -119,5 +119,11 @@ efi_delenv(EFI_GUID *guid, const char *name) rv = RS->SetVariable(var, guid, 0, 0, NULL); free(var); - return rv; + return (rv); +} + +EFI_STATUS +efi_freebsd_delenv(const char *name) +{ + return (efi_delenv(&FreeBSDBootVarGUID, name)); } Modified: stable/12/stand/efi/loader/main.c ============================================================================== --- stable/12/stand/efi/loader/main.c Thu Oct 24 02:49:13 2019 (r353981) +++ stable/12/stand/efi/loader/main.c Thu Oct 24 02:53:07 2019 (r353982) @@ -3,7 +3,7 @@ * Copyright (c) 2006 Marcel Moolenaar * All rights reserved. * - * Copyright (c) 2018 Netflix, Inc. + * Copyright (c) 2016-2019 Netflix, Inc. written by M. Warner Losh * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -472,13 +472,35 @@ find_currdev(bool do_bootmgr, bool is_last, */ rootdev = getenv("rootdev"); if (rootdev != NULL) { - printf("Setting currdev to configured rootdev %s\n", rootdev); + printf(" Setting currdev to configured rootdev %s\n", + rootdev); set_currdev(rootdev); return (0); } /* - * Second choice: If we can find out image boot_info, and there's + * Second choice: If uefi_rootdev is set, translate that UEFI device + * path to the loader's internal name and use that. + */ + do { + rootdev = getenv("uefi_rootdev"); + if (rootdev == NULL) + break; + devpath = efi_name_to_devpath(rootdev); + if (devpath == NULL) + break; + dp = efiblk_get_pdinfo_by_device_path(devpath); + efi_devpath_free(devpath); + if (dp == NULL) + break; + printf(" Setting currdev to UEFI path %s\n", + rootdev); + set_currdev_pdinfo(dp); + return (0); + } while (0); + + /* + * Third choice: If we can find out image boot_info, and there's * a follow-on boot image in that boot_info, use that. In this * case root will be the partition specified in that image and * we'll load the kernel specified by the file path. Should there @@ -742,6 +764,80 @@ out: return (how); } +void +parse_loader_efi_config(EFI_HANDLE h, const char *env_fn) +{ + pdinfo_t *dp; + struct stat st; + int fd = -1; + char *env = NULL; + + dp = efiblk_get_pdinfo_by_handle(h); + if (dp == NULL) + return; + set_currdev_pdinfo(dp); + if (stat(env_fn, &st) != 0) + return; + fd = open(env_fn, O_RDONLY); + if (fd == -1) + return; + env = malloc(st.st_size + 1); + if (env == NULL) + goto out; + if (read(fd, env, st.st_size) != st.st_size) + goto out; + env[st.st_size] = '\0'; + boot_parse_cmdline(env); +out: + free(env); + close(fd); +} + +static void +read_loader_env(const char *name, char *def_fn, bool once) +{ + UINTN len; + char *fn, *freeme = NULL; + + len = 0; + fn = def_fn; + if (efi_freebsd_getenv(name, NULL, &len) == EFI_BUFFER_TOO_SMALL) { + freeme = fn = malloc(len + 1); + if (fn != NULL) { + if (efi_freebsd_getenv(name, fn, &len) != EFI_SUCCESS) { + free(fn); + fn = NULL; + printf( + "Can't fetch FreeBSD::%s we know is there\n", name); + } else { + /* + * if tagged as 'once' delete the env variable so we + * only use it once. + */ + if (once) + efi_freebsd_delenv(name); + /* + * We malloced 1 more than len above, then redid the call. + * so now we have room at the end of the string to NUL terminate + * it here, even if the typical idium would have '- 1' here to + * not overflow. len should be the same on return both times. + */ + fn[len] = '\0'; + } + } else { + printf( + "Can't allocate %d bytes to fetch FreeBSD::%s env var\n", + len, name); + } + } + if (fn) { + printf(" Reading loader env vars from %s\n", fn); + parse_loader_efi_config(boot_img->DeviceHandle, fn); + } +} + + + EFI_STATUS main(int argc, CHAR16 *argv[]) { @@ -783,13 +879,30 @@ main(int argc, CHAR16 *argv[]) /* Init the time source */ efi_time_init(); - has_kbd = has_keyboard(); - /* * Initialise the block cache. Set the upper limit. */ bcache_init(32768, 512); + /* + * Scan the BLOCK IO MEDIA handles then + * march through the device switch probing for things. + */ + i = efipart_inithandles(); + if (i != 0 && i != ENOENT) { + printf("efipart_inithandles failed with ERRNO %d, expect " + "failures\n", i); + } + + for (i = 0; devsw[i] != NULL; i++) + if (devsw[i]->dv_init != NULL) + (devsw[i]->dv_init)(); + + /* + * Detect console settings two different ways: one via the command + * args (eg -h) or via the UEFI ConOut variable. + */ + has_kbd = has_keyboard(); howto = parse_args(argc, argv); if (!has_kbd && (howto & RB_PROBE)) howto |= RB_SERIAL | RB_MULTIPLE; @@ -797,6 +910,24 @@ main(int argc, CHAR16 *argv[]) uhowto = parse_uefi_con_out(); /* + * Read additional environment variables from the boot device's + * "LoaderEnv" file. Any boot loader environment variable may be set + * there, which are subtly different than loader.conf variables. Only + * the 'simple' ones may be set so things like foo_load="YES" won't work + * for two reasons. First, the parser is simplistic and doesn't grok + * quotes. Second, because the variables that cause an action to happen + * are parsed by the lua, 4th or whatever code that's not yet + * loaded. This is relative to the root directory when loader.efi is + * loaded off the UFS root drive (when chain booted), or from the ESP + * when directly loaded by the BIOS. + * + * We also read in NextLoaderEnv if it was specified. This allows next boot + * functionality to be implemented and to override anything in LoaderEnv. + */ + read_loader_env("LoaderEnv", "/efi/freebsd/loader.env", false); + read_loader_env("NextLoaderEnv", NULL, true); + + /* * We now have two notions of console. howto should be viewed as * overrides. If console is already set, don't set it again. */ @@ -852,20 +983,6 @@ main(int argc, CHAR16 *argv[]) 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. - */ - i = efipart_inithandles(); - if (i != 0 && i != ENOENT) { - printf("efipart_inithandles failed with ERRNO %d, expect " - "failures\n", i); - } - - for (i = 0; devsw[i] != NULL; i++) - if (devsw[i]->dv_init != NULL) - (devsw[i]->dv_init)(); - printf("%s\n", bootprog_info); printf(" Command line arguments:"); for (i = 0; i < argc; i++) @@ -878,8 +995,6 @@ main(int argc, CHAR16 *argv[]) ST->FirmwareRevision >> 16, ST->FirmwareRevision & 0xffff); printf(" Console: %s (%#x)\n", getenv("console"), howto); - - /* Determine the devpath of our image so we can prefer it. */ text = efi_devpath_name(boot_img->FilePath); if (text != NULL) { @@ -898,36 +1013,41 @@ main(int argc, CHAR16 *argv[]) } } - uefi_boot_mgr = true; - boot_current = 0; - sz = sizeof(boot_current); - rv = efi_global_getenv("BootCurrent", &boot_current, &sz); - if (rv == EFI_SUCCESS) - printf(" BootCurrent: %04x\n", boot_current); - else { - boot_current = 0xffff; + if (getenv("uefi_ignore_boot_mgr") != NULL) { + printf(" Ignoring UEFI boot manager\n"); uefi_boot_mgr = false; - } + } else { + uefi_boot_mgr = true; + boot_current = 0; + sz = sizeof(boot_current); + rv = efi_global_getenv("BootCurrent", &boot_current, &sz); + if (rv == EFI_SUCCESS) + printf(" BootCurrent: %04x\n", boot_current); + else { + boot_current = 0xffff; + uefi_boot_mgr = false; + } - sz = sizeof(boot_order); - rv = efi_global_getenv("BootOrder", &boot_order, &sz); - if (rv == EFI_SUCCESS) { - printf(" BootOrder:"); - for (i = 0; i < sz / sizeof(boot_order[0]); i++) - printf(" %04x%s", boot_order[i], - boot_order[i] == boot_current ? "[*]" : ""); - printf("\n"); - is_last = boot_order[(sz / sizeof(boot_order[0])) - 1] == boot_current; - bosz = sz; - } else if (uefi_boot_mgr) { - /* - * u-boot doesn't set BootOrder, but otherwise participates in the - * boot manager protocol. So we fake it here and don't consider it - * a failure. - */ - bosz = sizeof(boot_order[0]); - boot_order[0] = boot_current; - is_last = true; + sz = sizeof(boot_order); + rv = efi_global_getenv("BootOrder", &boot_order, &sz); + if (rv == EFI_SUCCESS) { + printf(" BootOrder:"); + for (i = 0; i < sz / sizeof(boot_order[0]); i++) + printf(" %04x%s", boot_order[i], + boot_order[i] == boot_current ? "[*]" : ""); + printf("\n"); + is_last = boot_order[(sz / sizeof(boot_order[0])) - 1] == boot_current; + bosz = sz; + } else if (uefi_boot_mgr) { + /* + * u-boot doesn't set BootOrder, but otherwise participates in the + * boot manager protocol. So we fake it here and don't consider it + * a failure. + */ + bosz = sizeof(boot_order[0]); + boot_order[0] = boot_current; + is_last = true; + } } /* @@ -976,7 +1096,8 @@ main(int argc, CHAR16 *argv[]) * to try something different. */ if (find_currdev(uefi_boot_mgr, is_last, boot_info, bisz) != 0) - if (!interactive_interrupt("Failed to find bootable partition")) + if (uefi_boot_mgr && + !interactive_interrupt("Failed to find bootable partition")) return (EFI_NOT_FOUND); efi_init_environment(); From owner-svn-src-all@freebsd.org Thu Oct 24 04:12:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1B3A15C01E; Thu, 24 Oct 2019 04:12:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zDNk4R21z4SYm; Thu, 24 Oct 2019 04:12:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C71F8822; Thu, 24 Oct 2019 04:12:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O4CcCH049417; Thu, 24 Oct 2019 04:12:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O4CcPx049416; Thu, 24 Oct 2019 04:12:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240412.x9O4CcPx049416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 04:12:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354012 - stable/12/stand/forth X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/forth X-SVN-Commit-Revision: 354012 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 04:12:38 -0000 Author: kevans Date: Thu Oct 24 04:12:38 2019 New Revision: 354012 URL: https://svnweb.freebsd.org/changeset/base/354012 Log: MFC r352420: loader_4th: scan_buffer can leave empty string on stack When the file processing is done, we will have string with lenght 0 in stack and we will attempt to allocate 0 bytes. Modified: stable/12/stand/forth/support.4th Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/forth/support.4th ============================================================================== --- stable/12/stand/forth/support.4th Thu Oct 24 04:08:24 2019 (r354011) +++ stable/12/stand/forth/support.4th Thu Oct 24 04:12:38 2019 (r354012) @@ -363,6 +363,7 @@ variable fd ; : line_buffer_resize ( len -- len ) + dup 0= if exit then >r line_buffer .len @ if line_buffer .addr @ @@ -376,6 +377,7 @@ variable fd ; : append_to_line_buffer ( addr len -- ) + dup 0= if 2drop exit then line_buffer strget 2swap strcat line_buffer .len ! From owner-svn-src-all@freebsd.org Thu Oct 24 03:32:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03CEA15590C; Thu, 24 Oct 2019 03:32:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCVl6N3Nz4Klf; Thu, 24 Oct 2019 03:32:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE17180A3; Thu, 24 Oct 2019 03:32:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O3WlBL025036; Thu, 24 Oct 2019 03:32:47 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3WlwF025035; Thu, 24 Oct 2019 03:32:47 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240332.x9O3WlwF025035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:32:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353998 - stable/12/stand/efi/loader X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/efi/loader X-SVN-Commit-Revision: 353998 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:32:48 -0000 Author: kevans Date: Thu Oct 24 03:32:47 2019 New Revision: 353998 URL: https://svnweb.freebsd.org/changeset/base/353998 Log: MFC r353697: Allow loader.efi to identify non-standard boot setup PATH_BOOTABLE_TOKEN can be set to a non-standard path that identifies a device as bootable. Modified: stable/12/stand/efi/loader/main.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/loader/main.c ============================================================================== --- stable/12/stand/efi/loader/main.c Thu Oct 24 03:32:02 2019 (r353997) +++ stable/12/stand/efi/loader/main.c Thu Oct 24 03:32:47 2019 (r353998) @@ -239,6 +239,9 @@ sanity_check_currdev(void) struct stat st; return (stat(PATH_DEFAULTS_LOADER_CONF, &st) == 0 || +#ifdef PATH_BOOTABLE_TOKEN + stat(PATH_BOOTABLE_TOKEN, &st) == 0 || /* non-standard layout */ +#endif stat(PATH_KERNEL, &st) == 0); } From owner-svn-src-all@freebsd.org Thu Oct 24 03:01:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E682F177D14; Thu, 24 Oct 2019 03:01:42 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zBpt6bgqz4DhQ; Thu, 24 Oct 2019 03:01:42 +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 C61967A9C; Thu, 24 Oct 2019 03:01:42 +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 x9O31g6o002772; Thu, 24 Oct 2019 03:01:42 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O31eCL002762; Thu, 24 Oct 2019 03:01:40 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240301.x9O31eCL002762@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:01:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353983 - in stable/12/stand: common efi/libefi i386/libi386 powerpc userboot/userboot X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: common efi/libefi i386/libi386 powerpc userboot/userboot X-SVN-Commit-Revision: 353983 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:01:43 -0000 Author: kevans Date: Thu Oct 24 03:01:40 2019 New Revision: 353983 URL: https://svnweb.freebsd.org/changeset/base/353983 Log: MFC r345066, r347219-r347220, r347223, r347388-r347389, r347391, r347393, r347553, r348040 r345066: stand: Improve some debugging experience Some of these files using _DEBUG defined a DEBUG() macro to serve as a debug-printf. -DDEBUG is useful to enable some debugging output across multiple ELF/common parts, so switch the DEBUG-as-printf macros over to something more like DPRINTF that is more commonly used for this kind of thing and less likely to conflict. userboot/elf64_freebsd debugging also assumed %llx for uint64; use PRIx64 instead. r347219: loader: use safer DPRINTF body for non-debug case r347220: loader: bcache code does not need to check argument for free() r347223: command_bcache() does not use argv Therefore mark argv __unused. r347388: loader: implement proper 8 char tab stops The current console code is printing out 8 spaces for tab, calculate the amount of spaces based on tab stops. r347389: loader: ptable_print() needs two tabs sometimes Since the partition/slice names do vary in length, check the length of the fixed part of the line against 3 * 8, if the lenth is less than 3 tab stops, print out extra tab. use snprintf() instead of sprintf. r347391: loader: no-TERM_EMU is broken now If TERM_EMU is not defined, we do not have curx variable. Use conout mode for efi and expose get_pos() for i386. r347393: loader: use DPRINTF in biosdisk.c and define safe DPRINTF r345066 did miss biosdisk.c. Also define DPRINTF as ((void)0) for case we do not want debug printouts. r347553: loader: fix memory handling errors in module.c file_loadraw(): check for file_alloc() and strdup() results. we leak 'name'. mod_load() does leak 'filename'. mod_loadkld() does not need to check fp, file_discard() does check. r348040: stand: TARGET_ARCH is spelled MACHINE_ARCH in Makefiles Modified: stable/12/stand/common/bcache.c stable/12/stand/common/disk.c stable/12/stand/common/interp_forth.c stable/12/stand/common/module.c stable/12/stand/common/part.c stable/12/stand/efi/libefi/efi_console.c stable/12/stand/i386/libi386/biosdisk.c stable/12/stand/i386/libi386/vidconsole.c stable/12/stand/powerpc/Makefile stable/12/stand/userboot/userboot/elf64_freebsd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/bcache.c ============================================================================== --- stable/12/stand/common/bcache.c Thu Oct 24 02:53:07 2019 (r353982) +++ stable/12/stand/common/bcache.c Thu Oct 24 03:01:40 2019 (r353983) @@ -44,9 +44,9 @@ __FBSDID("$FreeBSD$"); /* #define BCACHE_DEBUG */ #ifdef BCACHE_DEBUG -# define DEBUG(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args) +# define DPRINTF(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args) #else -# define DEBUG(fmt, args...) +# define DPRINTF(fmt, args...) ((void)0) #endif struct bcachectl @@ -384,7 +384,7 @@ bcache_strategy(void *devdata, int rw, daddr_t blk, si /* bypass large requests, or when the cache is inactive */ if (bc == NULL || ((size * 2 / bcache_blksize) > bcache_nblks)) { - DEBUG("bypass %zu from %qu", size / bcache_blksize, blk); + DPRINTF("bypass %zu from %qu", size / bcache_blksize, blk); bcache_bypasses++; rw &= F_MASK; return (dd->dv_strategy(dd->dv_devdata, rw, blk, size, buf, rsize)); @@ -441,10 +441,8 @@ static void bcache_free_instance(struct bcache *bc) { if (bc != NULL) { - if (bc->bcache_ctl) - free(bc->bcache_ctl); - if (bc->bcache_data) - free(bc->bcache_data); + free(bc->bcache_ctl); + free(bc->bcache_data); free(bc); } } @@ -459,7 +457,7 @@ bcache_insert(struct bcache *bc, daddr_t blkno) cand = BHASH(bc, blkno); - DEBUG("insert blk %llu -> %u # %d", blkno, cand, bcache_bcount); + DPRINTF("insert blk %llu -> %u # %d", blkno, cand, bcache_bcount); bc->bcache_ctl[cand].bc_blkno = blkno; bc->bcache_ctl[cand].bc_count = bcache_bcount++; } @@ -476,7 +474,7 @@ bcache_invalidate(struct bcache *bc, daddr_t blkno) if (bc->bcache_ctl[i].bc_blkno == blkno) { bc->bcache_ctl[i].bc_count = -1; bc->bcache_ctl[i].bc_blkno = -1; - DEBUG("invalidate blk %llu", blkno); + DPRINTF("invalidate blk %llu", blkno); } } @@ -484,7 +482,7 @@ bcache_invalidate(struct bcache *bc, daddr_t blkno) COMMAND_SET(bcachestat, "bcachestat", "get disk block cache stats", command_bcache); static int -command_bcache(int argc, char *argv[]) +command_bcache(int argc, char *argv[] __unused) { if (argc != 1) { command_errmsg = "wrong number of arguments"; Modified: stable/12/stand/common/disk.c ============================================================================== --- stable/12/stand/common/disk.c Thu Oct 24 02:53:07 2019 (r353982) +++ stable/12/stand/common/disk.c Thu Oct 24 03:01:40 2019 (r353983) @@ -38,9 +38,9 @@ __FBSDID("$FreeBSD$"); #include "disk.h" #ifdef DISK_DEBUG -# define DEBUG(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args) +# define DPRINTF(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args) #else -# define DEBUG(fmt, args...) +# define DPRINTF(fmt, args...) ((void)0) #endif struct open_disk { @@ -75,7 +75,7 @@ display_size(uint64_t size, u_int sectorsize) size /= 1024; unit = 'M'; } - sprintf(buf, "%4ld%cB", (long)size, unit); + snprintf(buf, sizeof(buf), "%4ld%cB", (long)size, unit); return (buf); } @@ -118,11 +118,24 @@ ptable_print(void *arg, const char *pname, const struc od = (struct open_disk *)pa->dev->dd.d_opendata; sectsize = od->sectorsize; partsize = part->end - part->start + 1; - sprintf(line, " %s%s: %s\t%s\n", pa->prefix, pname, - parttype2str(part->type), - pa->verbose ? display_size(partsize, sectsize) : ""); + snprintf(line, sizeof(line), " %s%s: %s", pa->prefix, pname, + parttype2str(part->type)); if (pager_output(line)) - return 1; + return (1); + + if (pa->verbose) { + /* Emit extra tab when the line is shorter than 3 tab stops */ + if (strlen(line) < 24) + (void) pager_output("\t"); + + snprintf(line, sizeof(line), "\t%s", + display_size(partsize, sectsize)); + if (pager_output(line)) + return (1); + } + if (pager_output("\n")) + return (1); + res = 0; if (part->type == PART_FREEBSD) { /* Open slice with BSD label */ @@ -140,7 +153,8 @@ ptable_print(void *arg, const char *pname, const struc dev.d_offset = part->start; table = ptable_open(&dev, partsize, sectsize, ptblread); if (table != NULL) { - sprintf(line, " %s%s", pa->prefix, pname); + snprintf(line, sizeof(line), " %s%s", + pa->prefix, pname); bsd.dev = pa->dev; bsd.prefix = line; bsd.verbose = pa->verbose; @@ -229,13 +243,13 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize int rc, slice, partition; if (sectorsize == 0) { - DEBUG("unknown sector size"); + DPRINTF("unknown sector size"); return (ENXIO); } rc = 0; od = (struct open_disk *)malloc(sizeof(struct open_disk)); if (od == NULL) { - DEBUG("no memory"); + DPRINTF("no memory"); return (ENOMEM); } dev->dd.d_opendata = od; @@ -256,14 +270,14 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize slice = dev->d_slice; partition = dev->d_partition; - DEBUG("%s unit %d, slice %d, partition %d => %p", + DPRINTF("%s unit %d, slice %d, partition %d => %p", disk_fmtdev(dev), dev->dd.d_unit, dev->d_slice, dev->d_partition, od); /* Determine disk layout. */ od->table = ptable_open(&partdev, mediasize / sectorsize, sectorsize, ptblread); if (od->table == NULL) { - DEBUG("Can't read partition table"); + DPRINTF("Can't read partition table"); rc = ENXIO; goto out; } @@ -319,7 +333,7 @@ disk_open(struct disk_devdesc *dev, uint64_t mediasize table = ptable_open(dev, part.end - part.start + 1, od->sectorsize, ptblread); if (table == NULL) { - DEBUG("Can't read BSD label"); + DPRINTF("Can't read BSD label"); rc = ENXIO; goto out; } @@ -347,12 +361,12 @@ out: if (od->table != NULL) ptable_close(od->table); free(od); - DEBUG("%s could not open", disk_fmtdev(dev)); + DPRINTF("%s could not open", disk_fmtdev(dev)); } else { /* Save the slice and partition number to the dev */ dev->d_slice = slice; dev->d_partition = partition; - DEBUG("%s offset %lld => %p", disk_fmtdev(dev), + DPRINTF("%s offset %lld => %p", disk_fmtdev(dev), (long long)dev->d_offset, od); } return (rc); @@ -364,7 +378,7 @@ disk_close(struct disk_devdesc *dev) struct open_disk *od; od = (struct open_disk *)dev->dd.d_opendata; - DEBUG("%s closed => %p", disk_fmtdev(dev), od); + DPRINTF("%s closed => %p", disk_fmtdev(dev), od); ptable_close(od->table); free(od); return (0); Modified: stable/12/stand/common/interp_forth.c ============================================================================== --- stable/12/stand/common/interp_forth.c Thu Oct 24 02:53:07 2019 (r353982) +++ stable/12/stand/common/interp_forth.c Thu Oct 24 03:01:40 2019 (r353983) @@ -39,9 +39,9 @@ INTERP_DEFINE("4th"); /* #define BFORTH_DEBUG */ #ifdef BFORTH_DEBUG -#define DEBUG(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args) +#define DPRINTF(fmt, args...) printf("%s: " fmt "\n" , __func__ , ## args) #else -#define DEBUG(fmt, args...) +#define DPRINTF(fmt, args...) ((void)0) #endif /* @@ -128,7 +128,7 @@ bf_command(FICL_VM *vm) vmUpdateTib(vm, tail + len); } } - DEBUG("cmd '%s'", line); + DPRINTF("cmd '%s'", line); command_errmsg = command_errbuf; command_errbuf[0] = 0; @@ -310,7 +310,7 @@ bf_run(const char *line) */ result = ficlExec(bf_vm, __DECONST(char *, line)); - DEBUG("ficlExec '%s' = %d", line, result); + DPRINTF("ficlExec '%s' = %d", line, result); switch (result) { case VM_OUTOFTEXT: case VM_ABORTQ: Modified: stable/12/stand/common/module.c ============================================================================== --- stable/12/stand/common/module.c Thu Oct 24 02:53:07 2019 (r353982) +++ stable/12/stand/common/module.c Thu Oct 24 03:01:40 2019 (r353983) @@ -499,7 +499,14 @@ file_loadraw(const char *fname, char *type, int insert /* Looks OK so far; create & populate control structure */ fp = file_alloc(); - fp->f_name = strdup(name); + if (fp == NULL) { + snprintf(command_errbuf, sizeof (command_errbuf), + "no memory to load %s", name); + free(name); + close(fd); + return (NULL); + } + fp->f_name = name; fp->f_type = strdup(type); fp->f_args = NULL; fp->f_metadata = NULL; @@ -507,6 +514,13 @@ file_loadraw(const char *fname, char *type, int insert fp->f_addr = loadaddr; fp->f_size = laddr - loadaddr; + if (fp->f_type == NULL) { + snprintf(command_errbuf, sizeof (command_errbuf), + "no memory to load %s", name); + free(name); + close(fd); + return (NULL); + } /* recognise space consumption */ loadaddr = laddr; @@ -552,6 +566,7 @@ mod_load(char *modname, struct mod_depend *verinfo, in return (ENOENT); } err = mod_loadkld(filename, argc, argv); + free(filename); return (err); } @@ -607,7 +622,7 @@ mod_loadkld(const char *kldname, int argc, char *argv[ snprintf(command_errbuf, sizeof(command_errbuf), "don't know how to load module '%s'", filename); } - if (err && fp) + if (err) file_discard(fp); free(filename); return (err); Modified: stable/12/stand/common/part.c ============================================================================== --- stable/12/stand/common/part.c Thu Oct 24 02:53:07 2019 (r353982) +++ stable/12/stand/common/part.c Thu Oct 24 03:01:40 2019 (r353983) @@ -44,9 +44,9 @@ __FBSDID("$FreeBSD$"); #include #ifdef PART_DEBUG -#define DEBUG(fmt, args...) printf("%s: " fmt "\n", __func__, ## args) +#define DPRINTF(fmt, args...) printf("%s: " fmt "\n", __func__, ## args) #else -#define DEBUG(fmt, args...) +#define DPRINTF(fmt, args...) ((void)0) #endif #ifdef LOADER_GPT_SUPPORT @@ -155,34 +155,34 @@ gpt_checkhdr(struct gpt_hdr *hdr, uint64_t lba_self, u uint32_t sz, crc; if (memcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) != 0) { - DEBUG("no GPT signature"); + DPRINTF("no GPT signature"); return (NULL); } sz = le32toh(hdr->hdr_size); if (sz < 92 || sz > sectorsize) { - DEBUG("invalid GPT header size: %d", sz); + DPRINTF("invalid GPT header size: %d", sz); return (NULL); } crc = le32toh(hdr->hdr_crc_self); hdr->hdr_crc_self = 0; if (crc32(hdr, sz) != crc) { - DEBUG("GPT header's CRC doesn't match"); + DPRINTF("GPT header's CRC doesn't match"); return (NULL); } hdr->hdr_crc_self = crc; hdr->hdr_revision = le32toh(hdr->hdr_revision); if (hdr->hdr_revision < GPT_HDR_REVISION) { - DEBUG("unsupported GPT revision %d", hdr->hdr_revision); + DPRINTF("unsupported GPT revision %d", hdr->hdr_revision); return (NULL); } hdr->hdr_lba_self = le64toh(hdr->hdr_lba_self); if (hdr->hdr_lba_self != lba_self) { - DEBUG("self LBA doesn't match"); + DPRINTF("self LBA doesn't match"); return (NULL); } hdr->hdr_lba_alt = le64toh(hdr->hdr_lba_alt); if (hdr->hdr_lba_alt == hdr->hdr_lba_self) { - DEBUG("invalid alternate LBA"); + DPRINTF("invalid alternate LBA"); return (NULL); } hdr->hdr_entries = le32toh(hdr->hdr_entries); @@ -190,7 +190,7 @@ gpt_checkhdr(struct gpt_hdr *hdr, uint64_t lba_self, u if (hdr->hdr_entries == 0 || hdr->hdr_entsz < sizeof(struct gpt_ent) || sectorsize % hdr->hdr_entsz != 0) { - DEBUG("invalid entry size or number of entries"); + DPRINTF("invalid entry size or number of entries"); return (NULL); } hdr->hdr_lba_start = le64toh(hdr->hdr_lba_start); @@ -214,7 +214,7 @@ gpt_checktbl(const struct gpt_hdr *hdr, uint8_t *tbl, /* Check CRC only when buffer size is enough for table. */ if (hdr->hdr_crc_table != crc32(tbl, hdr->hdr_entries * hdr->hdr_entsz)) { - DEBUG("GPT table's CRC doesn't match"); + DPRINTF("GPT table's CRC doesn't match"); return (-1); } } @@ -310,7 +310,7 @@ ptable_gptread(struct ptable *table, void *dev, diskre table->type = PTABLE_NONE; goto out; } - DEBUG("GPT detected"); + DPRINTF("GPT detected"); size = MIN(hdr.hdr_entries * hdr.hdr_entsz, MAXTBLSZ * table->sectorsize); @@ -346,7 +346,7 @@ ptable_gptread(struct ptable *table, void *dev, diskre entry->flags = le64toh(ent->ent_attr); memcpy(&entry->type.gpt, &ent->ent_type, sizeof(uuid_t)); STAILQ_INSERT_TAIL(&table->entries, entry, entry); - DEBUG("new GPT partition added"); + DPRINTF("new GPT partition added"); } out: free(buf); @@ -402,7 +402,7 @@ ptable_ebrread(struct ptable *table, void *dev, diskre buf = malloc(table->sectorsize); if (buf == NULL) return (table); - DEBUG("EBR detected"); + DPRINTF("EBR detected"); for (i = 0; i < MAXEBRENTRIES; i++) { #if 0 /* Some BIOSes return an incorrect number of sectors */ if (offset >= table->sectors) @@ -430,7 +430,7 @@ ptable_ebrread(struct ptable *table, void *dev, diskre entry->flags = dp[0].dp_flag; entry->type.mbr = dp[0].dp_typ; STAILQ_INSERT_TAIL(&table->entries, entry, entry); - DEBUG("new EBR partition added"); + DPRINTF("new EBR partition added"); if (dp[1].dp_typ == 0) break; offset = e1->part.start + le32toh(dp[1].dp_start); @@ -470,14 +470,14 @@ ptable_bsdread(struct ptable *table, void *dev, diskre int i; if (table->sectorsize < sizeof(struct disklabel)) { - DEBUG("Too small sectorsize"); + DPRINTF("Too small sectorsize"); return (table); } buf = malloc(table->sectorsize); if (buf == NULL) return (table); if (dread(dev, buf, 1, 1) != 0) { - DEBUG("read failed"); + DPRINTF("read failed"); ptable_close(table); table = NULL; goto out; @@ -487,15 +487,15 @@ ptable_bsdread(struct ptable *table, void *dev, diskre le32toh(dl->d_magic2) != DISKMAGIC) goto out; if (le32toh(dl->d_secsize) != table->sectorsize) { - DEBUG("unsupported sector size"); + DPRINTF("unsupported sector size"); goto out; } dl->d_npartitions = le16toh(dl->d_npartitions); if (dl->d_npartitions > 20 || dl->d_npartitions < 8) { - DEBUG("invalid number of partitions"); + DPRINTF("invalid number of partitions"); goto out; } - DEBUG("BSD detected"); + DPRINTF("BSD detected"); part = &dl->d_partitions[0]; raw_offset = le32toh(part[RAW_PART].p_offset); for (i = 0; i < dl->d_npartitions; i++, part++) { @@ -513,7 +513,7 @@ ptable_bsdread(struct ptable *table, void *dev, diskre entry->part.index = i; /* starts from zero */ entry->type.bsd = part->p_fstype; STAILQ_INSERT_TAIL(&table->entries, entry, entry); - DEBUG("new BSD partition added"); + DPRINTF("new BSD partition added"); } table->type = PTABLE_BSD; out: @@ -556,7 +556,7 @@ ptable_vtoc8read(struct ptable *table, void *dev, disk if (buf == NULL) return (table); if (dread(dev, buf, 1, 0) != 0) { - DEBUG("read failed"); + DPRINTF("read failed"); ptable_close(table); table = NULL; goto out; @@ -566,20 +566,20 @@ ptable_vtoc8read(struct ptable *table, void *dev, disk for (i = sum = 0; i < sizeof(struct vtoc8); i += sizeof(sum)) sum ^= be16dec(buf + i); if (sum != 0) { - DEBUG("incorrect checksum"); + DPRINTF("incorrect checksum"); goto out; } if (be16toh(dl->nparts) != VTOC8_NPARTS) { - DEBUG("invalid number of entries"); + DPRINTF("invalid number of entries"); goto out; } sectors = be16toh(dl->nsecs); heads = be16toh(dl->nheads); if (sectors * heads == 0) { - DEBUG("invalid geometry"); + DPRINTF("invalid geometry"); goto out; } - DEBUG("VTOC8 detected"); + DPRINTF("VTOC8 detected"); for (i = 0; i < VTOC8_NPARTS; i++) { dl->part[i].tag = be16toh(dl->part[i].tag); if (i == VTOC_RAW_PART || @@ -595,7 +595,7 @@ ptable_vtoc8read(struct ptable *table, void *dev, disk entry->part.index = i; /* starts from zero */ entry->type.vtoc8 = dl->part[i].tag; STAILQ_INSERT_TAIL(&table->entries, entry, entry); - DEBUG("new VTOC8 partition added"); + DPRINTF("new VTOC8 partition added"); } table->type = PTABLE_VTOC8; out: @@ -619,7 +619,7 @@ ptable_iso9660read(struct ptable *table, void *dev, di return (table); if (dread(dev, buf, 1, cdb2devb(16)) != 0) { - DEBUG("read failed"); + DPRINTF("read failed"); ptable_close(table); table = NULL; goto out; @@ -663,7 +663,7 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect return (NULL); /* First, read the MBR. */ if (dread(dev, buf, 1, DOSBBSECTOR) != 0) { - DEBUG("read failed"); + DPRINTF("read failed"); goto out; } @@ -703,7 +703,7 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect /* Check the MBR magic. */ if (buf[DOSMAGICOFFSET] != 0x55 || buf[DOSMAGICOFFSET + 1] != 0xaa) { - DEBUG("magic sequence not found"); + DPRINTF("magic sequence not found"); #if defined(LOADER_GPT_SUPPORT) /* There is no PMBR, check that we have backup GPT */ table->type = PTABLE_GPT; @@ -715,13 +715,13 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect dp = (struct dos_partition *)(buf + DOSPARTOFF); for (i = 0, count = 0; i < NDOSPART; i++) { if (dp[i].dp_flag != 0 && dp[i].dp_flag != 0x80) { - DEBUG("invalid partition flag %x", dp[i].dp_flag); + DPRINTF("invalid partition flag %x", dp[i].dp_flag); goto out; } #ifdef LOADER_GPT_SUPPORT if (dp[i].dp_typ == DOSPTYP_PMBR) { table->type = PTABLE_GPT; - DEBUG("PMBR detected"); + DPRINTF("PMBR detected"); } #endif if (dp[i].dp_typ != 0) @@ -731,9 +731,9 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect if (table->type == PTABLE_GPT && count > 1) { if (dp[1].dp_typ != DOSPTYP_HFS) { table->type = PTABLE_NONE; - DEBUG("Incorrect PMBR, ignore it"); + DPRINTF("Incorrect PMBR, ignore it"); } else { - DEBUG("Bootcamp detected"); + DPRINTF("Bootcamp detected"); } } #ifdef LOADER_GPT_SUPPORT @@ -744,7 +744,7 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect #endif #ifdef LOADER_MBR_SUPPORT /* Read MBR. */ - DEBUG("MBR detected"); + DPRINTF("MBR detected"); table->type = PTABLE_MBR; for (i = has_ext = 0; i < NDOSPART; i++) { if (dp[i].dp_typ == 0) @@ -770,7 +770,7 @@ ptable_open(void *dev, uint64_t sectors, uint16_t sect entry->flags = dp[i].dp_flag; entry->type.mbr = dp[i].dp_typ; STAILQ_INSERT_TAIL(&table->entries, entry, entry); - DEBUG("new MBR partition added"); + DPRINTF("new MBR partition added"); } if (has_ext) { table = ptable_ebrread(table, dev, dread); Modified: stable/12/stand/efi/libefi/efi_console.c ============================================================================== --- stable/12/stand/efi/libefi/efi_console.c Thu Oct 24 02:53:07 2019 (r353982) +++ stable/12/stand/efi/libefi/efi_console.c Thu Oct 24 03:01:40 2019 (r353983) @@ -135,11 +135,13 @@ efi_cons_rawputchar(int c) UINTN x, y; conout->QueryMode(conout, conout->Mode->Mode, &x, &y); - if (c == '\t') - /* XXX lame tab expansion */ - for (i = 0; i < 8; i++) + if (c == '\t') { + int n; + + n = 8 - ((conout->Mode->CursorColumn + 8) % 8); + for (i = 0; i < n; i++) efi_cons_rawputchar(' '); - else { + } else { #ifndef TERM_EMU if (c == '\n') efi_cons_efiputchar('\r'); Modified: stable/12/stand/i386/libi386/biosdisk.c ============================================================================== --- stable/12/stand/i386/libi386/biosdisk.c Thu Oct 24 02:53:07 2019 (r353982) +++ stable/12/stand/i386/libi386/biosdisk.c Thu Oct 24 03:01:40 2019 (r353983) @@ -65,9 +65,9 @@ __FBSDID("$FreeBSD$"); #define CDMAJOR 15 #ifdef DISK_DEBUG -#define DEBUG(fmt, args...) printf("%s: " fmt "\n", __func__, ## args) +#define DPRINTF(fmt, args...) printf("%s: " fmt "\n", __func__, ## args) #else -#define DEBUG(fmt, args...) +#define DPRINTF(fmt, args...) ((void)0) #endif struct specification_packet { @@ -218,12 +218,12 @@ bd_bios2unit(int biosdev) bdinfo_t *bd; int i, unit; - DEBUG("looking for bios device 0x%x", biosdev); + DPRINTF("looking for bios device 0x%x", biosdev); for (i = 0; bdi[i] != NULL; i++) { unit = 0; STAILQ_FOREACH(bd, bdi[i], bd_link) { if (bd->bd_unit == biosdev) { - DEBUG("bd unit %d is BIOS device 0x%x", unit, + DPRINTF("bd unit %d is BIOS device 0x%x", unit, bd->bd_unit); return (unit); } @@ -620,7 +620,7 @@ bd_int13probe(bdinfo_t *bd) if (bd->bd_sectors == 0) bd->bd_sectors = (uint64_t)bd->bd_cyl * bd->bd_hds * bd->bd_sec; - DEBUG("unit 0x%x geometry %d/%d/%d\n", bd->bd_unit, bd->bd_cyl, + DPRINTF("unit 0x%x geometry %d/%d/%d\n", bd->bd_unit, bd->bd_cyl, bd->bd_hds, bd->bd_sec); return (true); @@ -919,7 +919,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s return (EIO); } - DEBUG("open_disk %p", dev); + DPRINTF("open_disk %p", dev); offset = dblk * BIOSDISK_SECSIZE; dblk = offset / bd->bd_sectorsize; @@ -932,7 +932,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s * while translating block count to bytes. */ if (size > INT_MAX) { - DEBUG("too large I/O: %zu bytes", size); + DPRINTF("too large I/O: %zu bytes", size); return (EIO); } @@ -972,7 +972,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s if (dblk + blks >= d_offset + disk_blocks) { blks = d_offset + disk_blocks - dblk; size = blks * bd->bd_sectorsize; - DEBUG("short I/O %d", blks); + DPRINTF("short I/O %d", blks); } bio_size = min(BIO_BUFFER_SIZE, size); @@ -997,7 +997,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s switch (rw & F_MASK) { case F_READ: - DEBUG("read %d from %lld to %p", x, dblk, buf); + DPRINTF("read %d from %lld to %p", x, dblk, buf); bsize = bd->bd_sectorsize * x - blkoff; if (rest < bsize) bsize = rest; @@ -1010,7 +1010,7 @@ bd_realstrategy(void *devdata, int rw, daddr_t dblk, s bcopy(bbuf + blkoff, buf, bsize); break; case F_WRITE : - DEBUG("write %d from %lld to %p", x, dblk, buf); + DPRINTF("write %d from %lld to %p", x, dblk, buf); if (blkoff != 0) { /* * We got offset to sector, read 1 sector to @@ -1259,7 +1259,7 @@ bd_getdev(struct i386_devdesc *d) return (-1); biosdev = bd_unit2bios(d); - DEBUG("unit %d BIOS device %d", dev->dd.d_unit, biosdev); + DPRINTF("unit %d BIOS device %d", dev->dd.d_unit, biosdev); if (biosdev == -1) /* not a BIOS device */ return (-1); @@ -1312,6 +1312,6 @@ bd_getdev(struct i386_devdesc *d) } rootdev = MAKEBOOTDEV(major, slice, unit, partition); - DEBUG("dev is 0x%x\n", rootdev); + DPRINTF("dev is 0x%x\n", rootdev); return (rootdev); } Modified: stable/12/stand/i386/libi386/vidconsole.c ============================================================================== --- stable/12/stand/i386/libi386/vidconsole.c Thu Oct 24 02:53:07 2019 (r353982) +++ stable/12/stand/i386/libi386/vidconsole.c Thu Oct 24 03:01:40 2019 (r353983) @@ -49,6 +49,8 @@ static int vidc_ischar(void); static int vidc_started; +void get_pos(int *x, int *y); + #ifdef TERM_EMU #define MAXARGS 8 #define DEFAULT_FGCOLOR 7 @@ -57,7 +59,6 @@ static int vidc_started; void end_term(void); void bail_out(int c); void vidc_term_emu(int c); -void get_pos(int *x, int *y); void curs_move(int *_x, int *_y, int x, int y); void write_char(int c, int fg, int bg); void scroll_up(int rows, int fg, int bg); @@ -136,11 +137,18 @@ vidc_rawputchar(int c) { int i; - if (c == '\t') - /* lame tab expansion */ - for (i = 0; i < 8; i++) + if (c == '\t') { + int n; +#ifndef TERM_EMU + int curx, cury; + + get_pos(&curx, %cury); +#endif + + n = 8 - ((curx + 8) % 8); + for (i = 0; i < n; i++) vidc_rawputchar(' '); - else { + } else { #ifndef TERM_EMU vidc_biosputchar(c); #else @@ -188,8 +196,6 @@ vidc_rawputchar(int c) } } -#ifdef TERM_EMU - /* Get cursor position on the screen. Result is in edx. Sets * curx and cury appropriately. */ @@ -205,6 +211,8 @@ get_pos(int *x, int *y) *x = v86.edx & 0x00ff; *y = (v86.edx & 0xff00) >> 8; } + +#ifdef TERM_EMU /* Move cursor to x rows and y cols (0-based). */ void Modified: stable/12/stand/powerpc/Makefile ============================================================================== --- stable/12/stand/powerpc/Makefile Thu Oct 24 02:53:07 2019 (r353982) +++ stable/12/stand/powerpc/Makefile Thu Oct 24 03:01:40 2019 (r353983) @@ -6,7 +6,7 @@ NO_OBJ=t SUBDIR.yes= boot1.chrp ofw uboot -.if "${TARGET_ARCH}" == "powerpc64" +.if "${MACHINE_ARCH}" == "powerpc64" SUBDIR.${MK_FDT}+= kboot .endif Modified: stable/12/stand/userboot/userboot/elf64_freebsd.c ============================================================================== --- stable/12/stand/userboot/userboot/elf64_freebsd.c Thu Oct 24 02:53:07 2019 (r353982) +++ stable/12/stand/userboot/userboot/elf64_freebsd.c Thu Oct 24 03:01:40 2019 (r353983) @@ -31,6 +31,9 @@ __FBSDID("$FreeBSD$"); #include #include #include +#ifdef DEBUG +#include +#endif #include #include #include @@ -136,7 +139,7 @@ elf64_exec(struct preloaded_file *fp) } #ifdef DEBUG - printf("Start @ %#llx ...\n", ehdr->e_entry); + printf("Start @ %#"PRIx64" ...\n", ehdr->e_entry); #endif dev_cleanup(); From owner-svn-src-all@freebsd.org Thu Oct 24 03:06:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F0F9150E83; Thu, 24 Oct 2019 03:06:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zBwZ0VPZz4FQv; Thu, 24 Oct 2019 03:06:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E9C057AF3; Thu, 24 Oct 2019 03:06:37 +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 x9O36bFW006923; Thu, 24 Oct 2019 03:06:37 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O36bUs006922; Thu, 24 Oct 2019 03:06:37 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240306.x9O36bUs006922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:06:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353985 - stable/12/stand/libsa/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/libsa/zfs X-SVN-Commit-Revision: 353985 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:06:38 -0000 Author: kevans Date: Thu Oct 24 03:06:37 2019 New Revision: 353985 URL: https://svnweb.freebsd.org/changeset/base/353985 Log: MFC r348352, r348354 r348352: loader: zfs_alloc and zfs_free should use panic The zfs alloc and free code print out the error and get stuck in infinite loop; use panic() instead. r348354: loader: malloc+memset is calloc in spa_create Replace malloc + memset pair with calloc. Modified: stable/12/stand/libsa/zfs/zfsimpl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/zfs/zfsimpl.c ============================================================================== --- stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:04:36 2019 (r353984) +++ stable/12/stand/libsa/zfs/zfsimpl.c Thu Oct 24 03:06:37 2019 (r353985) @@ -174,8 +174,7 @@ zfs_alloc(size_t size) char *ptr; if (zfs_temp_ptr + size > zfs_temp_end) { - printf("ZFS: out of temporary buffer space\n"); - for (;;) ; + panic("ZFS: out of temporary buffer space"); } ptr = zfs_temp_ptr; zfs_temp_ptr += size; @@ -189,8 +188,7 @@ zfs_free(void *ptr, size_t size) zfs_temp_ptr -= size; if (zfs_temp_ptr != ptr) { - printf("ZFS: zfs_alloc()/zfs_free() mismatch\n"); - for (;;) ; + panic("ZFS: zfs_alloc()/zfs_free() mismatch"); } } @@ -1341,9 +1339,8 @@ spa_create(uint64_t guid, const char *name) { spa_t *spa; - if ((spa = malloc(sizeof(spa_t))) == NULL) + if ((spa = calloc(1, sizeof(spa_t))) == NULL) return (NULL); - memset(spa, 0, sizeof(spa_t)); if ((spa->spa_name = strdup(name)) == NULL) { free(spa); return (NULL); From owner-svn-src-all@freebsd.org Thu Oct 24 03:16:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52012152D83; Thu, 24 Oct 2019 03:16:26 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zC7t22vvz4Gy2; Thu, 24 Oct 2019 03:16: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 2A5B37CDC; Thu, 24 Oct 2019 03:16: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 x9O3GQFS013156; Thu, 24 Oct 2019 03:16:26 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3GNMT013142; Thu, 24 Oct 2019 03:16:23 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240316.x9O3GNMT013142@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:16:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353988 - in stable/12/stand: efi efi/boot1 efi/gptboot efi/include efi/libefi i386/gptboot libsa X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: efi efi/boot1 efi/gptboot efi/include efi/libefi i386/gptboot libsa X-SVN-Commit-Revision: 353988 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:16:26 -0000 Author: kevans Date: Thu Oct 24 03:16:23 2019 New Revision: 353988 URL: https://svnweb.freebsd.org/changeset/base/353988 Log: MFC r348658-r348659, r348674-r348675, r348678, r348760, r348766, r348768, r348811-r348812, r348814, r349008 r348658: Introduce efi_devpath_same_disk This is like efi_devpath_match, but allows differing device media paths. Those just specify the partition information. r348659: Use newly minted efi_devpath_same_disk() instead of efi_devpath_match(). This fixes a regression in r347193. r348674: Don't shadow a global zfsmount variable. r348675: ufs_module.c can't currently be compiled with -Wcast-align, but the code is safe enough. Turn off the warning for now until I can find the right construct to silence it in the code. r348678: Eliminate unused uuid parameters from gptread and gptread_table. We only need it for the gptfind() function, where it's used. r348760: Use simple malloc/free instead of dropping down to the UEFI BootServices AllocatePool/FreePool calls. They are simpler to use and result in the same thing happening. r348766: Remove left-over status variables r348768: Rework the reporting of the priority. Simplify the code a bit and rework how we report the results of the probing. r348811: Break out the disk selection protocol from the rest of boot1. Segregate the disk probing and selection protocol from the rest of the boot loader. r348812: Create gptboot.efi This is a primary boot loader that is intended to implement the gptboot partition selection algorithm just like we did for BIOS booting. While the preferred method for UEFI is to use the UEFI Boot Manager protocol, there are situations where that can't be done: some BIOS makers interfere with the protocol in unhelpful ways, there's a new standard for a zero variable write from the client OS, and finally for USB drives that might be mobile between systems with multiple partitions there needs to be a media stable way to select. r348814: Add stuff to disable warning for %S Add the customary warnings to disable format checking on armv7. Code move to new files, and the unconditional setting of WARNS to 6 provoked it on tinerbox... r349008: Fix gcc build by removing redeclaration Added: stable/12/stand/efi/boot1/proto.c - copied unchanged from r348812, head/stand/efi/boot1/proto.c stable/12/stand/efi/boot1/proto.h - copied unchanged from r348812, head/stand/efi/boot1/proto.h stable/12/stand/efi/gptboot/ - copied from r348812, head/stand/efi/gptboot/ Modified: stable/12/stand/efi/Makefile stable/12/stand/efi/boot1/Makefile stable/12/stand/efi/boot1/boot1.c stable/12/stand/efi/boot1/boot_module.h stable/12/stand/efi/boot1/ufs_module.c stable/12/stand/efi/boot1/zfs_module.c stable/12/stand/efi/include/efilib.h stable/12/stand/efi/libefi/devpath.c stable/12/stand/i386/gptboot/gptboot.c stable/12/stand/libsa/gpt.c stable/12/stand/libsa/gpt.h Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/Makefile ============================================================================== --- stable/12/stand/efi/Makefile Thu Oct 24 03:09:31 2019 (r353987) +++ stable/12/stand/efi/Makefile Thu Oct 24 03:16:23 2019 (r353988) @@ -9,7 +9,7 @@ NO_OBJ=t .if ${COMPILER_TYPE} != "gcc" || ${COMPILER_VERSION} >= 40500 SUBDIR.${MK_FDT}+= fdt -SUBDIR.yes+= libefi boot1 +SUBDIR.yes+= libefi boot1 gptboot SUBDIR.${MK_FORTH}+= loader_4th SUBDIR.${MK_LOADER_LUA}+= loader_lua SUBDIR.yes+= loader_simp Modified: stable/12/stand/efi/boot1/Makefile ============================================================================== --- stable/12/stand/efi/boot1/Makefile Thu Oct 24 03:09:31 2019 (r353987) +++ stable/12/stand/efi/boot1/Makefile Thu Oct 24 03:16:23 2019 (r353988) @@ -5,7 +5,7 @@ BOOT1?= boot1 PROG= ${BOOT1}.sym INTERNALPROG= -WARNS?= 6 +WARNS= 6 CFLAGS+= -DEFI_BOOT1 # We implement a slightly non-standard %S in that it always takes a @@ -13,8 +13,13 @@ CFLAGS+= -DEFI_BOOT1 # seems to matter on arm64 where wchar_t defaults to an int instead # of a short. There's no good cast to use here so just ignore the # warnings for now. +CWARNFLAGS.proto.c+= -Wno-format CWARNFLAGS.boot1.c+= -Wno-format +# Disable bogus alignment issues +CWARNFLAGS.ufs_module.c += -Wno-format +CWARNFLAGS.ufs_module.c += -Wno-cast-align + # Disable warnings that are currently incompatible with the zfs boot code CWARNFLAGS.zfs_module.c += -Wno-array-bounds CWARNFLAGS.zfs_module.c += -Wno-cast-align @@ -25,7 +30,7 @@ CWARNFLAGS.zfs_module.c += -Wno-unused-parameter CWARNFLAGS.zfs_module.c += -Wno-unused-function # architecture-specific loader code -SRCS+= boot1.c self_reloc.c start.S ufs_module.c devpath.c +SRCS+= boot1.c proto.c self_reloc.c start.S ufs_module.c devpath.c .if ${MK_LOADER_ZFS} != "no" SRCS+= zfs_module.c CFLAGS.zfs_module.c+= -I${ZFSSRC} Modified: stable/12/stand/efi/boot1/boot1.c ============================================================================== --- stable/12/stand/efi/boot1/boot1.c Thu Oct 24 03:09:31 2019 (r353987) +++ stable/12/stand/efi/boot1/boot1.c Thu Oct 24 03:16:23 2019 (r353988) @@ -33,10 +33,11 @@ __FBSDID("$FreeBSD$"); #include "boot_module.h" #include "paths.h" +#include "proto.h" static void efi_panic(EFI_STATUS s, const char *fmt, ...) __dead2 __printflike(2, 3); -static const boot_module_t *boot_modules[] = +const boot_module_t *boot_modules[] = { #ifdef EFI_ZFS_BOOT &zfs_module, @@ -45,9 +46,8 @@ static const boot_module_t *boot_modules[] = &ufs_module #endif }; +const UINTN num_boot_modules = nitems(boot_modules); -#define NUM_BOOT_MODULES nitems(boot_modules) - static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL; static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; static EFI_GUID LoadedImageGUID = LOADED_IMAGE_PROTOCOL; @@ -91,66 +91,19 @@ Calloc(size_t n1, size_t n2, const char *file, int lin } /* - * load_loader attempts to load the loader image data. - * - * It tries each module and its respective devices, identified by mod->probe, - * in order until a successful load occurs at which point it returns EFI_SUCCESS - * and EFI_NOT_FOUND otherwise. - * - * Only devices which have preferred matching the preferred parameter are tried. - */ -static EFI_STATUS -load_loader(const boot_module_t **modp, dev_info_t **devinfop, void **bufp, - size_t *bufsize, BOOLEAN preferred) -{ - UINTN i; - dev_info_t *dev; - const boot_module_t *mod; - - for (i = 0; i < NUM_BOOT_MODULES; i++) { - mod = boot_modules[i]; - for (dev = mod->devices(); dev != NULL; dev = dev->next) { - if (dev->preferred != preferred) - continue; - - if (mod->load(PATH_LOADER_EFI, dev, bufp, bufsize) == - EFI_SUCCESS) { - *devinfop = dev; - *modp = mod; - return (EFI_SUCCESS); - } - } - } - - return (EFI_NOT_FOUND); -} - -/* * try_boot only returns if it fails to load the loader. If it succeeds * it simply boots, otherwise it returns the status of last EFI call. */ -static EFI_STATUS -try_boot(void) +EFI_STATUS +try_boot(const boot_module_t *mod, dev_info_t *dev, void *loaderbuf, size_t loadersize) { - size_t bufsize, loadersize, cmdsize; - void *buf, *loaderbuf; + size_t bufsize, cmdsize; + void *buf; char *cmd; - dev_info_t *dev; - const boot_module_t *mod; EFI_HANDLE loaderhandle; EFI_LOADED_IMAGE *loaded_image; EFI_STATUS status; - status = load_loader(&mod, &dev, &loaderbuf, &loadersize, TRUE); - if (status != EFI_SUCCESS) { - status = load_loader(&mod, &dev, &loaderbuf, &loadersize, - FALSE); - if (status != EFI_SUCCESS) { - printf("Failed to load '%s'\n", PATH_LOADER_EFI); - return (status); - } - } - /* * Read in and parse the command line from /boot.config or /boot/config, * if present. We'll pass it the next stage via a simple ASCII @@ -230,111 +183,6 @@ errout: return (status); } -/* - * probe_handle determines if the passed handle represents a logical partition - * if it does it uses each module in order to probe it and if successful it - * returns EFI_SUCCESS. - */ -static EFI_STATUS -probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath, BOOLEAN *preferred) -{ - dev_info_t *devinfo; - EFI_BLOCK_IO *blkio; - EFI_DEVICE_PATH *devpath; - EFI_STATUS status; - UINTN i; - - /* Figure out if we're dealing with an actual partition. */ - status = OpenProtocolByHandle(h, &DevicePathGUID, (void **)&devpath); - if (status == EFI_UNSUPPORTED) - return (status); - - if (status != EFI_SUCCESS) { - DPRINTF("\nFailed to query DevicePath (%lu)\n", - EFI_ERROR_CODE(status)); - return (status); - } -#ifdef EFI_DEBUG - { - CHAR16 *text = efi_devpath_name(devpath); - DPRINTF("probing: %S\n", text); - efi_free_devpath_name(text); - } -#endif - status = OpenProtocolByHandle(h, &BlockIoProtocolGUID, (void **)&blkio); - if (status == EFI_UNSUPPORTED) - return (status); - - if (status != EFI_SUCCESS) { - DPRINTF("\nFailed to query BlockIoProtocol (%lu)\n", - EFI_ERROR_CODE(status)); - return (status); - } - - if (!blkio->Media->LogicalPartition) - return (EFI_UNSUPPORTED); - - *preferred = efi_devpath_match(imgpath, devpath); - - /* Run through each module, see if it can load this partition */ - devinfo = malloc(sizeof(*devinfo)); - if (devinfo == NULL) { - DPRINTF("\nFailed to allocate devinfo\n"); - return (EFI_UNSUPPORTED); - } - devinfo->dev = blkio; - devinfo->devpath = devpath; - devinfo->devhandle = h; - devinfo->preferred = *preferred; - devinfo->next = NULL; - - for (i = 0; i < NUM_BOOT_MODULES; i++) { - devinfo->devdata = NULL; - status = boot_modules[i]->probe(devinfo); - if (status == EFI_SUCCESS) - return (EFI_SUCCESS); - } - free(devinfo); - - return (EFI_UNSUPPORTED); -} - -/* - * probe_handle_status calls probe_handle and outputs the returned status - * of the call. - */ -static void -probe_handle_status(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) -{ - EFI_STATUS status; - BOOLEAN preferred; - - preferred = FALSE; - status = probe_handle(h, imgpath, &preferred); - - DPRINTF("probe: "); - switch (status) { - case EFI_UNSUPPORTED: - printf("."); - DPRINTF(" not supported\n"); - break; - case EFI_SUCCESS: - if (preferred) { - printf("%c", '*'); - DPRINTF(" supported (preferred)\n"); - } else { - printf("%c", '+'); - DPRINTF(" supported\n"); - } - break; - default: - printf("x"); - DPRINTF(" error (%lu)\n", EFI_ERROR_CODE(status)); - break; - } - DSTALL(500000); -} - EFI_STATUS efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) { @@ -346,9 +194,6 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) SIMPLE_TEXT_OUTPUT_INTERFACE *conout = NULL; UINTN i, hsize, nhandles; CHAR16 *text; - UINT16 boot_current; - size_t sz; - UINT16 boot_order[100]; /* Basic initialization*/ ST = Xsystab; @@ -376,13 +221,27 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) printf("\n>> FreeBSD EFI boot block\n"); printf(" Loader path: %s\n\n", PATH_LOADER_EFI); printf(" Initializing modules:"); - for (i = 0; i < NUM_BOOT_MODULES; i++) { + for (i = 0; i < num_boot_modules; i++) { printf(" %s", boot_modules[i]->name); if (boot_modules[i]->init != NULL) boot_modules[i]->init(); } putchar('\n'); + /* Fetch all the block I/O handles, we have to search through them later */ + hsize = 0; + BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, + &hsize, NULL); + handles = malloc(hsize); + if (handles == NULL) + efi_panic(EFI_OUT_OF_RESOURCES, "Failed to allocate %d handles\n", + hsize); + status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, + NULL, &hsize, handles); + if (status != EFI_SUCCESS) + efi_panic(status, "Failed to get device handles\n"); + nhandles = hsize / sizeof(*handles); + /* Determine the devpath of our image so we can prefer it. */ status = OpenProtocolByHandle(IH, &LoadedImageGUID, (void **)&img); imgpath = NULL; @@ -409,58 +268,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_TABLE *Xsystab) } } - boot_current = 0; - sz = sizeof(boot_current); - if (efi_global_getenv("BootCurrent", &boot_current, &sz) == EFI_SUCCESS) { - printf(" BootCurrent: %04x\n", boot_current); - - sz = sizeof(boot_order); - if (efi_global_getenv("BootOrder", &boot_order, &sz) == EFI_SUCCESS) { - printf(" BootOrder:"); - for (i = 0; i < sz / sizeof(boot_order[0]); i++) - printf(" %04x%s", boot_order[i], - boot_order[i] == boot_current ? "[*]" : ""); - printf("\n"); - } - } - -#ifdef TEST_FAILURE - /* - * For testing failover scenarios, it's nice to be able to fail fast. - * Define TEST_FAILURE to create a boot1.efi that always fails after - * reporting the boot manager protocol details. - */ - BS->Exit(IH, EFI_OUT_OF_RESOURCES, 0, NULL); -#endif - - hsize = 0; - BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, NULL, - &hsize, NULL); - handles = malloc(hsize); - if (handles == NULL) - efi_panic(EFI_OUT_OF_RESOURCES, "Failed to allocate %d handles\n", - hsize); - status = BS->LocateHandle(ByProtocol, &BlockIoProtocolGUID, - NULL, &hsize, handles); - if (status != EFI_SUCCESS) - efi_panic(status, "Failed to get device handles\n"); - - /* Scan all partitions, probing with all modules. */ - nhandles = hsize / sizeof(*handles); - printf(" Probing %zu block devices...", nhandles); - DPRINTF("\n"); - - for (i = 0; i < nhandles; i++) - probe_handle_status(handles[i], imgpath); - printf(" done\n"); - - /* Status summary. */ - for (i = 0; i < NUM_BOOT_MODULES; i++) { - printf(" "); - boot_modules[i]->status(); - } - - try_boot(); + choice_protocol(handles, nhandles, imgpath); /* If we get here, we're out of luck... */ efi_panic(EFI_LOAD_ERROR, "No bootable partitions found!"); Modified: stable/12/stand/efi/boot1/boot_module.h ============================================================================== --- stable/12/stand/efi/boot1/boot_module.h Thu Oct 24 03:09:31 2019 (r353987) +++ stable/12/stand/efi/boot1/boot_module.h Thu Oct 24 03:16:23 2019 (r353988) @@ -96,6 +96,9 @@ typedef struct boot_module_t dev_info_t *(*devices)(void); } boot_module_t; +extern const boot_module_t *boot_modules[]; +extern const UINTN num_boot_modules; + /* Standard boot modules. */ #ifdef EFI_UFS_BOOT extern const boot_module_t ufs_module; @@ -106,5 +109,4 @@ extern const boot_module_t zfs_module; /* Functions available to modules. */ extern void add_device(dev_info_t **devinfop, dev_info_t *devinfo); -extern int vsnprintf(char *str, size_t sz, const char *fmt, va_list ap); #endif Copied: stable/12/stand/efi/boot1/proto.c (from r348812, head/stand/efi/boot1/proto.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/efi/boot1/proto.c Thu Oct 24 03:16:23 2019 (r353988, copy of r348812, head/stand/efi/boot1/proto.c) @@ -0,0 +1,223 @@ +/*- + * Copyright (c) 1998 Robert Nordier + * All rights reserved. + * Copyright (c) 2001 Robert Drehmel + * All rights reserved. + * Copyright (c) 2014 Nathan Whitehorn + * All rights reserved. + * Copyright (c) 2015 Eric McCorkle + * All rights reserved. + * + * Redistribution and use in source and binary forms are freely + * permitted provided that the above copyright notice and this + * paragraph and the following disclaimer are duplicated in all + * such forms. + * + * This software is provided "AS IS" and without any express or + * implied warranties, including, without limitation, the implied + * warranties of merchantability and fitness for a particular + * purpose. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include + +#include +#include +#include + +#include "boot_module.h" +#include "paths.h" +#include "proto.h" + +static EFI_GUID BlockIoProtocolGUID = BLOCK_IO_PROTOCOL; +static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL; + +static const char *prio_str[] = { + "error", + "not supported", + "good", + "better" +}; + +/* + * probe_handle determines if the passed handle represents a logical partition + * if it does it uses each module in order to probe it and if successful it + * returns EFI_SUCCESS. + */ +static int +probe_handle(EFI_HANDLE h, EFI_DEVICE_PATH *imgpath) +{ + dev_info_t *devinfo; + EFI_BLOCK_IO *blkio; + EFI_DEVICE_PATH *devpath; + EFI_STATUS status; + UINTN i; + int preferred; + + /* Figure out if we're dealing with an actual partition. */ + status = BS->HandleProtocol(h, &DevicePathGUID, (void **)&devpath); + if (status == EFI_UNSUPPORTED) + return (0); + + if (status != EFI_SUCCESS) { + DPRINTF("\nFailed to query DevicePath (%lu)\n", + EFI_ERROR_CODE(status)); + return (-1); + } +#ifdef EFI_DEBUG + { + CHAR16 *text = efi_devpath_name(devpath); + DPRINTF("probing: %S ", text); + efi_free_devpath_name(text); + } +#endif + status = BS->HandleProtocol(h, &BlockIoProtocolGUID, (void **)&blkio); + if (status == EFI_UNSUPPORTED) + return (0); + + if (status != EFI_SUCCESS) { + DPRINTF("\nFailed to query BlockIoProtocol (%lu)\n", + EFI_ERROR_CODE(status)); + return (-1); + } + + if (!blkio->Media->LogicalPartition) + return (0); + + preferred = efi_devpath_same_disk(imgpath, devpath); + + /* Run through each module, see if it can load this partition */ + devinfo = malloc(sizeof(*devinfo)); + if (devinfo == NULL) { + DPRINTF("\nFailed to allocate devinfo\n"); + return (-1); + } + devinfo->dev = blkio; + devinfo->devpath = devpath; + devinfo->devhandle = h; + devinfo->preferred = preferred; + devinfo->next = NULL; + + for (i = 0; i < num_boot_modules; i++) { + devinfo->devdata = NULL; + + status = boot_modules[i]->probe(devinfo); + if (status == EFI_SUCCESS) + return (preferred + 1); + } + free(devinfo); + + return (0); +} + +/* + * load_loader attempts to load the loader image data. + * + * It tries each module and its respective devices, identified by mod->probe, + * in order until a successful load occurs at which point it returns EFI_SUCCESS + * and EFI_NOT_FOUND otherwise. + * + * Only devices which have preferred matching the preferred parameter are tried. + */ +static EFI_STATUS +load_loader(const boot_module_t **modp, dev_info_t **devinfop, void **bufp, + size_t *bufsize, int preferred) +{ + UINTN i; + dev_info_t *dev; + const boot_module_t *mod; + + for (i = 0; i < num_boot_modules; i++) { + mod = boot_modules[i]; + for (dev = mod->devices(); dev != NULL; dev = dev->next) { + if (dev->preferred != preferred) + continue; + + if (mod->load(PATH_LOADER_EFI, dev, bufp, bufsize) == + EFI_SUCCESS) { + *devinfop = dev; + *modp = mod; + return (EFI_SUCCESS); + } + } + } + + return (EFI_NOT_FOUND); +} + +void +choice_protocol(EFI_HANDLE *handles, UINTN nhandles, EFI_DEVICE_PATH *imgpath) +{ + UINT16 boot_current; + size_t sz; + UINT16 boot_order[100]; + unsigned i; + int rv; + EFI_STATUS status; + const boot_module_t *mod; + dev_info_t *dev; + void *loaderbuf; + size_t loadersize; + + /* Report UEFI Boot Manager Protocol details */ + boot_current = 0; + sz = sizeof(boot_current); + if (efi_global_getenv("BootCurrent", &boot_current, &sz) == EFI_SUCCESS) { + printf(" BootCurrent: %04x\n", boot_current); + + sz = sizeof(boot_order); + if (efi_global_getenv("BootOrder", &boot_order, &sz) == EFI_SUCCESS) { + printf(" BootOrder:"); + for (i = 0; i < sz / sizeof(boot_order[0]); i++) + printf(" %04x%s", boot_order[i], + boot_order[i] == boot_current ? "[*]" : ""); + printf("\n"); + } + } + +#ifdef TEST_FAILURE + /* + * For testing failover scenarios, it's nice to be able to fail fast. + * Define TEST_FAILURE to create a boot1.efi that always fails after + * reporting the boot manager protocol details. + */ + BS->Exit(IH, EFI_OUT_OF_RESOURCES, 0, NULL); +#endif + + /* Scan all partitions, probing with all modules. */ + printf(" Probing %zu block devices...", nhandles); + DPRINTF("\n"); + for (i = 0; i < nhandles; i++) { + rv = probe_handle(handles[i], imgpath); +#ifdef EFI_DEBUG + printf("%c", "x.+*"[rv + 1]); +#else + printf("%s\n", prio_str[rv + 1]); +#endif + } + printf(" done\n"); + + + /* Status summary. */ + for (i = 0; i < num_boot_modules; i++) { + printf(" "); + boot_modules[i]->status(); + } + + status = load_loader(&mod, &dev, &loaderbuf, &loadersize, 1); + if (status != EFI_SUCCESS) { + status = load_loader(&mod, &dev, &loaderbuf, &loadersize, 0); + if (status != EFI_SUCCESS) { + printf("Failed to load '%s'\n", PATH_LOADER_EFI); + return; + } + } + + try_boot(mod, dev, loaderbuf, loadersize); +} Copied: stable/12/stand/efi/boot1/proto.h (from r348812, head/stand/efi/boot1/proto.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/efi/boot1/proto.h Thu Oct 24 03:16:23 2019 (r353988, copy of r348812, head/stand/efi/boot1/proto.h) @@ -0,0 +1,29 @@ +/*- + * Copyright (c) 2019 Netflix, Inc + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +void choice_protocol(EFI_HANDLE *handles, UINTN nhandles, EFI_DEVICE_PATH *imgpath); +EFI_STATUS try_boot(const boot_module_t *mod, dev_info_t *dev, void *loaderbuf, size_t loadersize); Modified: stable/12/stand/efi/boot1/ufs_module.c ============================================================================== --- stable/12/stand/efi/boot1/ufs_module.c Thu Oct 24 03:09:31 2019 (r353987) +++ stable/12/stand/efi/boot1/ufs_module.c Thu Oct 24 03:16:23 2019 (r353988) @@ -140,7 +140,6 @@ static EFI_STATUS load(const char *filepath, dev_info_t *dev, void **bufp, size_t *bufsize) { ufs_ino_t ino; - EFI_STATUS status; size_t size; ssize_t read; void *buf; @@ -167,18 +166,18 @@ load(const char *filepath, dev_info_t *dev, void **buf return (EFI_INVALID_PARAMETER); } - if ((status = BS->AllocatePool(EfiLoaderData, size, &buf)) != - EFI_SUCCESS) { - printf("Failed to allocate read buffer %zu for '%s' (%lu)\n", - size, filepath, EFI_ERROR_CODE(status)); - return (status); + buf = malloc(size); + if (buf == NULL) { + printf("Failed to allocate read buffer %zu for '%s'\n", + size, filepath); + return (EFI_OUT_OF_RESOURCES); } read = fsread(ino, buf, size); if ((size_t)read != size) { printf("Failed to read '%s' (%zd != %zu)\n", filepath, read, size); - (void)BS->FreePool(buf); + free(buf); return (EFI_INVALID_PARAMETER); } Modified: stable/12/stand/efi/boot1/zfs_module.c ============================================================================== --- stable/12/stand/efi/boot1/zfs_module.c Thu Oct 24 03:09:31 2019 (r353987) +++ stable/12/stand/efi/boot1/zfs_module.c Thu Oct 24 03:16:23 2019 (r353988) @@ -115,19 +115,17 @@ probe(dev_info_t *dev) { spa_t *spa; dev_info_t *tdev; - EFI_STATUS status; /* ZFS consumes the dev on success so we need a copy. */ - if ((status = BS->AllocatePool(EfiLoaderData, sizeof(*dev), - (void**)&tdev)) != EFI_SUCCESS) { - DPRINTF("Failed to allocate tdev (%lu)\n", - EFI_ERROR_CODE(status)); - return (status); + tdev = malloc(sizeof(*dev)); + if (tdev == NULL) { + DPRINTF("Failed to allocate tdev\n"); + return (EFI_OUT_OF_RESOURCES); } memcpy(tdev, dev, sizeof(*dev)); if (vdev_probe(vdev_read, tdev, &spa) != 0) { - (void)BS->FreePool(tdev); + free(tdev); return (EFI_UNSUPPORTED); } @@ -141,12 +139,11 @@ static EFI_STATUS load(const char *filepath, dev_info_t *devinfo, void **bufp, size_t *bufsize) { spa_t *spa; - struct zfsmount zfsmount; + struct zfsmount zmount; dnode_phys_t dn; struct stat st; int err; void *buf; - EFI_STATUS status; spa = devinfo->devdata; @@ -163,12 +160,12 @@ load(const char *filepath, dev_info_t *devinfo, void * return (EFI_NOT_FOUND); } - if ((err = zfs_mount(spa, 0, &zfsmount)) != 0) { + if ((err = zfs_mount(spa, 0, &zmount)) != 0) { DPRINTF("Failed to mount pool '%s' (%d)\n", spa->spa_name, err); return (EFI_NOT_FOUND); } - if ((err = zfs_lookup(&zfsmount, filepath, &dn)) != 0) { + if ((err = zfs_lookup(&zmount, filepath, &dn)) != 0) { if (err == ENOENT) { DPRINTF("Failed to find '%s' on pool '%s' (%d)\n", filepath, spa->spa_name, err); @@ -185,17 +182,17 @@ load(const char *filepath, dev_info_t *devinfo, void * return (EFI_INVALID_PARAMETER); } - if ((status = BS->AllocatePool(EfiLoaderData, (UINTN)st.st_size, &buf)) - != EFI_SUCCESS) { - printf("Failed to allocate load buffer %jd for pool '%s' for '%s' " - "(%lu)\n", (intmax_t)st.st_size, spa->spa_name, filepath, EFI_ERROR_CODE(status)); + buf = malloc(st.st_size); + if (buf == NULL) { + printf("Failed to allocate load buffer %jd for pool '%s' for '%s' ", + (intmax_t)st.st_size, spa->spa_name, filepath); return (EFI_INVALID_PARAMETER); } if ((err = dnode_read(spa, &dn, 0, buf, st.st_size)) != 0) { printf("Failed to read node from %s (%d)\n", spa->spa_name, err); - (void)BS->FreePool(buf); + free(buf); return (EFI_INVALID_PARAMETER); } Modified: stable/12/stand/efi/include/efilib.h ============================================================================== --- stable/12/stand/efi/include/efilib.h Thu Oct 24 03:09:31 2019 (r353987) +++ stable/12/stand/efi/include/efilib.h Thu Oct 24 03:16:23 2019 (r353988) @@ -91,6 +91,7 @@ bool efi_devpath_match_node(EFI_DEVICE_PATH *, EFI_DEV bool efi_devpath_is_prefix(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *); CHAR16 *efi_devpath_name(EFI_DEVICE_PATH *); void efi_free_devpath_name(CHAR16 *); +bool efi_devpath_same_disk(EFI_DEVICE_PATH *, EFI_DEVICE_PATH *); EFI_DEVICE_PATH *efi_devpath_to_media_path(EFI_DEVICE_PATH *); UINTN efi_devpath_length(EFI_DEVICE_PATH *); EFI_HANDLE efi_devpath_to_handle(EFI_DEVICE_PATH *path, EFI_HANDLE *handles, unsigned nhandles); Modified: stable/12/stand/efi/libefi/devpath.c ============================================================================== --- stable/12/stand/efi/libefi/devpath.c Thu Oct 24 03:09:31 2019 (r353987) +++ stable/12/stand/efi/libefi/devpath.c Thu Oct 24 03:16:23 2019 (r353988) @@ -199,14 +199,19 @@ efi_devpath_match_node(EFI_DEVICE_PATH *devpath1, EFI_ return (true); } -bool -efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2) +static bool +_efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2, + bool ignore_media) { if (devpath1 == NULL || devpath2 == NULL) return (false); while (true) { + if (ignore_media && + IsDevicePathType(devpath1, MEDIA_DEVICE_PATH) && + IsDevicePathType(devpath2, MEDIA_DEVICE_PATH)) + return (true); if (!efi_devpath_match_node(devpath1, devpath2)) return false; if (IsDevicePathEnd(devpath1)) @@ -215,6 +220,25 @@ efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVIC devpath2 = NextDevicePathNode(devpath2); } return (true); +} +/* + * Are two devpaths identical? + */ +bool +efi_devpath_match(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2) +{ + return _efi_devpath_match(devpath1, devpath2, false); +} + +/* + * Like efi_devpath_match, but stops at when we hit the media device + * path node that specifies the partition information. If we match + * up to that point, then we're on the same disk. + */ +bool +efi_devpath_same_disk(EFI_DEVICE_PATH *devpath1, EFI_DEVICE_PATH *devpath2) +{ + return _efi_devpath_match(devpath1, devpath2, true); } bool Modified: stable/12/stand/i386/gptboot/gptboot.c ============================================================================== --- stable/12/stand/i386/gptboot/gptboot.c Thu Oct 24 03:09:31 2019 (r353987) +++ stable/12/stand/i386/gptboot/gptboot.c Thu Oct 24 03:16:23 2019 (r353988) @@ -232,7 +232,7 @@ static int gptinit(void) { - if (gptread(&freebsd_ufs_uuid, &gdsk.dsk, dmadat->secbuf) == -1) { + if (gptread(&gdsk.dsk, dmadat->secbuf) == -1) { printf("%s: unable to load GPT\n", BOOTPROG); return (-1); } Modified: stable/12/stand/libsa/gpt.c ============================================================================== --- stable/12/stand/libsa/gpt.c Thu Oct 24 03:09:31 2019 (r353987) +++ stable/12/stand/libsa/gpt.c Thu Oct 24 03:16:23 2019 (r353988) @@ -275,8 +275,8 @@ gptbootconv(const char *which, struct dsk *dskp, struc } static int -gptread_table(const char *which, const uuid_t *uuid, struct dsk *dskp, - struct gpt_hdr *hdr, struct gpt_ent *table) +gptread_table(const char *which, struct dsk *dskp, struct gpt_hdr *hdr, + struct gpt_ent *table) { struct gpt_ent *ent; int entries_per_sec; @@ -313,7 +313,7 @@ gptread_table(const char *which, const uuid_t *uuid, s } int -gptread(const uuid_t *uuid, struct dsk *dskp, char *buf) +gptread(struct dsk *dskp, char *buf) { uint64_t altlba; @@ -328,8 +328,7 @@ gptread(const uuid_t *uuid, struct dsk *dskp, char *bu dskp->start = 0; if (gptread_hdr("primary", dskp, &hdr_primary, 1) == 0 && - gptread_table("primary", uuid, dskp, &hdr_primary, - table_primary) == 0) { + gptread_table("primary", dskp, &hdr_primary, table_primary) == 0) { hdr_primary_lba = hdr_primary.hdr_lba_self; gpthdr = &hdr_primary; gpttable = table_primary; @@ -349,8 +348,7 @@ gptread(const uuid_t *uuid, struct dsk *dskp, char *bu if (altlba == 0) printf("%s: unable to locate backup GPT header\n", BOOTPROG); else if (gptread_hdr("backup", dskp, &hdr_backup, altlba) == 0 && - gptread_table("backup", uuid, dskp, &hdr_backup, - table_backup) == 0) { + gptread_table("backup", dskp, &hdr_backup, table_backup) == 0) { hdr_backup_lba = hdr_backup.hdr_lba_self; if (hdr_primary_lba == 0) { gpthdr = &hdr_backup; Modified: stable/12/stand/libsa/gpt.h ============================================================================== --- stable/12/stand/libsa/gpt.h Thu Oct 24 03:09:31 2019 (r353987) +++ stable/12/stand/libsa/gpt.h Thu Oct 24 03:16:23 2019 (r353988) @@ -34,7 +34,7 @@ #define MAXTBLENTS 128 -int gptread(const uuid_t *uuid, struct dsk *dskp, char *buf); +int gptread(struct dsk *dskp, char *buf); int gptfind(const uuid_t *uuid, struct dsk *dskp, int part); void gptbootfailed(struct dsk *dskp); From owner-svn-src-all@freebsd.org Thu Oct 24 03:26:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 02A6F154944; Thu, 24 Oct 2019 03:26:46 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCMn6G9lz4Jc0; Thu, 24 Oct 2019 03:26:45 +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 BAB017EBF; Thu, 24 Oct 2019 03:26:45 +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 x9O3QjiI019052; Thu, 24 Oct 2019 03:26:45 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3QjrH019051; Thu, 24 Oct 2019 03:26:45 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240326.x9O3QjrH019051@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:26:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r353993 - in stable/12/stand: i386/zfsloader sparc64/zfsloader X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: i386/zfsloader sparc64/zfsloader X-SVN-Commit-Revision: 353993 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:26:46 -0000 Author: kevans Date: Thu Oct 24 03:26:45 2019 New Revision: 353993 URL: https://svnweb.freebsd.org/changeset/base/353993 Log: MFC r352037, r352145: Remove empty zfsloader directories Deleted: stable/12/stand/i386/zfsloader/ stable/12/stand/sparc64/zfsloader/ Modified: Directory Properties: stable/12/ (props changed) From owner-svn-src-all@freebsd.org Thu Oct 24 03:40:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9326156C10; Thu, 24 Oct 2019 03:40:21 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCgT5PDfz4Lm5; Thu, 24 Oct 2019 03:40:21 +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 9D60B80C5; Thu, 24 Oct 2019 03:40:21 +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 x9O3eLPK025621; Thu, 24 Oct 2019 03:40:21 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3eLuO025619; Thu, 24 Oct 2019 03:40:21 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240340.x9O3eLuO025619@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:40:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354001 - stable/12/stand/libsa X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/libsa X-SVN-Commit-Revision: 354001 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:40:21 -0000 Author: kevans Date: Thu Oct 24 03:40:20 2019 New Revision: 354001 URL: https://svnweb.freebsd.org/changeset/base/354001 Log: MFC (proactively; not required yet) r339673: Fix stand/ build after r339671. ffs_subr.c requires calculate_crc32c() from libkern. Unfortunately we cannot just add libkern/crc32.c to libstand because crc32.o is already compiled from contrib/zlib/crc32.c. Use the include trick to rename the source. Note that libstand also provides crc32.c which seems to be unused. Added: stable/12/stand/libsa/crc32_libkern.c - copied unchanged from r339673, head/stand/libsa/crc32_libkern.c Modified: stable/12/stand/libsa/Makefile Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/Makefile ============================================================================== --- stable/12/stand/libsa/Makefile Thu Oct 24 03:38:16 2019 (r354000) +++ stable/12/stand/libsa/Makefile Thu Oct 24 03:40:20 2019 (r354001) @@ -148,9 +148,9 @@ SRCS+=ffs_subr.c ffs_tables.c CFLAGS.bzipfs.c+= -I${SRCTOP}/contrib/bzip2 -# explicit_bzero +# explicit_bzero and calculate_crc32c .PATH: ${SYSDIR}/libkern -SRCS+= explicit_bzero.c +SRCS+= explicit_bzero.c crc32_libkern.c # Maybe GELI .if ${MK_LOADER_GELI} == "yes" Copied: stable/12/stand/libsa/crc32_libkern.c (from r339673, head/stand/libsa/crc32_libkern.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/libsa/crc32_libkern.c Thu Oct 24 03:40:20 2019 (r354001, copy of r339673, head/stand/libsa/crc32_libkern.c) @@ -0,0 +1,3 @@ +/* $FreeBSD$ */ + +#include "../../sys/libkern/crc32.c" From owner-svn-src-all@freebsd.org Thu Oct 24 03:38:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4DC71565AC; Thu, 24 Oct 2019 03:38:17 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCd53Y5Qz4LQm; Thu, 24 Oct 2019 03:38:17 +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 5DD5F80BF; Thu, 24 Oct 2019 03:38:17 +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 x9O3cHtq025435; Thu, 24 Oct 2019 03:38:17 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3cG9F025432; Thu, 24 Oct 2019 03:38:16 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240338.x9O3cG9F025432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:38:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354000 - stable/12/stand/libsa X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12/stand/libsa X-SVN-Commit-Revision: 354000 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:38:17 -0000 Author: kevans Date: Thu Oct 24 03:38:16 2019 New Revision: 354000 URL: https://svnweb.freebsd.org/changeset/base/354000 Log: MFC r339970: Remove unnecessary include from libstand. Modified: stable/12/stand/libsa/ip.c stable/12/stand/libsa/net.c stable/12/stand/libsa/udp.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/ip.c ============================================================================== --- stable/12/stand/libsa/ip.c Thu Oct 24 03:37:17 2019 (r353999) +++ stable/12/stand/libsa/ip.c Thu Oct 24 03:38:16 2019 (r354000) @@ -51,7 +51,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: stable/12/stand/libsa/net.c ============================================================================== --- stable/12/stand/libsa/net.c Thu Oct 24 03:37:17 2019 (r353999) +++ stable/12/stand/libsa/net.c Thu Oct 24 03:38:16 2019 (r354000) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include Modified: stable/12/stand/libsa/udp.c ============================================================================== --- stable/12/stand/libsa/udp.c Thu Oct 24 03:37:17 2019 (r353999) +++ stable/12/stand/libsa/udp.c Thu Oct 24 03:38:16 2019 (r354000) @@ -48,7 +48,6 @@ __FBSDID("$FreeBSD$"); #include #include -#include #include #include #include From owner-svn-src-all@freebsd.org Thu Oct 24 03:48:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6ABD157FA9; Thu, 24 Oct 2019 03:48:29 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zCrs5ZzTz4N1Z; Thu, 24 Oct 2019 03:48:29 +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 A29098297; Thu, 24 Oct 2019 03:48:29 +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 x9O3mT8X031864; Thu, 24 Oct 2019 03:48:29 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3mTR3031859; Thu, 24 Oct 2019 03:48:29 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240348.x9O3mTR3031859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:48:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354004 - in stable/12/stand/efi/loader/arch: arm i386 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand/efi/loader/arch: arm i386 X-SVN-Commit-Revision: 354004 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:48:30 -0000 Author: kevans Date: Thu Oct 24 03:48:28 2019 New Revision: 354004 URL: https://svnweb.freebsd.org/changeset/base/354004 Log: MFC r344560, r344718 r344560: stand: Remove unused i386 EFI MD bits r328169 removed the copy of bootinfo that would've made this somewhat functional. However, this is irrelevant- earlier work in r292338 was done to exit boot services in the MI bi_load() rather than having N copies of the GetMemoryMap/ExitBootServices dance. i386 never quite caught up to that; ldr_enter was still being called but the prereq for that, ldr_bootinfo, was no longer. As a consequence, this ExitBootServices() was being called with a mapkey=0, clearly bogus, and reportedly breaking the boot in some instances. r344718: EFI: don't call printf after ExitBootServices, since it uses Boot Services ExitBootServices terminates all boot services including console access. Attempting to call printf afterwards can result in a crash, depending on the implementation. Move any printf statements to before we call bi_load, and remove any that depend on calling bi_load first. Deleted: stable/12/stand/efi/loader/arch/i386/efimd.c Modified: stable/12/stand/efi/loader/arch/arm/exec.c stable/12/stand/efi/loader/arch/i386/Makefile.inc stable/12/stand/efi/loader/arch/i386/elf32_freebsd.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/efi/loader/arch/arm/exec.c ============================================================================== --- stable/12/stand/efi/loader/arch/arm/exec.c Thu Oct 24 03:44:32 2019 (r354003) +++ stable/12/stand/efi/loader/arch/arm/exec.c Thu Oct 24 03:48:28 2019 (r354004) @@ -74,16 +74,19 @@ __elfN(arm_exec)(struct preloaded_file *fp) e = (Elf_Ehdr *)&fmp->md_data; efi_time_fini(); + + entry = efi_translate(e->e_entry); + + printf("Kernel entry at 0x%x...\n", (unsigned)entry); + printf("Kernel args: %s\n", fp->f_args); + if ((error = bi_load(fp->f_args, &modulep, &kernend)) != 0) { efi_time_init(); return (error); } - entry = efi_translate(e->e_entry); - printf("Kernel entry at 0x%x...\n", (unsigned)entry); - printf("Kernel args: %s\n", fp->f_args); - printf("modulep: %#x\n", modulep); - printf("relocation_offset %llx\n", __elfN(relocation_offset)); + /* At this point we've called ExitBootServices, so we can't call + * printf or any other function that uses Boot Services */ dev_cleanup(); Modified: stable/12/stand/efi/loader/arch/i386/Makefile.inc ============================================================================== --- stable/12/stand/efi/loader/arch/i386/Makefile.inc Thu Oct 24 03:44:32 2019 (r354003) +++ stable/12/stand/efi/loader/arch/i386/Makefile.inc Thu Oct 24 03:48:28 2019 (r354004) @@ -1,7 +1,6 @@ # $FreeBSD$ SRCS+= start.S \ - efimd.c \ elf32_freebsd.c \ exec.c Modified: stable/12/stand/efi/loader/arch/i386/elf32_freebsd.c ============================================================================== --- stable/12/stand/efi/loader/arch/i386/elf32_freebsd.c Thu Oct 24 03:44:32 2019 (r354003) +++ stable/12/stand/efi/loader/arch/i386/elf32_freebsd.c Thu Oct 24 03:48:28 2019 (r354004) @@ -44,7 +44,6 @@ __FBSDID("$FreeBSD$"); extern void __exec(caddr_t addr, ...); extern int bi_load(char *args, vm_offset_t *modulep, vm_offset_t *kernendp); -extern int ldr_enter(const char *kernel); static int elf32_exec(struct preloaded_file *amp); static int elf32_obj_exec(struct preloaded_file *amp); @@ -76,16 +75,19 @@ elf32_exec(struct preloaded_file *fp) ehdr = (Elf_Ehdr *)&(md->md_data); efi_time_fini(); + + entry = ehdr->e_entry & 0xffffff; + + printf("Start @ 0x%x ...\n", entry); + err = bi_load(fp->f_args, &modulep, &kernend); if (err != 0) { efi_time_init(); return(err); } - entry = ehdr->e_entry & 0xffffff; - printf("Start @ 0x%x ...\n", entry); - - ldr_enter(fp->f_name); + /* At this point we've called ExitBootServices, so we can't call + * printf or any other function that uses Boot Services */ dev_cleanup(); __exec((void *)entry, boothowto, bootdev, 0, 0, 0, bootinfop, modulep, kernend); From owner-svn-src-all@freebsd.org Thu Oct 24 03:57:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 072381594B8; Thu, 24 Oct 2019 03:57:58 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zD3n70nhz4PJ7; Thu, 24 Oct 2019 03:57:57 +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 D474C8477; Thu, 24 Oct 2019 03:57:57 +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 x9O3vvCi037614; Thu, 24 Oct 2019 03:57:57 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O3vuIv037608; Thu, 24 Oct 2019 03:57:56 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910240357.x9O3vuIv037608@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 03:57:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354007 - in stable/12/stand: . common efi/loader i386/loader X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12/stand: . common efi/loader i386/loader X-SVN-Commit-Revision: 354007 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 03:57:58 -0000 Author: kevans Date: Thu Oct 24 03:57:56 2019 New Revision: 354007 URL: https://svnweb.freebsd.org/changeset/base/354007 Log: MFC r346759: loader: implement map-vdisk and unmap-vdisk commands illumos update: https://www.illumos.org/issues/10598 Add map-vdisk and unmap-vdisk commands to create virtual disk interface on top of file. This will allow to use disk image from file system to load and start the kernel. By mapping file, we create vdiskX device, the device will be listed by lsdev [-v] and can be accessed directly as ls vdisk0p1:/path or can be used as value for currdev variable. vdisk strategy function does not use bcache as we have bcache used with backing file. vdisk can be unmapped when all consumers have closed the open files. In first iteration we do not support the zfs images because zfs pools do keep the device open (there is no "zpool export" mechanism). Adding zfs support is relatively simple, we just need to run zfs disk probe after mapping is done. Added: stable/12/stand/common/vdisk.c - copied unchanged from r346759, head/stand/common/vdisk.c Modified: stable/12/stand/common/help.common stable/12/stand/efi/loader/conf.c stable/12/stand/i386/loader/conf.c stable/12/stand/loader.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/common/help.common ============================================================================== --- stable/12/stand/common/help.common Thu Oct 24 03:52:32 2019 (r354006) +++ stable/12/stand/common/help.common Thu Oct 24 03:57:56 2019 (r354007) @@ -99,6 +99,13 @@ List loaded modules. If [-v] is specified, print more details. ################################################################################ +# Tmap-vdisk DMap virtual disk + + map-vdisk filename + + Map file as virtual disk. + +################################################################################ # Tmore DPage files more [ ...] @@ -395,6 +402,13 @@ unload This command removes any kernel and all loaded modules from memory. + +################################################################################ +# Tunmap-vdisk DUnmap virtual disk + + unmap-vdisk diskname + + Delete virtual disk mapping. ################################################################################ # Tunset DUnset a variable Copied: stable/12/stand/common/vdisk.c (from r346759, head/stand/common/vdisk.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/stand/common/vdisk.c Thu Oct 24 03:57:56 2019 (r354007, copy of r346759, head/stand/common/vdisk.c) @@ -0,0 +1,417 @@ +/*- + * Copyright 2019 Toomas Soome + * + * 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 + +static int vdisk_init(void); +static int vdisk_strategy(void *, int, daddr_t, size_t, char *, size_t *); +static int vdisk_open(struct open_file *, ...); +static int vdisk_close(struct open_file *); +static int vdisk_ioctl(struct open_file *, u_long, void *); +static int vdisk_print(int); + +struct devsw vdisk_dev = { + .dv_name = "vdisk", + .dv_type = DEVT_DISK, + .dv_init = vdisk_init, + .dv_strategy = vdisk_strategy, + .dv_open = vdisk_open, + .dv_close = vdisk_close, + .dv_ioctl = vdisk_ioctl, + .dv_print = vdisk_print, + .dv_cleanup = NULL +}; + +typedef STAILQ_HEAD(vdisk_info_list, vdisk_info) vdisk_info_list_t; + +typedef struct vdisk_info +{ + STAILQ_ENTRY(vdisk_info) vdisk_link; /* link in device list */ + char *vdisk_path; + int vdisk_unit; + int vdisk_fd; + uint64_t vdisk_size; /* size in bytes */ + uint32_t vdisk_sectorsz; + uint32_t vdisk_open; /* reference counter */ +} vdisk_info_t; + +static vdisk_info_list_t vdisk_list; /* list of mapped vdisks. */ + +static vdisk_info_t * +vdisk_get_info(struct devdesc *dev) +{ + vdisk_info_t *vd; + + STAILQ_FOREACH(vd, &vdisk_list, vdisk_link) { + if (vd->vdisk_unit == dev->d_unit) + return (vd); + } + return (vd); +} + +COMMAND_SET(map_vdisk, "map-vdisk", "map file as virtual disk", command_mapvd); + +static int +command_mapvd(int argc, char *argv[]) +{ + vdisk_info_t *vd, *p; + struct stat sb; + + if (argc != 2) { + printf("usage: %s filename\n", argv[0]); + return (CMD_ERROR); + } + + STAILQ_FOREACH(vd, &vdisk_list, vdisk_link) { + if (strcmp(vd->vdisk_path, argv[1]) == 0) { + printf("%s: file %s is already mapped as %s%d\n", + argv[0], argv[1], vdisk_dev.dv_name, + vd->vdisk_unit); + return (CMD_ERROR); + } + } + + if (stat(argv[1], &sb) < 0) { + /* + * ENOSYS is really ENOENT because we did try to walk + * through devsw list to try to open this file. + */ + if (errno == ENOSYS) + errno = ENOENT; + + printf("%s: stat failed: %s\n", argv[0], strerror(errno)); + return (CMD_ERROR); + } + + /* + * Avoid mapping small files. + */ + if (sb.st_size < 1024 * 1024) { + printf("%s: file %s is too small.\n", argv[0], argv[1]); + return (CMD_ERROR); + } + + vd = calloc(1, sizeof (*vd)); + if (vd == NULL) { + printf("%s: out of memory\n", argv[0]); + return (CMD_ERROR); + } + vd->vdisk_path = strdup(argv[1]); + if (vd->vdisk_path == NULL) { + free (vd); + printf("%s: out of memory\n", argv[0]); + return (CMD_ERROR); + } + vd->vdisk_fd = open(vd->vdisk_path, O_RDONLY); + if (vd->vdisk_fd < 0) { + printf("%s: open failed: %s\n", argv[0], strerror(errno)); + free(vd->vdisk_path); + free(vd); + return (CMD_ERROR); + } + + vd->vdisk_size = sb.st_size; + vd->vdisk_sectorsz = DEV_BSIZE; + STAILQ_FOREACH(p, &vdisk_list, vdisk_link) { + vdisk_info_t *n; + if (p->vdisk_unit == vd->vdisk_unit) { + vd->vdisk_unit++; + continue; + } + n = STAILQ_NEXT(p, vdisk_link); + if (p->vdisk_unit < vd->vdisk_unit) { + if (n == NULL) { + /* p is last elem */ + STAILQ_INSERT_TAIL(&vdisk_list, vd, vdisk_link); + break; + } + if (n->vdisk_unit > vd->vdisk_unit) { + /* p < vd < n */ + STAILQ_INSERT_AFTER(&vdisk_list, p, vd, + vdisk_link); + break; + } + /* else n < vd or n == vd */ + vd->vdisk_unit++; + continue; + } + /* p > vd only if p is the first element */ + STAILQ_INSERT_HEAD(&vdisk_list, vd, vdisk_link); + break; + } + + /* if the list was empty or contiguous */ + if (p == NULL) + STAILQ_INSERT_TAIL(&vdisk_list, vd, vdisk_link); + + printf("%s: file %s is mapped as %s%d\n", argv[0], vd->vdisk_path, + vdisk_dev.dv_name, vd->vdisk_unit); + return (CMD_OK); +} + +COMMAND_SET(unmap_vdisk, "unmap-vdisk", "unmap virtual disk", command_unmapvd); + +/* + * unmap-vdisk vdiskX + */ +static int +command_unmapvd(int argc, char *argv[]) +{ + size_t len; + vdisk_info_t *vd; + long unit; + char *end; + + if (argc != 2) { + printf("usage: %s %sN\n", argv[0], vdisk_dev.dv_name); + return (CMD_ERROR); + } + + len = strlen(vdisk_dev.dv_name); + if (strncmp(vdisk_dev.dv_name, argv[1], len) != 0) { + printf("%s: unknown device %s\n", argv[0], argv[1]); + return (CMD_ERROR); + } + errno = 0; + unit = strtol(argv[1] + len, &end, 10); + if (errno != 0 || (*end != '\0' && strcmp(end, ":") != 0)) { + printf("%s: unknown device %s\n", argv[0], argv[1]); + return (CMD_ERROR); + } + + STAILQ_FOREACH(vd, &vdisk_list, vdisk_link) { + if (vd->vdisk_unit == unit) + break; + } + + if (vd == NULL) { + printf("%s: unknown device %s\n", argv[0], argv[1]); + return (CMD_ERROR); + } + + if (vd->vdisk_open != 0) { + printf("%s: %s is in use, unable to unmap.\n", + argv[0], argv[1]); + return (CMD_ERROR); + } + + STAILQ_REMOVE(&vdisk_list, vd, vdisk_info, vdisk_link); + close(vd->vdisk_fd); + free(vd->vdisk_path); + free(vd); + printf("%s (%s) unmapped\n", argv[1], vd->vdisk_path); + + return (CMD_OK); +} + +static int +vdisk_init(void) +{ + STAILQ_INIT(&vdisk_list); + return (0); +} + +static int +vdisk_strategy(void *devdata, int rw, daddr_t blk, size_t size, + char *buf, size_t *rsize) +{ + struct disk_devdesc *dev; + vdisk_info_t *vd; + ssize_t rv; + + dev = devdata; + if (dev == NULL) + return (EINVAL); + vd = vdisk_get_info((struct devdesc *)dev); + if (vd == NULL) + return (EINVAL); + + if (size == 0 || (size % 512) != 0) + return (EIO); + + if (dev->dd.d_dev->dv_type == DEVT_DISK) { + daddr_t offset; + + offset = dev->d_offset * vd->vdisk_sectorsz; + offset /= 512; + blk += offset; + } + if (lseek(vd->vdisk_fd, blk << 9, SEEK_SET) == -1) + return (EIO); + + errno = 0; + switch (rw & F_MASK) { + case F_READ: + rv = read(vd->vdisk_fd, buf, size); + break; + case F_WRITE: + rv = write(vd->vdisk_fd, buf, size); + break; + default: + return (ENOSYS); + } + + if (errno == 0 && rsize != NULL) { + *rsize = rv; + } + return (errno); +} + +static int +vdisk_open(struct open_file *f, ...) +{ + va_list args; + struct disk_devdesc *dev; + vdisk_info_t *vd; + int rc = 0; + + va_start(args, f); + dev = va_arg(args, struct disk_devdesc *); + va_end(args); + if (dev == NULL) + return (EINVAL); + vd = vdisk_get_info((struct devdesc *)dev); + if (vd == NULL) + return (EINVAL); + + if (dev->dd.d_dev->dv_type == DEVT_DISK) { + rc = disk_open(dev, vd->vdisk_size, vd->vdisk_sectorsz); + } + if (rc == 0) + vd->vdisk_open++; + return (rc); +} + +static int +vdisk_close(struct open_file *f) +{ + struct disk_devdesc *dev; + vdisk_info_t *vd; + + dev = (struct disk_devdesc *)(f->f_devdata); + if (dev == NULL) + return (EINVAL); + vd = vdisk_get_info((struct devdesc *)dev); + if (vd == NULL) + return (EINVAL); + + vd->vdisk_open--; + if (dev->dd.d_dev->dv_type == DEVT_DISK) + return (disk_close(dev)); + return (0); +} + +static int +vdisk_ioctl(struct open_file *f, u_long cmd, void *data) +{ + struct disk_devdesc *dev; + vdisk_info_t *vd; + int rc; + + dev = (struct disk_devdesc *)(f->f_devdata); + if (dev == NULL) + return (EINVAL); + vd = vdisk_get_info((struct devdesc *)dev); + if (vd == NULL) + return (EINVAL); + + if (dev->dd.d_dev->dv_type == DEVT_DISK) { + rc = disk_ioctl(dev, cmd, data); + if (rc != ENOTTY) + return (rc); + } + + switch (cmd) { + case DIOCGSECTORSIZE: + *(u_int *)data = vd->vdisk_sectorsz; + break; + case DIOCGMEDIASIZE: + *(uint64_t *)data = vd->vdisk_size; + break; + default: + return (ENOTTY); + } + return (0); +} + +static int +vdisk_print(int verbose) +{ + int ret = 0; + vdisk_info_t *vd; + char line[80]; + + if (STAILQ_EMPTY(&vdisk_list)) + return (ret); + + printf("%s devices:", vdisk_dev.dv_name); + if ((ret = pager_output("\n")) != 0) + return (ret); + + STAILQ_FOREACH(vd, &vdisk_list, vdisk_link) { + struct disk_devdesc vd_dev; + + if (verbose) { + printf(" %s", vd->vdisk_path); + if ((ret = pager_output("\n")) != 0) + break; + } + snprintf(line, sizeof(line), + " %s%d", vdisk_dev.dv_name, vd->vdisk_unit); + printf("%s: %" PRIu64 " X %u blocks", line, + vd->vdisk_size / vd->vdisk_sectorsz, + vd->vdisk_sectorsz); + if ((ret = pager_output("\n")) != 0) + break; + + vd_dev.dd.d_dev = &vdisk_dev; + vd_dev.dd.d_unit = vd->vdisk_unit; + vd_dev.d_slice = -1; + vd_dev.d_partition = -1; + + ret = disk_open(&vd_dev, vd->vdisk_size, vd->vdisk_sectorsz); + if (ret == 0) { + ret = disk_print(&vd_dev, line, verbose); + disk_close(&vd_dev); + if (ret != 0) + break; + } else { + ret = 0; + } + } + + return (ret); +} Modified: stable/12/stand/efi/loader/conf.c ============================================================================== --- stable/12/stand/efi/loader/conf.c Thu Oct 24 03:52:32 2019 (r354006) +++ stable/12/stand/efi/loader/conf.c Thu Oct 24 03:57:56 2019 (r354007) @@ -33,11 +33,14 @@ __FBSDID("$FreeBSD$"); #include #include +extern struct devsw vdisk_dev; + struct devsw *devsw[] = { &efipart_fddev, &efipart_cddev, &efipart_hddev, &efinet_dev, + &vdisk_dev, #ifdef EFI_ZFS_BOOT &zfs_dev, #endif Modified: stable/12/stand/i386/loader/conf.c ============================================================================== --- stable/12/stand/i386/loader/conf.c Thu Oct 24 03:52:32 2019 (r354006) +++ stable/12/stand/i386/loader/conf.c Thu Oct 24 03:57:56 2019 (r354007) @@ -48,6 +48,7 @@ __FBSDID("$FreeBSD$"); #if defined(LOADER_FIREWIRE_SUPPORT) extern struct devsw fwohci; #endif +extern struct devsw vdisk_dev; /* Exported for libstand */ struct devsw *devsw[] = { @@ -60,6 +61,7 @@ struct devsw *devsw[] = { #if defined(LOADER_FIREWIRE_SUPPORT) &fwohci, #endif + &vdisk_dev, #if defined(LOADER_ZFS_SUPPORT) &zfs_dev, #endif Modified: stable/12/stand/loader.mk ============================================================================== --- stable/12/stand/loader.mk Thu Oct 24 03:52:32 2019 (r354006) +++ stable/12/stand/loader.mk Thu Oct 24 03:57:56 2019 (r354007) @@ -31,7 +31,7 @@ SRCS+= metadata.c .endif .if ${LOADER_DISK_SUPPORT:Uyes} == "yes" -SRCS+= disk.c part.c +SRCS+= disk.c part.c vdisk.c .endif .if ${LOADER_NET_SUPPORT:Uno} == "yes" From owner-svn-src-all@freebsd.org Thu Oct 24 05:54:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EA01D15F162; Thu, 24 Oct 2019 05:54:30 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zGfG5wrxz4Xpr; Thu, 24 Oct 2019 05:54:30 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AF0C099D3; Thu, 24 Oct 2019 05:54:30 +0000 (UTC) (envelope-from rrs@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O5sU0G008192; Thu, 24 Oct 2019 05:54:30 GMT (envelope-from rrs@FreeBSD.org) Received: (from rrs@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O5sU46008191; Thu, 24 Oct 2019 05:54:30 GMT (envelope-from rrs@FreeBSD.org) Message-Id: <201910240554.x9O5sU46008191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rrs set sender to rrs@FreeBSD.org using -f From: Randall Stewart Date: Thu, 24 Oct 2019 05:54:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354013 - head/sys/netinet/tcp_stacks X-SVN-Group: head X-SVN-Commit-Author: rrs X-SVN-Commit-Paths: head/sys/netinet/tcp_stacks X-SVN-Commit-Revision: 354013 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 05:54:31 -0000 Author: rrs Date: Thu Oct 24 05:54:30 2019 New Revision: 354013 URL: https://svnweb.freebsd.org/changeset/base/354013 Log: Fix a small bug in bbr when running under a VM. Basically what happens is we are more delayed in the pacer calling in so we remove the stack from the pacer and recalculate how much time is left after all data has been acknowledged. However the comparision was backwards so we end up with a negative value in the last_pacing_delay time which causes us to add in a huge value to the next pacing time thus stalling the connection. Reported by: vm2.finance@gmail.com Modified: head/sys/netinet/tcp_stacks/bbr.c Modified: head/sys/netinet/tcp_stacks/bbr.c ============================================================================== --- head/sys/netinet/tcp_stacks/bbr.c Thu Oct 24 04:12:38 2019 (r354012) +++ head/sys/netinet/tcp_stacks/bbr.c Thu Oct 24 05:54:30 2019 (r354013) @@ -11814,12 +11814,13 @@ bbr_do_segment_nounlock(struct mbuf *m, struct tcphdr uint32_t del; del = lcts - bbr->rc_pacer_started; - if (del > bbr->r_ctl.rc_last_delay_val) { + if (bbr->r_ctl.rc_last_delay_val > del) { BBR_STAT_INC(bbr_force_timer_start); bbr->r_ctl.rc_last_delay_val -= del; bbr->rc_pacer_started = lcts; } else { /* We are late */ + bbr->r_ctl.rc_last_delay_val = 0; BBR_STAT_INC(bbr_force_output); (void)tp->t_fb->tfb_tcp_output(tp); } @@ -12278,8 +12279,9 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeva * We are early setup to adjust * our slot time. */ + uint64_t merged_val; + bbr->r_ctl.rc_agg_early += (bbr->r_ctl.rc_last_delay_val - delay_calc); - bbr->r_ctl.rc_last_delay_val = 0; bbr->r_agg_early_set = 1; if (bbr->r_ctl.rc_hptsi_agg_delay) { if (bbr->r_ctl.rc_hptsi_agg_delay >= bbr->r_ctl.rc_agg_early) { @@ -12292,9 +12294,13 @@ bbr_output_wtime(struct tcpcb *tp, const struct timeva bbr->r_ctl.rc_hptsi_agg_delay = 0; } } + merged_val = bbr->rc_pacer_started; + merged_val <<= 32; + merged_val |= bbr->r_ctl.rc_last_delay_val; bbr_log_pacing_delay_calc(bbr, inp->inp_hpts_calls, - bbr->r_ctl.rc_agg_early, cts, 3, 0, + bbr->r_ctl.rc_agg_early, cts, delay_calc, merged_val, bbr->r_agg_early_set, 3); + bbr->r_ctl.rc_last_delay_val = 0; BBR_STAT_INC(bbr_early); delay_calc = 0; } From owner-svn-src-all@freebsd.org Thu Oct 24 06:58:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54ABF160AC9; Thu, 24 Oct 2019 06:58:18 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zJ3t1XX8z4bK5; Thu, 24 Oct 2019 06:58:18 +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 148DBA47A; Thu, 24 Oct 2019 06:58:18 +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 x9O6wHhO043435; Thu, 24 Oct 2019 06:58:17 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O6wHxY043434; Thu, 24 Oct 2019 06:58:17 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910240658.x9O6wHxY043434@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Thu, 24 Oct 2019 06:58:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354014 - stable/12/sys/vm X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/vm X-SVN-Commit-Revision: 354014 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 06:58:18 -0000 Author: kib Date: Thu Oct 24 06:58:17 2019 New Revision: 354014 URL: https://svnweb.freebsd.org/changeset/base/354014 Log: MFC r353681: swapon_check_swzone(): use already calculated static variables. Modified: stable/12/sys/vm/swap_pager.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/vm/swap_pager.c ============================================================================== --- stable/12/sys/vm/swap_pager.c Thu Oct 24 05:54:30 2019 (r354013) +++ stable/12/sys/vm/swap_pager.c Thu Oct 24 06:58:17 2019 (r354014) @@ -589,6 +589,7 @@ swap_pager_swap_init(void) if (n < n2) printf("Swap blk zone entries changed from %lu to %lu.\n", n2, n); + /* absolute maximum we can handle assuming 100% efficiency */ swap_maxpages = n * SWAP_META_PAGES; swzone = n * sizeof(struct swblk); if (!uma_zone_reserve_kva(swpctrie_zone, n)) @@ -2267,17 +2268,12 @@ done: static void swapon_check_swzone(void) { - unsigned long maxpages, npages; - npages = swap_total; - /* absolute maximum we can handle assuming 100% efficiency */ - maxpages = uma_zone_get_max(swblk_zone) * SWAP_META_PAGES; - /* recommend using no more than half that amount */ - if (npages > maxpages / 2) { + if (swap_total > swap_maxpages / 2) { printf("warning: total configured swap (%lu pages) " "exceeds maximum recommended amount (%lu pages).\n", - npages, maxpages / 2); + swap_total, swap_maxpages / 2); printf("warning: increase kern.maxswzone " "or reduce amount of swap.\n"); } From owner-svn-src-all@freebsd.org Thu Oct 24 07:49:34 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19CA4162C1F; Thu, 24 Oct 2019 07:49:34 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zKC16zSkz4fNf; Thu, 24 Oct 2019 07:49:33 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2DFDAD90; Thu, 24 Oct 2019 07:49:33 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O7nXUW072936; Thu, 24 Oct 2019 07:49:33 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O7nXCM072935; Thu, 24 Oct 2019 07:49:33 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201910240749.x9O7nXCM072935@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Thu, 24 Oct 2019 07:49:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354015 - head/stand/userboot/test X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/userboot/test X-SVN-Commit-Revision: 354015 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 07:49:34 -0000 Author: tsoome Date: Thu Oct 24 07:49:33 2019 New Revision: 354015 URL: https://svnweb.freebsd.org/changeset/base/354015 Log: userboot/test should use PRIx64 as one would expect from prefix 0x Test is printing decimal value after prefix 0x. Modified: head/stand/userboot/test/test.c Modified: head/stand/userboot/test/test.c ============================================================================== --- head/stand/userboot/test/test.c Thu Oct 24 06:58:17 2019 (r354014) +++ head/stand/userboot/test/test.c Thu Oct 24 07:49:33 2019 (r354015) @@ -336,7 +336,7 @@ test_setgdt(void *arg, uint64_t v, size_t sz) void test_exec(void *arg, uint64_t pc) { - printf("Execute at 0x%"PRIu64"\n", pc); + printf("Execute at 0x%"PRIx64"\n", pc); test_exit(arg, 0); } From owner-svn-src-all@freebsd.org Thu Oct 24 07:53:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AB916162F5B; Thu, 24 Oct 2019 07:53:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zKHC46bfz4fnH; Thu, 24 Oct 2019 07:53:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 719B3AF49; Thu, 24 Oct 2019 07:53:11 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O7rBec078734; Thu, 24 Oct 2019 07:53:11 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O7rBMi078733; Thu, 24 Oct 2019 07:53:11 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910240753.x9O7rBMi078733@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 07:53:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354016 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354016 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 07:53:11 -0000 Author: bz Date: Thu Oct 24 07:53:10 2019 New Revision: 354016 URL: https://svnweb.freebsd.org/changeset/base/354016 Log: frag6: remove IP6_REASS_MBUF macro The IP6_REASS_MBUF() macro did some pointer gynmastics to end up with the same type as it gets in [*(cast **)&]. Spelling it out instead saves all this and makes the code more readable and less obfuscated directly using the structure field. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 07:49:33 2019 (r354015) +++ head/sys/netinet6/frag6.c Thu Oct 24 07:53:10 2019 (r354016) @@ -106,8 +106,6 @@ struct ip6asfrag { bool ip6af_mff; /* More fragment bit in frag off. */ }; -#define IP6_REASS_MBUF(ip6af) (*(struct mbuf **)&((ip6af)->ip6af_m)) - static MALLOC_DEFINE(M_FRAG6, "frag6", "IPv6 fragment reassembly header"); #ifdef VIMAGE @@ -257,7 +255,7 @@ frag6_freef(struct ip6q *q6, uint32_t bucket) while ((af6 = TAILQ_FIRST(&q6->ip6q_frags)) != NULL) { - m = IP6_REASS_MBUF(af6); + m = af6->ip6af_m; TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); /* @@ -301,7 +299,6 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) struct ip6qhead *head; struct ip6q *q6; struct ip6asfrag *af6; - struct mbuf *m; uint32_t bucket; KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); @@ -323,11 +320,9 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) TAILQ_FOREACH(q6, head, ip6q_tq) { TAILQ_FOREACH(af6, &q6->ip6q_frags, ip6af_tq) { - m = IP6_REASS_MBUF(af6); - /* Clear no longer valid rcvif pointer. */ - if (m->m_pkthdr.rcvif == ifp) - m->m_pkthdr.rcvif = NULL; + if (af6->ip6af_m->m_pkthdr.rcvif == ifp) + af6->ip6af_m->m_pkthdr.rcvif = NULL; } } IP6QB_UNLOCK(bucket); @@ -593,7 +588,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) struct mbuf *merr; int erroff; - merr = IP6_REASS_MBUF(af6); + merr = af6->ip6af_m; erroff = af6->ip6af_offset; /* Dequeue the fragment. */ @@ -630,7 +625,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) ip6af->ip6af_off = fragoff; ip6af->ip6af_frglen = frgpartlen; ip6af->ip6af_offset = offset; - IP6_REASS_MBUF(ip6af) = m; + ip6af->ip6af_m = m; if (only_frag) { /* @@ -735,20 +730,20 @@ postinsert: /* Reassembly is complete; concatenate fragments. */ ip6af = TAILQ_FIRST(&q6->ip6q_frags); - t = m = IP6_REASS_MBUF(ip6af); + t = m = ip6af->ip6af_m; TAILQ_REMOVE(&q6->ip6q_frags, ip6af, ip6af_tq); while ((af6 = TAILQ_FIRST(&q6->ip6q_frags)) != NULL) { m->m_pkthdr.csum_flags &= - IP6_REASS_MBUF(af6)->m_pkthdr.csum_flags; + af6->ip6af_m->m_pkthdr.csum_flags; m->m_pkthdr.csum_data += - IP6_REASS_MBUF(af6)->m_pkthdr.csum_data; + af6->ip6af_m->m_pkthdr.csum_data; TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); while (t->m_next) t = t->m_next; - m_adj(IP6_REASS_MBUF(af6), af6->ip6af_offset); - m_demote_pkthdr(IP6_REASS_MBUF(af6)); - m_cat(t, IP6_REASS_MBUF(af6)); + m_adj(af6->ip6af_m, af6->ip6af_offset); + m_demote_pkthdr(af6->ip6af_m); + m_cat(t, af6->ip6af_m); free(af6, M_FRAG6); } From owner-svn-src-all@freebsd.org Thu Oct 24 08:15:41 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3C60164919; Thu, 24 Oct 2019 08:15:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zKn86BFSz4hCP; Thu, 24 Oct 2019 08:15:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B48B6B2CD; Thu, 24 Oct 2019 08:15:40 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O8FeFj090475; Thu, 24 Oct 2019 08:15:40 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O8FeiG090474; Thu, 24 Oct 2019 08:15:40 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910240815.x9O8FeiG090474@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 08:15:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354017 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354017 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 08:15:41 -0000 Author: bz Date: Thu Oct 24 08:15:40 2019 New Revision: 354017 URL: https://svnweb.freebsd.org/changeset/base/354017 Log: frag6: small improvements Rather than walking the mbuf chain manually use m_last() which doing exactly that for us. Defer initializing srcifp for longer as there are multiple exit paths out of the function which do not need it set. Initialize before taking the lock though. Rename the mtx lock to match the type better. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 07:53:10 2019 (r354016) +++ head/sys/netinet6/frag6.c Thu Oct 24 08:15:40 2019 (r354017) @@ -399,9 +399,6 @@ frag6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); #endif - /* Store receive network interface pointer for later. */ - srcifp = m->m_pkthdr.rcvif; - dstifp = NULL; /* Find the destination interface of the packet. */ ia6 = in6ifa_ifwithaddr(&ip6->ip6_dst, 0 /* XXX */); @@ -461,6 +458,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); } + /* Store receive network interface pointer for later. */ + srcifp = m->m_pkthdr.rcvif; + /* Generate a hash value for fragment bucket selection. */ hashkeyp = hashkey; memcpy(hashkeyp, &ip6->ip6_src, sizeof(struct in6_addr)); @@ -739,8 +739,7 @@ postinsert: af6->ip6af_m->m_pkthdr.csum_data; TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); - while (t->m_next) - t = t->m_next; + t = m_last(t); m_adj(af6->ip6af_m, af6->ip6af_offset); m_demote_pkthdr(af6->ip6af_m); m_cat(t, af6->ip6af_m); @@ -930,7 +929,7 @@ frag6_init(void) frag6_set_bucketsize(); for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { TAILQ_INIT(IP6QB_HEAD(bucket)); - mtx_init(&V_ip6qb[bucket].lock, "ip6qlock", NULL, MTX_DEF); + mtx_init(&V_ip6qb[bucket].lock, "ip6qb", NULL, MTX_DEF); V_ip6qb[bucket].count = 0; } V_ip6qb_hashseed = arc4random(); From owner-svn-src-all@freebsd.org Thu Oct 24 08:26:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6A0CF164CC7; Thu, 24 Oct 2019 08:26:09 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zL1F28X9z4hhs; Thu, 24 Oct 2019 08:26:09 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 2A36A96FF; Thu, 24 Oct 2019 08:26:09 +0000 (UTC) Date: Thu, 24 Oct 2019 08:26:09 +0000 From: Alexey Dokuchaev To: Dimitry Andric Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353936 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch Message-ID: <20191024082609.GA63459@FreeBSD.org> References: <201910231657.x9NGvCMD039111@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201910231657.x9NGvCMD039111@repo.freebsd.org> User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 08:26:09 -0000 On Wed, Oct 23, 2019 at 04:57:12PM +0000, Dimitry Andric wrote: > New Revision: 353936 > URL: https://svnweb.freebsd.org/changeset/base/353936 > > Log: > Bump clang's default target CPU for the i386 architecture (aka "x86") to > i686, as per the discussion on the freebsd-arch mailing list. Earlier > in r352030, I had already bumped it to i586, to work around missing > atomic 64 bit functions for the i386 architecture. Why i686, not i586? i486 lacking 64-bit atomics is a sound and valid reason, but I don't understand why i586 wasn't chosen, and quick review of that -arch thread did not help. Could you shed some more light here? ./danfe From owner-svn-src-all@freebsd.org Thu Oct 24 09:22:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 702C41665E8; Thu, 24 Oct 2019 09:22:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zMG82R3jz4lG4; Thu, 24 Oct 2019 09:22:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 381CEC0BE; Thu, 24 Oct 2019 09:22:24 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9O9MO0e031354; Thu, 24 Oct 2019 09:22:24 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9O9MNjR031352; Thu, 24 Oct 2019 09:22:23 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910240922.x9O9MNjR031352@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 24 Oct 2019 09:22:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354018 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 354018 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 09:22:24 -0000 Author: tuexen Date: Thu Oct 24 09:22:23 2019 New Revision: 354018 URL: https://svnweb.freebsd.org/changeset/base/354018 Log: Store a handle for the event handler. This will be used when unloading the SCTP as a module. Obtained from: markj@ Modified: head/sys/netinet/sctp_pcb.h head/sys/netinet/sctp_usrreq.c Modified: head/sys/netinet/sctp_pcb.h ============================================================================== --- head/sys/netinet/sctp_pcb.h Thu Oct 24 08:15:40 2019 (r354017) +++ head/sys/netinet/sctp_pcb.h Thu Oct 24 09:22:23 2019 (r354018) @@ -259,6 +259,7 @@ struct sctp_base_info { int packet_log_end; uint8_t packet_log_buffer[SCTP_PACKET_LOG_SIZE]; #endif + eventhandler_tag eh_tag; }; /*- Modified: head/sys/netinet/sctp_usrreq.c ============================================================================== --- head/sys/netinet/sctp_usrreq.c Thu Oct 24 08:15:40 2019 (r354017) +++ head/sys/netinet/sctp_usrreq.c Thu Oct 24 09:22:23 2019 (r354018) @@ -90,8 +90,8 @@ sctp_init(void) SCTP_BASE_VAR(packet_log_end) = 0; memset(&SCTP_BASE_VAR(packet_log_buffer), 0, SCTP_PACKET_LOG_SIZE); #endif - EVENTHANDLER_REGISTER(rt_addrmsg, sctp_addr_change_event_handler, - NULL, EVENTHANDLER_PRI_FIRST); + SCTP_BASE_VAR(eh_tag) = EVENTHANDLER_REGISTER(rt_addrmsg, + sctp_addr_change_event_handler, NULL, EVENTHANDLER_PRI_FIRST); } #ifdef VIMAGE From owner-svn-src-all@freebsd.org Thu Oct 24 11:58:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3C0311699EB; Thu, 24 Oct 2019 11:58:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zQk90pKhz4tJM; Thu, 24 Oct 2019 11:58:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 003E6DC75; Thu, 24 Oct 2019 11:58:25 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OBwOWN020363; Thu, 24 Oct 2019 11:58:24 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OBwOhe020362; Thu, 24 Oct 2019 11:58:24 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910241158.x9OBwOhe020362@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 11:58:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354019 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354019 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 11:58:25 -0000 Author: bz Date: Thu Oct 24 11:58:24 2019 New Revision: 354019 URL: https://svnweb.freebsd.org/changeset/base/354019 Log: frag6: check global limits before hash and lock Check whether we are accepting more fragments (based on global limits) before doing expensive operations of calculating the hash and taking the bucket lock. This slightly increases a "race" between check time and incrementing counters (which is already there) possibly allowing a few more fragments than the maximum limits. However, when under attack, we rather save this CPU time for other packets/work. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 09:22:23 2019 (r354018) +++ head/sys/netinet6/frag6.c Thu Oct 24 11:58:24 2019 (r354019) @@ -458,6 +458,16 @@ frag6_input(struct mbuf **mp, int *offp, int proto) return (IPPROTO_DONE); } + /* + * Enforce upper bound on number of fragments for the entire system. + * If maxfrag is 0, never accept fragments. + * If maxfrag is -1, accept all fragments without limitation. + */ + if (ip6_maxfrags < 0) + ; + else if (atomic_load_int(&frag6_nfrags) >= (u_int)ip6_maxfrags) + goto dropfrag2; + /* Store receive network interface pointer for later. */ srcifp = m->m_pkthdr.rcvif; @@ -473,16 +483,6 @@ frag6_input(struct mbuf **mp, int *offp, int proto) IP6QB_LOCK(bucket); head = IP6QB_HEAD(bucket); - /* - * Enforce upper bound on number of fragments for the entire system. - * If maxfrag is 0, never accept fragments. - * If maxfrag is -1, accept all fragments without limitation. - */ - if (ip6_maxfrags < 0) - ; - else if (atomic_load_int(&frag6_nfrags) >= (u_int)ip6_maxfrags) - goto dropfrag; - TAILQ_FOREACH(q6, head, ip6q_tq) if (ip6f->ip6f_ident == q6->ip6q_ident && IN6_ARE_ADDR_EQUAL(&ip6->ip6_src, &q6->ip6q_src) && @@ -825,6 +825,7 @@ postinsert: dropfrag: IP6QB_UNLOCK(bucket); +dropfrag2: in6_ifstat_inc(dstifp, ifs6_reass_fail); IP6STAT_INC(ip6s_fragdropped); m_freem(m); From owner-svn-src-all@freebsd.org Thu Oct 24 12:16:15 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C157D16ADA1; Thu, 24 Oct 2019 12:16:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zR6l4hwgz4vTL; Thu, 24 Oct 2019 12:16:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8587AE002; Thu, 24 Oct 2019 12:16:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OCGF77031846; Thu, 24 Oct 2019 12:16:15 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OCGFWH031845; Thu, 24 Oct 2019 12:16:15 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910241216.x9OCGFWH031845@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 12:16:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354020 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354020 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 12:16:15 -0000 Author: bz Date: Thu Oct 24 12:16:15 2019 New Revision: 354020 URL: https://svnweb.freebsd.org/changeset/base/354020 Log: frag6: leave a note about upper layer header checks TBD Per sepcification the upper layer header needs to be within the first fragment. The check was not done so far and there is an open review for related work, so just leave a note as to where to put it. Move the extraction of frag offset up to this as it is needed to determine whether this is a first fragment or not. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 11:58:24 2019 (r354019) +++ head/sys/netinet6/frag6.c Thu Oct 24 12:16:15 2019 (r354020) @@ -468,6 +468,18 @@ frag6_input(struct mbuf **mp, int *offp, int proto) else if (atomic_load_int(&frag6_nfrags) >= (u_int)ip6_maxfrags) goto dropfrag2; + /* + * Validate that a full header chain to the ULP is present in the + * packet containing the first fragment as per RFC RFC7112 and + * RFC 8200 pages 18,19: + * The first fragment packet is composed of: + * (3) Extension headers, if any, and the Upper-Layer header. These + * headers must be in the first fragment. ... + */ + fragoff = ntohs(ip6f->ip6f_offlg & IP6F_OFF_MASK); + /* XXX TODO. thj has D16851 open for this. */ + /* Send ICMPv6 4,3 in case of violation. */ + /* Store receive network interface pointer for later. */ srcifp = m->m_pkthdr.rcvif; @@ -546,7 +558,6 @@ frag6_input(struct mbuf **mp, int *offp, int proto) * If it is the 1st fragment, record the length of the * unfragmentable part and the next header of the fragment header. */ - fragoff = ntohs(ip6f->ip6f_offlg & IP6F_OFF_MASK); if (fragoff == 0) { q6->ip6q_unfrglen = offset - sizeof(struct ip6_hdr) - sizeof(struct ip6_frag); From owner-svn-src-all@freebsd.org Thu Oct 24 12:33:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9389716BA2F for ; Thu, 24 Oct 2019 12:33:42 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x841.google.com (mail-qt1-x841.google.com [IPv6:2607:f8b0:4864:20::841]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zRVs6McHz3CND for ; Thu, 24 Oct 2019 12:33:41 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x841.google.com with SMTP id c17so34563384qtn.8 for ; Thu, 24 Oct 2019 05:33:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=mDwMUk6D682y3ml+v+bAw9cJT3Qai8uFrFslhdcnTmI=; b=Gi6NJm31MpiCd0BQol35tQKr+JH0XEzmQ96ITtbRKLfG1yuyEo0UA5bLxTbOEfwOfv oGz580KE6rYFyAAAKMDkAoLhjCM36EBbixTKoBphZ2gIQQz6+07NdcPUORAkZdofaJPl jXbKijviyoR6oyxgqpsBm0FnvrUl/3emT8pyGsFQ4zVvL7xmpWZRfaa8F88Mm8eIQk0y 2ynC5sxr+67hTAUfi/veLad4movkVgNQ1S8tnBp5jew6pL39WDiNigxkpqayiBVocDS1 moLWLIDdAvOpqiouji+9FG0jGy7afStHs7SNX4V5AqLGjsEenrPzWs4a0TqD6pBDuS3h CW2Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=mDwMUk6D682y3ml+v+bAw9cJT3Qai8uFrFslhdcnTmI=; b=CAUjr5XFEQZ6kS7SidIYPh+JZYLoZb5883z8s/ubdSDRVUgUwqHgpmF0ZmvfbOxHPL 2bErQrjXls5uOctHYthNaEKVMXlcNoXavP8oVBEO1DMR6mDs+BnNMnori3SMkDRvNOt6 dSeClhBC6/c4rBhhZgBRL/zQfw33hO2nTCLRjrI63vnNvmkFrsppUMyf1LliFq1G7dF/ +KtPqnDbVwBFpSbmz5E9lu8qhEKSYxkLDQXU0zWHNFknyz80ZBzv1aFq1h8Eozj+DKmk iVhz3wdtfW3E3+gvFL8T9rX5oM1CTxPYA2JS2Z47cMZzS89hhuIARl4FE8S2qWM18zdm shrw== X-Gm-Message-State: APjAAAWj00qtNEpNTWvt2cwuOUTJYRZ+ZZqcHFsgZhhuNwlNSBkHzMdV 6b1VFqRKNkji2JHdw0NqScAMJg== X-Google-Smtp-Source: APXvYqwHHt2SG/a+a7ZsXboK1loBis/pNcnE4xQKxtQDuMtnKapKjUSm077bgALhFf84nFPSl5KKnw== X-Received: by 2002:a0c:c982:: with SMTP id b2mr3458836qvk.41.1571920420694; Thu, 24 Oct 2019 05:33:40 -0700 (PDT) Received: from mutt-hbsd ([63.88.83.68]) by smtp.gmail.com with ESMTPSA id u11sm11346863qtg.11.2019.10.24.05.33.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 05:33:39 -0700 (PDT) Date: Thu, 24 Oct 2019 08:33:40 -0400 From: Shawn Webb To: Dimitry Andric Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353937 - in head/share: man/man5 mk Message-ID: <20191024123340.gx67z4kmeygkmkq2@mutt-hbsd> References: <201910231702.x9NH2jQv045130@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="jzlmacwrquhn3cih" Content-Disposition: inline In-Reply-To: <201910231702.x9NH2jQv045130@repo.freebsd.org> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA User-Agent: NeoMutt/20180716 X-Rspamd-Queue-Id: 46zRVs6McHz3CND X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=Gi6NJm31; dmarc=none; spf=pass (mx1.freebsd.org: domain of shawn.webb@hardenedbsd.org designates 2607:f8b0:4864:20::841 as permitted sender) smtp.mailfrom=shawn.webb@hardenedbsd.org X-Spamd-Result: default: False [-4.50 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.20)[multipart/signed,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; TO_DN_SOME(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; RCVD_IN_DNSWL_NONE(0.00)[1.4.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; SIGNED_PGP(-2.00)[]; FROM_EQ_ENVFROM(0.00)[]; MID_RHS_NOT_FQDN(0.50)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-0.40)[ip: (2.52), ipnet: 2607:f8b0::/32(-2.41), asn: 15169(-2.06), country: US(-0.05)] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 12:33:42 -0000 --jzlmacwrquhn3cih Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Oct 23, 2019 at 05:02:45PM +0000, Dimitry Andric wrote: > Author: dim > Date: Wed Oct 23 17:02:45 2019 > New Revision: 353937 > URL: https://svnweb.freebsd.org/changeset/base/353937 >=20 > Log: > Build toolchain components as dynamically linked executables by default > =20 > Summary: > Historically, we have built toolchain components such as cc, ld, etc as > statically linked executables. One of the reasons being that you could > sometimes save yourself from botched upgrades, by e.g. recompiling a > "known good" libc and reinstalling it. > =20 > In this day and age, we have boot environments, virtual machine > snapshots, cloud backups, and other much more reliable methods to > restore systems to working order. So I think the time is ripe to flip > this default, and link the toolchain components dynamically, just like > almost all other executables on FreeBSD. > =20 > Maybe at some point they can even become PIE executables by default! :) They have been on HardenedBSD for a few years now. :) Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD Tor-ified Signal: +1 443-546-8752 Tor+XMPP+OTR: lattera@is.a.hacker.sx GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 --jzlmacwrquhn3cih Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl2xmh8ACgkQ/y5nonf4 4fpdjA/+IHchf1rmn9QUtdjpK6JH7UEC6r7jSfA+O2eYrp5W6ktxmTHjUBGVof5c P9fKim5R4zgg+yoADMMtxSpJr9QgzpwEapPxVQ7zOooICaaD6Nvh/c6ZE+4e60rD tyG4MjX80Gh1jUSdNTX5W1bHUFFekIA5bD3w3LaomAKHEmqVKda3tqtfJPCIEVTj yal9PyWoXDbLKAPKq3KFHbaGWJO8XPk3a86N+UkJYQ+56uN5kDUsvuzps9LgPyI5 K4J6RrcN/rYKgqzxkSEesj0I4k2lAyJ6tAPpfRzeMmiifwkUpf3LiS5uWB4Y4z52 aUwYXxvo1SNGtQbKoPbBkgW9MjzC0CIcCq7JfEiS+G3i7YGsYwuZv7qUCwoNMN7S kvJlMrpQuQDtx/VfpFjCgVzrlOj7q9jq7KE2oU9n1J5q0IzCngKjb7tv2WoRr2kC pwxwsi1NGyXKz8f0mElO+IJmxOkR0v7ZVQ09pkQ8jOwYLBqZOPSkwOJfFu0vzQEg CkS2M+oxU9DTimqL9Kg3uynV0NM0wpNieeWIFMP9gd6RyUKxxWfqZpoWk5mKEFju PcxJzaN13QZqr8VNP2vyxmEZfJVlRi7N7ywxXLfNWC5Bmem0g0LdSP6R7igjvJ5G iOE6w6/UxQCQfrZu5nfXlnuAOBjJG8rGRnfGqfkrOnsNVd0CAeI= =/RJC -----END PGP SIGNATURE----- --jzlmacwrquhn3cih-- From owner-svn-src-all@freebsd.org Thu Oct 24 12:49:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CFFA416C0F9; Thu, 24 Oct 2019 12:49:10 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2610:1c1:1:6074::16:84]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zRrk55q2z3DHC; Thu, 24 Oct 2019 12:49:10 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id A7547C845; Thu, 24 Oct 2019 12:49:10 +0000 (UTC) Date: Thu, 24 Oct 2019 12:49:10 +0000 From: Alexey Dokuchaev To: Enji Cooper Cc: Dimitry Andric , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r353937 - in head/share: man/man5 mk Message-ID: <20191024124910.GA93913@FreeBSD.org> References: <201910231702.x9NH2jQv045130@repo.freebsd.org> <2B855247-5097-442D-8D4A-77D68D2F6186@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <2B855247-5097-442D-8D4A-77D68D2F6186@gmail.com> User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 12:49:10 -0000 On Wed, Oct 23, 2019 at 11:31:41AM -0700, Enji Cooper wrote: > > On Oct 23, 2019, at 10:02, Dimitry Andric wrote: > > New Revision: 353937 > > URL: https://svnweb.freebsd.org/changeset/base/353937 > > > > Log: > > Build toolchain components as dynamically linked executables by default What are the benefits of the new order? > > Summary: > > Historically, we have built toolchain components such as cc, ld, etc as > > statically linked executables. One of the reasons being that you could > > sometimes save yourself from botched upgrades, by e.g. recompiling a > > "known good" libc and reinstalling it. > > In this day and age, we have boot environments, virtual machine > > snapshots, cloud backups, and other much more reliable methods to > > restore systems to working order. So I think the time is ripe to flip What about those of us who cannot use BEs, VMs, and other "cloudy" tech because, well, they might not work as well and reliably as one might think? > Using dynamic binaries instead of static binaries might actually regress > performance in a way you don't expect, depending on -j values, etc. Static > binaries avoid the dynamic linker, which (obviously) results in a perf hit > at scale [...] Very good point. > Did you calculate the perf trade offs for the static binaries at low -j vs > high -j, system and user time, etc? I'd like to know the answer to this question (and the results) as well. ./danfe From owner-svn-src-all@freebsd.org Thu Oct 24 13:08:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 44E7416C81F; Thu, 24 Oct 2019 13:08:22 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f196.google.com (mail-il1-f196.google.com [209.85.166.196]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zSGt0l7wz3FPZ; Thu, 24 Oct 2019 13:08:21 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f196.google.com with SMTP id u1so22290428ilq.12; Thu, 24 Oct 2019 06:08:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GRx1/7zfYkDF0r4ePqxLTREcfJwiipshd+lMTbHvDJk=; b=nxMorisUDEZCMloAjhoJ8sSV1k/6CDYbNSt/SnGqJA3YUMeV89S99feTz5po3wy2+O IOvy14zgD86I/tUzW3WozNzyxSgJklrYEt6htx+Wv2ysgrj11Ve9+iATd5C5pnzIWnbb Tpp8gtnVPMdyUtTTEOkwg0/+pu45MCXuSA+SMmT++gPp55VApa0EHIvcbQQCAr59Wcex Y3J9iYBfaULiLFlOotzyD3hFwGaAYN7x/VAWz013ledUKJbPRti2Kpo+bcdSdUJa4whj vfvepJy+AKpi/OGJx5JB2cZpdy5kiycq9yPujbpuuvr20EG0chVzUJfLaF8Xiz9C/ZC8 0kNw== X-Gm-Message-State: APjAAAWKTnWK025/socL3mew2QcONYvFvmwW0JkeOX28WsSnjP3mbBWK sjCcV1Q24Xj/IhZ7mMQo13meaBjuNEzkYaRsGqVHWwfH X-Google-Smtp-Source: APXvYqwpfOlEeUvlg5kohJshDQDwYRZvwc6gKZsu/dAcZE+xbIEtsLGW/BWXdTn2E41bubW3nrbY6JFlDP8L2vGnJ84= X-Received: by 2002:a92:650d:: with SMTP id z13mr13437809ilb.18.1571922500167; Thu, 24 Oct 2019 06:08:20 -0700 (PDT) MIME-Version: 1.0 References: <201910231657.x9NGvCMD039111@repo.freebsd.org> <20191024082609.GA63459@FreeBSD.org> In-Reply-To: <20191024082609.GA63459@FreeBSD.org> From: Ed Maste Date: Thu, 24 Oct 2019 07:35:01 -0400 Message-ID: Subject: Re: svn commit: r353936 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch To: Alexey Dokuchaev Cc: Dimitry Andric , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 46zSGt0l7wz3FPZ X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 13:08:22 -0000 On Thu, 24 Oct 2019 at 04:26, Alexey Dokuchaev wrote: > > Why i686, not i586? i486 lacking 64-bit atomics is a sound and valid > reason, but I don't understand why i586 wasn't chosen, and quick review > of that -arch thread did not help. Could you shed some more light here? i686 as a minimum allows a switch to PAE page tables. In my opinion we should still allow building FreeBSD for i586 (and I would like to have such a case in our hardware CI lab), but the default for the installation images and prebuilt packages should be i686. From owner-svn-src-all@freebsd.org Thu Oct 24 14:18:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03F5916E1B1; Thu, 24 Oct 2019 14:18:07 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zTqL6HlHz3K8Q; Thu, 24 Oct 2019 14:18:06 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC7F0F64B; Thu, 24 Oct 2019 14:18:06 +0000 (UTC) (envelope-from marius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OEI6o6002312; Thu, 24 Oct 2019 14:18:06 GMT (envelope-from marius@FreeBSD.org) Received: (from marius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OEI62d002311; Thu, 24 Oct 2019 14:18:06 GMT (envelope-from marius@FreeBSD.org) Message-Id: <201910241418.x9OEI62d002311@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: marius set sender to marius@FreeBSD.org using -f From: Marius Strobl Date: Thu, 24 Oct 2019 14:18:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354021 - stable/12/sys/dev/e1000 X-SVN-Group: stable-12 X-SVN-Commit-Author: marius X-SVN-Commit-Paths: stable/12/sys/dev/e1000 X-SVN-Commit-Revision: 354021 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 14:18:07 -0000 Author: marius Date: Thu Oct 24 14:18:06 2019 New Revision: 354021 URL: https://svnweb.freebsd.org/changeset/base/354021 Log: MFC: r353778 - In em_intr(), just call em_handle_link() instead of duplicating it. - In em_msix_link(), properly handle IGB-class devices after the iflib(4) conversion again by only setting EM_MSIX_LINK for the EM-class 82574 and by re-arming link interrupts unconditionally, i. e. not only in case of spurious interrupts. This fixes the interface link state change detection for the IGB-class. [1] - In em_if_update_admin_status(), only re-arm the link state change interrupt for 82574 and also only if such a device uses MSI-X, i. e. takes advantage of autoclearing. In case of INTx and MSI as well as for LEM- and IGB-class devices, re-arming isn't appropriate here and setting EM_MSIX_LINK isn't either. While at it, consistently take advantage of the hw variable. PR: 236724 [1] Differential Revision: https://reviews.freebsd.org/D21924 Modified: stable/12/sys/dev/e1000/if_em.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/e1000/if_em.c ============================================================================== --- stable/12/sys/dev/e1000/if_em.c Thu Oct 24 12:16:15 2019 (r354020) +++ stable/12/sys/dev/e1000/if_em.c Thu Oct 24 14:18:06 2019 (r354021) @@ -1395,10 +1395,8 @@ em_intr(void *arg) IFDI_INTR_DISABLE(ctx); /* Link status change */ - if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { - adapter->hw.mac.get_link_status = 1; - iflib_admin_intr_deferred(ctx); - } + if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) + em_handle_link(ctx); if (reg_icr & E1000_ICR_RXO) adapter->rx_overruns++; @@ -1481,22 +1479,24 @@ em_msix_link(void *arg) if (reg_icr & (E1000_ICR_RXSEQ | E1000_ICR_LSC)) { em_handle_link(adapter->ctx); - } else { - E1000_WRITE_REG(&adapter->hw, E1000_IMS, - EM_MSIX_LINK | E1000_IMS_LSC); - if (adapter->hw.mac.type >= igb_mac_min) - E1000_WRITE_REG(&adapter->hw, E1000_EIMS, adapter->link_mask); + } else if (adapter->hw.mac.type == e1000_82574) { + /* Only re-arm 82574 if em_if_update_admin_status() won't. */ + E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | + E1000_IMS_LSC); } - /* - * Because we must read the ICR for this interrupt - * it may clear other causes using autoclear, for - * this reason we simply create a soft interrupt - * for all these vectors. - */ - if (reg_icr && adapter->hw.mac.type < igb_mac_min) { - E1000_WRITE_REG(&adapter->hw, - E1000_ICS, adapter->ims); + if (adapter->hw.mac.type == e1000_82574) { + /* + * Because we must read the ICR for this interrupt it may + * clear other causes using autoclear, for this reason we + * simply create a soft interrupt for all these vectors. + */ + if (reg_icr) + E1000_WRITE_REG(&adapter->hw, E1000_ICS, adapter->ims); + } else { + /* Re-arm unconditionally */ + E1000_WRITE_REG(&adapter->hw, E1000_IMS, E1000_IMS_LSC); + E1000_WRITE_REG(&adapter->hw, E1000_EIMS, adapter->link_mask); } return (FILTER_HANDLED); @@ -1512,7 +1512,6 @@ em_handle_link(void *context) iflib_admin_intr_deferred(ctx); } - /********************************************************************* * * Media Ioctl callback @@ -1829,14 +1828,15 @@ em_if_update_admin_status(if_ctx_t ctx) em_update_stats_counters(adapter); /* Reset LAA into RAR[0] on 82571 */ - if ((adapter->hw.mac.type == e1000_82571) && - e1000_get_laa_state_82571(&adapter->hw)) - e1000_rar_set(&adapter->hw, adapter->hw.mac.addr, 0); + if (hw->mac.type == e1000_82571 && e1000_get_laa_state_82571(hw)) + e1000_rar_set(hw, hw->mac.addr, 0); - if (adapter->hw.mac.type < em_mac_min) + if (hw->mac.type < em_mac_min) lem_smartspeed(adapter); - - E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | E1000_IMS_LSC); + else if (hw->mac.type == e1000_82574 && + adapter->intr_type == IFLIB_INTR_MSIX) + E1000_WRITE_REG(&adapter->hw, E1000_IMS, EM_MSIX_LINK | + E1000_IMS_LSC); } static void From owner-svn-src-all@freebsd.org Thu Oct 24 14:57:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77D8B16EEEF; Thu, 24 Oct 2019 14:57:39 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zVhz2W7xz3MJf; Thu, 24 Oct 2019 14:57:39 +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 39659FDA7; Thu, 24 Oct 2019 14:57:39 +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 x9OEvdZG026368; Thu, 24 Oct 2019 14:57:39 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OEvdsM026367; Thu, 24 Oct 2019 14:57:39 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910241457.x9OEvdsM026367@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 24 Oct 2019 14:57:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354022 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 354022 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 14:57:39 -0000 Author: avg Date: Thu Oct 24 14:57:38 2019 New Revision: 354022 URL: https://svnweb.freebsd.org/changeset/base/354022 Log: MFC r353168: ZFS: unconditionally use atomic_swap_64 Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c Thu Oct 24 14:18:06 2019 (r354021) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c Thu Oct 24 14:57:38 2019 (r354022) @@ -313,12 +313,8 @@ feature_sync(spa_t *spa, zfeature_info_t *feature, uin if (feature->fi_feature != SPA_FEATURE_NONE) { uint64_t *refcount_cache = &spa->spa_feat_refcount_cache[feature->fi_feature]; -#ifdef atomic_swap_64 VERIFY3U(*refcount_cache, ==, atomic_swap_64(refcount_cache, refcount)); -#else - *refcount_cache = refcount; -#endif } if (refcount == 0) From owner-svn-src-all@freebsd.org Thu Oct 24 15:00:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F10A016EFC1; Thu, 24 Oct 2019 15:00:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zVmm5yhqz3Mby; Thu, 24 Oct 2019 15:00:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AFF01FDD8; Thu, 24 Oct 2019 15:00:56 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OF0ulZ028785; Thu, 24 Oct 2019 15:00:56 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OF0u67028784; Thu, 24 Oct 2019 15:00:56 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910241500.x9OF0u67028784@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 24 Oct 2019 15:00:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354023 - stable/12/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 354023 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 15:00:57 -0000 Author: avg Date: Thu Oct 24 15:00:56 2019 New Revision: 354023 URL: https://svnweb.freebsd.org/changeset/base/354023 Log: MFC r353607: MFV r353606: 10067 Miscellaneous man page typos Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Directory Properties: stable/12/ (props changed) Modified: stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Oct 24 14:57:38 2019 (r354022) +++ stable/12/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Oct 24 15:00:56 2019 (r354023) @@ -2335,7 +2335,7 @@ option was not specified. .Ar filesystem Ns | Ns Ar volume .Xc .Pp -Remap the indirect blocks in the given fileystem or volume so that they no +Remap the indirect blocks in the given filesystem or volume so that they no longer reference blocks on previously removed vdevs and we can eventually shrink the size of the indirect mapping objects for the previously removed vdevs. Note that remapping all blocks might not be possible and that From owner-svn-src-all@freebsd.org Thu Oct 24 15:01:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 240D016F032; Thu, 24 Oct 2019 15:01:32 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zVnS045hz3Mm5; Thu, 24 Oct 2019 15:01:32 +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 DA5BAFE10; Thu, 24 Oct 2019 15:01:31 +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 x9OF1VHG031126; Thu, 24 Oct 2019 15:01:31 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OF1V8g031125; Thu, 24 Oct 2019 15:01:31 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910241501.x9OF1V8g031125@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 24 Oct 2019 15:01:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354024 - stable/11/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 354024 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 15:01:32 -0000 Author: avg Date: Thu Oct 24 15:01:31 2019 New Revision: 354024 URL: https://svnweb.freebsd.org/changeset/base/354024 Log: MFC r353607: MFV r353606: 10067 Miscellaneous man page typos Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Directory Properties: stable/11/ (props changed) Modified: stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Oct 24 15:00:56 2019 (r354023) +++ stable/11/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Thu Oct 24 15:01:31 2019 (r354024) @@ -2331,7 +2331,7 @@ option was not specified. .Ar filesystem Ns | Ns Ar volume .Xc .Pp -Remap the indirect blocks in the given fileystem or volume so that they no +Remap the indirect blocks in the given filesystem or volume so that they no longer reference blocks on previously removed vdevs and we can eventually shrink the size of the indirect mapping objects for the previously removed vdevs. Note that remapping all blocks might not be possible and that From owner-svn-src-all@freebsd.org Thu Oct 24 15:04:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BF1F16F252; Thu, 24 Oct 2019 15:04:07 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zVrR2gdZz3Mxv; Thu, 24 Oct 2019 15:04:07 +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 407B5FF7C; Thu, 24 Oct 2019 15:04:07 +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 x9OF47eY031996; Thu, 24 Oct 2019 15:04:07 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OF479j031995; Thu, 24 Oct 2019 15:04:07 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910241504.x9OF479j031995@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 24 Oct 2019 15:04:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354025 - stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 354025 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 15:04:07 -0000 Author: avg Date: Thu Oct 24 15:04:06 2019 New Revision: 354025 URL: https://svnweb.freebsd.org/changeset/base/354025 Log: MFC r353614: MFV r353613: 10731 zfs: NULL pointer errors FreeBSD already had these changes locally. This commit removes a small formatting difference. Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Thu Oct 24 15:01:31 2019 (r354024) +++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Thu Oct 24 15:04:06 2019 (r354025) @@ -1249,8 +1249,7 @@ int dsl_pool_user_release(dsl_pool_t *dp, uint64_t dsobj, const char *tag, dmu_tx_t *tx) { - return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, 0, - tx, B_FALSE)); + return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, 0, tx, B_FALSE)); } /* From owner-svn-src-all@freebsd.org Thu Oct 24 15:04:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A15AF16F2C5; Thu, 24 Oct 2019 15:04:53 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zVsK3pWbz3N5Q; Thu, 24 Oct 2019 15:04:53 +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 669E4FF7D; Thu, 24 Oct 2019 15:04:53 +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 x9OF4rY8032095; Thu, 24 Oct 2019 15:04:53 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OF4rxl032094; Thu, 24 Oct 2019 15:04:53 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910241504.x9OF4rxl032094@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 24 Oct 2019 15:04:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354026 - stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs X-SVN-Commit-Revision: 354026 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 15:04:53 -0000 Author: avg Date: Thu Oct 24 15:04:52 2019 New Revision: 354026 URL: https://svnweb.freebsd.org/changeset/base/354026 Log: MFC r353614: MFV r353613: 10731 zfs: NULL pointer errors Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c ============================================================================== --- stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Thu Oct 24 15:04:06 2019 (r354025) +++ stable/11/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c Thu Oct 24 15:04:52 2019 (r354026) @@ -1245,8 +1245,7 @@ int dsl_pool_user_release(dsl_pool_t *dp, uint64_t dsobj, const char *tag, dmu_tx_t *tx) { - return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, 0, - tx, B_FALSE)); + return (dsl_pool_user_hold_rele_impl(dp, dsobj, tag, 0, tx, B_FALSE)); } /* From owner-svn-src-all@freebsd.org Thu Oct 24 15:14:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2E51A16F728 for ; Thu, 24 Oct 2019 15:14:21 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x832.google.com (mail-qt1-x832.google.com [IPv6:2607:f8b0:4864:20::832]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zW4D1hwlz3Nlv for ; Thu, 24 Oct 2019 15:14:19 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x832.google.com with SMTP id w14so38344722qto.9 for ; Thu, 24 Oct 2019 08:14:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=uXy0Y5xsVRztx3n82NB0Ju3DwprUJLICwynudZYUIe4=; b=df1T+OGuDKKEek83/l4zmw+dNTKfbtJEAwPoXHoUhLCd4LaklVewwzcBefvWCEV/1Y Ls6ukCxbP9cKIxwnSgC0ffj4MmFQtupwyH+piRvfrkEZ993So77+Nno05ZYdGQsqdKoh xvfmrhstZ1HTc72PBIyEzTdpnOOHmUVNDUHDPdxxm31Z4ezXxcvwmZkcOS2akjraTDpN OQpE6ls8ohOf/t4P4yFZwRoG+21jzb3wF29ZP/JwDd3A+1ijLmasjb5fhmOLg0eNxV4P GLz7Vzm8AuSDhpie4ZtOBl8oFMn1eyAeL0fscTy+GtxlAw1qCYSOpgX6OrxWkDpGJAs7 vkKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=uXy0Y5xsVRztx3n82NB0Ju3DwprUJLICwynudZYUIe4=; b=huu4ZKW92wNNcBr4Latyk9CzqIC3avKQgqcpNFXCvNzd208P6V5CKLfb3AeIs8mFWK adpaiBhel0Zxjf0NlpLNJU1aUcGM9T94CzKsjnByvL67KHZ27yMxsMrpJTWkeYZNsPNU sJOyi6xa15PWJhSlI0qIZcNEASmyGC4WRJ3qHUKfhI5kQOf7HXJCq5Z9nQ+69ddrLt1N My9HsuK55xsFJdGMO8S+8LU1ckyLFitTpB8ySQDXUDzjWKrKlxcIkshE5tVZRAI7Div8 zeicUAiefOHlOSLMG9mFv7JdF6eqZvlKOc8b73pMBkFbUAXjgz+OuJdUKlC2UDZdFLJ7 Qw8A== X-Gm-Message-State: APjAAAWYZURia0w0OJqYX1XsVKqil0ucu8MayJ6iTUOPMdkcF3IRBMO1 5R+mgGhatJOub6hsGszVyukIzUpdIN7ZTJUmtbZWyg== X-Google-Smtp-Source: APXvYqyNP/fYXbMTiQQYcLJjaIk00IGMj1RXoPpJYptkpWKl8uoWvMbrhlXHYydlJ4svHtk0/uzJvVHELzVJ94YD4gA= X-Received: by 2002:a0c:eda9:: with SMTP id h9mr12916984qvr.125.1571930058317; Thu, 24 Oct 2019 08:14:18 -0700 (PDT) MIME-Version: 1.0 References: <201910231657.x9NGvCMD039111@repo.freebsd.org> <20191024082609.GA63459@FreeBSD.org> In-Reply-To: <20191024082609.GA63459@FreeBSD.org> From: Warner Losh Date: Thu, 24 Oct 2019 09:14:07 -0600 Message-ID: Subject: Re: svn commit: r353936 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch To: Alexey Dokuchaev Cc: Dimitry Andric , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46zW4D1hwlz3Nlv X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=df1T+OGu; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::832) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.78 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[2.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.78)[ip: (-9.38), ipnet: 2607:f8b0::/32(-2.41), asn: 15169(-2.06), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 15:14:21 -0000 On Thu, Oct 24, 2019 at 2:26 AM Alexey Dokuchaev wrote: > On Wed, Oct 23, 2019 at 04:57:12PM +0000, Dimitry Andric wrote: > > New Revision: 353936 > > URL: https://svnweb.freebsd.org/changeset/base/353936 > > > > Log: > > Bump clang's default target CPU for the i386 architecture (aka "x86") > to > > i686, as per the discussion on the freebsd-arch mailing list. Earlier > > in r352030, I had already bumped it to i586, to work around missing > > atomic 64 bit functions for the i386 architecture. > > Why i686, not i586? i486 lacking 64-bit atomics is a sound and valid > reason, but I don't understand why i586 wasn't chosen, and quick review > of that -arch thread did not help. Could you shed some more light here? > There were several notions at play here. First, the rest of the i386 ecosystem has defaulted to i686 for a long time. This aligns us better when them. Next, the share of Pentium processors in FreeBSD is super small, and confined to firewall embedded boxes. These boxes aren't installed from our base installation media and have custom builds already. The arch@ thread suggested that people would be OK building their own packages. A recent survey of available hardware suggests that the last 586 core systems (Geode LX was the latest I could find) were sold by people like PC Engines in 2018 (or maybe 2019), those these were trailing edge, EOL'd systems that hadn't been recommended for new deployments for a few years prior. This tells us that the need for us to retain 586 compatibility by default is low, but the need to have it available is still high enough to not remove support entirely. People are transitioning away from this embedded gear now that the CPUs have gone EOL, though the transition will likely take years to complete. The 486 cores EOLd by 2010, so that part of things is a non-issue: only the hardiest of hardware is still around, and it's not being aggressively upgraded to -current. i686 support by default allows better code generation and increased performance. The biggest thing being using CMOVxx instructions to avoid a pipeline miss due to branching, though there's likely others. By moving to i686 by default, we have only one bump instead of two. We should have bumped to 586 in the 11 time frame, using similar analysis to the above, but we didn't. Doing one big bump means we won't have to go back to the well to have another discussion about it in the future. If these discussions were better in the past, then that wouldn't be a big deal. However, the project is a little dysfunctional in this area and the desire to bump to 686 to avoid some of that in a platform that's rapidly ramping down even in its core areas played into this a bit. Chances are this will be the last minimum bump as well before i386 is removed from the tree as irrelevant (some years from now, but the day will come). There's no good next higher tier to land on anyway.... So that's where we are: a mix of technical and political reasons were why we bumped up to i686 by default and retained the ability to still deploy on i586-cores for the small portion of our user base that will need to do so after 13 is released. Warner From owner-svn-src-all@freebsd.org Thu Oct 24 15:34:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C70C816FD62; Thu, 24 Oct 2019 15:34:33 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: from freefall.freebsd.org (freefall.freebsd.org [96.47.72.132]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "freefall.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zWWY4sD6z3Pl2; Thu, 24 Oct 2019 15:34:33 +0000 (UTC) (envelope-from danfe@freebsd.org) Received: by freefall.freebsd.org (Postfix, from userid 1033) id 9F36CF2D5; Thu, 24 Oct 2019 15:34:33 +0000 (UTC) Date: Thu, 24 Oct 2019 15:34:33 +0000 From: Alexey Dokuchaev To: Warner Losh Cc: Dimitry Andric , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r353936 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch Message-ID: <20191024153433.GA68256@FreeBSD.org> References: <201910231657.x9NGvCMD039111@repo.freebsd.org> <20191024082609.GA63459@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.11.4 (2019-03-13) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 15:34:33 -0000 On Thu, Oct 24, 2019 at 09:14:07AM -0600, Warner Losh wrote: > On Thu, Oct 24, 2019 at 2:26 AM Alexey Dokuchaev wrote: > > On Wed, Oct 23, 2019 at 04:57:12PM +0000, Dimitry Andric wrote: > > > New Revision: 353936 > > > URL: https://svnweb.freebsd.org/changeset/base/353936 > > > > > > Log: > > > Bump clang's default target CPU for the i386 architecture (aka > > > "x86") to i686, as per the discussion on the freebsd-arch mailing > > > list. > > > > Why i686, not i586? i486 lacking 64-bit atomics is a sound and valid > > reason, but I don't understand why i586 wasn't chosen, and quick review > > of that -arch thread did not help. > > There were several notions at play here. First, the rest of the i386 > ecosystem has defaulted to i686 for a long time. [...] > > i686 support by default allows better code generation and increased > performance. The biggest thing being using CMOVxx instructions to avoid > a pipeline miss due to branching, though there's likely others. > > By moving to i686 by default, we have only one bump instead of two. [...] > > So that's where we are: a mix of technical and political reasons were why > we bumped up to i686 by default Understood. I appreciate long and elaborate reply Warner. > Chances are this will be the last minimum bump as well before i386 is > removed from the tree as irrelevant (some years from now, but the day > will come). I hope the day never comes, as I don't want to be forced from FreeBSD to something else on vast majority of my hardware. ./danfe From owner-svn-src-all@freebsd.org Thu Oct 24 15:46:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9308217037F; Thu, 24 Oct 2019 15:46:01 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zWmn3Ls0z3Qg2; Thu, 24 Oct 2019 15:46:01 +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 52BB7186B8; Thu, 24 Oct 2019 15:46:01 +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 x9OFk1e5056321; Thu, 24 Oct 2019 15:46:01 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OFk0jZ056319; Thu, 24 Oct 2019 15:46:00 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910241546.x9OFk0jZ056319@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 24 Oct 2019 15:46:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354027 - in stable/12/sys: arm/include mips/include powerpc/include X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: in stable/12/sys: arm/include mips/include powerpc/include X-SVN-Commit-Revision: 354027 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 15:46:01 -0000 Author: avg Date: Thu Oct 24 15:46:00 2019 New Revision: 354027 URL: https://svnweb.freebsd.org/changeset/base/354027 Log: MFC r341787 by hselasky: Implement atomic_swap_xxx() for all platforms. Modified: stable/12/sys/arm/include/atomic.h stable/12/sys/mips/include/atomic.h stable/12/sys/powerpc/include/atomic.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/arm/include/atomic.h ============================================================================== --- stable/12/sys/arm/include/atomic.h Thu Oct 24 15:04:52 2019 (r354026) +++ stable/12/sys/arm/include/atomic.h Thu Oct 24 15:46:00 2019 (r354027) @@ -55,6 +55,13 @@ #include #endif /* Arch >= v6 */ +static __inline u_long +atomic_swap_long(volatile u_long *p, u_long v) +{ + + return (atomic_swap_32((volatile uint32_t *)p, v)); +} + #define atomic_clear_ptr atomic_clear_32 #define atomic_clear_acq_ptr atomic_clear_acq_32 #define atomic_clear_rel_ptr atomic_clear_rel_32 Modified: stable/12/sys/mips/include/atomic.h ============================================================================== --- stable/12/sys/mips/include/atomic.h Thu Oct 24 15:04:52 2019 (r354026) +++ stable/12/sys/mips/include/atomic.h Thu Oct 24 15:46:00 2019 (r354027) @@ -759,4 +759,68 @@ atomic_thread_fence_seq_cst(void) #define atomic_store_rel_ptr atomic_store_rel_long #define atomic_readandclear_ptr atomic_readandclear_long +static __inline unsigned int +atomic_swap_int(volatile unsigned int *ptr, const unsigned int value) +{ + unsigned int retval; + + retval = *ptr; + + while (!atomic_fcmpset_int(ptr, &retval, value)) + ; + return (retval); +} + +static __inline uint32_t +atomic_swap_32(volatile uint32_t *ptr, const uint32_t value) +{ + uint32_t retval; + + retval = *ptr; + + while (!atomic_fcmpset_32(ptr, &retval, value)) + ; + return (retval); +} + +#if defined(__mips_n64) || defined(__mips_n32) +static __inline uint64_t +atomic_swap_64(volatile uint64_t *ptr, const uint64_t value) +{ + uint64_t retval; + + retval = *ptr; + + while (!atomic_fcmpset_64(ptr, &retval, value)) + ; + return (retval); +} +#endif + +static __inline unsigned long +atomic_swap_long(volatile unsigned long *ptr, const unsigned long value) +{ + unsigned long retval; + + retval = *ptr; + + while (!atomic_fcmpset_32((volatile uint32_t *)ptr, + (uint32_t *)&retval, value)) + ; + return (retval); +} + +static __inline uintptr_t +atomic_swap_ptr(volatile uintptr_t *ptr, const uintptr_t value) +{ + uintptr_t retval; + + retval = *ptr; + + while (!atomic_fcmpset_32((volatile uint32_t *)ptr, + (uint32_t *)&retval, value)) + ; + return (retval); +} + #endif /* ! _MACHINE_ATOMIC_H_ */ Modified: stable/12/sys/powerpc/include/atomic.h ============================================================================== --- stable/12/sys/powerpc/include/atomic.h Thu Oct 24 15:04:52 2019 (r354026) +++ stable/12/sys/powerpc/include/atomic.h Thu Oct 24 15:46:00 2019 (r354027) @@ -852,6 +852,9 @@ atomic_swap_64(volatile u_long *p, u_long v) #define atomic_fetchadd_64 atomic_fetchadd_long #define atomic_swap_long atomic_swap_64 #define atomic_swap_ptr atomic_swap_64 +#else +#define atomic_swap_long(p,v) atomic_swap_32((volatile u_int *)(p), v) +#define atomic_swap_ptr(p,v) atomic_swap_32((volatile u_int *)(p), v) #endif #undef __ATOMIC_REL From owner-svn-src-all@freebsd.org Thu Oct 24 15:59:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B517B1706D4 for ; Thu, 24 Oct 2019 15:59:00 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x833.google.com (mail-qt1-x833.google.com [IPv6:2607:f8b0:4864:20::833]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zX3m038dz3RJR for ; Thu, 24 Oct 2019 15:58:59 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x833.google.com with SMTP id z22so18073490qtq.11 for ; Thu, 24 Oct 2019 08:58:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=ru//suYCHeloiQ1KHVcg3cOA1RRhZICZLYNQtYNc7Rk=; b=x51pCVL2wPCSIMCSZRSLM+bPFLlhv5Hd188XpeKtN7Oqy522scQiLvkPyDPzVK80jQ laZOobfc+Uym9ICsCxOBkC+NlS5i9jBTUODWF/o/Gy+Q7iv+RMxSzX7WlyqEfRwK/g+J rkPQp3NIQgR8eJn1x1aGIfWLW1vy7fmDbmd6ASephkI9V0VT12Wq5pABQVKOsysdmqdK lzRgpxO5Rtp/TogNrng/uW+dh33hLD748Mhj6fLUttvsn2cDglv504GnD/di3h7qDekB LAXOafQ6prAK3f5hTTGFDY8u7Fkj8CbwArmWfDOsTufIi9mHWMPF82c5b9Sz1mR2Pyg+ FYqQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ru//suYCHeloiQ1KHVcg3cOA1RRhZICZLYNQtYNc7Rk=; b=M1ybaNgeXVLwqRgjxm7T+Etxd2VG/qkpwmjPn1Nag+qqHqfhFE66btna+opIa7oVBj xcFzKPYeT+adxiV9wD0DwINVcqBiRvyU8KBeIl4kVwBx9W3S2cj4OSVThbC2mNywpSbh uLx5m1rCmf7xEfPj7BOEy/HVuxHL6FBxxzEOTpEg12SKqK7pdJVdfEJS7X/WVaBcyJmD RXFZHpjakVoklSXv4RjBOHEsGWcUJZseBb71A0J+7R41590QNlsXywt8p3iBEJ+trNVF OAU8zNH/tGJ9o17ykmRZnGWpK+K4C+U3jBW2UzDC+LpU7zkV20OMMMeOG0RrWpHJPo5g XXsQ== X-Gm-Message-State: APjAAAW1x/oETe6rl9msCpRVyLN00PuMMxzc8oLRGCljIxR3ojCktViN rfPgEN4ukqYUNMiBUiW+N7iFqfDgdGppM+f+zFEJIA== X-Google-Smtp-Source: APXvYqyzXaf+OBedbKdi8QQVKtc3P8A5wPun/r3XqgwC/Rrko7+cFMEmi+fJPmC7setp4X45vv8M5uCKP0JdOxKSFAk= X-Received: by 2002:a0c:95ca:: with SMTP id t10mr9163024qvt.22.1571932738606; Thu, 24 Oct 2019 08:58:58 -0700 (PDT) MIME-Version: 1.0 References: <201910231657.x9NGvCMD039111@repo.freebsd.org> <20191024082609.GA63459@FreeBSD.org> <20191024153433.GA68256@FreeBSD.org> In-Reply-To: <20191024153433.GA68256@FreeBSD.org> From: Warner Losh Date: Thu, 24 Oct 2019 09:58:47 -0600 Message-ID: Subject: Re: svn commit: r353936 - head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch To: Alexey Dokuchaev Cc: Dimitry Andric , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 46zX3m038dz3RJR X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=x51pCVL2; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::833) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-3.76 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[3.3.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.76)[ip: (-9.27), ipnet: 2607:f8b0::/32(-2.41), asn: 15169(-2.06), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 15:59:00 -0000 On Thu, Oct 24, 2019 at 9:34 AM Alexey Dokuchaev wrote: > On Thu, Oct 24, 2019 at 09:14:07AM -0600, Warner Losh wrote: > > On Thu, Oct 24, 2019 at 2:26 AM Alexey Dokuchaev > wrote: > > > On Wed, Oct 23, 2019 at 04:57:12PM +0000, Dimitry Andric wrote: > > > > New Revision: 353936 > > > > URL: https://svnweb.freebsd.org/changeset/base/353936 > > > > > > > > Log: > > > > Bump clang's default target CPU for the i386 architecture (aka > > > > "x86") to i686, as per the discussion on the freebsd-arch mailing > > > > list. > > > > > > Why i686, not i586? i486 lacking 64-bit atomics is a sound and valid > > > reason, but I don't understand why i586 wasn't chosen, and quick review > > > of that -arch thread did not help. > > > > There were several notions at play here. First, the rest of the i386 > > ecosystem has defaulted to i686 for a long time. [...] > > > > i686 support by default allows better code generation and increased > > performance. The biggest thing being using CMOVxx instructions to avoid > > a pipeline miss due to branching, though there's likely others. > The other reason to do this on i386 is that we've built lib32 with i686 forever on amd64, and this makes them match. I'd forgotten that this was mentioned in early discussions and was just reminded about that in IRC. > > By moving to i686 by default, we have only one bump instead of two. [...] > > > > So that's where we are: a mix of technical and political reasons were why > > we bumped up to i686 by default > > Understood. I appreciate long and elaborate reply Warner. > > > Chances are this will be the last minimum bump as well before i386 is > > removed from the tree as irrelevant (some years from now, but the day > > will come). > > I hope the day never comes, as I don't want to be forced from FreeBSD to > something else on vast majority of my hardware. > I hope so too. I know this change represents some hassle for some people, but represents an improvement for others. Warner From owner-svn-src-all@freebsd.org Thu Oct 24 18:13:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 117FF1765CD; Thu, 24 Oct 2019 18:13:27 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zb2t6lJZz4QZN; Thu, 24 Oct 2019 18:13:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CAE151A28D; Thu, 24 Oct 2019 18:13:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OIDQCm072372; Thu, 24 Oct 2019 18:13:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OIDQrU072371; Thu, 24 Oct 2019 18:13:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910241813.x9OIDQrU072371@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 24 Oct 2019 18:13:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354028 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354028 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 18:13:27 -0000 Author: jhb Date: Thu Oct 24 18:13:26 2019 New Revision: 354028 URL: https://svnweb.freebsd.org/changeset/base/354028 Log: Use a counter with a random base for explicit IVs in GCM. This permits constructing the entire TLS header in ktls_frame() rather than ktls_seq(). This also matches the approach used by OpenSSL which uses an incrementing nonce as the explicit IV rather than the sequence number. Reviewed by: gallatin Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22117 Modified: head/sys/kern/uipc_ktls.c Modified: head/sys/kern/uipc_ktls.c ============================================================================== --- head/sys/kern/uipc_ktls.c Thu Oct 24 15:46:00 2019 (r354027) +++ head/sys/kern/uipc_ktls.c Thu Oct 24 18:13:26 2019 (r354028) @@ -408,7 +408,7 @@ ktls_create_session(struct socket *so, struct tls_enab struct ktls_session *tls; int error; - /* Only TLS 1.0 - 1.2 are supported. */ + /* Only TLS 1.0 - 1.3 are supported. */ if (en->tls_vmajor != TLS_MAJOR_VER_ONE) return (EINVAL); if (en->tls_vminor < TLS_MINOR_VER_ZERO || @@ -576,13 +576,24 @@ ktls_create_session(struct socket *so, struct tls_enab /* * This holds the implicit portion of the nonce for GCM and * the initial implicit IV for TLS 1.0. The explicit portions - * of the IV are generated in ktls_frame() and ktls_seq(). + * of the IV are generated in ktls_frame(). */ if (en->iv_len != 0) { tls->params.iv_len = en->iv_len; error = copyin(en->iv, tls->params.iv, en->iv_len); if (error) goto out; + + /* + * For TLS 1.2, generate an 8-byte nonce as a counter + * to generate unique explicit IVs. + * + * Store this counter in the last 8 bytes of the IV + * array so that it is 8-byte aligned. + */ + if (en->cipher_algorithm == CRYPTO_AES_NIST_GCM_16 && + en->tls_vminor == TLS_MINOR_VER_TWO) + arc4rand(tls->params.iv + 8, sizeof(uint64_t), 0); } *tlsp = tls; @@ -1196,8 +1207,6 @@ void ktls_seq(struct sockbuf *sb, struct mbuf *m) { struct mbuf_ext_pgs *pgs; - struct tls_record_layer *tlshdr; - uint64_t seqno; for (; m != NULL; m = m->m_next) { KASSERT((m->m_flags & M_NOMAP) != 0, @@ -1205,17 +1214,6 @@ ktls_seq(struct sockbuf *sb, struct mbuf *m) pgs = m->m_ext.ext_pgs; pgs->seqno = sb->sb_tls_seqno; - - /* - * Store the sequence number in the TLS header as the - * explicit part of the IV for GCM. - */ - if (pgs->tls->params.cipher_algorithm == - CRYPTO_AES_NIST_GCM_16) { - tlshdr = (void *)pgs->hdr; - seqno = htobe64(pgs->seqno); - memcpy(tlshdr + 1, &seqno, sizeof(seqno)); - } sb->sb_tls_seqno++; } } @@ -1240,6 +1238,7 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls, struct tls_record_layer *tlshdr; struct mbuf *m; struct mbuf_ext_pgs *pgs; + uint64_t *noncep; uint16_t tls_len; int maxlen; @@ -1315,11 +1314,21 @@ ktls_frame(struct mbuf *top, struct ktls_session *tls, tlshdr->tls_length = htons(m->m_len - sizeof(*tlshdr)); /* - * For GCM, the sequence number is stored in the - * header by ktls_seq(). For CBC, a random nonce is - * inserted for TLS 1.1+. + * Store nonces / explicit IVs after the end of the + * TLS header. + * + * For GCM with TLS 1.2, an 8 byte nonce is copied + * from the end of the IV. The nonce is then + * incremented for use by the next record. + * + * For CBC, a random nonce is inserted for TLS 1.1+. */ - if (tls->params.cipher_algorithm == CRYPTO_AES_CBC && + if (tls->params.cipher_algorithm == CRYPTO_AES_NIST_GCM_16 && + tls->params.tls_vminor == TLS_MINOR_VER_TWO) { + noncep = (uint64_t *)(tls->params.iv + 8); + be64enc(tlshdr + 1, *noncep); + (*noncep)++; + } else if (tls->params.cipher_algorithm == CRYPTO_AES_CBC && tls->params.tls_vminor >= TLS_MINOR_VER_ONE) arc4rand(tlshdr + 1, AES_BLOCK_LEN, 0); From owner-svn-src-all@freebsd.org Thu Oct 24 18:39:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 41851176E46; Thu, 24 Oct 2019 18:39:06 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zbcV0zZlz4RqV; Thu, 24 Oct 2019 18:39:06 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 021871A64B; Thu, 24 Oct 2019 18:39:06 +0000 (UTC) (envelope-from gallatin@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OId56a084130; Thu, 24 Oct 2019 18:39:05 GMT (envelope-from gallatin@FreeBSD.org) Received: (from gallatin@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OId5gh084129; Thu, 24 Oct 2019 18:39:05 GMT (envelope-from gallatin@FreeBSD.org) Message-Id: <201910241839.x9OId5gh084129@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gallatin set sender to gallatin@FreeBSD.org using -f From: Andrew Gallatin Date: Thu, 24 Oct 2019 18:39:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354029 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: gallatin X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354029 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 18:39:06 -0000 Author: gallatin Date: Thu Oct 24 18:39:05 2019 New Revision: 354029 URL: https://svnweb.freebsd.org/changeset/base/354029 Log: Add a tunable to set the pgcache zone's maxcache When it is set to 0 (the default), a heavy Netflix-style web workload suffers from heavy lock contention on the vm page free queue called from vm_page_zone_{import,release}() as the buckets are frequently drained. When setting the maxcache, this contention goes away. We should eventually try to autotune this, as well as make this zone eligable for uma_reclaim(). Reviewed by: alc, markj Not Objected to by: jeff Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22112 Modified: head/sys/vm/vm_page.c Modified: head/sys/vm/vm_page.c ============================================================================== --- head/sys/vm/vm_page.c Thu Oct 24 18:13:26 2019 (r354028) +++ head/sys/vm/vm_page.c Thu Oct 24 18:39:05 2019 (r354029) @@ -216,8 +216,10 @@ vm_page_init_cache_zones(void *dummy __unused) { struct vm_domain *vmd; struct vm_pgcache *pgcache; - int domain, pool; + int domain, maxcache, pool; + maxcache = 0; + TUNABLE_INT_FETCH("vm.pgcache_zone_max", &maxcache); for (domain = 0; domain < vm_ndomains; domain++) { vmd = VM_DOMAIN(domain); @@ -237,7 +239,7 @@ vm_page_init_cache_zones(void *dummy __unused) sizeof(struct vm_page), NULL, NULL, NULL, NULL, vm_page_zone_import, vm_page_zone_release, pgcache, UMA_ZONE_MAXBUCKET | UMA_ZONE_VM); - (void)uma_zone_set_maxcache(pgcache->zone, 0); + (void)uma_zone_set_maxcache(pgcache->zone, maxcache); } } } From owner-svn-src-all@freebsd.org Thu Oct 24 19:05:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78D9D1777E4; Thu, 24 Oct 2019 19:05:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zcBx2SG9z4TDS; Thu, 24 Oct 2019 19:05:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3390C1ABA1; Thu, 24 Oct 2019 19:05:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJ5Tc4001446; Thu, 24 Oct 2019 19:05:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJ5T8H001445; Thu, 24 Oct 2019 19:05:29 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910241905.x9OJ5T8H001445@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 24 Oct 2019 19:05:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354030 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 354030 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:05:29 -0000 Author: mav Date: Thu Oct 24 19:05:28 2019 New Revision: 354030 URL: https://svnweb.freebsd.org/changeset/base/354030 Log: MFC r350972 (by jeff): Move scheduler state into the per-cpu area where it can be allocated on the correct NUMA domain. I haven't merged addition of the new field to struct pcpu to not break KBI, so this may be slightly pessimized, comparing to head. Modified: stable/12/sys/kern/sched_ule.c Modified: stable/12/sys/kern/sched_ule.c ============================================================================== --- stable/12/sys/kern/sched_ule.c Thu Oct 24 18:39:05 2019 (r354029) +++ stable/12/sys/kern/sched_ule.c Thu Oct 24 19:05:28 2019 (r354030) @@ -247,6 +247,7 @@ struct tdq { u_char tdq_ipipending; /* IPI pending. */ u_char tdq_idx; /* Current insert index. */ u_char tdq_ridx; /* Current removal index. */ + int tdq_id; /* cpuid. */ struct runq tdq_realtime; /* real-time run queue. */ struct runq tdq_timeshare; /* timeshare run queue. */ struct runq tdq_idle; /* Queue of IDLE threads. */ @@ -280,14 +281,14 @@ static int trysteal_limit = 2; /* * One thread queue per processor. */ -static struct tdq tdq_cpu[MAXCPU]; static struct tdq *balance_tdq; static int balance_ticks; +DPCPU_DEFINE_STATIC(struct tdq, tdq); DPCPU_DEFINE_STATIC(uint32_t, randomval); -#define TDQ_SELF() (&tdq_cpu[PCPU_GET(cpuid)]) -#define TDQ_CPU(x) (&tdq_cpu[(x)]) -#define TDQ_ID(x) ((int)((x) - tdq_cpu)) +#define TDQ_SELF() (DPCPU_PTR(tdq)) +#define TDQ_CPU(x) (DPCPU_ID_PTR((x), tdq)) +#define TDQ_ID(x) ((x)->tdq_id) #else /* !SMP */ static struct tdq tdq_cpu; @@ -311,7 +312,7 @@ static void sched_pctcpu_update(struct td_sched *, int /* Operations on per processor queues */ static struct thread *tdq_choose(struct tdq *); -static void tdq_setup(struct tdq *); +static void tdq_setup(struct tdq *, int i); static void tdq_load_add(struct tdq *, struct thread *); static void tdq_load_rem(struct tdq *, struct thread *); static __inline void tdq_runq_add(struct tdq *, struct thread *, int); @@ -838,6 +839,7 @@ sched_highest(const struct cpu_group *cg, cpuset_t mas static void sched_balance_group(struct cpu_group *cg) { + struct tdq *tdq; cpuset_t hmask, lmask; int high, low, anylow; @@ -853,9 +855,9 @@ sched_balance_group(struct cpu_group *cg) if (CPU_EMPTY(&lmask)) break; anylow = 1; + tdq = TDQ_CPU(high); nextlow: - low = sched_lowest(cg, lmask, -1, - TDQ_CPU(high)->tdq_load - 1, high); + low = sched_lowest(cg, lmask, -1, tdq->tdq_load - 1, high); /* Stop if we looked well and found no less loaded CPU. */ if (anylow && low == -1) break; @@ -863,7 +865,7 @@ nextlow: if (low == -1) continue; /* Transfer thread from high to low. */ - if (sched_balance_pair(TDQ_CPU(high), TDQ_CPU(low))) { + if (sched_balance_pair(tdq, TDQ_CPU(low))) { /* CPU that got thread can no longer be a donor. */ CPU_CLR(low, &hmask); } else { @@ -1271,7 +1273,7 @@ sched_pickcpu(struct thread *td, int flags) curthread->td_intr_nesting_level && ts->ts_cpu != self) { SCHED_STAT_INC(pickcpu_intrbind); ts->ts_cpu = self; - if (TDQ_CPU(self)->tdq_lowpri > pri) { + if (TDQ_SELF()->tdq_lowpri > pri) { SCHED_STAT_INC(pickcpu_affinity); return (ts->ts_cpu); } @@ -1329,9 +1331,10 @@ sched_pickcpu(struct thread *td, int flags) /* * Compare the lowest loaded cpu to current cpu. */ - if (THREAD_CAN_SCHED(td, self) && TDQ_CPU(self)->tdq_lowpri > pri && - TDQ_CPU(cpu)->tdq_lowpri < PRI_MIN_IDLE && - TDQ_CPU(self)->tdq_load <= TDQ_CPU(cpu)->tdq_load + 1) { + tdq = TDQ_CPU(cpu); + if (THREAD_CAN_SCHED(td, self) && TDQ_SELF()->tdq_lowpri > pri && + tdq->tdq_lowpri < PRI_MIN_IDLE && + TDQ_SELF()->tdq_load <= tdq->tdq_load + 1) { SCHED_STAT_INC(pickcpu_local); cpu = self; } else @@ -1376,14 +1379,15 @@ tdq_choose(struct tdq *tdq) * Initialize a thread queue. */ static void -tdq_setup(struct tdq *tdq) +tdq_setup(struct tdq *tdq, int id) { if (bootverbose) - printf("ULE: setup cpu %d\n", TDQ_ID(tdq)); + printf("ULE: setup cpu %d\n", id); runq_init(&tdq->tdq_realtime); runq_init(&tdq->tdq_timeshare); runq_init(&tdq->tdq_idle); + tdq->tdq_id = id; snprintf(tdq->tdq_name, sizeof(tdq->tdq_name), "sched lock %d", (int)TDQ_ID(tdq)); mtx_init(&tdq->tdq_lock, tdq->tdq_name, "sched lock", @@ -1403,8 +1407,8 @@ sched_setup_smp(void) cpu_top = smp_topo(); CPU_FOREACH(i) { - tdq = TDQ_CPU(i); - tdq_setup(tdq); + tdq = DPCPU_ID_PTR(i, tdq); + tdq_setup(tdq, i); tdq->tdq_cg = smp_topo_find(cpu_top, i); if (tdq->tdq_cg == NULL) panic("Can't find cpu group for %d\n", i); @@ -1422,12 +1426,12 @@ sched_setup(void *dummy) { struct tdq *tdq; - tdq = TDQ_SELF(); #ifdef SMP sched_setup_smp(); #else - tdq_setup(tdq); + tdq_setup(TDQ_SELF(), 0); #endif + tdq = TDQ_SELF(); /* Add thread0's load since it's running. */ TDQ_LOCK(tdq); @@ -2015,7 +2019,7 @@ sched_switch(struct thread *td, struct thread *newtd, KASSERT(newtd == NULL, ("sched_switch: Unsupported newtd argument")); cpuid = PCPU_GET(cpuid); - tdq = TDQ_CPU(cpuid); + tdq = TDQ_SELF(); ts = td_get_sched(td); mtx = td->td_lock; sched_pctcpu_update(ts, 1); @@ -2110,7 +2114,7 @@ sched_switch(struct thread *td, struct thread *newtd, * run queue lock. */ cpuid = PCPU_GET(cpuid); - tdq = TDQ_CPU(cpuid); + tdq = TDQ_SELF(); lock_profile_obtain_lock_success( &TDQ_LOCKPTR(tdq)->lock_object, 0, 0, __FILE__, __LINE__); @@ -2850,14 +2854,15 @@ sched_throw(struct thread *td) struct thread *newtd; struct tdq *tdq; - tdq = TDQ_SELF(); if (td == NULL) { /* Correct spinlock nesting and acquire the correct lock. */ + tdq = TDQ_SELF(); TDQ_LOCK(tdq); spinlock_exit(); PCPU_SET(switchtime, cpu_ticks()); PCPU_SET(switchticks, ticks); } else { + tdq = TDQ_SELF(); MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); tdq_load_rem(tdq, td); lock_profile_release_lock(&TDQ_LOCKPTR(tdq)->lock_object); @@ -2885,7 +2890,7 @@ sched_fork_exit(struct thread *td) * non-nested critical section with the scheduler lock held. */ cpuid = PCPU_GET(cpuid); - tdq = TDQ_CPU(cpuid); + tdq = TDQ_SELF(); if (TD_IS_IDLETHREAD(td)) td->td_lock = TDQ_LOCKPTR(tdq); MPASS(td->td_lock == TDQ_LOCKPTR(tdq)); From owner-svn-src-all@freebsd.org Thu Oct 24 19:07:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0EC1717787A; Thu, 24 Oct 2019 19:07:53 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zcFh6jPzz4TMf; Thu, 24 Oct 2019 19:07:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C985A1ABA3; Thu, 24 Oct 2019 19:07:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJ7qG0001612; Thu, 24 Oct 2019 19:07:52 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJ7qPR001611; Thu, 24 Oct 2019 19:07:52 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910241907.x9OJ7qPR001611@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 24 Oct 2019 19:07:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354031 - in stable: 11/sys/amd64/vmm/io 12/sys/amd64/vmm/io X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/amd64/vmm/io 12/sys/amd64/vmm/io X-SVN-Commit-Revision: 354031 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:07:53 -0000 Author: jhb Date: Thu Oct 24 19:07:52 2019 New Revision: 354031 URL: https://svnweb.freebsd.org/changeset/base/354031 Log: MFC 350178: Improve the precision of bhyve's vPIT. Use 'struct bintime' instead of 'sbintime_t' to manage times in vPIT to postpone rounding to final results rather than intermediate results. In tests performed by Joyent, this reduced the error measured by Linux guests by 59 ppm. Modified: stable/11/sys/amd64/vmm/io/vatpit.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/amd64/vmm/io/vatpit.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/amd64/vmm/io/vatpit.c ============================================================================== --- stable/11/sys/amd64/vmm/io/vatpit.c Thu Oct 24 19:05:28 2019 (r354030) +++ stable/11/sys/amd64/vmm/io/vatpit.c Thu Oct 24 19:07:52 2019 (r354031) @@ -2,6 +2,7 @@ * Copyright (c) 2014 Tycho Nightingale * Copyright (c) 2011 NetApp, Inc. * All rights reserved. + * Copyright (c) 2018 Joyent, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -78,7 +79,7 @@ struct vatpit_callout_arg { struct channel { int mode; uint16_t initial; /* initial counter value */ - sbintime_t now_sbt; /* uptime when counter was loaded */ + struct bintime now_bt; /* uptime when counter was loaded */ uint8_t cr[2]; uint8_t ol[2]; bool slatched; /* status latched */ @@ -87,7 +88,7 @@ struct channel { int olbyte; int frbyte; struct callout callout; - sbintime_t callout_sbt; /* target time */ + struct bintime callout_bt; /* target time */ struct vatpit_callout_arg callout_arg; }; @@ -95,26 +96,41 @@ struct vatpit { struct vm *vm; struct mtx mtx; - sbintime_t freq_sbt; + struct bintime freq_bt; struct channel channel[3]; }; static void pit_timer_start_cntr0(struct vatpit *vatpit); +static uint64_t +vatpit_delta_ticks(struct vatpit *vatpit, struct channel *c) +{ + struct bintime delta; + uint64_t result; + + binuptime(&delta); + bintime_sub(&delta, &c->now_bt); + + result = delta.sec * PIT_8254_FREQ; + result += delta.frac / vatpit->freq_bt.frac; + + return (result); +} + static int vatpit_get_out(struct vatpit *vatpit, int channel) { struct channel *c; - sbintime_t delta_ticks; + uint64_t delta_ticks; int out; c = &vatpit->channel[channel]; switch (c->mode) { case TIMER_INTTC: - delta_ticks = (sbinuptime() - c->now_sbt) / vatpit->freq_sbt; - out = ((c->initial - delta_ticks) <= 0); + delta_ticks = vatpit_delta_ticks(vatpit, c); + out = (delta_ticks >= c->initial); break; default: out = 0; @@ -164,24 +180,28 @@ static void pit_timer_start_cntr0(struct vatpit *vatpit) { struct channel *c; - sbintime_t now, delta, precision; + struct bintime now, delta; + sbintime_t precision; c = &vatpit->channel[0]; if (c->initial != 0) { - delta = c->initial * vatpit->freq_sbt; - precision = delta >> tc_precexp; - c->callout_sbt = c->callout_sbt + delta; + delta.sec = 0; + delta.frac = vatpit->freq_bt.frac * c->initial; + bintime_add(&c->callout_bt, &delta); + precision = bttosbt(delta) >> tc_precexp; /* - * Reset 'callout_sbt' if the time that the callout + * Reset 'callout_bt' if the time that the callout * was supposed to fire is more than 'c->initial' * ticks in the past. */ - now = sbinuptime(); - if (c->callout_sbt < now) - c->callout_sbt = now + delta; + binuptime(&now); + if (bintime_cmp(&c->callout_bt, &now, <)) { + c->callout_bt = now; + bintime_add(&c->callout_bt, &delta); + } - callout_reset_sbt(&c->callout, c->callout_sbt, + callout_reset_sbt(&c->callout, bttosbt(c->callout_bt), precision, vatpit_callout_handler, &c->callout_arg, C_ABSOLUTE); } @@ -191,7 +211,7 @@ static uint16_t pit_update_counter(struct vatpit *vatpit, struct channel *c, bool latch) { uint16_t lval; - sbintime_t delta_ticks; + uint64_t delta_ticks; /* cannot latch a new value until the old one has been consumed */ if (latch && c->olbyte != 0) @@ -207,12 +227,11 @@ pit_update_counter(struct vatpit *vatpit, struct chann * here. */ c->initial = TIMER_DIV(PIT_8254_FREQ, 100); - c->now_sbt = sbinuptime(); + binuptime(&c->now_bt); c->status &= ~TIMER_STS_NULLCNT; } - delta_ticks = (sbinuptime() - c->now_sbt) / vatpit->freq_sbt; - + delta_ticks = vatpit_delta_ticks(vatpit, c); lval = c->initial - delta_ticks % c->initial; if (latch) { @@ -383,10 +402,10 @@ vatpit_handler(struct vm *vm, int vcpuid, bool in, int c->frbyte = 0; c->crbyte = 0; c->initial = c->cr[0] | (uint16_t)c->cr[1] << 8; - c->now_sbt = sbinuptime(); + binuptime(&c->now_bt); /* Start an interval timer for channel 0 */ if (port == TIMER_CNTR0) { - c->callout_sbt = c->now_sbt; + c->callout_bt = c->now_bt; pit_timer_start_cntr0(vatpit); } if (c->initial == 0) @@ -423,7 +442,6 @@ struct vatpit * vatpit_init(struct vm *vm) { struct vatpit *vatpit; - struct bintime bt; struct vatpit_callout_arg *arg; int i; @@ -432,8 +450,7 @@ vatpit_init(struct vm *vm) mtx_init(&vatpit->mtx, "vatpit lock", NULL, MTX_SPIN); - FREQ2BT(PIT_8254_FREQ, &bt); - vatpit->freq_sbt = bttosbt(bt); + FREQ2BT(PIT_8254_FREQ, &vatpit->freq_bt); for (i = 0; i < 3; i++) { callout_init(&vatpit->channel[i].callout, 1); From owner-svn-src-all@freebsd.org Thu Oct 24 19:07:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2DA8177876; Thu, 24 Oct 2019 19:07:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zcFh4jNdz4TMd; Thu, 24 Oct 2019 19:07:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 807431ABA2; Thu, 24 Oct 2019 19:07:52 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJ7qox001606; Thu, 24 Oct 2019 19:07:52 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJ7qns001605; Thu, 24 Oct 2019 19:07:52 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910241907.x9OJ7qns001605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 24 Oct 2019 19:07:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354031 - in stable: 11/sys/amd64/vmm/io 12/sys/amd64/vmm/io X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/amd64/vmm/io 12/sys/amd64/vmm/io X-SVN-Commit-Revision: 354031 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:07:52 -0000 Author: jhb Date: Thu Oct 24 19:07:52 2019 New Revision: 354031 URL: https://svnweb.freebsd.org/changeset/base/354031 Log: MFC 350178: Improve the precision of bhyve's vPIT. Use 'struct bintime' instead of 'sbintime_t' to manage times in vPIT to postpone rounding to final results rather than intermediate results. In tests performed by Joyent, this reduced the error measured by Linux guests by 59 ppm. Modified: stable/12/sys/amd64/vmm/io/vatpit.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/amd64/vmm/io/vatpit.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/amd64/vmm/io/vatpit.c ============================================================================== --- stable/12/sys/amd64/vmm/io/vatpit.c Thu Oct 24 19:05:28 2019 (r354030) +++ stable/12/sys/amd64/vmm/io/vatpit.c Thu Oct 24 19:07:52 2019 (r354031) @@ -2,6 +2,7 @@ * Copyright (c) 2014 Tycho Nightingale * Copyright (c) 2011 NetApp, Inc. * All rights reserved. + * Copyright (c) 2018 Joyent, Inc. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -78,7 +79,7 @@ struct vatpit_callout_arg { struct channel { int mode; uint16_t initial; /* initial counter value */ - sbintime_t now_sbt; /* uptime when counter was loaded */ + struct bintime now_bt; /* uptime when counter was loaded */ uint8_t cr[2]; uint8_t ol[2]; bool slatched; /* status latched */ @@ -87,7 +88,7 @@ struct channel { int olbyte; int frbyte; struct callout callout; - sbintime_t callout_sbt; /* target time */ + struct bintime callout_bt; /* target time */ struct vatpit_callout_arg callout_arg; }; @@ -95,26 +96,41 @@ struct vatpit { struct vm *vm; struct mtx mtx; - sbintime_t freq_sbt; + struct bintime freq_bt; struct channel channel[3]; }; static void pit_timer_start_cntr0(struct vatpit *vatpit); +static uint64_t +vatpit_delta_ticks(struct vatpit *vatpit, struct channel *c) +{ + struct bintime delta; + uint64_t result; + + binuptime(&delta); + bintime_sub(&delta, &c->now_bt); + + result = delta.sec * PIT_8254_FREQ; + result += delta.frac / vatpit->freq_bt.frac; + + return (result); +} + static int vatpit_get_out(struct vatpit *vatpit, int channel) { struct channel *c; - sbintime_t delta_ticks; + uint64_t delta_ticks; int out; c = &vatpit->channel[channel]; switch (c->mode) { case TIMER_INTTC: - delta_ticks = (sbinuptime() - c->now_sbt) / vatpit->freq_sbt; - out = ((c->initial - delta_ticks) <= 0); + delta_ticks = vatpit_delta_ticks(vatpit, c); + out = (delta_ticks >= c->initial); break; default: out = 0; @@ -164,24 +180,28 @@ static void pit_timer_start_cntr0(struct vatpit *vatpit) { struct channel *c; - sbintime_t now, delta, precision; + struct bintime now, delta; + sbintime_t precision; c = &vatpit->channel[0]; if (c->initial != 0) { - delta = c->initial * vatpit->freq_sbt; - precision = delta >> tc_precexp; - c->callout_sbt = c->callout_sbt + delta; + delta.sec = 0; + delta.frac = vatpit->freq_bt.frac * c->initial; + bintime_add(&c->callout_bt, &delta); + precision = bttosbt(delta) >> tc_precexp; /* - * Reset 'callout_sbt' if the time that the callout + * Reset 'callout_bt' if the time that the callout * was supposed to fire is more than 'c->initial' * ticks in the past. */ - now = sbinuptime(); - if (c->callout_sbt < now) - c->callout_sbt = now + delta; + binuptime(&now); + if (bintime_cmp(&c->callout_bt, &now, <)) { + c->callout_bt = now; + bintime_add(&c->callout_bt, &delta); + } - callout_reset_sbt(&c->callout, c->callout_sbt, + callout_reset_sbt(&c->callout, bttosbt(c->callout_bt), precision, vatpit_callout_handler, &c->callout_arg, C_ABSOLUTE); } @@ -191,7 +211,7 @@ static uint16_t pit_update_counter(struct vatpit *vatpit, struct channel *c, bool latch) { uint16_t lval; - sbintime_t delta_ticks; + uint64_t delta_ticks; /* cannot latch a new value until the old one has been consumed */ if (latch && c->olbyte != 0) @@ -207,12 +227,11 @@ pit_update_counter(struct vatpit *vatpit, struct chann * here. */ c->initial = TIMER_DIV(PIT_8254_FREQ, 100); - c->now_sbt = sbinuptime(); + binuptime(&c->now_bt); c->status &= ~TIMER_STS_NULLCNT; } - delta_ticks = (sbinuptime() - c->now_sbt) / vatpit->freq_sbt; - + delta_ticks = vatpit_delta_ticks(vatpit, c); lval = c->initial - delta_ticks % c->initial; if (latch) { @@ -383,10 +402,10 @@ vatpit_handler(struct vm *vm, int vcpuid, bool in, int c->frbyte = 0; c->crbyte = 0; c->initial = c->cr[0] | (uint16_t)c->cr[1] << 8; - c->now_sbt = sbinuptime(); + binuptime(&c->now_bt); /* Start an interval timer for channel 0 */ if (port == TIMER_CNTR0) { - c->callout_sbt = c->now_sbt; + c->callout_bt = c->now_bt; pit_timer_start_cntr0(vatpit); } if (c->initial == 0) @@ -423,7 +442,6 @@ struct vatpit * vatpit_init(struct vm *vm) { struct vatpit *vatpit; - struct bintime bt; struct vatpit_callout_arg *arg; int i; @@ -432,8 +450,7 @@ vatpit_init(struct vm *vm) mtx_init(&vatpit->mtx, "vatpit lock", NULL, MTX_SPIN); - FREQ2BT(PIT_8254_FREQ, &bt); - vatpit->freq_sbt = bttosbt(bt); + FREQ2BT(PIT_8254_FREQ, &vatpit->freq_bt); for (i = 0; i < 3; i++) { callout_init(&vatpit->channel[i].callout, 1); From owner-svn-src-all@freebsd.org Thu Oct 24 19:11:01 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B466E1779D5; Thu, 24 Oct 2019 19:11:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zcKK4GlHz4TfR; Thu, 24 Oct 2019 19:11:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76E2C1ABD2; Thu, 24 Oct 2019 19:11:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJB1gN002573; Thu, 24 Oct 2019 19:11:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJB1nv002572; Thu, 24 Oct 2019 19:11:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910241911.x9OJB1nv002572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 24 Oct 2019 19:11:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354032 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 354032 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:11:01 -0000 Author: mav Date: Thu Oct 24 19:11:01 2019 New Revision: 354032 URL: https://svnweb.freebsd.org/changeset/base/354032 Log: MFC r352658, r352677, r352713: Fix/improve interrupt threads scheduling. Doing some tests with very high interrupt rates I've noticed that one of conditions I added in r232207 to make interrupt threads in most cases run on local CPU never worked as expected (worked only if previous time it was executed on some other CPU, that is quite opposite). It caused additional CPU usage to run full CPU search and could schedule interrupt threads to some other CPU. This patch removes that code and instead reuses existing non-interrupt code path with some tweaks for interrupt case: - On SMT systems, if current thread is idle, don't look on other threads. Even if they are busy, it may take more time to do fill search and bounce the interrupt thread to other core then execute it locally, even sharing CPU resources. It is other threads should migrate, not bound interrupts. - Try hard to keep interrupt threads within LLC of their original CPU. This improves scheduling cost and supposedly cache and memory locality. On a test system with 72 threads doing 2.2M IOPS to NVMe this saves few percents of CPU time while adding few percents to IOPS. Modified: stable/12/sys/kern/sched_ule.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sched_ule.c ============================================================================== --- stable/12/sys/kern/sched_ule.c Thu Oct 24 19:07:52 2019 (r354031) +++ stable/12/sys/kern/sched_ule.c Thu Oct 24 19:11:01 2019 (r354032) @@ -1251,7 +1251,7 @@ sched_pickcpu(struct thread *td, int flags) struct td_sched *ts; struct tdq *tdq; cpuset_t mask; - int cpu, pri, self; + int cpu, pri, self, intr; self = PCPU_GET(cpuid); ts = td_get_sched(td); @@ -1268,22 +1268,26 @@ sched_pickcpu(struct thread *td, int flags) * Prefer to run interrupt threads on the processors that generate * the interrupt. */ - pri = td->td_priority; if (td->td_priority <= PRI_MAX_ITHD && THREAD_CAN_SCHED(td, self) && - curthread->td_intr_nesting_level && ts->ts_cpu != self) { - SCHED_STAT_INC(pickcpu_intrbind); - ts->ts_cpu = self; - if (TDQ_SELF()->tdq_lowpri > pri) { - SCHED_STAT_INC(pickcpu_affinity); - return (ts->ts_cpu); + curthread->td_intr_nesting_level) { + tdq = TDQ_SELF(); + if (tdq->tdq_lowpri >= PRI_MIN_IDLE) { + SCHED_STAT_INC(pickcpu_idle_affinity); + return (self); } + ts->ts_cpu = self; + intr = 1; + cg = tdq->tdq_cg; + goto llc; + } else { + intr = 0; + tdq = TDQ_CPU(ts->ts_cpu); + cg = tdq->tdq_cg; } /* * If the thread can run on the last cpu and the affinity has not * expired and it is idle, run it there. */ - tdq = TDQ_CPU(ts->ts_cpu); - cg = tdq->tdq_cg; if (THREAD_CAN_SCHED(td, ts->ts_cpu) && tdq->tdq_lowpri >= PRI_MIN_IDLE && SCHED_AFFINITY(ts, CG_SHARE_L2)) { @@ -1299,34 +1303,58 @@ sched_pickcpu(struct thread *td, int flags) return (ts->ts_cpu); } } +llc: /* * Search for the last level cache CPU group in the tree. - * Skip caches with expired affinity time and SMT groups. - * Affinity to higher level caches will be handled less aggressively. + * Skip SMT, identical groups and caches with expired affinity. + * Interrupt threads affinity is explicit and never expires. */ for (ccg = NULL; cg != NULL; cg = cg->cg_parent) { if (cg->cg_flags & CG_FLAG_THREAD) continue; - if (!SCHED_AFFINITY(ts, cg->cg_level)) + if (cg->cg_children == 1 || cg->cg_count == 1) continue; + if (cg->cg_level == CG_SHARE_NONE || + (!intr && !SCHED_AFFINITY(ts, cg->cg_level))) + continue; ccg = cg; } - if (ccg != NULL) - cg = ccg; + /* Found LLC shared by all CPUs, so do a global search. */ + if (ccg == cpu_top) + ccg = NULL; cpu = -1; - /* Search the group for the less loaded idle CPU we can run now. */ mask = td->td_cpuset->cs_mask; - if (cg != NULL && cg != cpu_top && - CPU_CMP(&cg->cg_mask, &cpu_top->cg_mask) != 0) - cpu = sched_lowest(cg, mask, max(pri, PRI_MAX_TIMESHARE), + pri = td->td_priority; + /* + * Try hard to keep interrupts within found LLC. Search the LLC for + * the least loaded CPU we can run now. For NUMA systems it should + * be within target domain, and it also reduces scheduling overhead. + */ + if (ccg != NULL && intr) { + cpu = sched_lowest(ccg, mask, pri, INT_MAX, ts->ts_cpu); + if (cpu >= 0) + SCHED_STAT_INC(pickcpu_intrbind); + } else + /* Search the LLC for the least loaded idle CPU we can run now. */ + if (ccg != NULL) { + cpu = sched_lowest(ccg, mask, max(pri, PRI_MAX_TIMESHARE), INT_MAX, ts->ts_cpu); - /* Search globally for the less loaded CPU we can run now. */ - if (cpu == -1) + if (cpu >= 0) + SCHED_STAT_INC(pickcpu_affinity); + } + /* Search globally for the least loaded CPU we can run now. */ + if (cpu < 0) { cpu = sched_lowest(cpu_top, mask, pri, INT_MAX, ts->ts_cpu); - /* Search globally for the less loaded CPU. */ - if (cpu == -1) + if (cpu >= 0) + SCHED_STAT_INC(pickcpu_lowest); + } + /* Search globally for the least loaded CPU. */ + if (cpu < 0) { cpu = sched_lowest(cpu_top, mask, -1, INT_MAX, ts->ts_cpu); - KASSERT(cpu != -1, ("sched_pickcpu: Failed to find a cpu.")); + if (cpu >= 0) + SCHED_STAT_INC(pickcpu_lowest); + } + KASSERT(cpu >= 0, ("sched_pickcpu: Failed to find a cpu.")); KASSERT(!CPU_ABSENT(cpu), ("sched_pickcpu: Picked absent CPU %d.", cpu)); /* * Compare the lowest loaded cpu to current cpu. @@ -1337,8 +1365,7 @@ sched_pickcpu(struct thread *td, int flags) TDQ_SELF()->tdq_load <= tdq->tdq_load + 1) { SCHED_STAT_INC(pickcpu_local); cpu = self; - } else - SCHED_STAT_INC(pickcpu_lowest); + } if (cpu != ts->ts_cpu) SCHED_STAT_INC(pickcpu_migration); return (cpu); From owner-svn-src-all@freebsd.org Thu Oct 24 19:12:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 03E8F177A87; Thu, 24 Oct 2019 19:12:02 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zcLT6LMXz4Txq; Thu, 24 Oct 2019 19:12:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB95C1AC2F; Thu, 24 Oct 2019 19:12:01 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJC1TV006656; Thu, 24 Oct 2019 19:12:01 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJC1GX006655; Thu, 24 Oct 2019 19:12:01 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910241912.x9OJC1GX006655@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 24 Oct 2019 19:12:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354033 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 354033 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:12:02 -0000 Author: mav Date: Thu Oct 24 19:12:01 2019 New Revision: 354033 URL: https://svnweb.freebsd.org/changeset/base/354033 Log: MFC r352728: Microoptimize sched_pickcpu() CPU affinity on SMT. Use of CPU_FFS() to implement CPUSET_FOREACH() allows to save up to ~0.5% of CPU time on 72-thread SMT system doing 80K IOPS to NVMe from one thread. Modified: stable/12/sys/kern/sched_ule.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/sched_ule.c ============================================================================== --- stable/12/sys/kern/sched_ule.c Thu Oct 24 19:11:01 2019 (r354032) +++ stable/12/sys/kern/sched_ule.c Thu Oct 24 19:12:01 2019 (r354033) @@ -643,10 +643,6 @@ struct cpu_search { #define CPU_SEARCH_HIGHEST 0x2 #define CPU_SEARCH_BOTH (CPU_SEARCH_LOWEST|CPU_SEARCH_HIGHEST) -#define CPUSET_FOREACH(cpu, mask) \ - for ((cpu) = 0; (cpu) <= mp_maxid; (cpu)++) \ - if (CPU_ISSET(cpu, &mask)) - static __always_inline int cpu_search(const struct cpu_group *cg, struct cpu_search *low, struct cpu_search *high, const int match); int __noinline cpu_search_lowest(const struct cpu_group *cg, @@ -1292,13 +1288,17 @@ sched_pickcpu(struct thread *td, int flags) tdq->tdq_lowpri >= PRI_MIN_IDLE && SCHED_AFFINITY(ts, CG_SHARE_L2)) { if (cg->cg_flags & CG_FLAG_THREAD) { - CPUSET_FOREACH(cpu, cg->cg_mask) { - if (TDQ_CPU(cpu)->tdq_lowpri < PRI_MIN_IDLE) + /* Check all SMT threads for being idle. */ + for (cpu = CPU_FFS(&cg->cg_mask) - 1; ; cpu++) { + if (CPU_ISSET(cpu, &cg->cg_mask) && + TDQ_CPU(cpu)->tdq_lowpri < PRI_MIN_IDLE) break; + if (cpu >= mp_maxid) { + SCHED_STAT_INC(pickcpu_idle_affinity); + return (ts->ts_cpu); + } } - } else - cpu = INT_MAX; - if (cpu > mp_maxid) { + } else { SCHED_STAT_INC(pickcpu_idle_affinity); return (ts->ts_cpu); } From owner-svn-src-all@freebsd.org Thu Oct 24 19:14:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34813177CB6; Thu, 24 Oct 2019 19:14:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zcPV0cWtz4VDF; Thu, 24 Oct 2019 19:14:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E483A1AD72; Thu, 24 Oct 2019 19:14:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJEbUZ007622; Thu, 24 Oct 2019 19:14:37 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJEbcO007621; Thu, 24 Oct 2019 19:14:37 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910241914.x9OJEbcO007621@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 24 Oct 2019 19:14:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354034 - in stable: 11/lib/libutil 12/lib/libutil X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/lib/libutil 12/lib/libutil X-SVN-Commit-Revision: 354034 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:14:38 -0000 Author: jhb Date: Thu Oct 24 19:14:37 2019 New Revision: 354034 URL: https://svnweb.freebsd.org/changeset/base/354034 Log: MFC 350179: expand_number(3) parses suffixes, not prefixes. While here, tidy the opening sentence a bit. Modified: stable/12/lib/libutil/expand_number.3 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/lib/libutil/expand_number.3 Directory Properties: stable/11/ (props changed) Modified: stable/12/lib/libutil/expand_number.3 ============================================================================== --- stable/12/lib/libutil/expand_number.3 Thu Oct 24 19:12:01 2019 (r354033) +++ stable/12/lib/libutil/expand_number.3 Thu Oct 24 19:14:37 2019 (r354034) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 15, 2010 +.Dd July 20, 2019 .Dt EXPAND_NUMBER 3 .Os .Sh NAME @@ -42,11 +42,10 @@ .Sh DESCRIPTION The .Fn expand_number -function unformats the +function parses the .Fa buf -string and stores a unsigned 64-bit quantity at address pointed out by the -.Fa num -argument. +string and stores a unsigned 64-bit quantity at +.Fa *num . .Pp The .Fn expand_number @@ -54,9 +53,9 @@ function is case-insensitive and follows the SI power of two convention. .Pp -The prefixes are: -.Bl -column "Prefix" "Description" "1000000000000000000" -offset indent -.It Sy "Prefix" Ta Sy "Description" Ta Sy "Multiplier" +The suffixes are: +.Bl -column "Suffix" "Description" "1000000000000000000" -offset indent +.It Sy "Suffix" Ta Sy "Description" Ta Sy "Multiplier" .It Li K Ta No kilo Ta 1024 .It Li M Ta No mega Ta 1048576 .It Li G Ta No giga Ta 1073741824 @@ -74,7 +73,7 @@ function will fail if: .It Bq Er EINVAL The given string contains no digits. .It Bq Er EINVAL -An unrecognized prefix was given. +An unrecognized suffix was given. .It Bq Er ERANGE Result doesn't fit into 64 bits. .El From owner-svn-src-all@freebsd.org Thu Oct 24 19:14:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 98AA5177CC0; Thu, 24 Oct 2019 19:14:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zcPV3R9yz4VDH; Thu, 24 Oct 2019 19:14:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 595011AD73; Thu, 24 Oct 2019 19:14:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJEcLo007628; Thu, 24 Oct 2019 19:14:38 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJEcYp007627; Thu, 24 Oct 2019 19:14:38 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910241914.x9OJEcYp007627@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 24 Oct 2019 19:14:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354034 - in stable: 11/lib/libutil 12/lib/libutil X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/lib/libutil 12/lib/libutil X-SVN-Commit-Revision: 354034 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:14:38 -0000 Author: jhb Date: Thu Oct 24 19:14:37 2019 New Revision: 354034 URL: https://svnweb.freebsd.org/changeset/base/354034 Log: MFC 350179: expand_number(3) parses suffixes, not prefixes. While here, tidy the opening sentence a bit. Modified: stable/11/lib/libutil/expand_number.3 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/lib/libutil/expand_number.3 Directory Properties: stable/12/ (props changed) Modified: stable/11/lib/libutil/expand_number.3 ============================================================================== --- stable/11/lib/libutil/expand_number.3 Thu Oct 24 19:12:01 2019 (r354033) +++ stable/11/lib/libutil/expand_number.3 Thu Oct 24 19:14:37 2019 (r354034) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 15, 2010 +.Dd July 20, 2019 .Dt EXPAND_NUMBER 3 .Os .Sh NAME @@ -42,11 +42,10 @@ .Sh DESCRIPTION The .Fn expand_number -function unformats the +function parses the .Fa buf -string and stores a unsigned 64-bit quantity at address pointed out by the -.Fa num -argument. +string and stores a unsigned 64-bit quantity at +.Fa *num . .Pp The .Fn expand_number @@ -54,9 +53,9 @@ function is case-insensitive and follows the SI power of two convention. .Pp -The prefixes are: -.Bl -column "Prefix" "Description" "1000000000000000000" -offset indent -.It Sy "Prefix" Ta Sy "Description" Ta Sy "Multiplier" +The suffixes are: +.Bl -column "Suffix" "Description" "1000000000000000000" -offset indent +.It Sy "Suffix" Ta Sy "Description" Ta Sy "Multiplier" .It Li K Ta No kilo Ta 1024 .It Li M Ta No mega Ta 1048576 .It Li G Ta No giga Ta 1073741824 @@ -74,7 +73,7 @@ function will fail if: .It Bq Er EINVAL The given string contains no digits. .It Bq Er EINVAL -An unrecognized prefix was given. +An unrecognized suffix was given. .It Bq Er ERANGE Result doesn't fit into 64 bits. .El From owner-svn-src-all@freebsd.org Thu Oct 24 19:18:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F335C177E0E; Thu, 24 Oct 2019 19:18:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zcVL6Bhcz4VVG; Thu, 24 Oct 2019 19:18:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B812E1AD75; Thu, 24 Oct 2019 19:18:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJIoMJ007921; Thu, 24 Oct 2019 19:18:50 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJIoOw007920; Thu, 24 Oct 2019 19:18:50 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910241918.x9OJIoOw007920@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 24 Oct 2019 19:18:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354035 - in stable: 11/share/man/man9 12/share/man/man9 X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/share/man/man9 12/share/man/man9 X-SVN-Commit-Revision: 354035 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:18:51 -0000 Author: jhb Date: Thu Oct 24 19:18:49 2019 New Revision: 354035 URL: https://svnweb.freebsd.org/changeset/base/354035 Log: MFC 351224: Trim a spurious blank line I added in r348969. I did not bump .Dd since there is no content change. Modified: stable/11/share/man/man9/sysctl.9 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/share/man/man9/sysctl.9 Directory Properties: stable/12/ (props changed) Modified: stable/11/share/man/man9/sysctl.9 ============================================================================== --- stable/11/share/man/man9/sysctl.9 Thu Oct 24 19:14:37 2019 (r354034) +++ stable/11/share/man/man9/sysctl.9 Thu Oct 24 19:18:49 2019 (r354035) @@ -372,7 +372,6 @@ .Fn SYSCTL_UINT parent number name ctlflags ptr val descr .Fn SYSCTL_ULONG parent number name ctlflags ptr val descr .Fn SYSCTL_UQUAD parent number name ctlflags ptr val descr - .Sh DESCRIPTION The .Nm SYSCTL From owner-svn-src-all@freebsd.org Thu Oct 24 19:18:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3456177E0A; Thu, 24 Oct 2019 19:18:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zcVL4G1nz4VVF; Thu, 24 Oct 2019 19:18:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71A051AD74; Thu, 24 Oct 2019 19:18:50 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJIodB007915; Thu, 24 Oct 2019 19:18:50 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJIodM007914; Thu, 24 Oct 2019 19:18:50 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910241918.x9OJIodM007914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 24 Oct 2019 19:18:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354035 - in stable: 11/share/man/man9 12/share/man/man9 X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/share/man/man9 12/share/man/man9 X-SVN-Commit-Revision: 354035 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:18:50 -0000 Author: jhb Date: Thu Oct 24 19:18:49 2019 New Revision: 354035 URL: https://svnweb.freebsd.org/changeset/base/354035 Log: MFC 351224: Trim a spurious blank line I added in r348969. I did not bump .Dd since there is no content change. Modified: stable/12/share/man/man9/sysctl.9 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/share/man/man9/sysctl.9 Directory Properties: stable/11/ (props changed) Modified: stable/12/share/man/man9/sysctl.9 ============================================================================== --- stable/12/share/man/man9/sysctl.9 Thu Oct 24 19:14:37 2019 (r354034) +++ stable/12/share/man/man9/sysctl.9 Thu Oct 24 19:18:49 2019 (r354035) @@ -388,7 +388,6 @@ .Fn SYSCTL_UINT parent number name ctlflags ptr val descr .Fn SYSCTL_ULONG parent number name ctlflags ptr val descr .Fn SYSCTL_UQUAD parent number name ctlflags ptr val descr - .Sh DESCRIPTION The .Nm SYSCTL From owner-svn-src-all@freebsd.org Thu Oct 24 19:47:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 898A515889C; Thu, 24 Oct 2019 19:47:19 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zd7C346Cz4X5G; Thu, 24 Oct 2019 19:47:19 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 498B41B2B9; Thu, 24 Oct 2019 19:47:19 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJlJ04025606; Thu, 24 Oct 2019 19:47:19 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJlJQp025605; Thu, 24 Oct 2019 19:47:19 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201910241947.x9OJlJQp025605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Thu, 24 Oct 2019 19:47:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354036 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 354036 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:47:19 -0000 Author: mckusick Date: Thu Oct 24 19:47:18 2019 New Revision: 354036 URL: https://svnweb.freebsd.org/changeset/base/354036 Log: Soft updates needs to keep an on-disk linked list of inodes that have been unlinked, but are still referenced by open file descriptors. These inodes cannot be freed until the final file descriptor reference has been closed. If the system crashes while they are still being referenced, these inodes and their referenced blocks need to be freed by fsck. By having them on a linked list with the head pointer in the superblock, fsck can quickly find and process them rather than having to check every inode in the filesystem to see if it is unreferenced. When updating the head pointer of this list of unlinked inodes in the superblock, the superblock check-hash was not getting updated. If the system crashed with the incorrect superblock check-hash, the superblock would appear to be corrupted. This patch ensures that the superblock check-hash is updated when updating the head pointer of the unlinked inodes list. There is no need to MFC as superblock check hashes first appeared in 13.0. Tested by: Peter Holm Sponsored by: Netflix Modified: head/sys/ufs/ffs/ffs_softdep.c Modified: head/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- head/sys/ufs/ffs/ffs_softdep.c Thu Oct 24 19:18:49 2019 (r354035) +++ head/sys/ufs/ffs/ffs_softdep.c Thu Oct 24 19:47:18 2019 (r354036) @@ -9587,6 +9587,11 @@ initiate_write_sbdep(sbdep) } else fs->fs_sujfree = 0; bpfs->fs_sujfree = fs->fs_sujfree; + /* + * Because we have made changes to the superblock, we need to + * recompute its check-hash. + */ + bpfs->fs_ckhash = ffs_calc_sbhash(bpfs); } /* @@ -9665,7 +9670,7 @@ clear_unlinked_inodedep(inodedep) struct ufsmount *ump; struct inodedep *idp; struct inodedep *idn; - struct fs *fs; + struct fs *fs, *bpfs; struct buf *bp; ino_t ino; ino_t nino; @@ -9762,9 +9767,14 @@ clear_unlinked_inodedep(inodedep) */ if (pino == 0) { bcopy((caddr_t)fs, bp->b_data, (u_int)fs->fs_sbsize); - ffs_oldfscompat_write((struct fs *)bp->b_data, ump); - softdep_setup_sbupdate(ump, (struct fs *)bp->b_data, - bp); + bpfs = (struct fs *)bp->b_data; + ffs_oldfscompat_write(bpfs, ump); + softdep_setup_sbupdate(ump, bpfs, bp); + /* + * Because we may have made changes to the superblock, + * we need to recompute its check-hash. + */ + bpfs->fs_ckhash = ffs_calc_sbhash(bpfs); } else if (fs->fs_magic == FS_UFS1_MAGIC) { ((struct ufs1_dinode *)bp->b_data + ino_to_fsbo(fs, pino))->di_freelink = nino; @@ -9789,9 +9799,14 @@ clear_unlinked_inodedep(inodedep) bp = getblk(ump->um_devvp, btodb(fs->fs_sblockloc), (int)fs->fs_sbsize, 0, 0, 0); bcopy((caddr_t)fs, bp->b_data, (u_int)fs->fs_sbsize); - ffs_oldfscompat_write((struct fs *)bp->b_data, ump); - softdep_setup_sbupdate(ump, (struct fs *)bp->b_data, - bp); + bpfs = (struct fs *)bp->b_data; + ffs_oldfscompat_write(bpfs, ump); + softdep_setup_sbupdate(ump, bpfs, bp); + /* + * Because we may have made changes to the superblock, + * we need to recompute its check-hash. + */ + bpfs->fs_ckhash = ffs_calc_sbhash(bpfs); bwrite(bp); ACQUIRE_LOCK(ump); } From owner-svn-src-all@freebsd.org Thu Oct 24 19:47:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 891F315890A; Thu, 24 Oct 2019 19:47:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zd7T37gtz4XCc; Thu, 24 Oct 2019 19:47:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4F2131B2BA; Thu, 24 Oct 2019 19:47:33 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJlXr0025666; Thu, 24 Oct 2019 19:47:33 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJlX8M025665; Thu, 24 Oct 2019 19:47:33 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910241947.x9OJlX8M025665@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 19:47:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354037 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354037 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:47:33 -0000 Author: bz Date: Thu Oct 24 19:47:32 2019 New Revision: 354037 URL: https://svnweb.freebsd.org/changeset/base/354037 Log: frag6.c: do not leak packet queue entry in error case When we are checking for the maximum reassembled packet size of the fragmentable part and run into the error case (packet too big), we are leaking the packet queue enntry if this was a first fragment to arrive. Properly cleanup, removing the queue entry from the bucket, decrementing counters, and freeing the memory. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 19:47:18 2019 (r354036) +++ head/sys/netinet6/frag6.c Thu Oct 24 19:47:32 2019 (r354037) @@ -572,17 +572,35 @@ frag6_input(struct mbuf **mp, int *offp, int proto) if (q6->ip6q_unfrglen >= 0) { /* The 1st fragment has already arrived. */ if (q6->ip6q_unfrglen + fragoff + frgpartlen > IPV6_MAXPACKET) { + if (only_frag) { + TAILQ_REMOVE(head, q6, ip6q_tq); + V_ip6qb[bucket].count--; + atomic_subtract_int(&V_frag6_nfragpackets, 1); +#ifdef MAC + mac_ip6q_destroy(q6); +#endif + free(q6, M_FRAG6); + } + IP6QB_UNLOCK(bucket); icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset - sizeof(struct ip6_frag) + offsetof(struct ip6_frag, ip6f_offlg)); - IP6QB_UNLOCK(bucket); return (IPPROTO_DONE); } } else if (fragoff + frgpartlen > IPV6_MAXPACKET) { + if (only_frag) { + TAILQ_REMOVE(head, q6, ip6q_tq); + V_ip6qb[bucket].count--; + atomic_subtract_int(&V_frag6_nfragpackets, 1); +#ifdef MAC + mac_ip6q_destroy(q6); +#endif + free(q6, M_FRAG6); + } + IP6QB_UNLOCK(bucket); icmp6_error(m, ICMP6_PARAM_PROB, ICMP6_PARAMPROB_HEADER, offset - sizeof(struct ip6_frag) + offsetof(struct ip6_frag, ip6f_offlg)); - IP6QB_UNLOCK(bucket); return (IPPROTO_DONE); } From owner-svn-src-all@freebsd.org Thu Oct 24 19:50:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 808EE1589B9; Thu, 24 Oct 2019 19:50:19 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdBg2t6sz4XMd; Thu, 24 Oct 2019 19:50:19 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41C121B2CA; Thu, 24 Oct 2019 19:50:19 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJoJfD025871; Thu, 24 Oct 2019 19:50:19 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJoIFC025869; Thu, 24 Oct 2019 19:50:18 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201910241950.x9OJoIFC025869@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 24 Oct 2019 19:50:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354038 - head/lib/libsecureboot X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/lib/libsecureboot X-SVN-Commit-Revision: 354038 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:50:19 -0000 Author: sjg Date: Thu Oct 24 19:50:18 2019 New Revision: 354038 URL: https://svnweb.freebsd.org/changeset/base/354038 Log: Initialize verbosity and debug level from env For EFI at least, we can seed the environment with VE_VERBOSE etc. Reviewed by: stevek imp Sponsored by: Juniper Networks MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22135 Modified: head/lib/libsecureboot/verify_file.c head/lib/libsecureboot/vets.c Modified: head/lib/libsecureboot/verify_file.c ============================================================================== --- head/lib/libsecureboot/verify_file.c Thu Oct 24 19:47:32 2019 (r354037) +++ head/lib/libsecureboot/verify_file.c Thu Oct 24 19:50:18 2019 (r354038) @@ -292,6 +292,28 @@ verify_tweak(int fd, off_t off, struct stat *stp, } } +#ifndef VE_DEBUG_LEVEL +# define VE_DEBUG_LEVEL 0 +#endif + +static int +getenv_int(const char *var, int def) +{ + const char *cp; + char *ep; + long val; + + val = def; + cp = getenv(var); + if (cp && *cp) { + val = strtol(cp, &ep, 0); + if ((ep && *ep) || val != (int)val) { + val = def; + } + } + return (int)val; +} + /** * @brief verify an open file * @@ -331,9 +353,8 @@ verify_file(int fd, const char *filename, off_t off, i if (verifying < 0) { verifying = ve_trust_init(); -#ifdef VE_DEBUG_LEVEL - ve_debug_set(VE_DEBUG_LEVEL); -#endif + verbose = getenv_int("VE_VERBOSE", VE_VERBOSE_DEFAULT); + ve_debug_set(getenv_int("VE_DEBUG_LEVEL", VE_DEBUG_LEVEL)); /* initialize ve_status with default result */ rc = verifying ? VE_NOT_CHECKED : VE_NOT_VERIFYING; ve_status_set(0, rc); Modified: head/lib/libsecureboot/vets.c ============================================================================== --- head/lib/libsecureboot/vets.c Thu Oct 24 19:47:32 2019 (r354037) +++ head/lib/libsecureboot/vets.c Thu Oct 24 19:50:18 2019 (r354038) @@ -240,7 +240,7 @@ ve_forbidden_digest_add(hash_data *digest, size_t num) static size_t ve_anchors_add(br_x509_certificate *xcs, size_t num, anchor_list *anchors, - char *anchors_name) + const char *anchors_name) { br_x509_trust_anchor ta; size_t u; From owner-svn-src-all@freebsd.org Thu Oct 24 19:52:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9775F158C10; Thu, 24 Oct 2019 19:52:42 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdFQ3Mwtz4Xl5; Thu, 24 Oct 2019 19:52:42 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 571F61B49D; Thu, 24 Oct 2019 19:52:42 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJqgdn031091; Thu, 24 Oct 2019 19:52:42 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJqgTM031090; Thu, 24 Oct 2019 19:52:42 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201910241952.x9OJqgTM031090@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 24 Oct 2019 19:52:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354039 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 354039 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:52:42 -0000 Author: sjg Date: Thu Oct 24 19:52:41 2019 New Revision: 354039 URL: https://svnweb.freebsd.org/changeset/base/354039 Log: Allow loader.efi to identify non-standard boot setup PATH_BOOTABLE_TOKEN can be set to a non-standard path that identifies a device as bootable. Reviewed by: kevans, bcran Differential Revision: https://reviews.freebsd.org/D22062 Modified: head/stand/efi/loader/main.c Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Thu Oct 24 19:50:18 2019 (r354038) +++ head/stand/efi/loader/main.c Thu Oct 24 19:52:41 2019 (r354039) @@ -863,6 +863,7 @@ main(int argc, CHAR16 *argv[]) archsw.arch_getdev = efi_getdev; archsw.arch_copyin = efi_copyin; archsw.arch_copyout = efi_copyout; + archsw.arch_hypervisor = x86_hypervisor; archsw.arch_readin = efi_readin; archsw.arch_zfs_probe = efi_zfs_probe; From owner-svn-src-all@freebsd.org Thu Oct 24 19:57:19 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 94406158D53; Thu, 24 Oct 2019 19:57:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdLl3Q6xz4Xvn; Thu, 24 Oct 2019 19:57:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5886A1B4A1; Thu, 24 Oct 2019 19:57:19 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OJvJBt031358; Thu, 24 Oct 2019 19:57:19 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OJvJKE031357; Thu, 24 Oct 2019 19:57:19 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910241957.x9OJvJKE031357@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 19:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354040 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354040 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 19:57:19 -0000 Author: bz Date: Thu Oct 24 19:57:18 2019 New Revision: 354040 URL: https://svnweb.freebsd.org/changeset/base/354040 Log: frag6: fix counter leak in error case and optimise code In case the first fragmented part (off=0) arrives we check for the maximum packet size for each fragmented part we already queued with the addition of the unfragmentable part from the first one. For one we do not have to enter the loop at all if this is the first fragmented part to arrive, and we can skip the check. Should we encounter an error case we send an ICMPv6 message for any fragment exceeding the maximum length limit. While dequeueing the original packet and freeing it, statistics were not updated and leaked both the reassembly queue count for the fragment and the global fragment count. Found by code inspection and confirmed by tightening test cases checking more statistical and system counters. While here properly wrap a line. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 19:52:41 2019 (r354039) +++ head/sys/netinet6/frag6.c Thu Oct 24 19:57:18 2019 (r354040) @@ -608,11 +608,11 @@ frag6_input(struct mbuf **mp, int *offp, int proto) * If it is the first fragment, do the above check for each * fragment already stored in the reassembly queue. */ - if (fragoff == 0) { + if (fragoff == 0 && !only_frag) { TAILQ_FOREACH_SAFE(af6, &q6->ip6q_frags, ip6af_tq, af6tmp) { - if (q6->ip6q_unfrglen + af6->ip6af_off + af6->ip6af_frglen > - IPV6_MAXPACKET) { + if (q6->ip6q_unfrglen + af6->ip6af_off + + af6->ip6af_frglen > IPV6_MAXPACKET) { struct ip6_hdr *ip6err; struct mbuf *merr; int erroff; @@ -622,6 +622,8 @@ frag6_input(struct mbuf **mp, int *offp, int proto) /* Dequeue the fragment. */ TAILQ_REMOVE(&q6->ip6q_frags, af6, ip6af_tq); + q6->ip6q_nfrag--; + atomic_subtract_int(&frag6_nfrags, 1); free(af6, M_FRAG6); /* Set a valid receive interface pointer. */ From owner-svn-src-all@freebsd.org Thu Oct 24 20:00:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F3F08158E5F; Thu, 24 Oct 2019 20:00:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdQP69hgz4Y61; Thu, 24 Oct 2019 20:00:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B71DB1B4A9; Thu, 24 Oct 2019 20:00:29 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OK0T75031605; Thu, 24 Oct 2019 20:00:29 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OK0STL031601; Thu, 24 Oct 2019 20:00:28 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910242000.x9OK0STL031601@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 24 Oct 2019 20:00:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354041 - in stable/12/sys: amd64/amd64 dev/acpica vm X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: amd64/amd64 dev/acpica vm X-SVN-Commit-Revision: 354041 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:00:30 -0000 Author: mav Date: Thu Oct 24 20:00:28 2019 New Revision: 354041 URL: https://svnweb.freebsd.org/changeset/base/354041 Log: MFC r351200 (by jeff), 351454,351456,351494-351495 (by kib): Allocate all per-cpu datastructures in domain correct memory. Modified: stable/12/sys/amd64/amd64/mp_machdep.c stable/12/sys/dev/acpica/acpi_pxm.c stable/12/sys/dev/acpica/acpivar.h stable/12/sys/vm/vm_phys.c stable/12/sys/vm/vm_phys.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/mp_machdep.c Thu Oct 24 19:57:18 2019 (r354040) +++ stable/12/sys/amd64/amd64/mp_machdep.c Thu Oct 24 20:00:28 2019 (r354041) @@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #ifdef GPROF #include #endif @@ -59,6 +60,8 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include +#include #include #include @@ -75,6 +78,9 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include + #define WARMBOOT_TARGET 0 #define WARMBOOT_OFF (KERNBASE + 0x0467) #define WARMBOOT_SEG (KERNBASE + 0x0469) @@ -385,6 +391,27 @@ init_secondary(void) * local functions and data */ +#ifdef NUMA +static void +mp_realloc_pcpu(int cpuid, int domain) +{ + vm_page_t m; + vm_offset_t oa, na; + + oa = (vm_offset_t)&__pcpu[cpuid]; + if (_vm_phys_domain(pmap_kextract(oa)) == domain) + return; + m = vm_page_alloc_domain(NULL, 0, domain, + VM_ALLOC_NORMAL | VM_ALLOC_NOOBJ); + if (m == NULL) + return; + na = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); + pagecopy((void *)oa, (void *)na); + pmap_enter(kernel_pmap, oa, m, VM_PROT_READ | VM_PROT_WRITE, 0, 0); + /* XXX old pcpu page leaked. */ +} +#endif + /* * start each AP in our list */ @@ -393,7 +420,7 @@ native_start_all_aps(void) { u_int64_t *pt4, *pt3, *pt2; u_int32_t mpbioswarmvec; - int apic_id, cpu, i; + int apic_id, cpu, domain, i; u_char mpbiosreason; mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); @@ -432,21 +459,39 @@ native_start_all_aps(void) outb(CMOS_REG, BIOS_RESET); outb(CMOS_DATA, BIOS_WARM); /* 'warm-start' */ + /* Relocate pcpu areas to the correct domain. */ +#ifdef NUMA + if (vm_ndomains > 1) + for (cpu = 1; cpu < mp_ncpus; cpu++) { + apic_id = cpu_apic_ids[cpu]; + domain = acpi_pxm_get_cpu_locality(apic_id); + mp_realloc_pcpu(cpu, domain); + } +#endif + /* start each AP */ + domain = 0; for (cpu = 1; cpu < mp_ncpus; cpu++) { apic_id = cpu_apic_ids[cpu]; - +#ifdef NUMA + if (vm_ndomains > 1) + domain = acpi_pxm_get_cpu_locality(apic_id); +#endif /* allocate and set up an idle stack data page */ bootstacks[cpu] = (void *)kmem_malloc(kstack_pages * PAGE_SIZE, M_WAITOK | M_ZERO); doublefault_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); mce_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); - nmi_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); - dbg_stack = (char *)kmem_malloc(PAGE_SIZE, M_WAITOK | M_ZERO); - dpcpu = (void *)kmem_malloc(DPCPU_SIZE, M_WAITOK | M_ZERO); + nmi_stack = (char *)kmem_malloc_domainset( + DOMAINSET_PREF(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + dbg_stack = (char *)kmem_malloc_domainset( + DOMAINSET_PREF(domain), PAGE_SIZE, M_WAITOK | M_ZERO); + dpcpu = (void *)kmem_malloc_domainset(DOMAINSET_PREF(domain), + DPCPU_SIZE, M_WAITOK | M_ZERO); - bootSTK = (char *)bootstacks[cpu] + kstack_pages * PAGE_SIZE - 8; + bootSTK = (char *)bootstacks[cpu] + + kstack_pages * PAGE_SIZE - 8; bootAP = cpu; /* attempt to start the Application Processor */ Modified: stable/12/sys/dev/acpica/acpi_pxm.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_pxm.c Thu Oct 24 19:57:18 2019 (r354040) +++ stable/12/sys/dev/acpica/acpi_pxm.c Thu Oct 24 20:00:28 2019 (r354041) @@ -653,6 +653,17 @@ acpi_pxm_set_cpu_locality(void) } } +int +acpi_pxm_get_cpu_locality(int apic_id) +{ + struct cpu_info *cpu; + + cpu = cpu_find(apic_id); + if (cpu == NULL) + panic("SRAT: CPU with ID %u is not known", apic_id); + return (cpu->domain); +} + /* * Free data structures allocated during acpi_pxm_init. */ Modified: stable/12/sys/dev/acpica/acpivar.h ============================================================================== --- stable/12/sys/dev/acpica/acpivar.h Thu Oct 24 19:57:18 2019 (r354040) +++ stable/12/sys/dev/acpica/acpivar.h Thu Oct 24 20:00:28 2019 (r354041) @@ -528,6 +528,7 @@ int acpi_pxm_init(int ncpus, vm_paddr_t maxphys); void acpi_pxm_parse_tables(void); void acpi_pxm_set_mem_locality(void); void acpi_pxm_set_cpu_locality(void); +int acpi_pxm_get_cpu_locality(int apic_id); void acpi_pxm_free(void); /* Modified: stable/12/sys/vm/vm_phys.c ============================================================================== --- stable/12/sys/vm/vm_phys.c Thu Oct 24 19:57:18 2019 (r354040) +++ stable/12/sys/vm/vm_phys.c Thu Oct 24 20:00:28 2019 (r354041) @@ -624,6 +624,26 @@ vm_phys_register_domains(int ndomains, struct mem_affi #endif } +int +_vm_phys_domain(vm_paddr_t pa) +{ +#ifdef NUMA + int i; + + if (vm_ndomains == 1 || mem_affinity == NULL) + return (0); + + /* + * Check for any memory that overlaps. + */ + for (i = 0; mem_affinity[i].end != 0; i++) + if (mem_affinity[i].start <= pa && + mem_affinity[i].end >= pa) + return (mem_affinity[i].domain); +#endif + return (0); +} + /* * Split a contiguous, power of two-sized set of physical pages. * Modified: stable/12/sys/vm/vm_phys.h ============================================================================== --- stable/12/sys/vm/vm_phys.h Thu Oct 24 19:57:18 2019 (r354040) +++ stable/12/sys/vm/vm_phys.h Thu Oct 24 20:00:28 2019 (r354041) @@ -122,6 +122,7 @@ vm_phys_domain(vm_page_t m) return (0); #endif } +int _vm_phys_domain(vm_paddr_t pa); #endif /* _KERNEL */ #endif /* !_VM_PHYS_H_ */ From owner-svn-src-all@freebsd.org Thu Oct 24 20:00:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 48160158EBA; Thu, 24 Oct 2019 20:00:38 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdQY5Ymxz4YCq; Thu, 24 Oct 2019 20:00:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A37E61B4AE; Thu, 24 Oct 2019 20:00:37 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OK0bmF032218; Thu, 24 Oct 2019 20:00:37 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OK0bQT032169; Thu, 24 Oct 2019 20:00:37 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910242000.x9OK0bQT032169@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 20:00:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354042 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354042 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:00:38 -0000 Author: bz Date: Thu Oct 24 20:00:37 2019 New Revision: 354042 URL: https://svnweb.freebsd.org/changeset/base/354042 Log: frag6: export another counter read-only by sysctl Similar to the system global counter also export the per-VNET counter "frag6_nfragpackets" detailing the current number of fragment packets in this VNET's reassembly queues. The read-only counter is helpful for in-VNET statistical monitoring and for test-cases. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 20:00:28 2019 (r354041) +++ head/sys/netinet6/frag6.c Thu Oct 24 20:00:37 2019 (r354042) @@ -202,6 +202,10 @@ SYSCTL_PROC(_net_inet6_ip6, IPV6CTL_MAXFRAGPACKETS, ma "Default maximum number of outstanding fragmented IPv6 packets. " "A value of 0 means no fragmented packets will be accepted, while a " "a value of -1 means no limit"); +SYSCTL_UINT(_net_inet6_ip6, OID_AUTO, frag6_nfragpackets, + CTLFLAG_VNET | CTLFLAG_RD, + __DEVOLATILE(u_int *, &VNET_NAME(frag6_nfragpackets)), 0, + "Per-VNET number of IPv6 fragments across all reassembly queues."); SYSCTL_INT(_net_inet6_ip6, IPV6CTL_MAXFRAGSPERPACKET, maxfragsperpacket, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(ip6_maxfragsperpacket), 0, "Maximum allowed number of fragments per packet"); From owner-svn-src-all@freebsd.org Thu Oct 24 20:02:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BB12B1591A3; Thu, 24 Oct 2019 20:02:50 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdT64Yz7z4YbR; Thu, 24 Oct 2019 20:02:50 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 800A81B662; Thu, 24 Oct 2019 20:02:50 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OK2oGd037222; Thu, 24 Oct 2019 20:02:50 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OK2mI5037212; Thu, 24 Oct 2019 20:02:48 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201910242002.x9OK2mI5037212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 24 Oct 2019 20:02:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354043 - in head/stand: . ficl ficl/amd64 ficl/i386 ficl/x86 i386/loader libsa libsa/x86 X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: in head/stand: . ficl ficl/amd64 ficl/i386 ficl/x86 i386/loader libsa libsa/x86 X-SVN-Commit-Revision: 354043 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:02:50 -0000 Author: sjg Date: Thu Oct 24 20:02:48 2019 New Revision: 354043 URL: https://svnweb.freebsd.org/changeset/base/354043 Log: Add support for hypervisor check on x86 Add ficl words for isvirtualized and move ficl inb and outb words to ficl/x86/sysdep.c so can be shared by i386 and amd64 Reviewed by: imp bdrewery MFC after: 1 week Sponsored by: Juniper Networks Differential Revision: https://reviews.freebsd.org/D22069 Added: head/stand/ficl/x86/ head/stand/ficl/x86/sysdep.c (contents, props changed) head/stand/libsa/x86/ head/stand/libsa/x86/hypervisor.c (contents, props changed) Modified: head/stand/defs.mk head/stand/ficl/amd64/sysdep.c head/stand/ficl/i386/sysdep.c head/stand/ficl/loader.c head/stand/i386/loader/main.c head/stand/libsa/Makefile head/stand/libsa/stand.h Modified: head/stand/defs.mk ============================================================================== --- head/stand/defs.mk Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/defs.mk Thu Oct 24 20:02:48 2019 (r354043) @@ -189,14 +189,15 @@ teken_state.h: ${SYSDIR}/teken/sequences ${SYSDIR}/teken/sequences > teken_state.h .if !defined(NO_OBJ) -_ILINKS=machine +_ILINKS=include/machine .if ${MACHINE} != ${MACHINE_CPUARCH} && ${MACHINE} != "arm64" -_ILINKS+=${MACHINE_CPUARCH} +_ILINKS+=include/${MACHINE_CPUARCH} .endif .if ${MACHINE_CPUARCH} == "i386" || ${MACHINE_CPUARCH} == "amd64" -_ILINKS+=x86 +_ILINKS+=include/x86 .endif -CLEANFILES+=${_ILINKS} +CFLAGS+= -Iinclude +CLEANDIRS+= include beforedepend: ${_ILINKS} beforebuild: ${_ILINKS} @@ -211,8 +212,8 @@ ${OBJS}: ${_link} .NOPATH: ${_ILINKS} -${_ILINKS}: - @case ${.TARGET} in \ +${_ILINKS}: .NOMETA + @case ${.TARGET:T} in \ machine) \ if [ ${DO32:U0} -eq 0 ]; then \ path=${SYSDIR}/${MACHINE}/include ; \ @@ -222,8 +223,11 @@ ${_ILINKS}: *) \ path=${SYSDIR}/${.TARGET:T}/include ;; \ esac ; \ + case ${.TARGET} in \ + */*) mkdir -p ${.TARGET:H};; \ + esac ; \ path=`(cd $$path && /bin/pwd)` ; \ - ${ECHO} ${.TARGET:T} "->" $$path ; \ - ln -fhs $$path ${.TARGET:T} + ${ECHO} ${.TARGET} "->" $$path ; \ + ln -fhs $$path ${.TARGET} .endif # !NO_OBJ .endif # __BOOT_DEFS_MK__ Modified: head/stand/ficl/amd64/sysdep.c ============================================================================== --- head/stand/ficl/amd64/sysdep.c Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/ficl/amd64/sysdep.c Thu Oct 24 20:02:48 2019 (r354043) @@ -17,6 +17,8 @@ #endif #include "ficl.h" +#include "../x86/sysdep.c" + /* ******************* FreeBSD P O R T B E G I N S H E R E ******************** Michael Smith */ Modified: head/stand/ficl/i386/sysdep.c ============================================================================== --- head/stand/ficl/i386/sysdep.c Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/ficl/i386/sysdep.c Thu Oct 24 20:02:48 2019 (r354043) @@ -14,12 +14,11 @@ #include #else #include -#ifdef __i386__ -#include #endif -#endif #include "ficl.h" +#include "../x86/sysdep.c" + /* ******************* FreeBSD P O R T B E G I N S H E R E ******************** Michael Smith */ @@ -80,53 +79,6 @@ void ficlFree (void *p) free(p); } -#ifndef TESTMAIN -/* - * outb ( port# c -- ) - * Store a byte to I/O port number port# - */ -void -ficlOutb(FICL_VM *pVM) -{ - u_char c; - uint32_t port; - - port=stackPopUNS(pVM->pStack); - c=(u_char)stackPopINT(pVM->pStack); - outb(port,c); -} - -/* - * inb ( port# -- c ) - * Fetch a byte from I/O port number port# - */ -void -ficlInb(FICL_VM *pVM) -{ - u_char c; - uint32_t port; - - port=stackPopUNS(pVM->pStack); - c=inb(port); - stackPushINT(pVM->pStack,c); -} - -/* - * Glue function to add the appropriate forth words to access x86 special cpu - * functionality. - */ -static void ficlCompileCpufunc(FICL_SYSTEM *pSys) -{ - FICL_DICT *dp = pSys->dp; - assert (dp); - - dictAppendWord(dp, "outb", ficlOutb, FW_DEFAULT); - dictAppendWord(dp, "inb", ficlInb, FW_DEFAULT); -} - -FICL_COMPILE_SET(ficlCompileCpufunc); - -#endif /* ** Stub function for dictionary access control - does nothing Modified: head/stand/ficl/loader.c ============================================================================== --- head/stand/ficl/loader.c Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/ficl/loader.c Thu Oct 24 20:02:48 2019 (r354043) @@ -287,6 +287,32 @@ ficlFindfile(FICL_VM *pVM) return; } +#ifndef TESTMAIN + +/* isvirtualized? - Return whether the loader runs under a + * hypervisor. + * + * isvirtualized? ( -- flag ) + */ +static void +ficlIsvirtualizedQ(FICL_VM *pVM) +{ + FICL_INT flag; + const char *hv; + +#if FICL_ROBUST > 1 + vmCheckStack(pVM, 0, 1); +#endif + + hv = (archsw.arch_hypervisor != NULL) + ? (*archsw.arch_hypervisor)() + : NULL; + flag = (hv != NULL) ? FICL_TRUE : FICL_FALSE; + stackPushINT(pVM->pStack, flag); +} + +#endif /* ndef TESTMAIN */ + void ficlCcall(FICL_VM *pVM) { @@ -840,7 +866,10 @@ void ficlCompilePlatform(FICL_SYSTEM *pSys) dictAppendWord(dp, "ccall", ficlCcall, FW_DEFAULT); dictAppendWord(dp, "uuid-from-string", ficlUuidFromString, FW_DEFAULT); dictAppendWord(dp, "uuid-to-string", ficlUuidToString, FW_DEFAULT); - +#ifndef TESTMAIN + dictAppendWord(dp, "isvirtualized?",ficlIsvirtualizedQ, FW_DEFAULT); +#endif + SET_FOREACH(fnpp, Xficl_compile_set) (*fnpp)(pSys); Added: head/stand/ficl/x86/sysdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/ficl/x86/sysdep.c Thu Oct 24 20:02:48 2019 (r354043) @@ -0,0 +1,51 @@ +/* $FreeBSD$ */ + +#ifndef TESTMAIN +#include + +/* + * outb ( port# c -- ) + * Store a byte to I/O port number port# + */ +void +ficlOutb(FICL_VM *pVM) +{ + u_char c; + uint32_t port; + + port=stackPopUNS(pVM->pStack); + c=(u_char)stackPopINT(pVM->pStack); + outb(port,c); +} + +/* + * inb ( port# -- c ) + * Fetch a byte from I/O port number port# + */ +void +ficlInb(FICL_VM *pVM) +{ + u_char c; + uint32_t port; + + port=stackPopUNS(pVM->pStack); + c=inb(port); + stackPushINT(pVM->pStack,c); +} + +/* + * Glue function to add the appropriate forth words to access x86 special cpu + * functionality. + */ +static void ficlCompileCpufunc(FICL_SYSTEM *pSys) +{ + FICL_DICT *dp = pSys->dp; + assert (dp); + + dictAppendWord(dp, "outb", ficlOutb, FW_DEFAULT); + dictAppendWord(dp, "inb", ficlInb, FW_DEFAULT); +} + +FICL_COMPILE_SET(ficlCompileCpufunc); + +#endif Modified: head/stand/i386/loader/main.c ============================================================================== --- head/stand/i386/loader/main.c Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/i386/loader/main.c Thu Oct 24 20:02:48 2019 (r354043) @@ -167,6 +167,7 @@ main(void) archsw.arch_readin = i386_readin; archsw.arch_isainb = isa_inb; archsw.arch_isaoutb = isa_outb; + archsw.arch_hypervisor = x86_hypervisor; #ifdef LOADER_ZFS_SUPPORT archsw.arch_zfs_probe = i386_zfs_probe; Modified: head/stand/libsa/Makefile ============================================================================== --- head/stand/libsa/Makefile Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/libsa/Makefile Thu Oct 24 20:02:48 2019 (r354043) @@ -71,6 +71,11 @@ SRCS+= divmoddi4.c divmodsi4.c divdi3.c divsi3.c m SRCS+= udivmoddi4.c udivmodsi4.c udivdi3.c udivsi3.c umoddi3.c umodsi3.c SRCS+= ashldi3.c ashrdi3.c lshrdi3.c +.if ${MACHINE_CPUARCH:Namd64:Ni386} == "" +.PATH: ${SASRC}/x86 +SRCS+= hypervisor.c +.endif + .if ${MACHINE_CPUARCH} == "powerpc" SRCS+= syncicache.c .endif Modified: head/stand/libsa/stand.h ============================================================================== --- head/stand/libsa/stand.h Thu Oct 24 20:00:37 2019 (r354042) +++ head/stand/libsa/stand.h Thu Oct 24 20:02:48 2019 (r354043) @@ -434,6 +434,8 @@ void *Reallocf(void *, size_t, const char *, int); void Free(void *, const char *, int); extern void mallocstats(void); +const char *x86_hypervisor(void); + #ifdef DEBUG_MALLOC #define malloc(x) Malloc(x, __FILE__, __LINE__) #define memalign(x, y) Memalign(x, y, __FILE__, __LINE__) Added: head/stand/libsa/x86/hypervisor.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/stand/libsa/x86/hypervisor.c Thu Oct 24 20:02:48 2019 (r354043) @@ -0,0 +1,52 @@ +/*- + * Copyright (c) 2013-2019 Juniper Networks, Inc. + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include + +const char * +x86_hypervisor(void) +{ + static union { + struct { + u_int high; + char name[13]; + } hv; + u_int regs[4]; + } u; + + /* Return NULL when no hypervisor is present. */ + do_cpuid(1, u.regs); + if ((u.regs[2] & CPUID2_HV) == 0) + return (NULL); + /* Return the hypervisor's identification. */ + do_cpuid(0x40000000, u.regs); + return (u.hv.name); +} From owner-svn-src-all@freebsd.org Thu Oct 24 20:05:11 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C3F85159241; Thu, 24 Oct 2019 20:05:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdWq4pH0z4Yks; Thu, 24 Oct 2019 20:05:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 841611B66A; Thu, 24 Oct 2019 20:05:11 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OK5B13037386; Thu, 24 Oct 2019 20:05:11 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OK5AFp037383; Thu, 24 Oct 2019 20:05:10 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910242005.x9OK5AFp037383@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Thu, 24 Oct 2019 20:05:10 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354044 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 354044 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:05:11 -0000 Author: tuexen Date: Thu Oct 24 20:05:10 2019 New Revision: 354044 URL: https://svnweb.freebsd.org/changeset/base/354044 Log: Ensure that the flags indicating IPv4/IPv6 are not changed by failing bind() calls. This would lead to inconsistent state resulting in a panic. A fix for stable/11 was committed in https://svnweb.freebsd.org/base?view=revision&revision=338986 An accelerated MFC is planned as discussed with emaste@. Reported by: syzbot+2609a378d89264ff5a42@syzkaller.appspotmail.com Obtained from: jtl@ MFC after: 1 day Sponsored by: Netflix, Inc. Modified: head/sys/netinet/tcp_usrreq.c head/sys/netinet6/sctp6_usrreq.c head/sys/netinet6/udp6_usrreq.c Modified: head/sys/netinet/tcp_usrreq.c ============================================================================== --- head/sys/netinet/tcp_usrreq.c Thu Oct 24 20:02:48 2019 (r354043) +++ head/sys/netinet/tcp_usrreq.c Thu Oct 24 20:05:10 2019 (r354044) @@ -347,6 +347,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct inpcb *inp; struct tcpcb *tp = NULL; struct sockaddr_in6 *sin6; + u_char vflagsav; sin6 = (struct sockaddr_in6 *)nam; if (nam->sa_len != sizeof (*sin6)) @@ -363,6 +364,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { error = EINVAL; goto out; @@ -397,6 +399,8 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, error = in6_pcbbind(inp, nam, td->td_ucred); INP_HASH_WUNLOCK(&V_tcbinfo); out: + if (error != 0) + inp->inp_vflag = vflagsav; TCPDEBUG2(PRU_BIND); TCP_PROBE2(debug__user, tp, PRU_BIND); INP_WUNLOCK(inp); @@ -459,6 +463,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct int error = 0; struct inpcb *inp; struct tcpcb *tp = NULL; + u_char vflagsav; TCPDEBUG0; inp = sotoinpcb(so); @@ -468,6 +473,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct error = EINVAL; goto out; } + vflagsav = inp->inp_vflag; tp = intotcpcb(inp); TCPDEBUG1(); SOCK_LOCK(so); @@ -493,6 +499,9 @@ tcp6_usr_listen(struct socket *so, int backlog, struct if (IS_FASTOPEN(tp->t_flags)) tp->t_tfo_pending = tcp_fastopen_alloc_counter(); + if (error != 0) + inp->inp_vflag = vflagsav; + out: TCPDEBUG2(PRU_LISTEN); TCP_PROBE2(debug__user, tp, PRU_LISTEN); @@ -569,6 +578,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n struct inpcb *inp; struct tcpcb *tp = NULL; struct sockaddr_in6 *sin6; + u_int8_t incflagsav; + u_char vflagsav; TCPDEBUG0; @@ -585,6 +596,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; + incflagsav = inp->inp_inc.inc_flags; if (inp->inp_flags & INP_TIMEWAIT) { error = EADDRINUSE; goto out; @@ -618,11 +631,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n error = EAFNOSUPPORT; goto out; } - inp->inp_vflag |= INP_IPV4; - inp->inp_vflag &= ~INP_IPV6; if ((error = prison_remote_ip4(td->td_ucred, &sin.sin_addr)) != 0) goto out; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; if ((error = tcp_connect(tp, (struct sockaddr *)&sin, td)) != 0) goto out; #ifdef TCP_OFFLOAD @@ -640,11 +653,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n } } #endif + if ((error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr)) != 0) + goto out; inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; inp->inp_inc.inc_flags |= INC_ISIPV6; - if ((error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr)) != 0) - goto out; if ((error = tcp6_connect(tp, nam, td)) != 0) goto out; #ifdef TCP_OFFLOAD @@ -657,6 +670,15 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n error = tp->t_fb->tfb_tcp_output(tp); out: + /* + * If the implicit bind in the connect call fails, restore + * the flags we modified. + */ + if (error != 0 && inp->inp_lport == 0) { + inp->inp_vflag = vflagsav; + inp->inp_inc.inc_flags = incflagsav; + } + TCPDEBUG2(PRU_CONNECT); TCP_PROBE2(debug__user, tp, PRU_CONNECT); INP_WUNLOCK(inp); @@ -912,6 +934,9 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf #ifdef INET6 int isipv6; #endif + u_int8_t incflagsav; + u_char vflagsav; + bool restoreflags; TCPDEBUG0; /* @@ -923,6 +948,9 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_send: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; + incflagsav = inp->inp_inc.inc_flags; + restoreflags = false; if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { if (control) m_freem(control); @@ -1003,6 +1031,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf m_freem(m); goto out; } + restoreflags = true; inp->inp_vflag &= ~INP_IPV6; sinp = &sin; in6_sin6_2_sin(sinp, sin6); @@ -1033,6 +1062,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf error = EAFNOSUPPORT; goto out; } + restoreflags = true; inp->inp_vflag &= ~INP_IPV4; inp->inp_inc.inc_flags |= INC_ISIPV6; if ((error = prison_remote_ip6(td->td_ucred, @@ -1083,6 +1113,14 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf error = tcp_connect(tp, (struct sockaddr *)sinp, td); #endif + /* + * The bind operation in tcp_connect succeeded. We + * no longer want to restore the flags if later + * operations fail. + */ + if (error == 0 || inp->inp_lport != 0) + restoreflags = false; + if (error) goto out; if (IS_FASTOPEN(tp->t_flags)) @@ -1153,6 +1191,14 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf error = tcp_connect(tp, (struct sockaddr *)sinp, td); #endif + /* + * The bind operation in tcp_connect succeeded. We + * no longer want to restore the flags if later + * operations fail. + */ + if (error == 0 || inp->inp_lport != 0) + restoreflags = false; + if (error) goto out; tp->snd_wnd = TTCP_CLIENT_SND_WND; @@ -1171,6 +1217,14 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf TCP_LOG_USERSEND, error, 0, NULL, false); out: + /* + * If the request was unsuccessful and we changed flags, + * restore the original flags. + */ + if (error != 0 && restoreflags) { + inp->inp_vflag = vflagsav; + inp->inp_inc.inc_flags = incflagsav; + } TCPDEBUG2((flags & PRUS_OOB) ? PRU_SENDOOB : ((flags & PRUS_EOF) ? PRU_SEND_EOF : PRU_SEND)); TCP_PROBE2(debug__user, tp, (flags & PRUS_OOB) ? PRU_SENDOOB : Modified: head/sys/netinet6/sctp6_usrreq.c ============================================================================== --- head/sys/netinet6/sctp6_usrreq.c Thu Oct 24 20:02:48 2019 (r354043) +++ head/sys/netinet6/sctp6_usrreq.c Thu Oct 24 20:05:10 2019 (r354044) @@ -558,6 +558,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s { struct sctp_inpcb *inp; int error; + u_char vflagsav; inp = (struct sctp_inpcb *)so->so_pcb; if (inp == NULL) { @@ -588,6 +589,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s return (EINVAL); } } + vflagsav = inp->ip_inp.inp.inp_vflag; inp->ip_inp.inp.inp_vflag &= ~INP_IPV4; inp->ip_inp.inp.inp_vflag |= INP_IPV6; if ((addr != NULL) && (SCTP_IPV6_V6ONLY(inp) == 0)) { @@ -617,7 +619,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s inp->ip_inp.inp.inp_vflag |= INP_IPV4; inp->ip_inp.inp.inp_vflag &= ~INP_IPV6; error = sctp_inpcb_bind(so, (struct sockaddr *)&sin, NULL, p); - return (error); + goto out; } #endif break; @@ -634,7 +636,8 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s if (addr->sa_family == AF_INET) { /* can't bind v4 addr to v6 only socket! */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); - return (EINVAL); + error = EINVAL; + goto out; } #endif sin6_p = (struct sockaddr_in6 *)addr; @@ -643,10 +646,14 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s /* can't bind v4-mapped addrs either! */ /* NOTE: we don't support SIIT */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); - return (EINVAL); + error = EINVAL; + goto out; } } error = sctp_inpcb_bind(so, addr, NULL, p); +out: + if (error != 0) + inp->ip_inp.inp.inp_vflag = vflagsav; return (error); } Modified: head/sys/netinet6/udp6_usrreq.c ============================================================================== --- head/sys/netinet6/udp6_usrreq.c Thu Oct 24 20:02:48 2019 (r354043) +++ head/sys/netinet6/udp6_usrreq.c Thu Oct 24 20:05:10 2019 (r354044) @@ -1143,6 +1143,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str struct inpcb *inp; struct inpcbinfo *pcbinfo; int error; + u_char vflagsav; pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); @@ -1150,6 +1151,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str INP_WLOCK(inp); INP_HASH_WLOCK(pcbinfo); + vflagsav = inp->inp_vflag; inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { @@ -1177,6 +1179,8 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str #ifdef INET out: #endif + if (error != 0) + inp->inp_vflag = vflagsav; INP_HASH_WUNLOCK(pcbinfo); INP_WUNLOCK(inp); return (error); @@ -1223,6 +1227,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct inpcbinfo *pcbinfo; struct sockaddr_in6 *sin6; int error; + u_char vflagsav; pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); @@ -1250,17 +1255,26 @@ udp6_connect(struct socket *so, struct sockaddr *nam, goto out; } in6_sin6_2_sin(&sin, sin6); - inp->inp_vflag |= INP_IPV4; - inp->inp_vflag &= ~INP_IPV6; error = prison_remote_ip4(td->td_ucred, &sin.sin_addr); if (error != 0) goto out; + vflagsav = inp->inp_vflag; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; INP_HASH_WLOCK(pcbinfo); error = in_pcbconnect(inp, (struct sockaddr *)&sin, td->td_ucred); INP_HASH_WUNLOCK(pcbinfo); + /* + * If connect succeeds, mark socket as connected. If + * connect fails and socket is unbound, reset inp_vflag + * field. + */ if (error == 0) soisconnected(so); + else if (inp->inp_laddr.s_addr == INADDR_ANY && + inp->inp_lport == 0) + inp->inp_vflag = vflagsav; goto out; } else { if ((inp->inp_vflag & INP_IPV6) == 0) { @@ -1273,16 +1287,25 @@ udp6_connect(struct socket *so, struct sockaddr *nam, error = EISCONN; goto out; } - inp->inp_vflag &= ~INP_IPV4; - inp->inp_vflag |= INP_IPV6; error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr); if (error != 0) goto out; + vflagsav = inp->inp_vflag; + inp->inp_vflag &= ~INP_IPV4; + inp->inp_vflag |= INP_IPV6; INP_HASH_WLOCK(pcbinfo); error = in6_pcbconnect(inp, nam, td->td_ucred); INP_HASH_WUNLOCK(pcbinfo); + /* + * If connect succeeds, mark socket as connected. If + * connect fails and socket is unbound, reset inp_vflag + * field. + */ if (error == 0) soisconnected(so); + else if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) && + inp->inp_lport == 0) + inp->inp_vflag = vflagsav; out: INP_WUNLOCK(inp); return (error); From owner-svn-src-all@freebsd.org Thu Oct 24 20:08:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5719715932C; Thu, 24 Oct 2019 20:08:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdbq2JRHz4YtV; Thu, 24 Oct 2019 20:08:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DB081B66F; Thu, 24 Oct 2019 20:08:39 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OK8d9p037604; Thu, 24 Oct 2019 20:08:39 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OK8YRY037580; Thu, 24 Oct 2019 20:08:34 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910242008.x9OK8YRY037580@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 20:08:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354045 - head/tests/sys/netinet6/frag6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/tests/sys/netinet6/frag6 X-SVN-Commit-Revision: 354045 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:08:39 -0000 Author: bz Date: Thu Oct 24 20:08:33 2019 New Revision: 354045 URL: https://svnweb.freebsd.org/changeset/base/354045 Log: frag6 test cases: check more counters, wait for expiry When done with tests check that both the per-VNET and the global-fragmented- packets-in-system counters are zero to make sure we do not leak counters or queue entries. This implies that for all test cases we either have to check for the ICMPv6 packet sent in case of TLL=0 expiry (if it is sent) or sleep at least long enough for the TTL to expire for all packets (e.g., fragments where we do not have the off=0 packet). This also means that statistics are now updated to include all the expired packets. There are cases when we do not check for counters to be zero and this is when testing VNET teardown to behave properly and not panic, when we are intentionally leaving fragments in the system. MFC after: 3 weeks Sponsored by: Netflix Modified: head/tests/sys/netinet6/frag6/frag6_01.sh head/tests/sys/netinet6/frag6/frag6_02.sh head/tests/sys/netinet6/frag6/frag6_03.py head/tests/sys/netinet6/frag6/frag6_03.sh head/tests/sys/netinet6/frag6/frag6_04.sh head/tests/sys/netinet6/frag6/frag6_05.py head/tests/sys/netinet6/frag6/frag6_05.sh head/tests/sys/netinet6/frag6/frag6_06.sh head/tests/sys/netinet6/frag6/frag6_07.py head/tests/sys/netinet6/frag6/frag6_07.sh head/tests/sys/netinet6/frag6/frag6_08.py head/tests/sys/netinet6/frag6/frag6_08.sh head/tests/sys/netinet6/frag6/frag6_09.sh head/tests/sys/netinet6/frag6/frag6_10.py head/tests/sys/netinet6/frag6/frag6_10.sh head/tests/sys/netinet6/frag6/frag6_11.sh head/tests/sys/netinet6/frag6/frag6_12.sh head/tests/sys/netinet6/frag6/frag6_13.py head/tests/sys/netinet6/frag6/frag6_13.sh head/tests/sys/netinet6/frag6/frag6_14.py head/tests/sys/netinet6/frag6/frag6_14.sh head/tests/sys/netinet6/frag6/frag6_15.sh head/tests/sys/netinet6/frag6/frag6_16.sh Modified: head/tests/sys/netinet6/frag6/frag6_01.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_01.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_01.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_01_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_02.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_02.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_02.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_02_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_03.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_03.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_03.py Thu Oct 24 20:08:33 2019 (r354045) @@ -82,20 +82,21 @@ def main(): ######################################################################## # - # (1) Atomic fragment. + # Atomic fragment. # # A: Nothing listening on UDP port. # R: ICMPv6 dst unreach, unreach port. # ip6f01 = sp.Ether() / \ sp.IPv6(src=args.src[0], dst=args.to[0]) / \ - sp.IPv6ExtHdrFragment(offset=0, m=0, id=1) / \ + sp.IPv6ExtHdrFragment(offset=0, m=0, id=3) / \ sp.UDP(dport=3456, sport=6543) if args.debug : ip6f01.display() sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) sleep(0.10) + sniffer.setEnd() sniffer.join() if not sniffer.foundCorrectPacket: sys.exit(1) Modified: head/tests/sys/netinet6/frag6/frag6_03.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_03.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_03.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_03_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_04.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_04.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_04.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_04_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_05.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_05.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_05.py Thu Oct 24 20:08:33 2019 (r354045) @@ -76,6 +76,8 @@ def main(): ip6f01.display() sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) + # Wait for possible expiry to happen. + sleep(75) sys.exit(0) if __name__ == '__main__': Modified: head/tests/sys/netinet6/frag6/frag6_05.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_05.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_05.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -47,6 +47,17 @@ frag6_05_check_stats_0() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + # # Check that the sysctl is set to what we expect. # @@ -229,6 +240,16 @@ frag6_05_check_stats_1() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check that the sysctl is set to what we expect. @@ -272,7 +293,7 @@ EOF 0 20 10 - 0 + 10 0 0 0 @@ -300,7 +321,7 @@ EOF # XXX-TODO check output histogram (just too hard to parse [no multi-line-grep]) # cat < ${HOME}/filter-${jname}.txt - 0 + 10 0 0 0 @@ -308,7 +329,7 @@ EOF 0 0 0 - 0 + 10 0 0 0 @@ -372,10 +393,10 @@ EOF 0 0 0 - 0 + 10 0 0 - 0 + 10 0 0 0 Modified: head/tests/sys/netinet6/frag6/frag6_06.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_06.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_06.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -61,6 +61,17 @@ frag6_06_check_stats_0() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + # # Check that the sysctl is set to what we expect. # Modified: head/tests/sys/netinet6/frag6/frag6_07.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_07.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_07.py Thu Oct 24 20:08:33 2019 (r354045) @@ -54,6 +54,25 @@ def check_icmp6_error(args, packet): #icmp6.display() return True +def check_icmp6_error_2(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6TimeExceeded) + if not icmp6: + return False + # ICMP6_TIME_EXCEED_REASSEMBLY 1 + if icmp6.code != 1: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Time Exceeded / Frag reassembly so leave it. + #icmp6.display() + return True + def main(): parser = argparse.ArgumentParser("frag6.py", description="IPv6 fragementation test tool") @@ -78,6 +97,7 @@ def main(): # Start sniffing on recvif sniffer = Sniffer(args, check_icmp6_error) + sniffer2 = Sniffer(args, check_icmp6_error_2) ######################################################################## @@ -88,6 +108,7 @@ def main(): # # A: Reassembly failure. # R: ICMPv6 param prob, param header. + # R: ICMPv6 timeout (1st frag, off=0) # data = "6" * 1280 ip6f01 = \ @@ -142,6 +163,13 @@ def main(): sniffer.setEnd() sniffer.join() if not sniffer.foundCorrectPacket: + sys.exit(1) + + # Wait for expiry from first test run. + sleep(75) + sniffer2.setEnd() + sniffer2.join() + if not sniffer2.foundCorrectPacket: sys.exit(1) sys.exit(0) Modified: head/tests/sys/netinet6/frag6/frag6_07.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_07.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_07.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -47,6 +47,17 @@ frag6_07_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + # # Check selection of global UDP stats. # @@ -81,7 +92,7 @@ EOF 0 3 0 - 0 + 1 0 0 0 @@ -109,7 +120,7 @@ EOF # XXX-TODO check output histogram (just too hard to parse [no multi-line-grep]) # cat < ${HOME}/filter-${jname}.txt - 2 + 3 0 0 0 @@ -117,7 +128,7 @@ EOF 0 0 0 - 0 + 1 2 0 0 @@ -181,10 +192,10 @@ EOF 0 0 0 - 2 + 3 0 0 - 0 + 1 2 0 0 Modified: head/tests/sys/netinet6/frag6/frag6_08.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_08.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_08.py Thu Oct 24 20:08:33 2019 (r354045) @@ -54,6 +54,26 @@ def check_icmp6_error(args, packet): #icmp6.display() return True +def check_icmp6_error_2(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6TimeExceeded) + if not icmp6: + return False + # ICMP6_TIME_EXCEED_REASSEMBLY 1 + if icmp6.code != 1: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Time Exceeded / Frag reassembly so leave it. + #icmp6.display() + return True + + def main(): parser = argparse.ArgumentParser("frag6.py", description="IPv6 fragementation test tool") @@ -78,15 +98,20 @@ def main(): # Start sniffing on recvif sniffer = Sniffer(args, check_icmp6_error) + sniffer2 = Sniffer(args, check_icmp6_error_2) ######################################################################## # # A fragment with payload and offset set to add up to >64k when # another frag with offset=0 arrives and has an unfrag part. + # This is us checking for all fragments queued already when the + # one with off=0 arrives. Note: unless the off=0 has its own problem + # it will be queued and off!=0 ones might be expunged with param prob. # - # A: Reassembly failure (timeout) after - # R: ICMPv6 param prob, param header (earlier). + # A: Reassembly failure, timeout after + # R: ICMPv6 param prob, param header (1st frag) + # R: ICMPv6 time exceeded (2nd frag, as off=0) # data = "6" * 15 ip6f01 = \ @@ -114,6 +139,11 @@ def main(): sniffer.setEnd() sniffer.join() if not sniffer.foundCorrectPacket: + sys.exit(1) + sleep(75) + sniffer2.setEnd() + sniffer2.join() + if not sniffer2.foundCorrectPacket: sys.exit(1) sys.exit(0) Modified: head/tests/sys/netinet6/frag6/frag6_08.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_08.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_08.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -47,6 +47,17 @@ frag6_08_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + # # Check selection of global UDP stats. # @@ -81,7 +92,7 @@ EOF 0 2 0 - 0 + 1 0 0 0 @@ -109,7 +120,7 @@ EOF # XXX-TODO check output histogram (just too hard to parse [no multi-line-grep]) # cat < ${HOME}/filter-${jname}.txt - 1 + 2 0 0 0 @@ -117,7 +128,7 @@ EOF 0 0 0 - 0 + 1 1 0 0 @@ -181,10 +192,10 @@ EOF 0 0 0 - 1 + 2 0 0 - 0 + 1 1 0 0 Modified: head/tests/sys/netinet6/frag6/frag6_09.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_09.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_09.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_09_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_10.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_10.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_10.py Thu Oct 24 20:08:33 2019 (r354045) @@ -72,6 +72,8 @@ def main(): sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) # We do not generate ICMPv6 for non-off=0-segments. + # Wait for expiry. + sleep(75) sys.exit(0) Modified: head/tests/sys/netinet6/frag6/frag6_10.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_10.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_10.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_10_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. @@ -77,8 +87,8 @@ EOF # # Check selection of global IPv6 stats. - # We do not seem to sent a timeout ICMPv6 for this one? - # No, as it is not an off=0 segment. + # We do not sent a timeout ICMPv6 for this one + # as it is not an off=0 segment. # cat < ${HOME}/filter-${jname}.txt 0 @@ -87,7 +97,7 @@ EOF 0 1 0 - 0 + 1 0 0 0 Modified: head/tests/sys/netinet6/frag6/frag6_11.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_11.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_11.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_11_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_12.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_12.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_12.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_12_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. Modified: head/tests/sys/netinet6/frag6/frag6_13.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_13.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_13.py Thu Oct 24 20:08:33 2019 (r354045) @@ -114,6 +114,8 @@ def main(): sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) sp.sendp(ip6f02, iface=args.sendif[0], verbose=False) + # Wait for expiry. + sleep(75) sys.exit(0) if __name__ == '__main__': Modified: head/tests/sys/netinet6/frag6/frag6_13.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_13.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_13.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_13_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. @@ -85,7 +95,7 @@ EOF 0 4 2 - 0 + 2 0 0 0 @@ -112,7 +122,7 @@ EOF # Check selection of global ICMPv6 stats. # cat < ${HOME}/filter-${jname}.txt - 0 + 2 0 0 0 @@ -120,7 +130,7 @@ EOF 0 0 0 - 0 + 2 0 0 0 @@ -184,10 +194,10 @@ EOF 0 0 0 - 0 + 2 0 0 - 0 + 2 0 0 0 Modified: head/tests/sys/netinet6/frag6/frag6_14.py ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_14.py Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_14.py Thu Oct 24 20:08:33 2019 (r354045) @@ -129,6 +129,8 @@ def main(): sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) sp.sendp(ip6f02, iface=args.sendif[0], verbose=False) + # Wait for expiry. + sleep(75) sys.exit(0) if __name__ == '__main__': Modified: head/tests/sys/netinet6/frag6/frag6_14.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_14.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_14.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -52,6 +52,16 @@ frag6_14_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac # # Check selection of global UDP stats. @@ -85,7 +95,7 @@ EOF 0 6 2 - 0 + 4 0 0 0 @@ -112,7 +122,7 @@ EOF # Check selection of global ICMPv6 stats. # cat < ${HOME}/filter-${jname}.txt - 0 + 1 0 0 0 @@ -120,7 +130,7 @@ EOF 0 0 0 - 0 + 1 0 0 0 @@ -184,10 +194,10 @@ EOF 0 0 0 - 0 + 1 0 0 - 0 + 1 0 0 0 Modified: head/tests/sys/netinet6/frag6/frag6_15.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_15.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_15.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -61,6 +61,17 @@ frag6_15_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + # # Check that the sysctl is set to what we expect. # Modified: head/tests/sys/netinet6/frag6/frag6_16.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_16.sh Thu Oct 24 20:05:10 2019 (r354044) +++ head/tests/sys/netinet6/frag6/frag6_16.sh Thu Oct 24 20:08:33 2019 (r354045) @@ -48,6 +48,17 @@ frag6_16_check_stats() { # The Python script has to wait for this already to get the ICMPv6 # hence we do not sleep here anymore. + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + # # Check selection of global UDP stats. # From owner-svn-src-all@freebsd.org Thu Oct 24 20:22:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4330F1598CF; Thu, 24 Oct 2019 20:22:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zdwF0LHVz4Zfm; Thu, 24 Oct 2019 20:22:53 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E36C81BA13; Thu, 24 Oct 2019 20:22:52 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OKMq1e049629; Thu, 24 Oct 2019 20:22:52 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OKMqjA049628; Thu, 24 Oct 2019 20:22:52 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910242022.x9OKMqjA049628@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 20:22:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354046 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354046 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:22:53 -0000 Author: bz Date: Thu Oct 24 20:22:52 2019 New Revision: 354046 URL: https://svnweb.freebsd.org/changeset/base/354046 Log: frag6: handling of overlapping fragments to conform to RFC 8200 While the comment was updated in r350746, the code was not. RFC8200 says that unless fragment overlaps are exact (same fragment twice) not only the current fragment but the entire reassembly queue for this packet must be silently discarded, which we now do if fragment offset and fragment length do not match. Obtained from: jtl MFC after: 3 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D16850 Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 20:08:33 2019 (r354045) +++ head/sys/netinet6/frag6.c Thu Oct 24 20:22:52 2019 (r354046) @@ -712,6 +712,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) if (af6tmp != NULL) { if (af6tmp->ip6af_off + af6tmp->ip6af_frglen - ip6af->ip6af_off > 0) { + if (af6tmp->ip6af_off != ip6af->ip6af_off || + af6tmp->ip6af_frglen != ip6af->ip6af_frglen) + frag6_freef(q6, bucket); free(ip6af, M_FRAG6); goto dropfrag; } @@ -719,6 +722,9 @@ frag6_input(struct mbuf **mp, int *offp, int proto) if (af6 != NULL) { if (ip6af->ip6af_off + ip6af->ip6af_frglen - af6->ip6af_off > 0) { + if (af6->ip6af_off != ip6af->ip6af_off || + af6->ip6af_frglen != ip6af->ip6af_frglen) + frag6_freef(q6, bucket); free(ip6af, M_FRAG6); goto dropfrag; } From owner-svn-src-all@freebsd.org Thu Oct 24 20:40:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B37C6159DA7 for ; Thu, 24 Oct 2019 20:40:32 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: from mail-yb1-xb2f.google.com (mail-yb1-xb2f.google.com [IPv6:2607:f8b0:4864:20::b2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zfJb08rWz4bRV for ; Thu, 24 Oct 2019 20:40:30 +0000 (UTC) (envelope-from oliver.pinter@hardenedbsd.org) Received: by mail-yb1-xb2f.google.com with SMTP id q143so65050ybg.12 for ; Thu, 24 Oct 2019 13:40:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=UYqMM0G4SJFyX38B507pzj56u1MaiZHgKWduO/NSW/E=; b=SVv4DAvKdBQU7/rUAk0/XxTFVgXot4BhAPGEbqikr2O4Obmqb0WwxM6PygyVfnNgZw 0yKplLCh8Rz3giD7zTdgQsbENVGKgvvZIK5p+uiOMP4oIaTUTj21PG/jsrA08I892+na nohfjj+txjbfJYjGN6M14QUlaUfEGRpGizmfEFTe3J8RdLFRBYGu7rvmAOqzo/p7ViGw 7ogBRFK9dnfH6CBJCFuTLRjFylJxJGIk7W7iUeSST/DFBrfteXgkC+z/+j4bmcbsDcxe ZU0qyLXN3aRpRtex572rXyP6NM6a4v0TNi5f/yHLSN7L2b2kEX6xFCbpUt+7iUxRGsOE vIoA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=UYqMM0G4SJFyX38B507pzj56u1MaiZHgKWduO/NSW/E=; b=kJ2WsIEZkjd6c2/NK1cdkOdsNG+R1Qf8Ps35i8zNvbq5W4SWz+L5ZBk8ao2b5m4JTF ZlArBthOlP8iNbmQrx5USNRR4diavqG2H1qOPakDMtQcplCHfi++5oXAdcZKhrezcZof OHIxFYymIOOCtQq1/ise4Bkc61SL8DBE3VSlRBkLYukEk2WbIMS/wD7IubK9SuZOcjEz 4AxGD9sJi36ca2y5dOVi9VUw/RkzmsljQIzJKvVsckbLMrwUBITvLWCUm3koTn6hMxuC oiYTWq0eWPaywuWCnozbpqdVZ82bOQKfBwo5LRasw/liZ2jfRUnftYUjnNMoC+WEbybA B+zw== X-Gm-Message-State: APjAAAUFl83KL53JMLC6TFvXxT9EMzTrmyJCvKklPOJJEqMDZKpvItWg O3+SsYi+jR+vDxQ3X4GkoNSX5D3quxJvoj8cHxdg09u2jPg= X-Google-Smtp-Source: APXvYqyNOOt/QzzSxZU+gEKqVJ3Cd2X9MCEz63LlCSsWtQeA0eclsgPCnJxv76ylLYHDTwnBFQo5e1JzjZPB+vGGEes= X-Received: by 2002:a25:bacb:: with SMTP id a11mr194599ybk.483.1571949629638; Thu, 24 Oct 2019 13:40:29 -0700 (PDT) MIME-Version: 1.0 Received: by 2002:a25:7b47:0:0:0:0:0 with HTTP; Thu, 24 Oct 2019 13:40:29 -0700 (PDT) In-Reply-To: <201910241952.x9OJqgTM031090@repo.freebsd.org> References: <201910241952.x9OJqgTM031090@repo.freebsd.org> From: Oliver Pinter Date: Thu, 24 Oct 2019 22:40:29 +0200 Message-ID: Subject: Re: svn commit: r354039 - head/stand/efi/loader To: "Simon J. Gerraty" Cc: "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" X-Rspamd-Queue-Id: 46zfJb08rWz4bRV X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=hardenedbsd.org header.s=google header.b=SVv4DAvK; dmarc=none; spf=pass (mx1.freebsd.org: domain of oliver.pinter@hardenedbsd.org designates 2607:f8b0:4864:20::b2f as permitted sender) smtp.mailfrom=oliver.pinter@hardenedbsd.org X-Spamd-Result: default: False [-4.24 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; R_DKIM_ALLOW(-0.20)[hardenedbsd.org:s=google]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[hardenedbsd.org]; TO_DN_SOME(0.00)[]; URI_COUNT_ODD(1.00)[9]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[hardenedbsd.org:+]; RCVD_IN_DNSWL_NONE(0.00)[f.2.b.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-2.74)[ip: (-9.20), ipnet: 2607:f8b0::/32(-2.41), asn: 15169(-2.05), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:40:32 -0000 On Thursday, October 24, 2019, Simon J. Gerraty wrote: > Author: sjg > Date: Thu Oct 24 19:52:41 2019 > New Revision: 354039 > URL: https://svnweb.freebsd.org/changeset/base/354039 > > Log: > Allow loader.efi to identify non-standard boot setup > > PATH_BOOTABLE_TOKEN can be set to a non-standard > path that identifies a device as bootable. > > Reviewed by: kevans, bcran > Differential Revision: https://reviews.freebsd.org/D22062 > > Modified: > head/stand/efi/loader/main.c This will be a different patch. The committed code and the code in phabricator differs. > > Modified: head/stand/efi/loader/main.c > ============================================================ > ================== > --- head/stand/efi/loader/main.c Thu Oct 24 19:50:18 2019 > (r354038) > +++ head/stand/efi/loader/main.c Thu Oct 24 19:52:41 2019 > (r354039) > @@ -863,6 +863,7 @@ main(int argc, CHAR16 *argv[]) > archsw.arch_getdev = efi_getdev; > archsw.arch_copyin = efi_copyin; > archsw.arch_copyout = efi_copyout; > + archsw.arch_hypervisor = x86_hypervisor; > archsw.arch_readin = efi_readin; > archsw.arch_zfs_probe = efi_zfs_probe; > > _______________________________________________ > svn-src-head@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-head > To unsubscribe, send any mail to "svn-src-head-unsubscribe@freebsd.org" > From owner-svn-src-all@freebsd.org Thu Oct 24 20:48:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 483E7159FDB; Thu, 24 Oct 2019 20:48:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zfTq1CbCz4brK; Thu, 24 Oct 2019 20:48:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 094481BDA2; Thu, 24 Oct 2019 20:48:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OKmUdi061589; Thu, 24 Oct 2019 20:48:30 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OKmUN8061587; Thu, 24 Oct 2019 20:48:30 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910242048.x9OKmUN8061587@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 24 Oct 2019 20:48:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354047 - in stable: 11/sys/kern 12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/kern 12/sys/kern X-SVN-Commit-Revision: 354047 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:48:31 -0000 Author: jhb Date: Thu Oct 24 20:48:30 2019 New Revision: 354047 URL: https://svnweb.freebsd.org/changeset/base/354047 Log: MFC 350549: Set ISOPEN in namei flags when opening executable interpreters. These vnodes are explicitly opened via VOP_OPEN via exec_check_permissions identical to the main exectuable image. Setting ISOPEN allows filesystems to perform suitable checks in VOP_LOOKUP (e.g. close-to-open consistency in the NFS client). Modified: stable/12/sys/kern/imgact_elf.c stable/12/sys/kern/kern_exec.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/kern/imgact_elf.c stable/11/sys/kern/kern_exec.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/kern/imgact_elf.c ============================================================================== --- stable/12/sys/kern/imgact_elf.c Thu Oct 24 20:22:52 2019 (r354046) +++ stable/12/sys/kern/imgact_elf.c Thu Oct 24 20:48:30 2019 (r354047) @@ -767,8 +767,8 @@ __elfN(load_file)(struct proc *p, const char *file, u_ imgp->proc = p; imgp->attr = attr; - NDINIT(nd, LOOKUP, FOLLOW | LOCKSHARED | LOCKLEAF, UIO_SYSSPACE, file, - curthread); + NDINIT(nd, LOOKUP, ISOPEN | FOLLOW | LOCKSHARED | LOCKLEAF, + UIO_SYSSPACE, file, curthread); if ((error = namei(nd)) != 0) { nd->ni_vp = NULL; goto fail; Modified: stable/12/sys/kern/kern_exec.c ============================================================================== --- stable/12/sys/kern/kern_exec.c Thu Oct 24 20:22:52 2019 (r354046) +++ stable/12/sys/kern/kern_exec.c Thu Oct 24 20:48:30 2019 (r354047) @@ -643,7 +643,7 @@ interpret: free(imgp->freepath, M_TEMP); imgp->freepath = NULL; /* set new name to that of the interpreter */ - NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME, + NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | FOLLOW | SAVENAME, UIO_SYSSPACE, imgp->interpreter_name, td); args->fname = imgp->interpreter_name; goto interpret; From owner-svn-src-all@freebsd.org Thu Oct 24 20:48:31 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCF8A159FE1; Thu, 24 Oct 2019 20:48:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zfTq4cxsz4brL; Thu, 24 Oct 2019 20:48:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8203F1BDA3; Thu, 24 Oct 2019 20:48:31 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OKmVRg061596; Thu, 24 Oct 2019 20:48:31 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OKmV4X061595; Thu, 24 Oct 2019 20:48:31 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910242048.x9OKmV4X061595@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 24 Oct 2019 20:48:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354047 - in stable: 11/sys/kern 12/sys/kern X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/kern 12/sys/kern X-SVN-Commit-Revision: 354047 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 20:48:31 -0000 Author: jhb Date: Thu Oct 24 20:48:30 2019 New Revision: 354047 URL: https://svnweb.freebsd.org/changeset/base/354047 Log: MFC 350549: Set ISOPEN in namei flags when opening executable interpreters. These vnodes are explicitly opened via VOP_OPEN via exec_check_permissions identical to the main exectuable image. Setting ISOPEN allows filesystems to perform suitable checks in VOP_LOOKUP (e.g. close-to-open consistency in the NFS client). Modified: stable/11/sys/kern/imgact_elf.c stable/11/sys/kern/kern_exec.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/kern/imgact_elf.c stable/12/sys/kern/kern_exec.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/kern/imgact_elf.c ============================================================================== --- stable/11/sys/kern/imgact_elf.c Thu Oct 24 20:22:52 2019 (r354046) +++ stable/11/sys/kern/imgact_elf.c Thu Oct 24 20:48:30 2019 (r354047) @@ -687,7 +687,8 @@ __elfN(load_file)(struct proc *p, const char *file, u_ imgp->object = NULL; imgp->execlabel = NULL; - NDINIT(nd, LOOKUP, LOCKLEAF | FOLLOW, UIO_SYSSPACE, file, curthread); + NDINIT(nd, LOOKUP, ISOPEN | LOCKLEAF | FOLLOW, UIO_SYSSPACE, file, + curthread); if ((error = namei(nd)) != 0) { nd->ni_vp = NULL; goto fail; Modified: stable/11/sys/kern/kern_exec.c ============================================================================== --- stable/11/sys/kern/kern_exec.c Thu Oct 24 20:22:52 2019 (r354046) +++ stable/11/sys/kern/kern_exec.c Thu Oct 24 20:48:30 2019 (r354047) @@ -652,7 +652,7 @@ interpret: free(imgp->freepath, M_TEMP); imgp->freepath = NULL; /* set new name to that of the interpreter */ - NDINIT(&nd, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME, + NDINIT(&nd, LOOKUP, ISOPEN | LOCKLEAF | FOLLOW | SAVENAME, UIO_SYSSPACE, imgp->interpreter_name, td); args->fname = imgp->interpreter_name; goto interpret; From owner-svn-src-all@freebsd.org Thu Oct 24 21:02:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AB4715A58C; Thu, 24 Oct 2019 21:02:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zfns1DpBz4ccc; Thu, 24 Oct 2019 21:02:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0DA351C12D; Thu, 24 Oct 2019 21:02:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OL2O48072799; Thu, 24 Oct 2019 21:02:24 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OL2Ovs072798; Thu, 24 Oct 2019 21:02:24 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910242102.x9OL2Ovs072798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 24 Oct 2019 21:02:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354048 - stable/12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/sys/conf X-SVN-Commit-Revision: 354048 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 21:02:25 -0000 Author: jhb Date: Thu Oct 24 21:02:24 2019 New Revision: 354048 URL: https://svnweb.freebsd.org/changeset/base/354048 Log: MFC 351434: Fix universe to include arm LINT kernel configs. Strip comments from the NOTES.armv[57] files as is done for other NOTES files when building the corresponding LINT configs. Without this, the LINT configs contained the NO_UNIVERSE comment from the NOTES.armv[57] files. Modified: stable/12/sys/conf/makeLINT.mk Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/conf/makeLINT.mk ============================================================================== --- stable/12/sys/conf/makeLINT.mk Thu Oct 24 20:48:30 2019 (r354047) +++ stable/12/sys/conf/makeLINT.mk Thu Oct 24 21:02:24 2019 (r354048) @@ -51,8 +51,10 @@ LINT: ${NOTES} ${MAKELINT_SED} echo "nodevice netmap" >> ${.TARGET}-NOIP .endif .if ${TARGET} == "arm" - cat ${.TARGET} ${.CURDIR}/NOTES.armv5 > ${.TARGET}-V5 - cat ${.TARGET} ${.CURDIR}/NOTES.armv7 > ${.TARGET}-V7 + cat ${NOTES} ${.CURDIR}/NOTES.armv5 | sed -E -n -f ${MAKELINT_SED} > \ + ${.TARGET}-V5 + cat ${NOTES} ${.CURDIR}/NOTES.armv7 | sed -E -n -f ${MAKELINT_SED} > \ + ${.TARGET}-V7 rm ${.TARGET} .endif .if ${TARGET} == "mips" From owner-svn-src-all@freebsd.org Thu Oct 24 21:10:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A236E15A703; Thu, 24 Oct 2019 21:10:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zfyp3rBBz4cpB; Thu, 24 Oct 2019 21:10:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 673ED1C139; Thu, 24 Oct 2019 21:10:10 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OLAA2Q073260; Thu, 24 Oct 2019 21:10:10 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OLA91Q073256; Thu, 24 Oct 2019 21:10:09 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910242110.x9OLA91Q073256@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Thu, 24 Oct 2019 21:10:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354049 - in stable/12/sys/amd64: amd64 include X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys/amd64: amd64 include X-SVN-Commit-Revision: 354049 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 21:10:10 -0000 Author: mav Date: Thu Oct 24 21:10:09 2019 New Revision: 354049 URL: https://svnweb.freebsd.org/changeset/base/354049 Log: MFC r351457 (by kib): amd64: rework PCPU allocation Move pcpu KVA out of .bss into dynamically allocated VA at pmap_bootstrap(). This avoids demoting superpage mapping .data/.bss. Also it makes possible to use pmap_qenter() for installation of domain-local pcpu page on NUMA configs. Refactor pcpu and IST initialization by moving it to helper functions. Modified: stable/12/sys/amd64/amd64/machdep.c stable/12/sys/amd64/amd64/mp_machdep.c stable/12/sys/amd64/amd64/pmap.c stable/12/sys/amd64/include/counter.h stable/12/sys/amd64/include/md_var.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/machdep.c Thu Oct 24 21:02:24 2019 (r354048) +++ stable/12/sys/amd64/amd64/machdep.c Thu Oct 24 21:10:09 2019 (r354049) @@ -230,7 +230,8 @@ struct kva_md_info kmi; static struct trapframe proc0_tf; struct region_descriptor r_gdt, r_idt; -struct pcpu __pcpu[MAXCPU]; +struct pcpu *__pcpu; +struct pcpu temp_bsp_pcpu; struct mtx icu_lock; @@ -1559,13 +1560,68 @@ amd64_conf_fast_syscall(void) wrmsr(MSR_SF_MASK, PSL_NT | PSL_T | PSL_I | PSL_C | PSL_D | PSL_AC); } +void +amd64_bsp_pcpu_init1(struct pcpu *pc) +{ + + PCPU_SET(prvspace, pc); + PCPU_SET(curthread, &thread0); + PCPU_SET(tssp, &common_tss[0]); + PCPU_SET(commontssp, &common_tss[0]); + PCPU_SET(tss, (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); + PCPU_SET(ldt, (struct system_segment_descriptor *)&gdt[GUSERLDT_SEL]); + PCPU_SET(fs32p, &gdt[GUFS32_SEL]); + PCPU_SET(gs32p, &gdt[GUGS32_SEL]); +} + +void +amd64_bsp_pcpu_init2(uint64_t rsp0) +{ + + PCPU_SET(rsp0, rsp0); + PCPU_SET(pti_rsp0, ((vm_offset_t)PCPU_PTR(pti_stack) + + PC_PTI_STACK_SZ * sizeof(uint64_t)) & ~0xful); + PCPU_SET(curpcb, thread0.td_pcb); +} + +void +amd64_bsp_ist_init(struct pcpu *pc) +{ + struct nmi_pcpu *np; + + /* doublefault stack space, runs on ist1 */ + common_tss[0].tss_ist1 = (long)&dblfault_stack[sizeof(dblfault_stack)]; + + /* + * NMI stack, runs on ist2. The pcpu pointer is stored just + * above the start of the ist2 stack. + */ + np = ((struct nmi_pcpu *)&nmi0_stack[sizeof(nmi0_stack)]) - 1; + np->np_pcpu = (register_t)pc; + common_tss[0].tss_ist2 = (long)np; + + /* + * MC# stack, runs on ist3. The pcpu pointer is stored just + * above the start of the ist3 stack. + */ + np = ((struct nmi_pcpu *)&mce0_stack[sizeof(mce0_stack)]) - 1; + np->np_pcpu = (register_t)pc; + common_tss[0].tss_ist3 = (long)np; + + /* + * DB# stack, runs on ist4. + */ + np = ((struct nmi_pcpu *)&dbg0_stack[sizeof(dbg0_stack)]) - 1; + np->np_pcpu = (register_t)pc; + common_tss[0].tss_ist4 = (long)np; +} + u_int64_t hammer_time(u_int64_t modulep, u_int64_t physfree) { caddr_t kmdp; int gsel_tss, x; struct pcpu *pc; - struct nmi_pcpu *np; struct xstate_hdr *xhdr; u_int64_t rsp0; char *env; @@ -1639,7 +1695,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) r_gdt.rd_limit = NGDT * sizeof(gdt[0]) - 1; r_gdt.rd_base = (long) gdt; lgdt(&r_gdt); - pc = &__pcpu[0]; + pc = &temp_bsp_pcpu; wrmsr(MSR_FSBASE, 0); /* User value */ wrmsr(MSR_GSBASE, (u_int64_t)pc); @@ -1648,15 +1704,8 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) pcpu_init(pc, 0, sizeof(struct pcpu)); dpcpu_init((void *)(physfree + KERNBASE), 0); physfree += DPCPU_SIZE; - PCPU_SET(prvspace, pc); - PCPU_SET(curthread, &thread0); + amd64_bsp_pcpu_init1(pc); /* Non-late cninit() and printf() can be moved up to here. */ - PCPU_SET(tssp, &common_tss[0]); - PCPU_SET(commontssp, &common_tss[0]); - PCPU_SET(tss, (struct system_segment_descriptor *)&gdt[GPROC0_SEL]); - PCPU_SET(ldt, (struct system_segment_descriptor *)&gdt[GUSERLDT_SEL]); - PCPU_SET(fs32p, &gdt[GUFS32_SEL]); - PCPU_SET(gs32p, &gdt[GUGS32_SEL]); /* * Initialize mutexes. @@ -1745,31 +1794,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) finishidentcpu(); /* Final stage of CPU initialization */ initializecpu(); /* Initialize CPU registers */ - /* doublefault stack space, runs on ist1 */ - common_tss[0].tss_ist1 = (long)&dblfault_stack[sizeof(dblfault_stack)]; - - /* - * NMI stack, runs on ist2. The pcpu pointer is stored just - * above the start of the ist2 stack. - */ - np = ((struct nmi_pcpu *) &nmi0_stack[sizeof(nmi0_stack)]) - 1; - np->np_pcpu = (register_t) pc; - common_tss[0].tss_ist2 = (long) np; - - /* - * MC# stack, runs on ist3. The pcpu pointer is stored just - * above the start of the ist3 stack. - */ - np = ((struct nmi_pcpu *) &mce0_stack[sizeof(mce0_stack)]) - 1; - np->np_pcpu = (register_t) pc; - common_tss[0].tss_ist3 = (long) np; - - /* - * DB# stack, runs on ist4. - */ - np = ((struct nmi_pcpu *) &dbg0_stack[sizeof(dbg0_stack)]) - 1; - np->np_pcpu = (register_t) pc; - common_tss[0].tss_ist4 = (long) np; + amd64_bsp_ist_init(pc); /* Set the IO permission bitmap (empty due to tss seg limit) */ common_tss[0].tss_iobase = sizeof(struct amd64tss) + IOPERM_BITMAP_SIZE; @@ -1858,10 +1883,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) /* Ensure the stack is aligned to 16 bytes */ rsp0 &= ~0xFul; common_tss[0].tss_rsp0 = rsp0; - PCPU_SET(rsp0, rsp0); - PCPU_SET(pti_rsp0, ((vm_offset_t)PCPU_PTR(pti_stack) + - PC_PTI_STACK_SZ * sizeof(uint64_t)) & ~0xful); - PCPU_SET(curpcb, thread0.td_pcb); + amd64_bsp_pcpu_init2(rsp0); /* transfer to user mode */ Modified: stable/12/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/mp_machdep.c Thu Oct 24 21:02:24 2019 (r354048) +++ stable/12/sys/amd64/amd64/mp_machdep.c Thu Oct 24 21:10:09 2019 (r354049) @@ -94,7 +94,7 @@ __FBSDID("$FreeBSD$"); #define AP_BOOTPT_SZ (PAGE_SIZE * 3) -extern struct pcpu __pcpu[]; +extern struct pcpu *__pcpu; /* Temporary variables for init_secondary() */ char *doublefault_stack; @@ -407,7 +407,7 @@ mp_realloc_pcpu(int cpuid, int domain) return; na = PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); pagecopy((void *)oa, (void *)na); - pmap_enter(kernel_pmap, oa, m, VM_PROT_READ | VM_PROT_WRITE, 0, 0); + pmap_qenter((vm_offset_t)&__pcpu[cpuid], &m, 1); /* XXX old pcpu page leaked. */ } #endif Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Thu Oct 24 21:02:24 2019 (r354048) +++ stable/12/sys/amd64/amd64/pmap.c Thu Oct 24 21:10:09 2019 (r354049) @@ -446,6 +446,10 @@ static pml4_entry_t *pti_pml4; static vm_pindex_t pti_pg_idx; static bool pti_finalized; +extern struct pcpu *__pcpu; +extern struct pcpu temp_bsp_pcpu; +extern pt_entry_t *pcpu_pte; + struct pmap_pkru_range { struct rs_el pkru_rs_el; u_int pkru_keyidx; @@ -1595,8 +1599,8 @@ void pmap_bootstrap(vm_paddr_t *firstaddr) { vm_offset_t va; - pt_entry_t *pte; - uint64_t cr4; + pt_entry_t *pte, *pcpu_pte; + uint64_t cr4, pcpu_phys; u_long res; int i; @@ -1611,6 +1615,8 @@ pmap_bootstrap(vm_paddr_t *firstaddr) */ create_pagetables(firstaddr); + pcpu_phys = allocpages(firstaddr, MAXCPU); + /* * Add a physical memory segment (vm_phys_seg) corresponding to the * preallocated kernel page table pages so that vm_page structures @@ -1678,7 +1684,20 @@ pmap_bootstrap(vm_paddr_t *firstaddr) SYSMAP(caddr_t, CMAP1, crashdumpmap, MAXDUMPPGS) CADDR1 = crashdumpmap; + SYSMAP(struct pcpu *, pcpu_pte, __pcpu, MAXCPU); virtual_avail = va; + + for (i = 0; i < MAXCPU; i++) { + pcpu_pte[i] = (pcpu_phys + ptoa(i)) | X86_PG_V | X86_PG_RW | + pg_g | pg_nx | X86_PG_M | X86_PG_A; + } + STAILQ_INIT(&cpuhead); + wrmsr(MSR_GSBASE, (uint64_t)&__pcpu[0]); + pcpu_init(&__pcpu[0], 0, sizeof(struct pcpu)); + amd64_bsp_pcpu_init1(&__pcpu[0]); + amd64_bsp_ist_init(&__pcpu[0]); + __pcpu[0].pc_dynamic = temp_bsp_pcpu.pc_dynamic; + __pcpu[0].pc_acpi_id = temp_bsp_pcpu.pc_acpi_id; /* * Initialize the PAT MSR. Modified: stable/12/sys/amd64/include/counter.h ============================================================================== --- stable/12/sys/amd64/include/counter.h Thu Oct 24 21:02:24 2019 (r354048) +++ stable/12/sys/amd64/include/counter.h Thu Oct 24 21:10:09 2019 (r354049) @@ -33,9 +33,10 @@ #include -extern struct pcpu __pcpu[]; +extern struct pcpu *__pcpu; +extern struct pcpu temp_bsp_pcpu; -#define EARLY_COUNTER &__pcpu[0].pc_early_dummy_counter +#define EARLY_COUNTER &temp_bsp_pcpu.pc_early_dummy_counter #define counter_enter() do {} while (0) #define counter_exit() do {} while (0) Modified: stable/12/sys/amd64/include/md_var.h ============================================================================== --- stable/12/sys/amd64/include/md_var.h Thu Oct 24 21:02:24 2019 (r354048) +++ stable/12/sys/amd64/include/md_var.h Thu Oct 24 21:10:09 2019 (r354049) @@ -58,6 +58,9 @@ struct sysentvec; void amd64_conf_fast_syscall(void); void amd64_db_resume_dbreg(void); void amd64_lower_shared_page(struct sysentvec *); +void amd64_bsp_pcpu_init1(struct pcpu *pc); +void amd64_bsp_pcpu_init2(uint64_t rsp0); +void amd64_bsp_ist_init(struct pcpu *pc); void amd64_syscall(struct thread *td, int traced); void amd64_syscall_ret_flush_l1d(int error); void amd64_syscall_ret_flush_l1d_recalc(void); From owner-svn-src-all@freebsd.org Thu Oct 24 21:28:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B730E15AC32; Thu, 24 Oct 2019 21:28:37 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zgN54QHWz4dbh; Thu, 24 Oct 2019 21:28:37 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 774851C4B1; Thu, 24 Oct 2019 21:28:37 +0000 (UTC) (envelope-from mckusick@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OLSbOG085175; Thu, 24 Oct 2019 21:28:37 GMT (envelope-from mckusick@FreeBSD.org) Received: (from mckusick@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OLSbqS085174; Thu, 24 Oct 2019 21:28:37 GMT (envelope-from mckusick@FreeBSD.org) Message-Id: <201910242128.x9OLSbqS085174@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mckusick set sender to mckusick@FreeBSD.org using -f From: Kirk McKusick Date: Thu, 24 Oct 2019 21:28:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354050 - head/sys/ufs/ufs X-SVN-Group: head X-SVN-Commit-Author: mckusick X-SVN-Commit-Paths: head/sys/ufs/ufs X-SVN-Commit-Revision: 354050 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 21:28:37 -0000 Author: mckusick Date: Thu Oct 24 21:28:37 2019 New Revision: 354050 URL: https://svnweb.freebsd.org/changeset/base/354050 Log: After the unlink() of one name of a file with multiple links, a stat() of one of the remaining names of the file does not show an updated ctime (inode modification time) until several seconds after the unlink() completes. The problem only occurs when the filesystem is running with soft updates enabled. When running with soft updates, the ctime is not updated until the soft updates background process has settled all the needed I/O operations. This commit causes the ctime to be updated immediately during the unlink(). A side effect of this change is that the ctime is updated again when soft updates has finished its processing because that is the time that is correct from the perspective of programs that look at the disk (like dump). This change does not cause any extra I/O to be done, it just ensures that stat() updates the ctime before handing it back. PR: 241373 Reported by: Alan Somers Tested by: Alan Somers MFC after: 3 days Sponsored by: Netflix Modified: head/sys/ufs/ufs/ufs_lookup.c Modified: head/sys/ufs/ufs/ufs_lookup.c ============================================================================== --- head/sys/ufs/ufs/ufs_lookup.c Thu Oct 24 21:10:09 2019 (r354049) +++ head/sys/ufs/ufs/ufs_lookup.c Thu Oct 24 21:28:37 2019 (r354050) @@ -1178,6 +1178,7 @@ ufs_dirremove(dvp, ip, flags, isrmdir) */ if (ip) { ip->i_effnlink--; + ip->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(dvp)) { softdep_setup_unlink(dp, ip); } else { @@ -1291,6 +1292,7 @@ ufs_dirrewrite(dp, oip, newinum, newtype, isrmdir) * necessary. */ oip->i_effnlink--; + oip->i_flag |= IN_CHANGE; if (DOINGSOFTDEP(vdp)) { softdep_setup_unlink(dp, oip); } else { From owner-svn-src-all@freebsd.org Thu Oct 24 21:43:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FB7215B1B0; Thu, 24 Oct 2019 21:43:02 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zghk3hDVz4fMt; Thu, 24 Oct 2019 21:43:02 +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 628DF1C83B; Thu, 24 Oct 2019 21:43:02 +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 x9OLh26R096434; Thu, 24 Oct 2019 21:43:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OLh2qS096432; Thu, 24 Oct 2019 21:43:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910242143.x9OLh2qS096432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 21:43:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354051 - in stable: 11/release/picobsd/build 11/share/man/man8 12/release/picobsd/build 12/share/man/man8 X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/release/picobsd/build 11/share/man/man8 12/release/picobsd/build 12/share/man/man8 X-SVN-Commit-Revision: 354051 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 21:43:02 -0000 Author: kevans Date: Thu Oct 24 21:43:01 2019 New Revision: 354051 URL: https://svnweb.freebsd.org/changeset/base/354051 Log: MFC r353788: picobsd: add deprecation notices Notices appear both in picobsd(8) (near the top for easy notice) and are also printed to stderr on every invocation of picobsd for visibility. The tentative date for removal is October 31st, as no volunteers have stepped forward at all from postings to -arch@ at least. picobsd: add deprecation notices Modified: stable/11/release/picobsd/build/picobsd stable/11/share/man/man8/picobsd.8 Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/release/picobsd/build/picobsd stable/12/share/man/man8/picobsd.8 Directory Properties: stable/12/ (props changed) Modified: stable/11/release/picobsd/build/picobsd ============================================================================== --- stable/11/release/picobsd/build/picobsd Thu Oct 24 21:28:37 2019 (r354050) +++ stable/11/release/picobsd/build/picobsd Thu Oct 24 21:43:01 2019 (r354051) @@ -997,6 +997,7 @@ set_build_parameters() { # Main entry of the script. Initialize variables, parse command line # arguments. +1>&2 echo "WARNING: picobsd is deprecated and will be removed in FreeBSD 13.0." set_defaults while [ true ]; do Modified: stable/11/share/man/man8/picobsd.8 ============================================================================== --- stable/11/share/man/man8/picobsd.8 Thu Oct 24 21:28:37 2019 (r354050) +++ stable/11/share/man/man8/picobsd.8 Thu Oct 24 21:43:01 2019 (r354051) @@ -1,6 +1,6 @@ .\" -*- nroff-fill -*- .\" $FreeBSD$ -.Dd October 1, 2013 +.Dd October 20, 2019 .Dt PICOBSD 8 .Os .Sh NAME @@ -11,6 +11,10 @@ .Op Ar options .Op Ar config-name Op Ar site-name .Sh DESCRIPTION +.Nm +is deprecated and will be removed in +.Fx 13.0 . +.Pp The .Nm utility is a script which produces a minimal implementation of From owner-svn-src-all@freebsd.org Thu Oct 24 21:43:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 317DF15B1BD; Thu, 24 Oct 2019 21:43:03 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zghl0ZY1z4fMv; Thu, 24 Oct 2019 21:43:03 +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 E821D1C83C; Thu, 24 Oct 2019 21:43:02 +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 x9OLh2VI096441; Thu, 24 Oct 2019 21:43:02 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OLh205096439; Thu, 24 Oct 2019 21:43:02 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910242143.x9OLh205096439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Thu, 24 Oct 2019 21:43:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354051 - in stable: 11/release/picobsd/build 11/share/man/man8 12/release/picobsd/build 12/share/man/man8 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/release/picobsd/build 11/share/man/man8 12/release/picobsd/build 12/share/man/man8 X-SVN-Commit-Revision: 354051 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 21:43:03 -0000 Author: kevans Date: Thu Oct 24 21:43:01 2019 New Revision: 354051 URL: https://svnweb.freebsd.org/changeset/base/354051 Log: MFC r353788: picobsd: add deprecation notices Notices appear both in picobsd(8) (near the top for easy notice) and are also printed to stderr on every invocation of picobsd for visibility. The tentative date for removal is October 31st, as no volunteers have stepped forward at all from postings to -arch@ at least. picobsd: add deprecation notices Modified: stable/12/release/picobsd/build/picobsd stable/12/share/man/man8/picobsd.8 Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/release/picobsd/build/picobsd stable/11/share/man/man8/picobsd.8 Directory Properties: stable/11/ (props changed) Modified: stable/12/release/picobsd/build/picobsd ============================================================================== --- stable/12/release/picobsd/build/picobsd Thu Oct 24 21:28:37 2019 (r354050) +++ stable/12/release/picobsd/build/picobsd Thu Oct 24 21:43:01 2019 (r354051) @@ -1019,6 +1019,7 @@ set_build_parameters() { # Main entry of the script. Initialize variables, parse command line # arguments. +1>&2 echo "WARNING: picobsd is deprecated and will be removed in FreeBSD 13.0." set_defaults while [ true ]; do Modified: stable/12/share/man/man8/picobsd.8 ============================================================================== --- stable/12/share/man/man8/picobsd.8 Thu Oct 24 21:28:37 2019 (r354050) +++ stable/12/share/man/man8/picobsd.8 Thu Oct 24 21:43:01 2019 (r354051) @@ -1,6 +1,6 @@ .\" -*- nroff-fill -*- .\" $FreeBSD$ -.Dd October 1, 2013 +.Dd October 20, 2019 .Dt PICOBSD 8 .Os .Sh NAME @@ -11,6 +11,10 @@ .Op Ar options .Op Ar config-name Op Ar site-name .Sh DESCRIPTION +.Nm +is deprecated and will be removed in +.Fx 13.0 . +.Pp The .Nm utility is a script which produces a minimal implementation of From owner-svn-src-all@freebsd.org Thu Oct 24 21:55:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 29E8C15B51C; Thu, 24 Oct 2019 21:55:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zgyw0MVBz4g2p; Thu, 24 Oct 2019 21:55:20 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E44761CA04; Thu, 24 Oct 2019 21:55:19 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OLtJCV002534; Thu, 24 Oct 2019 21:55:19 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OLtJjJ002532; Thu, 24 Oct 2019 21:55:19 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910242155.x9OLtJjJ002532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Thu, 24 Oct 2019 21:55:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354052 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 354052 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 21:55:20 -0000 Author: glebius Date: Thu Oct 24 21:55:19 2019 New Revision: 354052 URL: https://svnweb.freebsd.org/changeset/base/354052 Log: Use THREAD_CAN_SLEEP() macro to check if thread can sleep. There is no functional change. Discussed with: kib Modified: head/sys/kern/subr_sleepqueue.c head/sys/kern/subr_trap.c Modified: head/sys/kern/subr_sleepqueue.c ============================================================================== --- head/sys/kern/subr_sleepqueue.c Thu Oct 24 21:43:01 2019 (r354051) +++ head/sys/kern/subr_sleepqueue.c Thu Oct 24 21:55:19 2019 (r354052) @@ -315,7 +315,7 @@ sleepq_add(void *wchan, struct lock_object *lock, cons MPASS((queue >= 0) && (queue < NR_SLEEPQS)); /* If this thread is not allowed to sleep, die a horrible death. */ - KASSERT(td->td_no_sleeping == 0, + KASSERT(THREAD_CAN_SLEEP(), ("%s: td %p to sleep on wchan %p with sleeping prohibited", __func__, td, wchan)); Modified: head/sys/kern/subr_trap.c ============================================================================== --- head/sys/kern/subr_trap.c Thu Oct 24 21:43:01 2019 (r354051) +++ head/sys/kern/subr_trap.c Thu Oct 24 21:55:19 2019 (r354052) @@ -185,7 +185,7 @@ userret(struct thread *td, struct trapframe *frame) td->td_lk_slocks)); KASSERT((td->td_pflags & TDP_NOFAULTING) == 0, ("userret: Returning with pagefaults disabled")); - KASSERT(td->td_no_sleeping == 0, + KASSERT(THREAD_CAN_SLEEP(), ("userret: Returning with sleep disabled")); KASSERT(td->td_pinned == 0 || (td->td_pflags & TDP_CALLCHAIN) != 0, ("userret: Returning with with pinned thread")); From owner-svn-src-all@freebsd.org Thu Oct 24 22:07:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B92915B84C; Thu, 24 Oct 2019 22:07:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zhFG4NbQz3C0y; Thu, 24 Oct 2019 22:07:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7A47F1CBE7; Thu, 24 Oct 2019 22:07:46 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OM7kP9008744; Thu, 24 Oct 2019 22:07:46 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OM7jf7008740; Thu, 24 Oct 2019 22:07:45 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910242207.x9OM7jf7008740@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Thu, 24 Oct 2019 22:07:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354053 - in head: sys/netinet6 tests/sys/netinet6/frag6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head: sys/netinet6 tests/sys/netinet6/frag6 X-SVN-Commit-Revision: 354053 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 22:07:46 -0000 Author: bz Date: Thu Oct 24 22:07:45 2019 New Revision: 354053 URL: https://svnweb.freebsd.org/changeset/base/354053 Log: frag6: prevent overwriting initial fragoff=0 packet meta-data. When we receive the packet with the first fragmented part (fragoff=0) we remember the length of the unfragmentable part and the next header (and should probably also remember ECN) as meta-data on the reassembly queue. Someone replying this packet so far could change these 2 (3) values. While changing the next header seems more severe, for a full size fragmented UDP packet, for example, adding an extension header to the unfragmentable part would go unnoticed (as the framented part would be considered an exact duplicate) but make reassembly fail. So do not allow updating the meta-data after we have seen the first fragmented part anymore. The frag6_20 test case is added which failed before triggering an ICMPv6 "param prob" due to the check for each queued fragment for a max-size violation if a fragoff=0 packet was received. MFC after: 3 weeks Sponsored by: Netflix Added: head/tests/sys/netinet6/frag6/frag6_20.py (contents, props changed) head/tests/sys/netinet6/frag6/frag6_20.sh (contents, props changed) Modified: head/sys/netinet6/frag6.c head/tests/sys/netinet6/frag6/Makefile Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Thu Oct 24 21:55:19 2019 (r354052) +++ head/sys/netinet6/frag6.c Thu Oct 24 22:07:45 2019 (r354053) @@ -561,11 +561,16 @@ frag6_input(struct mbuf **mp, int *offp, int proto) /* * If it is the 1st fragment, record the length of the * unfragmentable part and the next header of the fragment header. + * Assume the first 1st fragement to arrive will be correct. + * We do not have any duplicate checks here yet so another packet + * with fragoff == 0 could come and overwrite the ip6q_unfrglen + * and worse, the next header, at any time. */ - if (fragoff == 0) { + if (fragoff == 0 && q6->ip6q_unfrglen == -1) { q6->ip6q_unfrglen = offset - sizeof(struct ip6_hdr) - sizeof(struct ip6_frag); q6->ip6q_nxt = ip6f->ip6f_nxt; + /* XXX ECN? */ } /* Modified: head/tests/sys/netinet6/frag6/Makefile ============================================================================== --- head/tests/sys/netinet6/frag6/Makefile Thu Oct 24 21:55:19 2019 (r354052) +++ head/tests/sys/netinet6/frag6/Makefile Thu Oct 24 22:07:45 2019 (r354053) @@ -27,7 +27,8 @@ ATF_TESTS_SH= \ frag6_16 \ frag6_17 \ frag6_18 \ - frag6_19 + frag6_19 \ + frag6_20 ${PACKAGE}FILES+= frag6.subr ${PACKAGE}FILES+= sniffer.py @@ -50,6 +51,7 @@ ${PACKAGE}FILES+= frag6_16.py ${PACKAGE}FILES+= frag6_17.py ${PACKAGE}FILES+= frag6_18.py ${PACKAGE}FILES+= frag6_19.py +${PACKAGE}FILES+= frag6_20.py ${PACKAGE}FILESMODE_frag6.subr= 0444 ${PACKAGE}FILESMODE_sniffer.py= 0555 @@ -72,5 +74,6 @@ ${PACKAGE}FILESMODE_frag6_16.py= 0555 ${PACKAGE}FILESMODE_frag6_17.py= 0555 ${PACKAGE}FILESMODE_frag6_18.py= 0555 ${PACKAGE}FILESMODE_frag6_19.py= 0555 +${PACKAGE}FILESMODE_frag6_20.py= 0555 .include Added: head/tests/sys/netinet6/frag6/frag6_20.py ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_20.py Thu Oct 24 22:07:45 2019 (r354053) @@ -0,0 +1,137 @@ +#!/usr/bin/env python +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# +# $FreeBSD$ +# + +import argparse +import scapy.all as sp +import socket +import sys +from sniffer import Sniffer +from time import sleep + +def check_icmp6_error(args, packet): + ip6 = packet.getlayer(sp.IPv6) + if not ip6: + return False + oip6 = sp.IPv6(src=args.src[0], dst=args.to[0]) + if ip6.dst != oip6.src: + return False + icmp6 = packet.getlayer(sp.ICMPv6TimeExceeded) + if not icmp6: + return False + # ICMP6_TIME_EXCEED_REASSEMBLY 1 + if icmp6.code != 1: + return False + # Should we check the payload as well? + # We are running in a very isolated environment and nothing else + # should trigger an ICMPv6 Time Exceeded / Frag reassembly so leave it. + #icmp6.display() + return True + + +def main(): + parser = argparse.ArgumentParser("frag6.py", + description="IPv6 fragementation test tool") + parser.add_argument('--sendif', nargs=1, + required=True, + help='The interface through which the packet will be sent') + parser.add_argument('--recvif', nargs=1, + required=True, + help='The interface on which to check for the packet') + parser.add_argument('--src', nargs=1, + required=True, + help='The source IP address') + parser.add_argument('--to', nargs=1, + required=True, + help='The destination IP address') + parser.add_argument('--debug', + required=False, action='store_true', + help='Enable test debugging') + + args = parser.parse_args() + + + # Start sniffing on recvif + sniffer = Sniffer(args, check_icmp6_error) + + + ######################################################################## + # + # Send a proper first fragment (off=0) and a second fragment which + # just fits the 64k. The re-send the first fragment with an extra + # unfragmentable part making the 64k to exceed the limit. + # This is to make sure we don't allow to update meta-data for a + # 1st fragmented packet should a second arrive but given the + # fragmentable part is an exact duplicate only that fragment + # will be silently discarded. + # + # A: Reassembly failure, timeout after + # R: ICMPv6 time exceeded / statistics for the duplicate + # + data = "6" * 8 + ip6f00 = \ + sp.Ether() / \ + sp.IPv6(src=args.src[0], dst=args.to[0]) / \ + sp.IPv6ExtHdrFragment(offset=0, m=1, id=20) / \ + sp.UDP(dport=3456, sport=6543) / \ + data + data = "6" * 15 + ip6f01 = \ + sp.Ether() / \ + sp.IPv6(src=args.src[0], dst=args.to[0]) / \ + sp.IPv6ExtHdrFragment(offset=0x1ffc, m=0, id=20) / \ + sp.UDP(dport=3456, sport=6543) / \ + data + data = "6" * 8 + ip6f02 = \ + sp.Ether() / \ + sp.IPv6(src=args.src[0], dst=args.to[0]) / \ + sp.IPv6ExtHdrDestOpt(options = \ + sp.PadN(optdata="\x00\x00\x00\x00\x00\x00")) / \ + sp.IPv6ExtHdrFragment(offset=0, m=1, id=20) / \ + sp.UDP(dport=3456, sport=6543) / \ + data + if args.debug : + ip6f00.display() + ip6f01.display() + ip6f02.display() + sp.sendp(ip6f00, iface=args.sendif[0], verbose=False) + sp.sendp(ip6f01, iface=args.sendif[0], verbose=False) + sp.sendp(ip6f02, iface=args.sendif[0], verbose=False) + + sleep(75) + sniffer.setEnd() + sniffer.join() + if not sniffer.foundCorrectPacket: + sys.exit(1) + + sys.exit(0) + +if __name__ == '__main__': + main() Added: head/tests/sys/netinet6/frag6/frag6_20.sh ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/tests/sys/netinet6/frag6/frag6_20.sh Thu Oct 24 22:07:45 2019 (r354053) @@ -0,0 +1,231 @@ +# $FreeBSD$ +#- +# SPDX-License-Identifier: BSD-2-Clause +# +# Copyright (c) 2019 Netflix, Inc. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +# SUCH DAMAGE. +# + +. $(atf_get_srcdir)/frag6.subr + +frag6_20_check_stats() { + + local jname ifname + jname=$1 + ifname=$2 + + case "${jname}" in + "") echo "ERROR: jname is empty"; return ;; + esac + case "${ifname}" in + "") echo "ERROR: ifname is empty"; return ;; + esac + + # Defaults are: IPV6_FRAGTTL 120 slowtimo ticks. + # pfslowtimo() is run at hz/2. So this takes 60s. + # This is awefully long for a test case. + # The Python script has to wait for this already to get the ICMPv6 + # hence we do not sleep here anymore. + + nf=`jexec ${jname} sysctl -n net.inet6.ip6.frag6_nfragpackets` + case ${nf} in + 0) break ;; + *) atf_fail "VNET frag6_nfragpackets not 0 but: ${nf}" ;; + esac + nf=`sysctl -n net.inet6.ip6.frag6_nfrags` + case ${nf} in + 0) break ;; + *) atf_fail "Global frag6_nfrags not 0 but: ${nf}" ;; + esac + + # + # Check selection of global UDP stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p udp --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 9) ;; + *) jexec ${jname} netstat -s -p udp --libxo xml,pretty + atf_fail "Global UDP statistics do not match: ${count} != 9" ;; + esac + + + # + # Check selection of global IPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 3 + 1 + 2 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p ip6 --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 20) ;; + *) jexec ${jname} netstat -s -p ip6 --libxo xml,pretty + atf_fail "Global IPv6 statistics do not match: ${count} != 20" ;; + esac + + # + # Check selection of global ICMPv6 stats. + # XXX-TODO check output histogram (just too hard to parse [no multi-line-grep]) + # + cat < ${HOME}/filter-${jname}.txt + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p icmp6 --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 22) ;; + *) jexec ${jname} netstat -s -p icmp6 --libxo xml,pretty + atf_fail "Global ICMPv6 statistics do not match: ${count} != 22" ;; + esac + + # + # Check selection of interface IPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 3 + 0 + 1 +EOF + count=`jexec ${jname} netstat -s -p ip6 -I ${ifname} --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 14) ;; + *) jexec ${jname} netstat -s -p ip6 -I ${ifname} --libxo xml,pretty + atf_fail "Interface IPv6 statistics do not match: ${count} != 14" ;; + esac + + # + # Check selection of interface ICMPv6 stats. + # + cat < ${HOME}/filter-${jname}.txt + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 0 + 1 + 0 + 0 + 1 + 0 + 0 + 0 + 0 + 0 + 0 + 0 +EOF + count=`jexec ${jname} netstat -s -p icmp6 -I ${ifname} --libxo xml,pretty | grep -E -x -c -f ${HOME}/filter-${jname}.txt` + rm -f ${HOME}/filter-${jname}.txt + case ${count} in + 21) ;; + *) jexec ${jname} netstat -s -p icmp6 -I ${ifname} --libxo xml,pretty + atf_fail "Interface ICMPv6 statistics do not match: ${count} != 21" ;; + esac +} + +atf_test_case "frag6_20" "cleanup" +frag6_20_head() { + frag6_head 20 +} + +frag6_20_body() { + frag6_body 20 frag6_20_check_stats +} + +frag6_20_cleanup() { + frag6_cleanup 20 +} + +atf_init_test_cases() +{ + atf_add_test_case "frag6_20" +} From owner-svn-src-all@freebsd.org Thu Oct 24 22:23:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2F01B15BE5A; Thu, 24 Oct 2019 22:23:54 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zhbt08pVz3D7W; Thu, 24 Oct 2019 22:23:54 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DCCE41CF83; Thu, 24 Oct 2019 22:23:53 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OMNrln020093; Thu, 24 Oct 2019 22:23:53 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OMNrcn020092; Thu, 24 Oct 2019 22:23:53 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910242223.x9OMNrcn020092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 24 Oct 2019 22:23:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354054 - head/sys/cam/nvme X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: head/sys/cam/nvme X-SVN-Commit-Revision: 354054 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 22:23:54 -0000 Author: brooks Date: Thu Oct 24 22:23:53 2019 New Revision: 354054 URL: https://svnweb.freebsd.org/changeset/base/354054 Log: nda(4): Remove unnecessary union and avoid Clang -Wsizeof-array-divwarning Clang trunk recently gained this new warning, and complains about the sizeof(trim->data) / sizeof(struct nvme_dsm_range) expression, since the left hand side's element type (char) does not match the right hand side's type. The byte buffer is unnecessary so we can remove it to clean up the code and fix the warning at the same time. No functional change. Submitted by: James Clarke Reviewed by: imp Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21912 Modified: head/sys/cam/nvme/nvme_da.c Modified: head/sys/cam/nvme/nvme_da.c ============================================================================== --- head/sys/cam/nvme/nvme_da.c Thu Oct 24 22:07:45 2019 (r354053) +++ head/sys/cam/nvme/nvme_da.c Thu Oct 24 22:23:53 2019 (r354054) @@ -129,12 +129,11 @@ struct nda_softc { }; struct nda_trim_request { - union { - struct nvme_dsm_range dsm; - uint8_t data[NVME_MAX_DSM_TRIM]; - }; + struct nvme_dsm_range dsm[NVME_MAX_DSM_TRIM / sizeof(struct nvme_dsm_range)]; TAILQ_HEAD(, bio) bps; }; +_Static_assert(NVME_MAX_DSM_TRIM % sizeof(struct nvme_dsm_range) == 0, + "NVME_MAX_DSM_TRIM must be an integral number of ranges"); /* Need quirk table */ @@ -957,9 +956,8 @@ ndastart(struct cam_periph *periph, union ccb *start_c } TAILQ_INIT(&trim->bps); bp1 = bp; - ents = sizeof(trim->data) / sizeof(struct nvme_dsm_range); - ents = min(ents, nda_max_trim_entries); - dsm_range = &trim->dsm; + ents = min(nitems(trim->dsm), nda_max_trim_entries); + dsm_range = trim->dsm; dsm_end = dsm_range + ents; do { TAILQ_INSERT_TAIL(&trim->bps, bp1, bio_queue); @@ -977,8 +975,8 @@ ndastart(struct cam_periph *periph, union ccb *start_c /* XXX -- Could limit based on total payload size */ } while (bp1 != NULL); start_ccb->ccb_trim = trim; - nda_nvme_trim(softc, &start_ccb->nvmeio, &trim->dsm, - dsm_range - &trim->dsm); + nda_nvme_trim(softc, &start_ccb->nvmeio, trim->dsm, + dsm_range - trim->dsm); start_ccb->ccb_state = NDA_CCB_TRIM; softc->trim_count++; softc->trim_ranges += ranges; From owner-svn-src-all@freebsd.org Thu Oct 24 22:26:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E9B2E15BF28; Thu, 24 Oct 2019 22:26:06 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zhfQ5z5Tz3DHj; Thu, 24 Oct 2019 22:26:06 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B18D61CF8B; Thu, 24 Oct 2019 22:26:06 +0000 (UTC) (envelope-from sjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OMQ60J020246; Thu, 24 Oct 2019 22:26:06 GMT (envelope-from sjg@FreeBSD.org) Received: (from sjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OMQ6Qb020245; Thu, 24 Oct 2019 22:26:06 GMT (envelope-from sjg@FreeBSD.org) Message-Id: <201910242226.x9OMQ6Qb020245@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: sjg set sender to sjg@FreeBSD.org using -f From: "Simon J. Gerraty" Date: Thu, 24 Oct 2019 22:26:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354055 - head/stand/efi/loader X-SVN-Group: head X-SVN-Commit-Author: sjg X-SVN-Commit-Paths: head/stand/efi/loader X-SVN-Commit-Revision: 354055 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 22:26:07 -0000 Author: sjg Date: Thu Oct 24 22:26:06 2019 New Revision: 354055 URL: https://svnweb.freebsd.org/changeset/base/354055 Log: Guard reference to x86_hypervisor Obviously we only want x86_hypervisor on x86 Guard reference to x86_hypervisor Obviously we only want x86_hypervisor on x86 Modified: head/stand/efi/loader/main.c Modified: head/stand/efi/loader/main.c ============================================================================== --- head/stand/efi/loader/main.c Thu Oct 24 22:23:53 2019 (r354054) +++ head/stand/efi/loader/main.c Thu Oct 24 22:26:06 2019 (r354055) @@ -863,7 +863,9 @@ main(int argc, CHAR16 *argv[]) archsw.arch_getdev = efi_getdev; archsw.arch_copyin = efi_copyin; archsw.arch_copyout = efi_copyout; +#ifdef __amd64__ archsw.arch_hypervisor = x86_hypervisor; +#endif archsw.arch_readin = efi_readin; archsw.arch_zfs_probe = efi_zfs_probe; From owner-svn-src-all@freebsd.org Thu Oct 24 22:33:47 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D955F15C233; Thu, 24 Oct 2019 22:33:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zhqH5MfZz3DkD; Thu, 24 Oct 2019 22:33:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 82C661D14C; Thu, 24 Oct 2019 22:33:47 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OMXlU6026047; Thu, 24 Oct 2019 22:33:47 GMT (envelope-from jkim@FreeBSD.org) Received: (from jkim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OMXlTO026046; Thu, 24 Oct 2019 22:33:47 GMT (envelope-from jkim@FreeBSD.org) Message-Id: <201910242233.x9OMXlTO026046@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jkim set sender to jkim@FreeBSD.org using -f From: Jung-uk Kim Date: Thu, 24 Oct 2019 22:33:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354056 - head/usr.sbin/bhyve X-SVN-Group: head X-SVN-Commit-Author: jkim X-SVN-Commit-Paths: head/usr.sbin/bhyve X-SVN-Commit-Revision: 354056 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 22:33:47 -0000 Author: jkim Date: Thu Oct 24 22:33:46 2019 New Revision: 354056 URL: https://svnweb.freebsd.org/changeset/base/354056 Log: Catch up with ACPICA 20191018. PR: 241467 XMFC with: r353764 Modified: head/usr.sbin/bhyve/acpi.c head/usr.sbin/bhyve/pci_emul.c Modified: head/usr.sbin/bhyve/acpi.c ============================================================================== --- head/usr.sbin/bhyve/acpi.c Thu Oct 24 22:26:06 2019 (r354055) +++ head/usr.sbin/bhyve/acpi.c Thu Oct 24 22:33:46 2019 (r354056) @@ -309,11 +309,11 @@ basl_fwrite_madt(FILE *fp) /* Local APIC NMI is connected to LINT 1 on all CPUs */ EFPRINTF(fp, "[0001]\t\tSubtable Type : 04\n"); EFPRINTF(fp, "[0001]\t\tLength : 06\n"); - EFPRINTF(fp, "[0001]\t\tProcessorId : FF\n"); + EFPRINTF(fp, "[0001]\t\tProcessor ID : FF\n"); EFPRINTF(fp, "[0002]\t\tFlags (decoded below) : 0005\n"); EFPRINTF(fp, "\t\t\tPolarity : 1\n"); EFPRINTF(fp, "\t\t\tTrigger Mode : 1\n"); - EFPRINTF(fp, "[0001]\t\tInterrupt : 01\n"); + EFPRINTF(fp, "[0001]\t\tInterrupt Input LINT : 01\n"); EFPRINTF(fp, "\n"); EFFLUSH(fp); @@ -560,7 +560,7 @@ basl_fwrite_hpet(FILE *fp) EFPRINTF(fp, "[0004]\t\tAsl Compiler Revision : 00000000\n"); EFPRINTF(fp, "\n"); - EFPRINTF(fp, "[0004]\t\tTimer Block ID : %08X\n", hpet_capabilities); + EFPRINTF(fp, "[0004]\t\tHardware Block ID : %08X\n", hpet_capabilities); EFPRINTF(fp, "[0012]\t\tTimer Block Register : [Generic Address Structure]\n"); EFPRINTF(fp, "[0001]\t\tSpace ID : 00 [SystemMemory]\n"); @@ -571,7 +571,7 @@ basl_fwrite_hpet(FILE *fp) EFPRINTF(fp, "[0008]\t\tAddress : 00000000FED00000\n"); EFPRINTF(fp, "\n"); - EFPRINTF(fp, "[0001]\t\tHPET Number : 00\n"); + EFPRINTF(fp, "[0001]\t\tSequence Number : 00\n"); EFPRINTF(fp, "[0002]\t\tMinimum Clock Ticks : 0000\n"); EFPRINTF(fp, "[0004]\t\tFlags (decoded below) : 00000001\n"); EFPRINTF(fp, "\t\t\t4K Page Protect : 1\n"); @@ -607,9 +607,9 @@ basl_fwrite_mcfg(FILE *fp) EFPRINTF(fp, "\n"); EFPRINTF(fp, "[0008]\t\tBase Address : %016lX\n", pci_ecfg_base()); - EFPRINTF(fp, "[0002]\t\tSegment Group: 0000\n"); - EFPRINTF(fp, "[0001]\t\tStart Bus: 00\n"); - EFPRINTF(fp, "[0001]\t\tEnd Bus: FF\n"); + EFPRINTF(fp, "[0002]\t\tSegment Group Number : 0000\n"); + EFPRINTF(fp, "[0001]\t\tStart Bus Number : 00\n"); + EFPRINTF(fp, "[0001]\t\tEnd Bus Number : FF\n"); EFPRINTF(fp, "[0004]\t\tReserved : 0\n"); EFFLUSH(fp); return (0); Modified: head/usr.sbin/bhyve/pci_emul.c ============================================================================== --- head/usr.sbin/bhyve/pci_emul.c Thu Oct 24 22:26:06 2019 (r354055) +++ head/usr.sbin/bhyve/pci_emul.c Thu Oct 24 22:33:46 2019 (r354056) @@ -1268,7 +1268,6 @@ pci_bus_write_dsdt(int bus) dsdt_line(" Device (PC%02X)", bus); dsdt_line(" {"); dsdt_line(" Name (_HID, EisaId (\"PNP0A03\"))"); - dsdt_line(" Name (_ADR, Zero)"); dsdt_line(" Method (_BBN, 0, NotSerialized)"); dsdt_line(" {"); From owner-svn-src-all@freebsd.org Thu Oct 24 22:34:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B7FAA15C2BA; Thu, 24 Oct 2019 22:34:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zhrT4Qp9z3DsC; Thu, 24 Oct 2019 22:34:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7AB2B1D154; Thu, 24 Oct 2019 22:34:49 +0000 (UTC) (envelope-from brooks@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9OMYnls026145; Thu, 24 Oct 2019 22:34:49 GMT (envelope-from brooks@FreeBSD.org) Received: (from brooks@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9OMYn8g026143; Thu, 24 Oct 2019 22:34:49 GMT (envelope-from brooks@FreeBSD.org) Message-Id: <201910242234.x9OMYn8g026143@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: brooks set sender to brooks@FreeBSD.org using -f From: Brooks Davis Date: Thu, 24 Oct 2019 22:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354057 - in head/contrib/binutils: bfd binutils X-SVN-Group: head X-SVN-Commit-Author: brooks X-SVN-Commit-Paths: in head/contrib/binutils: bfd binutils X-SVN-Commit-Revision: 354057 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 24 Oct 2019 22:34:49 -0000 Author: brooks Date: Thu Oct 24 22:34:48 2019 New Revision: 354057 URL: https://svnweb.freebsd.org/changeset/base/354057 Log: binutils: Fix bugs found by -Wpointer-compare The MIPS bug was introduced by upstream commit 7403cb630, which failed to account for the additional indirection introduced and also dropped one of the checks; change it to the standard "NULL-or-empty" check as used elsewhere in BFD, which is also what upstream now has. Submitted by: James Clarke Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D21911 Modified: head/contrib/binutils/bfd/elfxx-mips.c head/contrib/binutils/binutils/stabs.c Modified: head/contrib/binutils/bfd/elfxx-mips.c ============================================================================== --- head/contrib/binutils/bfd/elfxx-mips.c Thu Oct 24 22:33:46 2019 (r354056) +++ head/contrib/binutils/bfd/elfxx-mips.c Thu Oct 24 22:34:48 2019 (r354057) @@ -3966,7 +3966,7 @@ mips_elf_calculate_relocation (bfd *abfd, bfd *input_b *namep = bfd_elf_string_from_elf_section (input_bfd, symtab_hdr->sh_link, sym->st_name); - if (*namep == '\0') + if (*namep == NULL || **namep == '\0') *namep = bfd_section_name (input_bfd, sec); target_is_16_bit_code_p = (sym->st_other == STO_MIPS16); Modified: head/contrib/binutils/binutils/stabs.c ============================================================================== --- head/contrib/binutils/binutils/stabs.c Thu Oct 24 22:33:46 2019 (r354056) +++ head/contrib/binutils/binutils/stabs.c Thu Oct 24 22:34:48 2019 (r354057) @@ -2668,7 +2668,7 @@ parse_stab_members (void *dhandle, struct stab_handle ++*pp; voffset &= 0x7fffffff; - if (**pp == ';' || *pp == '\0') + if (**pp == ';' || **pp == '\0') { /* Must be g++ version 1. */ context = DEBUG_TYPE_NULL; From owner-svn-src-all@freebsd.org Fri Oct 25 00:16:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49A9E15EA45; Fri, 25 Oct 2019 00:16:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zl6L1FxSz3KcW; Fri, 25 Oct 2019 00:16:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FE031E31E; Fri, 25 Oct 2019 00:16:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9P0GvhS084683; Fri, 25 Oct 2019 00:16:57 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9P0Gv24084681; Fri, 25 Oct 2019 00:16:57 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910250016.x9P0Gv24084681@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Oct 2019 00:16:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354058 - in stable: 11/sys/dev/acpica 11/sys/i386/pci 12/sys/dev/acpica 12/sys/i386/pci X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/dev/acpica 11/sys/i386/pci 12/sys/dev/acpica 12/sys/i386/pci X-SVN-Commit-Revision: 354058 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 00:16:58 -0000 Author: jhb Date: Fri Oct 25 00:16:57 2019 New Revision: 354058 URL: https://svnweb.freebsd.org/changeset/base/354058 Log: MFC 350662: Detect invalid PCI devices more correctly in PCI interrupt router drivers. - Check for an invalid device (vendor is invalid) before reading the header type register when examining function 0 of a possible device. - When iterating over functions of a device, reject any device whose 16-bit vendor is invalid rather than requiring the full 32-bit vendor+device to be all 1's. In practice the latter check is probably fine, but checking the vendor is what the PCI spec recommends. Modified: stable/12/sys/dev/acpica/acpi_pci_link.c stable/12/sys/i386/pci/pci_pir.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/acpica/acpi_pci_link.c stable/11/sys/i386/pci/pci_pir.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/dev/acpica/acpi_pci_link.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_pci_link.c Thu Oct 24 22:34:48 2019 (r354057) +++ stable/12/sys/dev/acpica/acpi_pci_link.c Fri Oct 25 00:16:57 2019 (r354058) @@ -577,6 +577,9 @@ acpi_pci_link_search_irq(int bus, int device, int pin) uint8_t func, maxfunc; /* See if we have a valid device at function 0. */ + value = pci_cfgregread(bus, device, 0, PCIR_VENDOR, 2); + if (value == PCIV_INVALID) + return (PCI_INVALID_IRQ); value = pci_cfgregread(bus, device, 0, PCIR_HDRTYPE, 1); if ((value & PCIM_HDRTYPE) > PCI_MAXHDRTYPE) return (PCI_INVALID_IRQ); @@ -587,8 +590,8 @@ acpi_pci_link_search_irq(int bus, int device, int pin) /* Scan all possible functions at this device. */ for (func = 0; func <= maxfunc; func++) { - value = pci_cfgregread(bus, device, func, PCIR_DEVVENDOR, 4); - if (value == 0xffffffff) + value = pci_cfgregread(bus, device, func, PCIR_VENDOR, 2); + if (value == PCIV_INVALID) continue; value = pci_cfgregread(bus, device, func, PCIR_INTPIN, 1); Modified: stable/12/sys/i386/pci/pci_pir.c ============================================================================== --- stable/12/sys/i386/pci/pci_pir.c Thu Oct 24 22:34:48 2019 (r354057) +++ stable/12/sys/i386/pci/pci_pir.c Fri Oct 25 00:16:57 2019 (r354058) @@ -257,8 +257,8 @@ pci_pir_create_links(struct PIR_entry *entry, struct P } /* - * Look to see if any of the function on the PCI device at bus/device have - * an interrupt routed to intpin 'pin' by the BIOS. + * Look to see if any of the functions on the PCI device at bus/device + * have an interrupt routed to intpin 'pin' by the BIOS. */ static uint8_t pci_pir_search_irq(int bus, int device, int pin) @@ -267,6 +267,9 @@ pci_pir_search_irq(int bus, int device, int pin) uint8_t func, maxfunc; /* See if we have a valid device at function 0. */ + value = pci_cfgregread(bus, device, 0, PCIR_VENDOR, 2); + if (value == PCIV_INVALID) + return (PCI_INVALID_IRQ); value = pci_cfgregread(bus, device, 0, PCIR_HDRTYPE, 1); if ((value & PCIM_HDRTYPE) > PCI_MAXHDRTYPE) return (PCI_INVALID_IRQ); @@ -277,8 +280,8 @@ pci_pir_search_irq(int bus, int device, int pin) /* Scan all possible functions at this device. */ for (func = 0; func <= maxfunc; func++) { - value = pci_cfgregread(bus, device, func, PCIR_DEVVENDOR, 4); - if (value == 0xffffffff) + value = pci_cfgregread(bus, device, func, PCIR_VENDOR, 2); + if (value == PCIV_INVALID) continue; value = pci_cfgregread(bus, device, func, PCIR_INTPIN, 1); From owner-svn-src-all@freebsd.org Fri Oct 25 00:16:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C4FAF15EA4E; Fri, 25 Oct 2019 00:16:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zl6L4rz2z3KcX; Fri, 25 Oct 2019 00:16:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B2061E31F; Fri, 25 Oct 2019 00:16:58 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9P0GwjC084690; Fri, 25 Oct 2019 00:16:58 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9P0GwFP084689; Fri, 25 Oct 2019 00:16:58 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910250016.x9P0GwFP084689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Oct 2019 00:16:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354058 - in stable: 11/sys/dev/acpica 11/sys/i386/pci 12/sys/dev/acpica 12/sys/i386/pci X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/dev/acpica 11/sys/i386/pci 12/sys/dev/acpica 12/sys/i386/pci X-SVN-Commit-Revision: 354058 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 00:16:58 -0000 Author: jhb Date: Fri Oct 25 00:16:57 2019 New Revision: 354058 URL: https://svnweb.freebsd.org/changeset/base/354058 Log: MFC 350662: Detect invalid PCI devices more correctly in PCI interrupt router drivers. - Check for an invalid device (vendor is invalid) before reading the header type register when examining function 0 of a possible device. - When iterating over functions of a device, reject any device whose 16-bit vendor is invalid rather than requiring the full 32-bit vendor+device to be all 1's. In practice the latter check is probably fine, but checking the vendor is what the PCI spec recommends. Modified: stable/11/sys/dev/acpica/acpi_pci_link.c stable/11/sys/i386/pci/pci_pir.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/dev/acpica/acpi_pci_link.c stable/12/sys/i386/pci/pci_pir.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/dev/acpica/acpi_pci_link.c ============================================================================== --- stable/11/sys/dev/acpica/acpi_pci_link.c Thu Oct 24 22:34:48 2019 (r354057) +++ stable/11/sys/dev/acpica/acpi_pci_link.c Fri Oct 25 00:16:57 2019 (r354058) @@ -577,6 +577,9 @@ acpi_pci_link_search_irq(int bus, int device, int pin) uint8_t func, maxfunc; /* See if we have a valid device at function 0. */ + value = pci_cfgregread(bus, device, 0, PCIR_VENDOR, 2); + if (value == PCIV_INVALID) + return (PCI_INVALID_IRQ); value = pci_cfgregread(bus, device, 0, PCIR_HDRTYPE, 1); if ((value & PCIM_HDRTYPE) > PCI_MAXHDRTYPE) return (PCI_INVALID_IRQ); @@ -587,8 +590,8 @@ acpi_pci_link_search_irq(int bus, int device, int pin) /* Scan all possible functions at this device. */ for (func = 0; func <= maxfunc; func++) { - value = pci_cfgregread(bus, device, func, PCIR_DEVVENDOR, 4); - if (value == 0xffffffff) + value = pci_cfgregread(bus, device, func, PCIR_VENDOR, 2); + if (value == PCIV_INVALID) continue; value = pci_cfgregread(bus, device, func, PCIR_INTPIN, 1); Modified: stable/11/sys/i386/pci/pci_pir.c ============================================================================== --- stable/11/sys/i386/pci/pci_pir.c Thu Oct 24 22:34:48 2019 (r354057) +++ stable/11/sys/i386/pci/pci_pir.c Fri Oct 25 00:16:57 2019 (r354058) @@ -260,8 +260,8 @@ pci_pir_create_links(struct PIR_entry *entry, struct P } /* - * Look to see if any of the function on the PCI device at bus/device have - * an interrupt routed to intpin 'pin' by the BIOS. + * Look to see if any of the functions on the PCI device at bus/device + * have an interrupt routed to intpin 'pin' by the BIOS. */ static uint8_t pci_pir_search_irq(int bus, int device, int pin) @@ -270,6 +270,9 @@ pci_pir_search_irq(int bus, int device, int pin) uint8_t func, maxfunc; /* See if we have a valid device at function 0. */ + value = pci_cfgregread(bus, device, 0, PCIR_VENDOR, 2); + if (value == PCIV_INVALID) + return (PCI_INVALID_IRQ); value = pci_cfgregread(bus, device, 0, PCIR_HDRTYPE, 1); if ((value & PCIM_HDRTYPE) > PCI_MAXHDRTYPE) return (PCI_INVALID_IRQ); @@ -280,8 +283,8 @@ pci_pir_search_irq(int bus, int device, int pin) /* Scan all possible functions at this device. */ for (func = 0; func <= maxfunc; func++) { - value = pci_cfgregread(bus, device, func, PCIR_DEVVENDOR, 4); - if (value == 0xffffffff) + value = pci_cfgregread(bus, device, func, PCIR_VENDOR, 2); + if (value == PCIV_INVALID) continue; value = pci_cfgregread(bus, device, func, PCIR_INTPIN, 1); From owner-svn-src-all@freebsd.org Fri Oct 25 00:47:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF38C15F200; Fri, 25 Oct 2019 00:47:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zlnk4gPVz3LhJ; Fri, 25 Oct 2019 00:47:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F1AF1E85C; Fri, 25 Oct 2019 00:47:38 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9P0lcHq001923; Fri, 25 Oct 2019 00:47:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9P0lcU2001922; Fri, 25 Oct 2019 00:47:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910250047.x9P0lcU2001922@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 25 Oct 2019 00:47:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354059 - in stable: 11/stand/lua 12/stand/lua X-SVN-Group: stable-11 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/lua 12/stand/lua X-SVN-Commit-Revision: 354059 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 00:47:38 -0000 Author: kevans Date: Fri Oct 25 00:47:37 2019 New Revision: 354059 URL: https://svnweb.freebsd.org/changeset/base/354059 Log: MFC r353872-r353873: lualoader color handling fixes r353872: lualoader: don't botch disabling of color When colors are disabled, color.escape{fg,bg} would return the passed in color rather than the proper ANSI sequence for the color. color.escape{fg,bg} would be wrong. Instead return '', as the associated reset* functions will also return ''. This should get rid of the funky '2' and '4' in the kernel selector if you're booting serial. r353873: lualoader: fix setting of loader_color=NO in loader.conf(5) Previously color.disabled would be calculated at color module load time, then never touched again. We can detect serial boots beyond just what we're told by loader.conf(5) so this works out in many cases, but we must re-evaluate the situation after the config is loaded to make sure we're not supposed to be forcing it enabled/disabled. Discovered while trying to test r353872. Modified: stable/11/stand/lua/color.lua stable/11/stand/lua/screen.lua Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/stand/lua/color.lua stable/12/stand/lua/screen.lua Directory Properties: stable/12/ (props changed) Modified: stable/11/stand/lua/color.lua ============================================================================== --- stable/11/stand/lua/color.lua Fri Oct 25 00:16:57 2019 (r354058) +++ stable/11/stand/lua/color.lua Fri Oct 25 00:47:37 2019 (r354059) @@ -29,9 +29,14 @@ -- local core = require("core") +local hook = require("hook") local color = {} +local function recalcDisabled() + color.disabled = not color.isEnabled() +end + -- Module exports color.BLACK = 0 color.RED = 1 @@ -54,11 +59,9 @@ function color.isEnabled() return not core.isSerialBoot() end -color.disabled = not color.isEnabled() - function color.escapefg(color_value) if color.disabled then - return color_value + return '' end return core.KEYSTR_CSI .. "3" .. color_value .. "m" end @@ -72,7 +75,7 @@ end function color.escapebg(color_value) if color.disabled then - return color_value + return '' end return core.KEYSTR_CSI .. "4" .. color_value .. "m" end @@ -112,5 +115,8 @@ function color.highlight(str) -- case the terminal defaults don't match what we're expecting. return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "22m" end + +recalcDisabled() +hook.register("config.loaded", recalcDisabled) return color Modified: stable/11/stand/lua/screen.lua ============================================================================== --- stable/11/stand/lua/screen.lua Fri Oct 25 00:16:57 2019 (r354058) +++ stable/11/stand/lua/screen.lua Fri Oct 25 00:47:37 2019 (r354059) @@ -47,14 +47,14 @@ end function screen.setforeground(color_value) if color.disabled then - return color_value + return end printc(color.escapefg(color_value)) end function screen.setbackground(color_value) if color.disabled then - return color_value + return end printc(color.escapebg(color_value)) end From owner-svn-src-all@freebsd.org Fri Oct 25 00:47:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 43AF915F207; Fri, 25 Oct 2019 00:47:39 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zlnl1862z3LhL; Fri, 25 Oct 2019 00:47:39 +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 0A8031E85D; Fri, 25 Oct 2019 00:47:39 +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 x9P0lcdn001931; Fri, 25 Oct 2019 00:47:38 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9P0lcnq001929; Fri, 25 Oct 2019 00:47:38 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910250047.x9P0lcnq001929@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 25 Oct 2019 00:47:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354059 - in stable: 11/stand/lua 12/stand/lua X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable: 11/stand/lua 12/stand/lua X-SVN-Commit-Revision: 354059 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 00:47:39 -0000 Author: kevans Date: Fri Oct 25 00:47:37 2019 New Revision: 354059 URL: https://svnweb.freebsd.org/changeset/base/354059 Log: MFC r353872-r353873: lualoader color handling fixes r353872: lualoader: don't botch disabling of color When colors are disabled, color.escape{fg,bg} would return the passed in color rather than the proper ANSI sequence for the color. color.escape{fg,bg} would be wrong. Instead return '', as the associated reset* functions will also return ''. This should get rid of the funky '2' and '4' in the kernel selector if you're booting serial. r353873: lualoader: fix setting of loader_color=NO in loader.conf(5) Previously color.disabled would be calculated at color module load time, then never touched again. We can detect serial boots beyond just what we're told by loader.conf(5) so this works out in many cases, but we must re-evaluate the situation after the config is loaded to make sure we're not supposed to be forcing it enabled/disabled. Discovered while trying to test r353872. Modified: stable/12/stand/lua/color.lua stable/12/stand/lua/screen.lua Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/stand/lua/color.lua stable/11/stand/lua/screen.lua Directory Properties: stable/11/ (props changed) Modified: stable/12/stand/lua/color.lua ============================================================================== --- stable/12/stand/lua/color.lua Fri Oct 25 00:16:57 2019 (r354058) +++ stable/12/stand/lua/color.lua Fri Oct 25 00:47:37 2019 (r354059) @@ -29,9 +29,14 @@ -- local core = require("core") +local hook = require("hook") local color = {} +local function recalcDisabled() + color.disabled = not color.isEnabled() +end + -- Module exports color.BLACK = 0 color.RED = 1 @@ -54,11 +59,9 @@ function color.isEnabled() return not core.isSerialBoot() end -color.disabled = not color.isEnabled() - function color.escapefg(color_value) if color.disabled then - return color_value + return '' end return core.KEYSTR_CSI .. "3" .. color_value .. "m" end @@ -72,7 +75,7 @@ end function color.escapebg(color_value) if color.disabled then - return color_value + return '' end return core.KEYSTR_CSI .. "4" .. color_value .. "m" end @@ -112,5 +115,8 @@ function color.highlight(str) -- case the terminal defaults don't match what we're expecting. return core.KEYSTR_CSI .. "1m" .. str .. core.KEYSTR_CSI .. "22m" end + +recalcDisabled() +hook.register("config.loaded", recalcDisabled) return color Modified: stable/12/stand/lua/screen.lua ============================================================================== --- stable/12/stand/lua/screen.lua Fri Oct 25 00:16:57 2019 (r354058) +++ stable/12/stand/lua/screen.lua Fri Oct 25 00:47:37 2019 (r354059) @@ -47,14 +47,14 @@ end function screen.setforeground(color_value) if color.disabled then - return color_value + return end printc(color.escapefg(color_value)) end function screen.setbackground(color_value) if color.disabled then - return color_value + return end printc(color.escapebg(color_value)) end From owner-svn-src-all@freebsd.org Fri Oct 25 01:10:13 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6F33D15F973; Fri, 25 Oct 2019 01:10:13 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zmHn31djz3Mmp; Fri, 25 Oct 2019 01:10:13 +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 4A6E81EBF7; Fri, 25 Oct 2019 01:10:13 +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 x9P1AD8Y014130; Fri, 25 Oct 2019 01:10:13 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9P1A8bl014107; Fri, 25 Oct 2019 01:10:08 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910250110.x9P1A8bl014107@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 25 Oct 2019 01:10:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354060 - in stable/12: . sbin/ifconfig share/man/man4 sys/amd64/conf sys/arm/conf sys/arm64/conf sys/conf sys/i386/conf sys/mips/conf sys/modules sys/modules/if_tap sys/modules/if_tun ... X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in stable/12: . sbin/ifconfig share/man/man4 sys/amd64/conf sys/arm/conf sys/arm64/conf sys/conf sys/i386/conf sys/mips/conf sys/modules sys/modules/if_tap sys/modules/if_tun sys/modules/if_tuntap sys... X-SVN-Commit-Revision: 354060 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 01:10:13 -0000 Author: kevans Date: Fri Oct 25 01:10:08 2019 New Revision: 354060 URL: https://svnweb.freebsd.org/changeset/base/354060 Log: MFC tun/tap merge: r347241, r347394, r347404, r347483, r351220, r351229, r352148, r353056-r353057, r353781-r353782, r353785-r353786, r353877 Note: A little more than just the tun/tap merge has been MFC'd to ease auditing correctness/differences, as some later commits were cherry-picked back to tun+tap. r347241: tun/tap: merge and rename to `tuntap` tun(4) and tap(4) share the same general management interface and have a lot in common. Bugs exist in tap(4) that have been fixed in tun(4), and vice-versa. Let's reduce the maintenance requirements by merging them together and using flags to differentiate between the three interface types (tun, tap, vmnet). This fixes a couple of tap(4)/vmnet(4) issues right out of the gate: - tap devices may no longer be destroyed while they're open [0] - VIMAGE issues already addressed in tun by kp [0] emaste had removed an easy-panic-button in r240938 due to devdrn blocking. A naive glance over this leads me to believe that this isn't quite complete -- destroy_devl will only block while executing d_* functions, but doesn't block the device from being destroyed while a process has it open. The latter is the intent of the condvar in tun, so this is "fixed" (for certain definitions of the word -- it wasn't really broken in tap, it just wasn't quite ideal). ifconfig(8) also grew the ability to map an interface name to a kld, so that `ifconfig {tun,tap}0` can continue to autoload the correct module, and `ifconfig vmnet0 create` will now autoload the correct module. This is a low overhead addition. r347394: tuntap: Properly detach tap ifp r347404: tuntap: Don't down tap interfaces if LINK0 is set r347483: tuntap: Improve style No functional change. tun_flags of the tuntap_driver was renamed to ident_flags to reflect the fact that it's a subset of the tun_flags that identifies a tuntap device. This maps more easily (visually) to the TUN_DRIVER_IDENT_MASK that masks off the bits of tun_flags that are applicable to tuntap driver ident. This is a purely cosmetic change. r351220: if_tuntap: minor improvements Rewrite a loop to avoid duplicating the exit condition. Simplify mask processing in tunpoll(). Fix minor typos. r351229: tuntap: belatedly add MODULE_VERSION for if_tun and if_tap When tun/tap were merged, appropriate MODULE_VERSION should have been added for things like modfind(2) to continue to do the right thing with the old names. r352148: Remove empty tap/tun modules directories after r347241 r353056: if_tuntap: add a busy/unbusy mechanism, replace destroy OPEN check A future commit will create device aliases when a tuntap device is renamed so that it's still easily found in /dev after the rename. Said mechanism will want to keep the tun alive long enough to either realize that it's about to go away or complete the alias creation, even if the alias is about to get destroyed. While we're introducing it, using it to prevent open devices from going away makes plenty of sense and keeps the logic on waking up tun_destroy clean, so we don't have multiple places trying to cv_broadcast unless it's still in use elsewhere. r353057: if_tuntap: create /dev aliases when a tuntap device gets renamed Currently, if you do: $ ifconfig tun0 create $ ifconfig tun0 name wg0 $ ls -l /dev | egrep 'wg|tun' You will see tun0, but no wg0. In fact, it's slightly more annoying to make the association between the new name and the old name in order to open the device (if it hadn't been opened during the rename). Register an eventhandler for ifnet_arrival_events and catch interface renames. We can determine if the ifnet is a tun easily enough from the if_dname, which matches the cevsw.d_name from the associated tuntap_driver. Some locking dance is required because renames don't require the device to be opened, so it could go away in the middle of handling the ioctl, but as soon as we've verified this isn't the case we can attempt to busy the tun and either bail out if the tun device is dying, or we can proceed with the rename. We only create these aliases on a best-effort basis. Renaming a tun device to "usbctl", which doesn't exist as an ifnet but does as a /dev, is clearly not that disastrous, but we can't and won't create a /dev for that. r353781: tuntap(4): Drop TUN_IASET This flag appears to have been effectively unused since introduction to if_tun(4) -- drop it now. r353782: tuntap(4): break out after setting TUN_DSTADDR This is now the only flag we set in this loop, terminate early. r353785: tuntap(4): Use make_dev_s to avoid si_drv1 race This allows us to avoid some dance in tunopen for dealing with the possibility of dev->si_drv1 being NULL as it's set prior to the devfs node being created in all cases. There's still the possibility that the tun device hasn't been fully initialized, since that's done after the devfs node was created. Alleviate this by returning ENXIO if we're not to that point of tuncreate yet. This work is what sparked r353128, full initialization of cloned devices w/ specified make_dev_args. r353786: tuntap(4): use cdevpriv w/ dtor for last close instead of d_close cdevpriv dtors will be called when the reference count on the associated struct file drops to 0, while d_close can be unreliable for cleaning up state at "last close" for a number of reasons. As far as tunclose/tundtor is concerned the difference is minimal, so make the switch. r353877: tuntap(4): properly declare if_tun and if_tap modules Simply adding MODULE_VERSION does not do the trick, because the modules haven't been declared. This should actually fix modfind/kldstat, which r351229 aimed and failed to do. This should make vm-bhyve do the right thing again when using the ports version, rather than the latest version not in ports. Relnotes: yes Added: stable/12/sys/modules/if_tuntap/ - copied from r347241, head/sys/modules/if_tuntap/ stable/12/sys/net/if_tuntap.c - copied, changed from r354059, stable/12/sys/net/if_tun.c Deleted: stable/12/sys/modules/if_tap/ stable/12/sys/modules/if_tun/ stable/12/sys/net/if_tap.c stable/12/sys/net/if_tapvar.h stable/12/sys/net/if_tun.c Modified: stable/12/UPDATING stable/12/sbin/ifconfig/ifconfig.c stable/12/share/man/man4/tap.4 stable/12/share/man/man4/tun.4 stable/12/sys/amd64/conf/GENERIC stable/12/sys/amd64/conf/MINIMAL stable/12/sys/arm/conf/DOCKSTAR stable/12/sys/arm/conf/DREAMPLUG-1001 stable/12/sys/arm/conf/EFIKA_MX stable/12/sys/arm/conf/IMX53 stable/12/sys/arm/conf/IMX6 stable/12/sys/arm/conf/TEGRA124 stable/12/sys/arm64/conf/GENERIC stable/12/sys/conf/NOTES stable/12/sys/conf/files stable/12/sys/i386/conf/GENERIC stable/12/sys/mips/conf/ERL stable/12/sys/mips/conf/OCTEON1 stable/12/sys/modules/Makefile stable/12/sys/modules/if_tuntap/Makefile stable/12/sys/net/if_tap.h stable/12/sys/powerpc/conf/GENERIC stable/12/sys/powerpc/conf/GENERIC64 stable/12/sys/powerpc/conf/MPC85XX stable/12/sys/powerpc/conf/MPC85XXSPE stable/12/sys/powerpc/conf/QORIQ64 stable/12/sys/riscv/conf/GENERIC stable/12/sys/sparc64/conf/GENERIC Directory Properties: stable/12/ (props changed) Modified: stable/12/UPDATING ============================================================================== --- stable/12/UPDATING Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/UPDATING Fri Oct 25 01:10:08 2019 (r354060) @@ -16,6 +16,14 @@ from older versions of FreeBSD, try WITHOUT_CLANG and the tip of head, and then rebuild without this option. The bootstrap process from older version of current across the gcc/clang cutover is a bit fragile. +20191024: + The tap(4) driver has been folded into tun(4), and the module has been + renamed to tuntap. You should update any kld_load="if_tap" or + kld_load="if_tun" entries in /etc/rc.conf, if_tap_load="YES" or + if_tun_load="YES" entries in /boot/loader.conf to load the if_tuntap + module instead, and "device tap" or "device tun" entries in kernel + config files to select the tuntap device instead. + 20190913: ntpd no longer by default locks its pages in memory, allowing them to be paged out by the kernel. Use rlimit memlock to restore Modified: stable/12/sbin/ifconfig/ifconfig.c ============================================================================== --- stable/12/sbin/ifconfig/ifconfig.c Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sbin/ifconfig/ifconfig.c Fri Oct 25 01:10:08 2019 (r354060) @@ -136,8 +136,16 @@ static struct module_map_entry { const char *kldname; } module_map[] = { { + .ifname = "tun", + .kldname = "if_tuntap", + }, + { + .ifname = "tap", + .kldname = "if_tuntap", + }, + { .ifname = "vmnet", - .kldname = "if_tap", + .kldname = "if_tuntap", }, { .ifname = "ipsec", Modified: stable/12/share/man/man4/tap.4 ============================================================================== --- stable/12/share/man/man4/tap.4 Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/share/man/man4/tap.4 Fri Oct 25 01:10:08 2019 (r354060) @@ -1,14 +1,14 @@ .\" $FreeBSD$ .\" Based on PR#2411 .\" -.Dd November 29, 2017 +.Dd April 29, 2019 .Dt TAP 4 .Os .Sh NAME .Nm tap .Nd Ethernet tunnel software network interface .Sh SYNOPSIS -.Cd device tap +.Cd device tuntap .Sh DESCRIPTION The .Nm @@ -51,7 +51,7 @@ The network interfaces are named .Dq Li tap1 , etc., one for each control device that has been opened. These Ethernet network interfaces persist until -.Pa if_tap.ko +.Pa if_tuntap.ko module is unloaded, or until removed with "ifconfig destroy" (see below). .Pp .Nm @@ -96,7 +96,7 @@ It therefore defaults to being enabled until further n .Ef .Pp Control devices (once successfully opened) persist until -.Pa if_tap.ko +.Pa if_tuntap.ko is unloaded or the interface is destroyed. .Pp Each interface supports the usual Ethernet network interface @@ -296,27 +296,6 @@ device can also be used with the VMware port as a repl for the old .Em VMnet device driver. -The driver uses the minor number -to select between -.Nm -and -.Nm vmnet -devices. -.Em VMnet -minor numbers begin at -.Va 0x800000 -+ -.Va N ; -where -.Va N -is a -.Em VMnet -unit number. -In this case the control device is expected to be -.Pa /dev/vmnet Ns Sy N , -and the network interface will be -.Sy vmnet Ns Ar N . -Additionally, .Em VMnet devices do not .Xr ifconfig 8 Modified: stable/12/share/man/man4/tun.4 ============================================================================== --- stable/12/share/man/man4/tun.4 Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/share/man/man4/tun.4 Fri Oct 25 01:10:08 2019 (r354060) @@ -2,14 +2,14 @@ .\" $FreeBSD$ .\" Based on PR#2411 .\" -.Dd November 29, 2017 +.Dd April 29, 2019 .Dt TUN 4 .Os .Sh NAME .Nm tun .Nd tunnel software network interface .Sh SYNOPSIS -.Cd device tun +.Cd device tuntap .Sh DESCRIPTION The .Nm @@ -52,7 +52,7 @@ The network interfaces are named .Dq Li tun1 , etc., one for each control device that has been opened. These network interfaces persist until the -.Pa if_tun.ko +.Pa if_tuntap.ko module is unloaded, or until removed with the .Xr ifconfig 8 command. @@ -99,7 +99,7 @@ It therefore defaults to being enabled until further n .Ef .Pp Control devices (once successfully opened) persist until -.Pa if_tun.ko +.Pa if_tuntap.ko is unloaded in the same way that network interfaces persist (see above). .Pp Each interface supports the usual network-interface Modified: stable/12/sys/amd64/conf/GENERIC ============================================================================== --- stable/12/sys/amd64/conf/GENERIC Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/amd64/conf/GENERIC Fri Oct 25 01:10:08 2019 (r354060) @@ -308,7 +308,7 @@ device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG device ether # Ethernet support device vlan # 802.1Q VLAN support -device tun # Packet tunnel. +device tuntap # Packet tunnel. device md # Memory "disks" device gif # IPv6 and IPv4 tunneling device firmware # firmware assist module Modified: stable/12/sys/amd64/conf/MINIMAL ============================================================================== --- stable/12/sys/amd64/conf/MINIMAL Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/amd64/conf/MINIMAL Fri Oct 25 01:10:08 2019 (r354060) @@ -125,7 +125,7 @@ device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG device ether # Ethernet support device vlan # 802.1Q VLAN support -device tun # Packet tunnel. +device tuntap # Packet tunnel. device gif # IPv6 and IPv4 tunneling # The `bpf' device enables the Berkeley Packet Filter. Modified: stable/12/sys/arm/conf/DOCKSTAR ============================================================================== --- stable/12/sys/arm/conf/DOCKSTAR Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/arm/conf/DOCKSTAR Fri Oct 25 01:10:08 2019 (r354060) @@ -69,7 +69,7 @@ device loop # Network loopback device md # Memory/malloc disk device pty # BSD-style compatibility pseudo ttys device random # Entropy device -device tun # Packet tunnel. +device tuntap # Packet tunnel. device ether # Required for all ethernet devices device vlan # 802.1Q VLAN support device wlan # 802.11 WLAN support Modified: stable/12/sys/arm/conf/DREAMPLUG-1001 ============================================================================== --- stable/12/sys/arm/conf/DREAMPLUG-1001 Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/arm/conf/DREAMPLUG-1001 Fri Oct 25 01:10:08 2019 (r354060) @@ -72,7 +72,7 @@ device loop # Network loopback device md # Memory/malloc disk device pty # BSD-style compatibility pseudo ttys device random # Entropy device -device tun # Packet tunnel. +device tuntap # Packet tunnel. device ether # Required for all ethernet devices device vlan # 802.1Q VLAN support device wlan # 802.11 WLAN support Modified: stable/12/sys/arm/conf/EFIKA_MX ============================================================================== --- stable/12/sys/arm/conf/EFIKA_MX Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/arm/conf/EFIKA_MX Fri Oct 25 01:10:08 2019 (r354060) @@ -60,7 +60,7 @@ device loop # Network loopback device random # Entropy device device ether # Ethernet support #device vlan # 802.1Q VLAN support -#device tun # Packet tunnel. +#device tuntap # Packet tunnel. #device md # Memory "disks" #device gif # IPv6 and IPv4 tunneling #device firmware # firmware assist module Modified: stable/12/sys/arm/conf/IMX53 ============================================================================== --- stable/12/sys/arm/conf/IMX53 Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/arm/conf/IMX53 Fri Oct 25 01:10:08 2019 (r354060) @@ -47,7 +47,7 @@ device loop # Network loopback device random # Entropy device device ether # Ethernet support #device vlan # 802.1Q VLAN support -#device tun # Packet tunnel. +#device tuntap # Packet tunnel. device md # Memory "disks" #device gif # IPv6 and IPv4 tunneling #device firmware # firmware assist module Modified: stable/12/sys/arm/conf/IMX6 ============================================================================== --- stable/12/sys/arm/conf/IMX6 Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/arm/conf/IMX6 Fri Oct 25 01:10:08 2019 (r354060) @@ -51,7 +51,7 @@ device mpcore_timer device loop # Network loopback device random # Entropy device device vlan # 802.1Q VLAN support -device tun # Packet tunnel. +device tuntap # Packet tunnel. device md # Memory "disks" #device gif # IPv6 and IPv4 tunneling #device firmware # firmware assist module Modified: stable/12/sys/arm/conf/TEGRA124 ============================================================================== --- stable/12/sys/arm/conf/TEGRA124 Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/arm/conf/TEGRA124 Fri Oct 25 01:10:08 2019 (r354060) @@ -45,7 +45,7 @@ device regulator device loop # Network loopback device random # Entropy device device vlan # 802.1Q VLAN support -#device tun # Packet tunnel. +#device tuntap # Packet tunnel. device md # Memory "disks" #device gif # IPv6 and IPv4 tunneling device firmware # firmware assist module Modified: stable/12/sys/arm64/conf/GENERIC ============================================================================== --- stable/12/sys/arm64/conf/GENERIC Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/arm64/conf/GENERIC Fri Oct 25 01:10:08 2019 (r354060) @@ -271,7 +271,7 @@ device loop # Network loopback device random # Entropy device device ether # Ethernet support device vlan # 802.1Q VLAN support -device tun # Packet tunnel. +device tuntap # Packet tunnel. device md # Memory "disks" device gif # IPv6 and IPv4 tunneling device firmware # firmware assist module Modified: stable/12/sys/conf/NOTES ============================================================================== --- stable/12/sys/conf/NOTES Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/conf/NOTES Fri Oct 25 01:10:08 2019 (r354060) @@ -895,11 +895,9 @@ device epair # which discards all packets sent and receives none. device edsc -# The `tap' device is a pty-like virtual Ethernet interface -device tap - -# The `tun' device implements (user-)ppp and nos-tun(8) -device tun +# The `tuntap' device implements (user-)ppp, nos-tun(8) and a pty-like virtual +# Ethernet interface +device tuntap # The `gif' device implements IPv6 over IP4 tunneling, # IPv4 over IPv6 tunneling, IPv4 over IPv4 tunneling and Modified: stable/12/sys/conf/files ============================================================================== --- stable/12/sys/conf/files Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/conf/files Fri Oct 25 01:10:08 2019 (r354060) @@ -4152,8 +4152,7 @@ net/if_mib.c standard net/if_spppfr.c optional sppp | netgraph_sppp net/if_spppsubr.c optional sppp | netgraph_sppp net/if_stf.c optional stf inet inet6 -net/if_tun.c optional tun -net/if_tap.c optional tap +net/if_tuntap.c optional tuntap net/if_vlan.c optional vlan net/if_vxlan.c optional vxlan inet | vxlan inet6 net/ifdi_if.m optional ether pci iflib Modified: stable/12/sys/i386/conf/GENERIC ============================================================================== --- stable/12/sys/i386/conf/GENERIC Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/i386/conf/GENERIC Fri Oct 25 01:10:08 2019 (r354060) @@ -309,7 +309,7 @@ device padlock_rng # VIA Padlock RNG device rdrand_rng # Intel Bull Mountain RNG device ether # Ethernet support device vlan # 802.1Q VLAN support -device tun # Packet tunnel. +device tuntap # Packet tunnel. device md # Memory "disks" device gif # IPv6 and IPv4 tunneling device firmware # firmware assist module Modified: stable/12/sys/mips/conf/ERL ============================================================================== --- stable/12/sys/mips/conf/ERL Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/mips/conf/ERL Fri Oct 25 01:10:08 2019 (r354060) @@ -151,7 +151,7 @@ device loop # Network loopback device random # Entropy device device ether # Ethernet support device vlan # 802.1Q VLAN support -device tun # Packet tunnel. +device tuntap # Packet tunnel. device md # Memory "disks" device gif # IPv6 and IPv4 tunneling device firmware # firmware assist module Modified: stable/12/sys/mips/conf/OCTEON1 ============================================================================== --- stable/12/sys/mips/conf/OCTEON1 Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/mips/conf/OCTEON1 Fri Oct 25 01:10:08 2019 (r354060) @@ -256,7 +256,7 @@ device loop # Network loopback device random # Entropy device device ether # Ethernet support device vlan # 802.1Q VLAN support -device tun # Packet tunnel. +device tuntap # Packet tunnel. device md # Memory "disks" device gif # IPv6 and IPv4 tunneling device firmware # firmware assist module Modified: stable/12/sys/modules/Makefile ============================================================================== --- stable/12/sys/modules/Makefile Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/modules/Makefile Fri Oct 25 01:10:08 2019 (r354060) @@ -170,8 +170,7 @@ SUBDIR= \ if_lagg \ ${_if_ndis} \ ${_if_stf} \ - if_tap \ - if_tun \ + if_tuntap \ if_vlan \ if_vxlan \ iflib \ Modified: stable/12/sys/modules/if_tuntap/Makefile ============================================================================== --- head/sys/modules/if_tuntap/Makefile Wed May 8 02:32:11 2019 (r347241) +++ stable/12/sys/modules/if_tuntap/Makefile Fri Oct 25 01:10:08 2019 (r354060) @@ -31,5 +31,4 @@ alias_debug: .PHONY .endif .endif - .include Modified: stable/12/sys/net/if_tap.h ============================================================================== --- stable/12/sys/net/if_tap.h Fri Oct 25 00:47:37 2019 (r354059) +++ stable/12/sys/net/if_tap.h Fri Oct 25 01:10:08 2019 (r354060) @@ -40,24 +40,22 @@ #ifndef _NET_IF_TAP_H_ #define _NET_IF_TAP_H_ -/* refer to if_tapvar.h for the softc stuff */ +#include /* maximum receive packet size (hard limit) */ #define TAPMRU 16384 -struct tapinfo { - int baudrate; /* linespeed */ - short mtu; /* maximum transmission unit */ - u_char type; /* ethernet, tokenring, etc. */ - u_char dummy; /* place holder */ -}; +#define tapinfo tuninfo -/* ioctl's for get/set debug */ -#define TAPSDEBUG _IOW('t', 90, int) -#define TAPGDEBUG _IOR('t', 89, int) -#define TAPSIFINFO _IOW('t', 91, struct tapinfo) -#define TAPGIFINFO _IOR('t', 92, struct tapinfo) -#define TAPGIFNAME _IOR('t', 93, struct ifreq) +/* + * ioctl's for get/set debug; these are aliases of TUN* ioctls, see net/if_tun.h + * for details. + */ +#define TAPSDEBUG TUNSDEBUG +#define TAPGDEBUG TUNGDEBUG +#define TAPSIFINFO TUNSIFINFO +#define TAPGIFINFO TUNGIFINFO +#define TAPGIFNAME TUNGIFNAME /* VMware ioctl's */ #define VMIO_SIOCSIFFLAGS _IOWINT('V', 0) Copied and modified: stable/12/sys/net/if_tuntap.c (from r354059, stable/12/sys/net/if_tun.c) ============================================================================== --- stable/12/sys/net/if_tun.c Fri Oct 25 00:47:37 2019 (r354059, copy source) +++ stable/12/sys/net/if_tuntap.c Fri Oct 25 01:10:08 2019 (r354060) @@ -1,6 +1,36 @@ /* $NetBSD: if_tun.c,v 1.14 1994/06/29 06:36:25 cgd Exp $ */ - /*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (C) 1999-2000 by Maksim Yevmenkin + * All rights reserved. + * Copyright (c) 2019 Kyle Evans + * + * 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. + * + * BASED ON: + * ------------------------------------------------------------------------- + * * Copyright (c) 1988, Julian Onions * Nottingham University 1987. * @@ -46,9 +76,12 @@ #include #include +#include #include #include #include +#include +#include #include #include #include @@ -57,89 +90,131 @@ #include #endif #include +#include #include #include #include - #include +struct tuntap_driver; + /* * tun_list is protected by global tunmtx. Other mutable fields are * protected by tun->tun_mtx, or by their owning subsystem. tun_dev is * static for the duration of a tunnel interface. */ -struct tun_softc { - TAILQ_ENTRY(tun_softc) tun_list; - struct cdev *tun_dev; - u_short tun_flags; /* misc flags */ +struct tuntap_softc { + TAILQ_ENTRY(tuntap_softc) tun_list; + struct cdev *tun_alias; + struct cdev *tun_dev; + u_short tun_flags; /* misc flags */ #define TUN_OPEN 0x0001 #define TUN_INITED 0x0002 -#define TUN_RCOLL 0x0004 -#define TUN_IASET 0x0008 +#define TUN_UNUSED1 0x0008 #define TUN_DSTADDR 0x0010 #define TUN_LMODE 0x0020 #define TUN_RWAIT 0x0040 #define TUN_ASYNC 0x0080 #define TUN_IFHEAD 0x0100 #define TUN_DYING 0x0200 +#define TUN_L2 0x0400 +#define TUN_VMNET 0x0800 -#define TUN_READY (TUN_OPEN | TUN_INITED) +#define TUN_DRIVER_IDENT_MASK (TUN_L2 | TUN_VMNET) +#define TUN_READY (TUN_OPEN | TUN_INITED) - pid_t tun_pid; /* owning pid */ - struct ifnet *tun_ifp; /* the interface */ - struct sigio *tun_sigio; /* information for async I/O */ - struct selinfo tun_rsel; /* read select */ - struct mtx tun_mtx; /* protect mutable softc fields */ - struct cv tun_cv; /* protect against ref'd dev destroy */ + pid_t tun_pid; /* owning pid */ + struct ifnet *tun_ifp; /* the interface */ + struct sigio *tun_sigio; /* async I/O info */ + struct tuntap_driver *tun_drv; /* appropriate driver */ + struct selinfo tun_rsel; /* read select */ + struct mtx tun_mtx; /* softc field mutex */ + struct cv tun_cv; /* for ref'd dev destroy */ + struct ether_addr tun_ether; /* remote address */ + int tun_busy; /* busy count */ }; -#define TUN2IFP(sc) ((sc)->tun_ifp) +#define TUN2IFP(sc) ((sc)->tun_ifp) -#define TUNDEBUG if (tundebug) if_printf +#define TUNDEBUG if (tundebug) if_printf +#define TUN_LOCK(tp) mtx_lock(&(tp)->tun_mtx) +#define TUN_UNLOCK(tp) mtx_unlock(&(tp)->tun_mtx) +#define TUN_LOCK_ASSERT(tp) mtx_assert(&(tp)->tun_mtx, MA_OWNED); + +#define TUN_VMIO_FLAG_MASK 0x0fff + /* * All mutable global variables in if_tun are locked using tunmtx, with - * the exception of tundebug, which is used unlocked, and tunclones, - * which is static after setup. + * the exception of tundebug, which is used unlocked, and the drivers' *clones, + * which are static after setup. */ static struct mtx tunmtx; -static eventhandler_tag tag; +static eventhandler_tag arrival_tag; +static eventhandler_tag clone_tag; static const char tunname[] = "tun"; +static const char tapname[] = "tap"; +static const char vmnetname[] = "vmnet"; static MALLOC_DEFINE(M_TUN, tunname, "Tunnel Interface"); static int tundebug = 0; static int tundclone = 1; -static struct clonedevs *tunclones; -static TAILQ_HEAD(,tun_softc) tunhead = TAILQ_HEAD_INITIALIZER(tunhead); +static int tap_allow_uopen = 0; /* allow user open() */ +static int tapuponopen = 0; /* IFF_UP on open() */ +static int tapdclone = 1; /* enable devfs cloning */ + +static TAILQ_HEAD(,tuntap_softc) tunhead = TAILQ_HEAD_INITIALIZER(tunhead); SYSCTL_INT(_debug, OID_AUTO, if_tun_debug, CTLFLAG_RW, &tundebug, 0, ""); static struct sx tun_ioctl_sx; SX_SYSINIT(tun_ioctl_sx, &tun_ioctl_sx, "tun_ioctl"); SYSCTL_DECL(_net_link); +/* tun */ static SYSCTL_NODE(_net_link, OID_AUTO, tun, CTLFLAG_RW, 0, - "IP tunnel software network interface."); + "IP tunnel software network interface"); SYSCTL_INT(_net_link_tun, OID_AUTO, devfs_cloning, CTLFLAG_RWTUN, &tundclone, 0, - "Enable legacy devfs interface creation."); + "Enable legacy devfs interface creation"); +/* tap */ +static SYSCTL_NODE(_net_link, OID_AUTO, tap, CTLFLAG_RW, 0, + "Ethernet tunnel software network interface"); +SYSCTL_INT(_net_link_tap, OID_AUTO, user_open, CTLFLAG_RW, &tap_allow_uopen, 0, + "Allow user to open /dev/tap (based on node permissions)"); +SYSCTL_INT(_net_link_tap, OID_AUTO, up_on_open, CTLFLAG_RW, &tapuponopen, 0, + "Bring interface up when /dev/tap is opened"); +SYSCTL_INT(_net_link_tap, OID_AUTO, devfs_cloning, CTLFLAG_RWTUN, &tapdclone, 0, + "Enable legacy devfs interface creation"); +SYSCTL_INT(_net_link_tap, OID_AUTO, debug, CTLFLAG_RW, &tundebug, 0, ""); + +static int tun_create_device(struct tuntap_driver *drv, int unit, + struct ucred *cr, struct cdev **dev, const char *name); +static int tun_busy_locked(struct tuntap_softc *tp); +static void tun_unbusy_locked(struct tuntap_softc *tp); +static int tun_busy(struct tuntap_softc *tp); +static void tun_unbusy(struct tuntap_softc *tp); + +static int tuntap_name2info(const char *name, int *unit, int *flags); static void tunclone(void *arg, struct ucred *cred, char *name, int namelen, struct cdev **dev); -static void tuncreate(const char *name, struct cdev *dev); +static void tuncreate(struct cdev *dev); +static void tundtor(void *data); +static void tunrename(void *arg, struct ifnet *ifp); static int tunifioctl(struct ifnet *, u_long, caddr_t); static void tuninit(struct ifnet *); -static int tunmodevent(module_t, int, void *); +static void tunifinit(void *xtp); +static int tuntapmodevent(module_t, int, void *); static int tunoutput(struct ifnet *, struct mbuf *, const struct sockaddr *, struct route *ro); static void tunstart(struct ifnet *); +static void tunstart_l2(struct ifnet *); static int tun_clone_match(struct if_clone *ifc, const char *name); +static int tap_clone_match(struct if_clone *ifc, const char *name); +static int vmnet_clone_match(struct if_clone *ifc, const char *name); static int tun_clone_create(struct if_clone *, char *, size_t, caddr_t); static int tun_clone_destroy(struct if_clone *, struct ifnet *); -static struct unrhdr *tun_unrhdr; -VNET_DEFINE_STATIC(struct if_clone *, tun_cloner); -#define V_tun_cloner VNET(tun_cloner) static d_open_t tunopen; -static d_close_t tunclose; static d_read_t tunread; static d_write_t tunwrite; static d_ioctl_t tunioctl; @@ -164,59 +239,295 @@ static struct filterops tun_write_filterops = { .f_event = tunkqwrite, }; -static struct cdevsw tun_cdevsw = { - .d_version = D_VERSION, - .d_flags = D_NEEDMINOR, - .d_open = tunopen, - .d_close = tunclose, - .d_read = tunread, - .d_write = tunwrite, - .d_ioctl = tunioctl, - .d_poll = tunpoll, - .d_kqfilter = tunkqfilter, - .d_name = tunname, +static struct tuntap_driver { + struct cdevsw cdevsw; + int ident_flags; + struct unrhdr *unrhdr; + struct clonedevs *clones; + ifc_match_t *clone_match_fn; + ifc_create_t *clone_create_fn; + ifc_destroy_t *clone_destroy_fn; +} tuntap_drivers[] = { + { + .ident_flags = 0, + .cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDMINOR, + .d_open = tunopen, + .d_read = tunread, + .d_write = tunwrite, + .d_ioctl = tunioctl, + .d_poll = tunpoll, + .d_kqfilter = tunkqfilter, + .d_name = tunname, + }, + .clone_match_fn = tun_clone_match, + .clone_create_fn = tun_clone_create, + .clone_destroy_fn = tun_clone_destroy, + }, + { + .ident_flags = TUN_L2, + .cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDMINOR, + .d_open = tunopen, + .d_read = tunread, + .d_write = tunwrite, + .d_ioctl = tunioctl, + .d_poll = tunpoll, + .d_kqfilter = tunkqfilter, + .d_name = tapname, + }, + .clone_match_fn = tap_clone_match, + .clone_create_fn = tun_clone_create, + .clone_destroy_fn = tun_clone_destroy, + }, + { + .ident_flags = TUN_L2 | TUN_VMNET, + .cdevsw = { + .d_version = D_VERSION, + .d_flags = D_NEEDMINOR, + .d_open = tunopen, + .d_read = tunread, + .d_write = tunwrite, + .d_ioctl = tunioctl, + .d_poll = tunpoll, + .d_kqfilter = tunkqfilter, + .d_name = vmnetname, + }, + .clone_match_fn = vmnet_clone_match, + .clone_create_fn = tun_clone_create, + .clone_destroy_fn = tun_clone_destroy, + }, }; +struct tuntap_driver_cloner { + SLIST_ENTRY(tuntap_driver_cloner) link; + struct tuntap_driver *drv; + struct if_clone *cloner; +}; + +VNET_DEFINE_STATIC(SLIST_HEAD(, tuntap_driver_cloner), tuntap_driver_cloners) = + SLIST_HEAD_INITIALIZER(tuntap_driver_cloners); + +#define V_tuntap_driver_cloners VNET(tuntap_driver_cloners) + +/* + * Mechanism for marking a tunnel device as busy so that we can safely do some + * orthogonal operations (such as operations on devices) without racing against + * tun_destroy. tun_destroy will wait on the condvar if we're at all busy or + * open, to be woken up when the condition is alleviated. + */ static int +tun_busy_locked(struct tuntap_softc *tp) +{ + + TUN_LOCK_ASSERT(tp); + if ((tp->tun_flags & TUN_DYING) != 0) { + /* + * Perhaps unintuitive, but the device is busy going away. + * Other interpretations of EBUSY from tun_busy make little + * sense, since making a busy device even more busy doesn't + * sound like a problem. + */ + return (EBUSY); + } + + ++tp->tun_busy; + return (0); +} + +static void +tun_unbusy_locked(struct tuntap_softc *tp) +{ + + TUN_LOCK_ASSERT(tp); + KASSERT(tp->tun_busy != 0, ("tun_unbusy: called for non-busy tunnel")); + + --tp->tun_busy; + /* Wake up anything that may be waiting on our busy tunnel. */ + if (tp->tun_busy == 0) + cv_broadcast(&tp->tun_cv); +} + +static int +tun_busy(struct tuntap_softc *tp) +{ + int ret; + + TUN_LOCK(tp); + ret = tun_busy_locked(tp); + TUN_UNLOCK(tp); + return (ret); +} + + +static void +tun_unbusy(struct tuntap_softc *tp) +{ + + TUN_LOCK(tp); + tun_unbusy_locked(tp); + TUN_UNLOCK(tp); +} + +/* + * Sets unit and/or flags given the device name. Must be called with correct + * vnet context. + */ +static int +tuntap_name2info(const char *name, int *outunit, int *outflags) +{ + struct tuntap_driver *drv; + struct tuntap_driver_cloner *drvc; + char *dname; + int flags, unit; + bool found; + + if (name == NULL) + return (EINVAL); + + /* + * Needed for dev_stdclone, but dev_stdclone will not modify, it just + * wants to be able to pass back a char * through the second param. We + * will always set that as NULL here, so we'll fake it. + */ + dname = __DECONST(char *, name); + found = false; + + KASSERT(!SLIST_EMPTY(&V_tuntap_driver_cloners), + ("tuntap_driver_cloners failed to initialize")); + SLIST_FOREACH(drvc, &V_tuntap_driver_cloners, link) { + KASSERT(drvc->drv != NULL, + ("tuntap_driver_cloners entry not properly initialized")); + drv = drvc->drv; + + if (strcmp(name, drv->cdevsw.d_name) == 0) { + found = true; + unit = -1; + flags = drv->ident_flags; + break; + } + + if (dev_stdclone(dname, NULL, drv->cdevsw.d_name, &unit) == 1) { + found = true; + flags = drv->ident_flags; + break; + } + } + + if (!found) + return (ENXIO); + + if (outunit != NULL) + *outunit = unit; + if (outflags != NULL) + *outflags = flags; + return (0); +} + +/* + * Get driver information from a set of flags specified. Masks the identifying + * part of the flags and compares it against all of the available + * tuntap_drivers. Must be called with correct vnet context. + */ +static struct tuntap_driver * +tuntap_driver_from_flags(int tun_flags) +{ + struct tuntap_driver *drv; + struct tuntap_driver_cloner *drvc; + + KASSERT(!SLIST_EMPTY(&V_tuntap_driver_cloners), + ("tuntap_driver_cloners failed to initialize")); + SLIST_FOREACH(drvc, &V_tuntap_driver_cloners, link) { + KASSERT(drvc->drv != NULL, + ("tuntap_driver_cloners entry not properly initialized")); + drv = drvc->drv; + if ((tun_flags & TUN_DRIVER_IDENT_MASK) == drv->ident_flags) + return (drv); + } + + return (NULL); +} + + + +static int tun_clone_match(struct if_clone *ifc, const char *name) { - if (strncmp(tunname, name, 3) == 0 && - (name[3] == '\0' || isdigit(name[3]))) - return (1); + int tunflags; + if (tuntap_name2info(name, NULL, &tunflags) == 0) { + if ((tunflags & TUN_L2) == 0) + return (1); + } + return (0); } static int +tap_clone_match(struct if_clone *ifc, const char *name) +{ + int tunflags; + + if (tuntap_name2info(name, NULL, &tunflags) == 0) { + if ((tunflags & (TUN_L2 | TUN_VMNET)) == TUN_L2) + return (1); + } + + return (0); +} + +static int +vmnet_clone_match(struct if_clone *ifc, const char *name) +{ + int tunflags; + + if (tuntap_name2info(name, NULL, &tunflags) == 0) { + if ((tunflags & TUN_VMNET) != 0) + return (1); + } + + return (0); +} + +static int tun_clone_create(struct if_clone *ifc, char *name, size_t len, caddr_t params) { + struct tuntap_driver *drv; struct cdev *dev; - int err, unit, i; + int err, i, tunflags, unit; - err = ifc_name2unit(name, &unit); + tunflags = 0; + /* The name here tells us exactly what we're creating */ + err = tuntap_name2info(name, &unit, &tunflags); if (err != 0) return (err); + drv = tuntap_driver_from_flags(tunflags); + if (drv == NULL) + return (ENXIO); + if (unit != -1) { - /* If this unit number is still available that/s okay. */ - if (alloc_unr_specific(tun_unrhdr, unit) == -1) + /* If this unit number is still available that's okay. */ + if (alloc_unr_specific(drv->unrhdr, unit) == -1) return (EEXIST); } else { - unit = alloc_unr(tun_unrhdr); + unit = alloc_unr(drv->unrhdr); } - snprintf(name, IFNAMSIZ, "%s%d", tunname, unit); + snprintf(name, IFNAMSIZ, "%s%d", drv->cdevsw.d_name, unit); /* find any existing device, or allocate new unit number */ - i = clone_create(&tunclones, &tun_cdevsw, &unit, &dev, 0); - if (i) { - /* No preexisting struct cdev *, create one */ - dev = make_dev(&tun_cdevsw, unit, - UID_UUCP, GID_DIALER, 0600, "%s%d", tunname, unit); - } - tuncreate(tunname, dev); + dev = NULL; + i = clone_create(&drv->clones, &drv->cdevsw, &unit, &dev, 0); + /* No preexisting struct cdev *, create one */ + if (i != 0) + i = tun_create_device(drv, unit, NULL, &dev, name); + if (i == 0) + tuncreate(dev); - return (0); + return (i); } static void @@ -224,76 +535,91 @@ tunclone(void *arg, struct ucred *cred, char *name, in struct cdev **dev) { char devname[SPECNAMELEN + 1]; - int u, i, append_unit; + struct tuntap_driver *drv; + int append_unit, i, u, tunflags; + bool mayclone; if (*dev != NULL) return; + tunflags = 0; + CURVNET_SET(CRED_TO_VNET(cred)); + if (tuntap_name2info(name, &u, &tunflags) != 0) + goto out; /* Not recognized */ + + if (u != -1 && u > IF_MAXUNIT) + goto out; /* Unit number too high */ + + mayclone = priv_check_cred(cred, PRIV_NET_IFCREATE, 0) == 0; + if ((tunflags & TUN_L2) != 0) { + /* tap/vmnet allow user open with a sysctl */ + mayclone = (mayclone || tap_allow_uopen) && tapdclone; + } else { + mayclone = mayclone && tundclone; + } + /* * If tun cloning is enabled, only the superuser can create an * interface. */ - if (!tundclone || priv_check_cred(cred, PRIV_NET_IFCREATE, 0) != 0) - return; + if (!mayclone) + goto out; - if (strcmp(name, tunname) == 0) { - u = -1; - } else if (dev_stdclone(name, NULL, tunname, &u) != 1) - return; /* Don't recognise the name */ - if (u != -1 && u > IF_MAXUNIT) - return; /* Unit number too high */ - if (u == -1) append_unit = 1; else append_unit = 0; - CURVNET_SET(CRED_TO_VNET(cred)); + drv = tuntap_driver_from_flags(tunflags); + if (drv == NULL) + goto out; + /* find any existing device, or allocate new unit number */ - i = clone_create(&tunclones, &tun_cdevsw, &u, dev, 0); + i = clone_create(&drv->clones, &drv->cdevsw, &u, dev, 0); if (i) { if (append_unit) { namelen = snprintf(devname, sizeof(devname), "%s%d", name, u); name = devname; } - /* No preexisting struct cdev *, create one */ - *dev = make_dev_credf(MAKEDEV_REF, &tun_cdevsw, u, cred, - UID_UUCP, GID_DIALER, 0600, "%s", name); - } - if_clone_create(name, namelen, NULL); + i = tun_create_device(drv, u, cred, dev, name); + } + if (i == 0) + if_clone_create(name, namelen, NULL); +out: CURVNET_RESTORE(); } static void -tun_destroy(struct tun_softc *tp) +tun_destroy(struct tuntap_softc *tp) { - struct cdev *dev; - mtx_lock(&tp->tun_mtx); + TUN_LOCK(tp); tp->tun_flags |= TUN_DYING; - if ((tp->tun_flags & TUN_OPEN) != 0) + if (tp->tun_busy != 0) cv_wait_unlock(&tp->tun_cv, &tp->tun_mtx); else - mtx_unlock(&tp->tun_mtx); + TUN_UNLOCK(tp); CURVNET_SET(TUN2IFP(tp)->if_vnet); - dev = tp->tun_dev; - bpfdetach(TUN2IFP(tp)); - if_detach(TUN2IFP(tp)); - + /* destroy_dev will take care of any alias. */ + destroy_dev(tp->tun_dev); + seldrain(&tp->tun_rsel); + knlist_clear(&tp->tun_rsel.si_note, 0); + knlist_destroy(&tp->tun_rsel.si_note); *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-all@freebsd.org Fri Oct 25 09:19:16 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8042C16B49F; Fri, 25 Oct 2019 09:19:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zz842q6gz4GJ6; Fri, 25 Oct 2019 09:19:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3F500243B2; Fri, 25 Oct 2019 09:19:16 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9P9JGST002521; Fri, 25 Oct 2019 09:19:16 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9P9JG9i002520; Fri, 25 Oct 2019 09:19:16 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910250919.x9P9JG9i002520@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 09:19:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354062 - head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/zfs X-SVN-Commit-Revision: 354062 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 09:19:16 -0000 Author: avg Date: Fri Oct 25 09:19:15 2019 New Revision: 354062 URL: https://svnweb.freebsd.org/changeset/base/354062 Log: zfs.8: fix a typo in the date Reported by: Trond Endrestøl MFC after: 3 days Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Oct 25 04:44:17 2019 (r354061) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 Fri Oct 25 09:19:15 2019 (r354062) @@ -32,7 +32,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Octover 16, 2019 +.Dd October 16, 2019 .Dt ZFS 8 .Os .Sh NAME From owner-svn-src-all@freebsd.org Fri Oct 25 09:23:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7A0FB16B701; Fri, 25 Oct 2019 09:23:54 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zzFQ2bStz4Gfy; Fri, 25 Oct 2019 09:23:54 +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 3C5172457E; Fri, 25 Oct 2019 09:23:54 +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 x9P9Ns2N008146; Fri, 25 Oct 2019 09:23:54 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9P9Nsme008145; Fri, 25 Oct 2019 09:23:54 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910250923.x9P9Nsme008145@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 09:23:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354063 - stable/12/sys/dev/gpio X-SVN-Group: stable-12 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/12/sys/dev/gpio X-SVN-Commit-Revision: 354063 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 09:23:54 -0000 Author: avg Date: Fri Oct 25 09:23:53 2019 New Revision: 354063 URL: https://svnweb.freebsd.org/changeset/base/354063 Log: MFC r353727: gpioiic: add the detach method Modified: stable/12/sys/dev/gpio/gpioiic.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/gpio/gpioiic.c ============================================================================== --- stable/12/sys/dev/gpio/gpioiic.c Fri Oct 25 09:19:15 2019 (r354062) +++ stable/12/sys/dev/gpio/gpioiic.c Fri Oct 25 09:23:53 2019 (r354063) @@ -143,6 +143,15 @@ gpioiic_attach(device_t dev) return (0); } +static int +gpioiic_detach(device_t dev) +{ + + bus_generic_detach(dev); + device_delete_children(dev); + return (0); +} + /* * Reset bus by setting SDA first and then SCL. * Must always be called with gpio bus locked. @@ -241,7 +250,7 @@ static device_method_t gpioiic_methods[] = { /* Device interface */ DEVMETHOD(device_probe, gpioiic_probe), DEVMETHOD(device_attach, gpioiic_attach), - DEVMETHOD(device_detach, bus_generic_detach), + DEVMETHOD(device_detach, gpioiic_detach), /* iicbb interface */ DEVMETHOD(iicbb_setsda, gpioiic_setsda), From owner-svn-src-all@freebsd.org Fri Oct 25 09:24:42 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 34BFD16B78D; Fri, 25 Oct 2019 09:24:42 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zzGL0d1Vz4GnB; Fri, 25 Oct 2019 09:24:42 +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 ECDB52457F; Fri, 25 Oct 2019 09:24:41 +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 x9P9OfVp008241; Fri, 25 Oct 2019 09:24:41 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9P9Ofeu008240; Fri, 25 Oct 2019 09:24:41 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910250924.x9P9Ofeu008240@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 09:24:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354064 - stable/11/sys/dev/gpio X-SVN-Group: stable-11 X-SVN-Commit-Author: avg X-SVN-Commit-Paths: stable/11/sys/dev/gpio X-SVN-Commit-Revision: 354064 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 09:24:42 -0000 Author: avg Date: Fri Oct 25 09:24:41 2019 New Revision: 354064 URL: https://svnweb.freebsd.org/changeset/base/354064 Log: MFC r353727: gpioiic: add the detach method Modified: stable/11/sys/dev/gpio/gpioiic.c Directory Properties: stable/11/ (props changed) Modified: stable/11/sys/dev/gpio/gpioiic.c ============================================================================== --- stable/11/sys/dev/gpio/gpioiic.c Fri Oct 25 09:23:53 2019 (r354063) +++ stable/11/sys/dev/gpio/gpioiic.c Fri Oct 25 09:24:41 2019 (r354064) @@ -141,6 +141,15 @@ gpioiic_attach(device_t dev) return (0); } +static int +gpioiic_detach(device_t dev) +{ + + bus_generic_detach(dev); + device_delete_children(dev); + return (0); +} + /* * Reset bus by setting SDA first and then SCL. * Must always be called with gpio bus locked. @@ -239,7 +248,7 @@ static device_method_t gpioiic_methods[] = { /* Device interface */ DEVMETHOD(device_probe, gpioiic_probe), DEVMETHOD(device_attach, gpioiic_attach), - DEVMETHOD(device_detach, bus_generic_detach), + DEVMETHOD(device_detach, gpioiic_detach), /* iicbb interface */ DEVMETHOD(iicbb_setsda, gpioiic_setsda), From owner-svn-src-all@freebsd.org Fri Oct 25 09:37:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6403716BCFE; Fri, 25 Oct 2019 09:37:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 46zzYb243xz4HdL; Fri, 25 Oct 2019 09:37:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2A3B824743; Fri, 25 Oct 2019 09:37:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9P9btUH014621; Fri, 25 Oct 2019 09:37:55 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9P9btoi014620; Fri, 25 Oct 2019 09:37:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910250937.x9P9btoi014620@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 09:37:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354065 - head/sys/dev/gpio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/gpio X-SVN-Commit-Revision: 354065 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 09:37:55 -0000 Author: avg Date: Fri Oct 25 09:37:54 2019 New Revision: 354065 URL: https://svnweb.freebsd.org/changeset/base/354065 Log: gpioiic: set output after switching to output mode if presetting it failed Some controllers cannot preset future output value while the pin is in input mode. This adds a fallback for those controllers. The new code assumes that a controller reports an error in that case. For example, all hardware supported by nctgpio behaves in that way. This is a temporary measure. In the future we will use GPIO_PIN_PRESET_LOW / GPIO_PIN_PRESET_HIGH to preset the output either in hardware, if supported, or in software (e.g., in gpiobus_pin_setflags). While here, I extracted common functionality of gpioiic_set{sda,scl} and gpioiic_get{sda,scl} to gpioiic_setpin and gpioiic_getpin respectively. MFC after: 2 weeks Modified: head/sys/dev/gpio/gpioiic.c Modified: head/sys/dev/gpio/gpioiic.c ============================================================================== --- head/sys/dev/gpio/gpioiic.c Fri Oct 25 09:24:41 2019 (r354064) +++ head/sys/dev/gpio/gpioiic.c Fri Oct 25 09:37:54 2019 (r354065) @@ -168,59 +168,67 @@ gpioiic_reset_bus(device_t dev) } static void -gpioiic_setsda(device_t dev, int val) +gpioiic_setpin(struct gpioiic_softc *sc, int pin, int val) { - struct gpioiic_softc *sc = device_get_softc(dev); + int err; if (val == 0) { - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, 0); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, + err = GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0); + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_OUTPUT); + + /* + * Some controllers cannot set output value while a pin is in + * input mode. + */ + if (err != 0) + GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0); } else { - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_INPUT); } } static void +gpioiic_setsda(device_t dev, int val) +{ + struct gpioiic_softc *sc = device_get_softc(dev); + + gpioiic_setpin(sc, sc->sda_pin, val); +} + +static void gpioiic_setscl(device_t dev, int val) { struct gpioiic_softc *sc = device_get_softc(dev); - if (val == 0) { - GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, 0); - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, - GPIO_PIN_OUTPUT); - } else { - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, - GPIO_PIN_INPUT); - } + gpioiic_setpin(sc, sc->scl_pin, val); } static int -gpioiic_getscl(device_t dev) +gpioiic_getpin(struct gpioiic_softc *sc, int pin) { - struct gpioiic_softc *sc = device_get_softc(dev); unsigned int val; - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin, - GPIO_PIN_INPUT); - GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, &val); - + GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_INPUT); + GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, pin, &val); return ((int)val); } static int -gpioiic_getsda(device_t dev) +gpioiic_getscl(device_t dev) { struct gpioiic_softc *sc = device_get_softc(dev); - unsigned int val; - GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin, - GPIO_PIN_INPUT); - GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, &val); + return (gpioiic_getpin(sc, sc->scl_pin)); +} - return ((int)val); +static int +gpioiic_getsda(device_t dev) +{ + struct gpioiic_softc *sc = device_get_softc(dev); + + return (gpioiic_getpin(sc, sc->sda_pin)); } static int From owner-svn-src-all@freebsd.org Fri Oct 25 12:46:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECC371704C6; Fri, 25 Oct 2019 12:46:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4703kk5zJzz4T83; Fri, 25 Oct 2019 12:46:06 +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 ABB3E268E9; Fri, 25 Oct 2019 12:46:06 +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 x9PCk60S027825; Fri, 25 Oct 2019 12:46:06 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PCk6E7027824; Fri, 25 Oct 2019 12:46:06 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <201910251246.x9PCk6E7027824@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 25 Oct 2019 12:46:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354066 - stable/12 X-SVN-Group: stable-12 X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: stable/12 X-SVN-Commit-Revision: 354066 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 12:46:07 -0000 Author: kevans Date: Fri Oct 25 12:46:06 2019 New Revision: 354066 URL: https://svnweb.freebsd.org/changeset/base/354066 Log: MFC r352387: Fix if_tuntap UPDATING entry Reported by: yuripv [originally] Reported by: Helge Oldach (freebsd@oldach.net) [this time] Modified: stable/12/UPDATING Directory Properties: stable/12/ (props changed) Modified: stable/12/UPDATING ============================================================================== --- stable/12/UPDATING Fri Oct 25 09:37:54 2019 (r354065) +++ stable/12/UPDATING Fri Oct 25 12:46:06 2019 (r354066) @@ -18,8 +18,8 @@ from older version of current across the gcc/clang cut 20191024: The tap(4) driver has been folded into tun(4), and the module has been - renamed to tuntap. You should update any kld_load="if_tap" or - kld_load="if_tun" entries in /etc/rc.conf, if_tap_load="YES" or + renamed to tuntap. You should update any kld_list="if_tap" or + kld_list="if_tun" entries in /etc/rc.conf, if_tap_load="YES" or if_tun_load="YES" entries in /boot/loader.conf to load the if_tuntap module instead, and "device tap" or "device tun" entries in kernel config files to select the tuntap device instead. From owner-svn-src-all@freebsd.org Fri Oct 25 12:46:53 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 22794170578; Fri, 25 Oct 2019 12:46:53 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4703ld03F5z4TLZ; Fri, 25 Oct 2019 12:46:53 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id CB977138BA; Fri, 25 Oct 2019 12:46:52 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f179.google.com with SMTP id e14so3047465qto.1; Fri, 25 Oct 2019 05:46:52 -0700 (PDT) X-Gm-Message-State: APjAAAU4+nMhR07vW/oDkm+Iwpbth0OzUKzH0O0cNY3M2I27hVIomhOn HqhG1rUJP+yObNVjkdtGK07d/nJrj0l95lAMxxM= X-Google-Smtp-Source: APXvYqyvu2y0UuSP0kf522l6qPSgV3NSy7O0EdwQjHmr2RU2L4T4aXHrir+1edtlI73FK0jecxYxw/oUBvQqnxcBdYM= X-Received: by 2002:ac8:411b:: with SMTP id q27mr2879059qtl.53.1572007612175; Fri, 25 Oct 2019 05:46:52 -0700 (PDT) MIME-Version: 1.0 References: <201910250110.x9P1A8bl014107@repo.freebsd.org> <201910250450.x9P4oX9Q078873@nuc.oldach.net> In-Reply-To: <201910250450.x9P4oX9Q078873@nuc.oldach.net> From: Kyle Evans Date: Fri, 25 Oct 2019 07:46:39 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r354060 - in stable/12: . sbin/ifconfig share/man/man4 sys/amd64/conf sys/arm/conf sys/arm64/conf sys/conf sys/i386/ To: Helge Oldach Cc: src-committers , svn-src-all , svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 12:46:53 -0000 On Thu, Oct 24, 2019 at 11:50 PM Helge Oldach wrote: > > Hi, > > Kyle Evans wrote on Fri, 25 Oct 2019 03:10:08 +0200 (CEST): > > Author: kevans > > Date: Fri Oct 25 01:10:08 2019 > > New Revision: 354060 > > URL: https://svnweb.freebsd.org/changeset/base/354060 > > > > Log: > > MFC tun/tap merge: r347241, r347394, r347404, r347483, r351220, r351229, > > r352148, r353056-r353057, r353781-r353782, r353785-r353786, r353877 > > > Modified: stable/12/UPDATING > > ============================================================================== > > --- stable/12/UPDATING Fri Oct 25 00:47:37 2019 (r354059) > > +++ stable/12/UPDATING Fri Oct 25 01:10:08 2019 (r354060) > > @@ -16,6 +16,14 @@ from older versions of FreeBSD, try WITHOUT_CLANG and > > the tip of head, and then rebuild without this option. The bootstrap process > > from older version of current across the gcc/clang cutover is a bit fragile. > > > > +20191024: > > + The tap(4) driver has been folded into tun(4), and the module has been > > + renamed to tuntap. You should update any kld_load="if_tap" or > > + kld_load="if_tun" entries in /etc/rc.conf, if_tap_load="YES" or > > + if_tun_load="YES" entries in /boot/loader.conf to load the if_tuntap > > + module instead, and "device tap" or "device tun" entries in kernel > > + config files to select the tuntap device instead. > > + > > Should the /etc/rc.conf reference read kld_list instead of kld_load? > Ah, but of course I would do it a second time. Fixed in r354066- thanks! From owner-svn-src-all@freebsd.org Fri Oct 25 13:42:37 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 74C381713AC; Fri, 25 Oct 2019 13:42:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4704zx2T02z4Wgy; Fri, 25 Oct 2019 13:42:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 38DDA27382; Fri, 25 Oct 2019 13:42:37 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PDgbFu063165; Fri, 25 Oct 2019 13:42:37 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PDgbS8063164; Fri, 25 Oct 2019 13:42:37 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251342.x9PDgbS8063164@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 13:42:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354067 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354067 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 13:42:37 -0000 Author: avg Date: Fri Oct 25 13:42:36 2019 New Revision: 354067 URL: https://svnweb.freebsd.org/changeset/base/354067 Log: ow_temp: drop the lock around a call that can sleep This is similar to what is done around other calls that lead to own_command_wait() that can sleep. Reviewed by: imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22107 Modified: head/sys/dev/ow/ow_temp.c Modified: head/sys/dev/ow/ow_temp.c ============================================================================== --- head/sys/dev/ow/ow_temp.c Fri Oct 25 12:46:06 2019 (r354066) +++ head/sys/dev/ow/ow_temp.c Fri Oct 25 13:42:36 2019 (r354067) @@ -143,7 +143,9 @@ ow_temp_event_thread(void *arg) pause("owtstart", device_get_unit(sc->dev) * hz / 100); // 10ms stagger mtx_lock(&sc->temp_lock); sc->flags |= OW_TEMP_RUNNING; + mtx_unlock(&sc->temp_lock); ow_temp_read_power_supply(sc->dev, &sc->parasite); + mtx_lock(&sc->temp_lock); if (sc->parasite) device_printf(sc->dev, "Running in parasitic mode unsupported\n"); while ((sc->flags & OW_TEMP_DONE) == 0) { From owner-svn-src-all@freebsd.org Fri Oct 25 13:47:18 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 920DD171490; Fri, 25 Oct 2019 13:47:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47055L2rwwz4WsR; Fri, 25 Oct 2019 13:47:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 41E9727387; Fri, 25 Oct 2019 13:47:18 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PDlI3F063452; Fri, 25 Oct 2019 13:47:18 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PDlH4k063451; Fri, 25 Oct 2019 13:47:17 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251347.x9PDlH4k063451@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 13:47:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354068 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354068 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 13:47:18 -0000 Author: avg Date: Fri Oct 25 13:47:17 2019 New Revision: 354068 URL: https://svnweb.freebsd.org/changeset/base/354068 Log: ow_temp: better scopes for the lock The lock is used only for start / stop signaling. It is used only for 'flags' field and the related condition variable. This change is a follow-up to r354067, it was suggested by Warner in D22107. Suggested by: imp MFC after: 1 week Modified: head/sys/dev/ow/ow_temp.c Modified: head/sys/dev/ow/ow_temp.c ============================================================================== --- head/sys/dev/ow/ow_temp.c Fri Oct 25 13:42:36 2019 (r354067) +++ head/sys/dev/ow/ow_temp.c Fri Oct 25 13:47:17 2019 (r354068) @@ -145,9 +145,9 @@ ow_temp_event_thread(void *arg) sc->flags |= OW_TEMP_RUNNING; mtx_unlock(&sc->temp_lock); ow_temp_read_power_supply(sc->dev, &sc->parasite); - mtx_lock(&sc->temp_lock); if (sc->parasite) device_printf(sc->dev, "Running in parasitic mode unsupported\n"); + mtx_lock(&sc->temp_lock); while ((sc->flags & OW_TEMP_DONE) == 0) { mtx_unlock(&sc->temp_lock); ow_temp_convert_t(sc->dev); @@ -155,10 +155,9 @@ ow_temp_event_thread(void *arg) msleep(sc, &sc->temp_lock, 0, "owtcvt", hz); if (sc->flags & OW_TEMP_DONE) break; + mtx_unlock(&sc->temp_lock); for (retries = 5; retries > 0; retries--) { - mtx_unlock(&sc->temp_lock); rv = ow_temp_read_scratchpad(sc->dev, scratch, sizeof(scratch)); - mtx_lock(&sc->temp_lock); if (rv == 0) { crc = own_crc(sc->dev, scratch, sizeof(scratch) - 1); if (crc == scratch[8]) { @@ -182,6 +181,7 @@ ow_temp_event_thread(void *arg) } else sc->bad_reads++; } + mtx_lock(&sc->temp_lock); msleep(sc, &sc->temp_lock, 0, "owtcvt", sc->reading_interval); } sc->flags &= ~OW_TEMP_RUNNING; From owner-svn-src-all@freebsd.org Fri Oct 25 14:21:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D1A1171F6F; Fri, 25 Oct 2019 14:21:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4705rD1Pxlz4Yj0; Fri, 25 Oct 2019 14:21:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 151D427916; Fri, 25 Oct 2019 14:21:00 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PEKxtc083903; Fri, 25 Oct 2019 14:20:59 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PEKxxS083902; Fri, 25 Oct 2019 14:20:59 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251420.x9PEKxxS083902@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 14:20:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354069 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354069 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 14:21:00 -0000 Author: avg Date: Fri Oct 25 14:20:59 2019 New Revision: 354069 URL: https://svnweb.freebsd.org/changeset/base/354069 Log: owc_gpiobus_read_data: disable preemption earlier Now this is done before starting the low pulse that has rather tight timing. Reviewed by: imp (D22108) MFC after: 2 weeks Modified: head/sys/dev/ow/owc_gpiobus.c Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 13:47:17 2019 (r354068) +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 14:20:59 2019 (r354069) @@ -279,6 +279,8 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * if (error != 0) return (error); + critical_enter(); + /* Force low for t_lowr microseconds */ then = sbinuptime(); OUTPIN(sc); @@ -291,7 +293,6 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * * master's pushing the line low. */ INPIN(sc); - critical_enter(); do { now = sbinuptime(); GETPIN(sc, &sample); From owner-svn-src-all@freebsd.org Fri Oct 25 14:30:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B22D17227A; Fri, 25 Oct 2019 14:30:28 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4706376ykfz4Z8W; Fri, 25 Oct 2019 14:30:27 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE1A527AA6; Fri, 25 Oct 2019 14:30:27 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PEURiV087323; Fri, 25 Oct 2019 14:30:27 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PEURH4087322; Fri, 25 Oct 2019 14:30:27 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910251430.x9PEURH4087322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 25 Oct 2019 14:30:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354070 - head/sys/arm64/arm64 X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/arm64 X-SVN-Commit-Revision: 354070 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 14:30:28 -0000 Author: andrew Date: Fri Oct 25 14:30:27 2019 New Revision: 354070 URL: https://svnweb.freebsd.org/changeset/base/354070 Log: Make special register names lowercase so they don't conflict with future ID register macros. MFC after: 2 weeks Sponsored by: DARPA, AFRL Modified: head/sys/arm64/arm64/identcpu.c Modified: head/sys/arm64/arm64/identcpu.c ============================================================================== --- head/sys/arm64/arm64/identcpu.c Fri Oct 25 14:20:59 2019 (r354069) +++ head/sys/arm64/arm64/identcpu.c Fri Oct 25 14:30:27 2019 (r354070) @@ -1187,15 +1187,15 @@ identify_cpu(void) cpu_desc[cpu].mpidr = get_mpidr(); CPU_AFFINITY(cpu) = cpu_desc[cpu].mpidr & CPU_AFF_MASK; - cpu_desc[cpu].id_aa64dfr0 = READ_SPECIALREG(ID_AA64DFR0_EL1); - cpu_desc[cpu].id_aa64dfr1 = READ_SPECIALREG(ID_AA64DFR1_EL1); - cpu_desc[cpu].id_aa64isar0 = READ_SPECIALREG(ID_AA64ISAR0_EL1); - cpu_desc[cpu].id_aa64isar1 = READ_SPECIALREG(ID_AA64ISAR1_EL1); - cpu_desc[cpu].id_aa64mmfr0 = READ_SPECIALREG(ID_AA64MMFR0_EL1); - cpu_desc[cpu].id_aa64mmfr1 = READ_SPECIALREG(ID_AA64MMFR1_EL1); - cpu_desc[cpu].id_aa64mmfr2 = READ_SPECIALREG(ID_AA64MMFR2_EL1); - cpu_desc[cpu].id_aa64pfr0 = READ_SPECIALREG(ID_AA64PFR0_EL1); - cpu_desc[cpu].id_aa64pfr1 = READ_SPECIALREG(ID_AA64PFR1_EL1); + cpu_desc[cpu].id_aa64dfr0 = READ_SPECIALREG(id_aa64dfr0_el1); + cpu_desc[cpu].id_aa64dfr1 = READ_SPECIALREG(id_aa64dfr1_el1); + cpu_desc[cpu].id_aa64isar0 = READ_SPECIALREG(id_aa64isar0_el1); + cpu_desc[cpu].id_aa64isar1 = READ_SPECIALREG(id_aa64isar1_el1); + cpu_desc[cpu].id_aa64mmfr0 = READ_SPECIALREG(id_aa64mmfr0_el1); + cpu_desc[cpu].id_aa64mmfr1 = READ_SPECIALREG(id_aa64mmfr1_el1); + cpu_desc[cpu].id_aa64mmfr2 = READ_SPECIALREG(id_aa64mmfr2_el1); + cpu_desc[cpu].id_aa64pfr0 = READ_SPECIALREG(id_aa64pfr0_el1); + cpu_desc[cpu].id_aa64pfr1 = READ_SPECIALREG(id_aa64pfr1_el1); if (cpu != 0) { /* From owner-svn-src-all@freebsd.org Fri Oct 25 14:33:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 14FC817242F; Fri, 25 Oct 2019 14:33:08 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47066C6pjKz4ZVY; Fri, 25 Oct 2019 14:33:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD94327C6E; Fri, 25 Oct 2019 14:33:07 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PEX7q2092939; Fri, 25 Oct 2019 14:33:07 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PEX70S092938; Fri, 25 Oct 2019 14:33:07 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910251433.x9PEX70S092938@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 25 Oct 2019 14:33:07 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354071 - stable/12/sys/ufs/ffs X-SVN-Group: stable-12 X-SVN-Commit-Author: markj X-SVN-Commit-Paths: stable/12/sys/ufs/ffs X-SVN-Commit-Revision: 354071 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 14:33:08 -0000 Author: markj Date: Fri Oct 25 14:33:07 2019 New Revision: 354071 URL: https://svnweb.freebsd.org/changeset/base/354071 Log: MFC r353733: Abbreviate softdep lock names. Modified: stable/12/sys/ufs/ffs/ffs_softdep.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/ufs/ffs/ffs_softdep.c ============================================================================== --- stable/12/sys/ufs/ffs/ffs_softdep.c Fri Oct 25 14:30:27 2019 (r354070) +++ stable/12/sys/ufs/ffs/ffs_softdep.c Fri Oct 25 14:33:07 2019 (r354071) @@ -975,7 +975,7 @@ static int softdep_count_dependencies(struct buf *bp, * Global lock over all of soft updates. */ static struct mtx lk; -MTX_SYSINIT(softdep_lock, &lk, "Global Softdep Lock", MTX_DEF); +MTX_SYSINIT(softdep_lock, &lk, "global softdep", MTX_DEF); #define ACQUIRE_GBLLOCK(lk) mtx_lock(lk) #define FREE_GBLLOCK(lk) mtx_unlock(lk) @@ -2478,7 +2478,7 @@ softdep_mount(devvp, mp, fs, cred) ump = VFSTOUFS(mp); ump->um_softdep = sdp; MNT_IUNLOCK(mp); - rw_init(LOCK_PTR(ump), "Per-Filesystem Softdep Lock"); + rw_init(LOCK_PTR(ump), "per-fs softdep"); sdp->sd_ump = ump; LIST_INIT(&ump->softdep_workitem_pending); LIST_INIT(&ump->softdep_journal_pending); From owner-svn-src-all@freebsd.org Fri Oct 25 14:46:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DA95172846; Fri, 25 Oct 2019 14:46:10 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4706PF6SSsz4bHJ; Fri, 25 Oct 2019 14:46:09 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C23E427E74; Fri, 25 Oct 2019 14:46:09 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PEk9ie098952; Fri, 25 Oct 2019 14:46:09 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PEk9mX098951; Fri, 25 Oct 2019 14:46:09 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <201910251446.x9PEk9mX098951@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Fri, 25 Oct 2019 14:46:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354072 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 354072 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 14:46:10 -0000 Author: andrew Date: Fri Oct 25 14:46:09 2019 New Revision: 354072 URL: https://svnweb.freebsd.org/changeset/base/354072 Log: Remove the arm4 ID register masks, they are not needed after r353641. Sponsored by: DARPA, AFRL Modified: head/sys/arm64/include/armreg.h Modified: head/sys/arm64/include/armreg.h ============================================================================== --- head/sys/arm64/include/armreg.h Fri Oct 25 14:33:07 2019 (r354071) +++ head/sys/arm64/include/armreg.h Fri Oct 25 14:46:09 2019 (r354072) @@ -176,7 +176,6 @@ #define ICC_SRE_EL2_EN (1U << 3) /* ID_AA64DFR0_EL1 */ -#define ID_AA64DFR0_MASK UL(0x0000000ff0f0ffff) #define ID_AA64DFR0_DebugVer_SHIFT 0 #define ID_AA64DFR0_DebugVer_MASK (UL(0xf) << ID_AA64DFR0_DebugVer_SHIFT) #define ID_AA64DFR0_DebugVer(x) ((x) & ID_AA64DFR0_DebugVer_MASK) @@ -214,7 +213,6 @@ #define ID_AA64DFR0_PMSVer_V1 (UL(0x1) << ID_AA64DFR0_PMSVer_SHIFT) /* ID_AA64ISAR0_EL1 */ -#define ID_AA64ISAR0_MASK UL(0x0000fffff0fffff0) #define ID_AA64ISAR0_AES_SHIFT 4 #define ID_AA64ISAR0_AES_MASK (UL(0xf) << ID_AA64ISAR0_AES_SHIFT) #define ID_AA64ISAR0_AES(x) ((x) & ID_AA64ISAR0_AES_MASK) @@ -269,7 +267,6 @@ #define ID_AA64ISAR0_DP_IMPL (UL(0x1) << ID_AA64ISAR0_DP_SHIFT) /* ID_AA64ISAR1_EL1 */ -#define ID_AA64ISAR1_MASK UL(0x00000000ffffffff) #define ID_AA64ISAR1_DPB_SHIFT 0 #define ID_AA64ISAR1_DPB_MASK (UL(0xf) << ID_AA64ISAR1_DPB_SHIFT) #define ID_AA64ISAR1_DPB(x) ((x) & ID_AA64ISAR1_DPB_MASK) @@ -312,7 +309,6 @@ #define ID_AA64ISAR1_GPI_IMPL (UL(0x1) << ID_AA64ISAR1_GPI_SHIFT) /* ID_AA64MMFR0_EL1 */ -#define ID_AA64MMFR0_MASK UL(0x00000000ffffffff) #define ID_AA64MMFR0_PARange_SHIFT 0 #define ID_AA64MMFR0_PARange_MASK (UL(0xf) << ID_AA64MMFR0_PARange_SHIFT) #define ID_AA64MMFR0_PARange(x) ((x) & ID_AA64MMFR0_PARange_MASK) @@ -360,7 +356,6 @@ #define ID_AA64MMFR0_TGran4_NONE (UL(0xf) << ID_AA64MMFR0_TGran4_SHIFT) /* ID_AA64MMFR1_EL1 */ -#define ID_AA64MMFR1_MASK UL(0x00000000ffffffff) #define ID_AA64MMFR1_HAFDBS_SHIFT 0 #define ID_AA64MMFR1_HAFDBS_MASK (UL(0xf) << ID_AA64MMFR1_HAFDBS_SHIFT) #define ID_AA64MMFR1_HAFDBS(x) ((x) & ID_AA64MMFR1_HAFDBS_MASK) @@ -407,7 +402,6 @@ /* ID_AA64MMFR2_EL1 */ #define ID_AA64MMFR2_EL1 S3_0_C0_C7_2 -#define ID_AA64MMFR2_MASK UL(0x000000000fffffff) #define ID_AA64MMFR2_CnP_SHIFT 0 #define ID_AA64MMFR2_CnP_MASK (UL(0xf) << ID_AA64MMFR2_CnP_SHIFT) #define ID_AA64MMFR2_CnP(x) ((x) & ID_AA64MMFR2_CnP_MASK) @@ -445,7 +439,6 @@ #define ID_AA64MMFR2_NV_IMPL (UL(0x1) << ID_AA64MMFR2_NV_SHIFT) /* ID_AA64PFR0_EL1 */ -#define ID_AA64PFR0_MASK UL(0x0000000fffffffff) #define ID_AA64PFR0_EL0_SHIFT 0 #define ID_AA64PFR0_EL0_MASK (UL(0xf) << ID_AA64PFR0_EL0_SHIFT) #define ID_AA64PFR0_EL0(x) ((x) & ID_AA64PFR0_EL0_MASK) From owner-svn-src-all@freebsd.org Fri Oct 25 14:51:23 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 919F1172BAC; Fri, 25 Oct 2019 14:51:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4706WH3MFbz4bZ3; Fri, 25 Oct 2019 14:51:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 569F127FD2; Fri, 25 Oct 2019 14:51:23 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PEpNdQ002433; Fri, 25 Oct 2019 14:51:23 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PEpLvA002425; Fri, 25 Oct 2019 14:51:21 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910251451.x9PEpLvA002425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 25 Oct 2019 14:51:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354073 - in stable/12: share/man/man4 sys/kern sys/powerpc/powernv sys/powerpc/powerpc sys/powerpc/ps3 sys/powerpc/pseries sys/sys sys/x86/x86 X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12: share/man/man4 sys/kern sys/powerpc/powernv sys/powerpc/powerpc sys/powerpc/ps3 sys/powerpc/pseries sys/sys sys/x86/x86 X-SVN-Commit-Revision: 354073 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 14:51:23 -0000 Author: mav Date: Fri Oct 25 14:51:21 2019 New Revision: 354073 URL: https://svnweb.freebsd.org/changeset/base/354073 Log: MFC r342771 (by cem): Expose threads-per-core and physical core count information With new sysctls (to the best of our ability do detect them). Restructured smp.4 slightly for clarity (keep relevant stuff closer to the top) while documenting. Modified: stable/12/share/man/man4/smp.4 stable/12/sys/kern/subr_smp.c stable/12/sys/powerpc/powernv/platform_powernv.c stable/12/sys/powerpc/powerpc/mp_machdep.c stable/12/sys/powerpc/ps3/platform_ps3.c stable/12/sys/powerpc/pseries/platform_chrp.c stable/12/sys/sys/smp.h stable/12/sys/x86/x86/mp_x86.c Directory Properties: stable/12/ (props changed) Modified: stable/12/share/man/man4/smp.4 ============================================================================== --- stable/12/share/man/man4/smp.4 Fri Oct 25 14:46:09 2019 (r354072) +++ stable/12/share/man/man4/smp.4 Fri Oct 25 14:51:21 2019 (r354073) @@ -23,7 +23,7 @@ .\" .\" $FreeBSD$ .\" -.Dd January 6, 2018 +.Dd January 4, 2019 .Dt SMP 4 .Os .Sh NAME @@ -35,27 +35,6 @@ The .Nm kernel implements symmetric multi-processor support. -.Sh COMPATIBILITY -Support for multi-processor systems is present for all Tier-1 -architectures on -.Fx . -Currently, this includes amd64, i386 and sparc64. -Support is enabled using -.Cd options SMP . -It is permissible to use the SMP kernel configuration on non-SMP equipped -motherboards. -.Sh I386 NOTES -For i386 systems, the -.Nm -kernel supports motherboards that follow the Intel MP specification, -version 1.4. -In addition to -.Cd options SMP , -i386 also requires -.Cd device apic . -The -.Xr mptable 1 -command may be used to view the status of multi-processor support. .Pp .Nm support can be disabled by setting the loader tunable @@ -66,6 +45,13 @@ The number of CPUs detected by the system is available the read-only sysctl variable .Va hw.ncpu . .Pp +The number of online threads per CPU core is available in the read-only sysctl +variable +.Va kern.smp.threads_per_core . +The number of physical CPU cores detected by the system is available in the +read-only sysctl variable +.Va kern.smp.cores . +.Pp .Fx allows specific CPUs on a multi-processor system to be disabled. This can be done using the @@ -74,6 +60,12 @@ tunable, where X is the APIC ID of a CPU. Setting this tunable to 1 will result in the corresponding CPU being disabled. .Pp +.Fx +supports simultaneous multithreading on x86 and powerpc platforms. +On x86, the logical CPUs can be disabled by setting the +.Va machdep.hyperthreading_allowed +tunable to zero. +.Pp The .Xr sched_ule 4 scheduler implements CPU topology detection and adjusts the scheduling @@ -122,13 +114,26 @@ two quad-core processors is: .Pp This information is used internally by the kernel to schedule related tasks on CPUs that are closely grouped together. -.Pp -.Fx -supports hyperthreading on Intel CPU's on the i386 and AMD64 platforms. -Because using logical CPUs can cause performance penalties under certain loads, -the logical CPUs can be disabled by setting the -.Va machdep.hyperthreading_allowed -tunable to zero. +.Sh COMPATIBILITY +Support for multi-processor systems is present for all Tier-1 and Tier-2 +architectures on +.Fx . +Currently, this includes x86, powerpc, arm, and sparc64. +Support is enabled using +.Cd options SMP . +It is permissible to use the SMP kernel configuration on non-SMP hardware. +.Sh I386 NOTES +For i386 systems, the +.Nm +kernel supports motherboards that follow the Intel MP specification, +version 1.4. +In addition to +.Cd options SMP , +i386 also requires +.Cd device apic . +The +.Xr mptable 1 +command may be used to view the status of multi-processor support. .Sh SEE ALSO .Xr cpuset 1 , .Xr mptable 1 , @@ -166,3 +171,20 @@ in also introduced support for SMP on the sparc64 architecture. .Sh AUTHORS .An Steve Passe Aq Mt fsmp@FreeBSD.org +.Sh CAVEATS +The +.Va kern.smp.threads_per_core +and +.Va kern.smp.cores +sysctl variables are provided as a best-effort guess. +If an architecture or platform adds SMT and +.Fx +has not yet implemented detection, the reported values may be inaccurate. +In this case, +.Va kern.smp.threads_per_core +will report +.Dv 1 +and +.Va kern.smp.cores +will report the same value as +.Va hw.ncpu . Modified: stable/12/sys/kern/subr_smp.c ============================================================================== --- stable/12/sys/kern/subr_smp.c Fri Oct 25 14:46:09 2019 (r354072) +++ stable/12/sys/kern/subr_smp.c Fri Oct 25 14:51:21 2019 (r354073) @@ -98,6 +98,14 @@ int smp_cpus = 1; /* how many cpu's running */ SYSCTL_INT(_kern_smp, OID_AUTO, cpus, CTLFLAG_RD|CTLFLAG_CAPRD, &smp_cpus, 0, "Number of CPUs online"); +int smp_threads_per_core = 1; /* how many SMT threads are running per core */ +SYSCTL_INT(_kern_smp, OID_AUTO, threads_per_core, CTLFLAG_RD|CTLFLAG_CAPRD, + &smp_threads_per_core, 0, "Number of SMT threads online per core"); + +int mp_ncores = -1; /* how many physical cores running */ +SYSCTL_INT(_kern_smp, OID_AUTO, cores, CTLFLAG_RD|CTLFLAG_CAPRD, &mp_ncores, 0, + "Number of CPUs online"); + int smp_topology = 0; /* Which topology we're using. */ SYSCTL_INT(_kern_smp, OID_AUTO, topology, CTLFLAG_RDTUN, &smp_topology, 0, "Topology override setting; 0 is default provided by hardware."); @@ -154,6 +162,7 @@ mp_start(void *dummy) /* Probe for MP hardware. */ if (smp_disabled != 0 || cpu_mp_probe() == 0) { + mp_ncores = 1; mp_ncpus = 1; CPU_SETOF(PCPU_GET(cpuid), &all_cpus); return; @@ -162,6 +171,11 @@ mp_start(void *dummy) cpu_mp_start(); printf("FreeBSD/SMP: Multiprocessor System Detected: %d CPUs\n", mp_ncpus); + + /* Provide a default for most architectures that don't have SMT/HTT. */ + if (mp_ncores < 0) + mp_ncores = mp_ncpus; + cpu_mp_announce(); } SYSINIT(cpu_mp, SI_SUB_CPU, SI_ORDER_THIRD, mp_start, NULL); @@ -823,6 +837,7 @@ static void mp_setvariables_for_up(void *dummy) { mp_ncpus = 1; + mp_ncores = 1; mp_maxid = PCPU_GET(cpuid); CPU_SETOF(mp_maxid, &all_cpus); KASSERT(PCPU_GET(cpuid) == 0, ("UP must have a CPU ID of zero")); Modified: stable/12/sys/powerpc/powernv/platform_powernv.c ============================================================================== --- stable/12/sys/powerpc/powernv/platform_powernv.c Fri Oct 25 14:46:09 2019 (r354072) +++ stable/12/sys/powerpc/powernv/platform_powernv.c Fri Oct 25 14:51:21 2019 (r354073) @@ -435,12 +435,16 @@ powernv_smp_topo(platform_t plat) break; } + smp_threads_per_core = nthreads; + if (mp_ncpus % nthreads != 0) { printf("WARNING: Irregular SMP topology. Performance may be " "suboptimal (%d threads, %d on first core)\n", mp_ncpus, nthreads); return (smp_topo_none()); } + + mp_ncores = mp_ncpus / nthreads; /* Don't do anything fancier for non-threaded SMP */ if (nthreads == 1) Modified: stable/12/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- stable/12/sys/powerpc/powerpc/mp_machdep.c Fri Oct 25 14:46:09 2019 (r354072) +++ stable/12/sys/powerpc/powerpc/mp_machdep.c Fri Oct 25 14:51:21 2019 (r354073) @@ -182,6 +182,11 @@ cpu_mp_start(void) next: error = platform_smp_next_cpu(&cpu); } + +#ifdef SMP + /* Probe mp_ncores and smp_threads_per_core as a side effect. */ + (void)cpu_topo(); +#endif } void Modified: stable/12/sys/powerpc/ps3/platform_ps3.c ============================================================================== --- stable/12/sys/powerpc/ps3/platform_ps3.c Fri Oct 25 14:46:09 2019 (r354072) +++ stable/12/sys/powerpc/ps3/platform_ps3.c Fri Oct 25 14:51:21 2019 (r354073) @@ -246,6 +246,8 @@ ps3_smp_start_cpu(platform_t plat, struct pcpu *pc) static struct cpu_group * ps3_smp_topo(platform_t plat) { + mp_ncores = 1; + smp_threads_per_core = 2; return (smp_topo_1level(CG_SHARE_L1, 2, CG_FLAG_SMT)); } #endif Modified: stable/12/sys/powerpc/pseries/platform_chrp.c ============================================================================== --- stable/12/sys/powerpc/pseries/platform_chrp.c Fri Oct 25 14:46:09 2019 (r354072) +++ stable/12/sys/powerpc/pseries/platform_chrp.c Fri Oct 25 14:51:21 2019 (r354073) @@ -517,6 +517,8 @@ chrp_smp_topo(platform_t plat) ncpus++; } + mp_ncores = ncores; + if (ncpus % ncores != 0) { printf("WARNING: Irregular SMP topology. Performance may be " "suboptimal (%d CPUS, %d cores)\n", ncpus, ncores); @@ -527,6 +529,7 @@ chrp_smp_topo(platform_t plat) if (ncpus == ncores) return (smp_topo_none()); + smp_threads_per_core = ncpus / ncores; return (smp_topo_1level(CG_SHARE_L1, ncpus / ncores, CG_FLAG_SMT)); } #endif Modified: stable/12/sys/sys/smp.h ============================================================================== --- stable/12/sys/sys/smp.h Fri Oct 25 14:46:09 2019 (r354072) +++ stable/12/sys/sys/smp.h Fri Oct 25 14:51:21 2019 (r354073) @@ -167,8 +167,10 @@ extern cpuset_t logical_cpus_mask; extern u_int mp_maxid; extern int mp_maxcpus; +extern int mp_ncores; extern int mp_ncpus; extern volatile int smp_started; +extern int smp_threads_per_core; extern cpuset_t all_cpus; extern cpuset_t cpuset_domain[MAXMEMDOM]; /* CPUs in each NUMA domain. */ Modified: stable/12/sys/x86/x86/mp_x86.c ============================================================================== --- stable/12/sys/x86/x86/mp_x86.c Fri Oct 25 14:46:09 2019 (r354072) +++ stable/12/sys/x86/x86/mp_x86.c Fri Oct 25 14:51:21 2019 (r354073) @@ -608,6 +608,7 @@ assign_cpu_ids(void) { struct topo_node *node; u_int smt_mask; + int nhyper; smt_mask = (1u << core_id_shift) - 1; @@ -616,6 +617,7 @@ assign_cpu_ids(void) * beyond MAXCPU. CPU 0 is always assigned to the BSP. */ mp_ncpus = 0; + nhyper = 0; TOPO_FOREACH(node, &topo_root) { if (node->type != TOPO_TYPE_PU) continue; @@ -643,6 +645,9 @@ assign_cpu_ids(void) continue; } + if (cpu_info[node->hwid].cpu_hyperthread) + nhyper++; + cpu_apic_ids[mp_ncpus] = node->hwid; apic_cpuids[node->hwid] = mp_ncpus; topo_set_pu_id(node, mp_ncpus); @@ -652,6 +657,9 @@ assign_cpu_ids(void) KASSERT(mp_maxid >= mp_ncpus - 1, ("%s: counters out of sync: max %d, count %d", __func__, mp_maxid, mp_ncpus)); + + mp_ncores = mp_ncpus - nhyper; + smp_threads_per_core = mp_ncpus / mp_ncores; } /* From owner-svn-src-all@freebsd.org Fri Oct 25 14:55:39 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3E9A5172DF9; Fri, 25 Oct 2019 14:55:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4706cC1cSbz4c3Q; Fri, 25 Oct 2019 14:55:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A95028054; Fri, 25 Oct 2019 14:55:39 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PEtcBI004978; Fri, 25 Oct 2019 14:55:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PEtb9U004971; Fri, 25 Oct 2019 14:55:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910251455.x9PEtb9U004971@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 25 Oct 2019 14:55:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354074 - stable/12/sys/dev/nvme X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/dev/nvme X-SVN-Commit-Revision: 354074 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 14:55:39 -0000 Author: mav Date: Fri Oct 25 14:55:37 2019 New Revision: 354074 URL: https://svnweb.freebsd.org/changeset/base/354074 Log: MFC r352630: Make nvme(4) driver some more NUMA aware. - For each queue pair precalculate CPU and domain it is bound to. If queue pairs are not per-CPU, then use the domain of the device. - Allocate most of queue pair memory from the domain it is bound to. - Bind callouts to the same CPUs as queue pair to avoid migrations. - Do not assign queue pairs to each SMT thread. It just wasted resources and increased lock congestions. - Remove fixed multiplier of CPUs per queue pair, spread them even. This allows to use more queue pairs in some hardware configurations. - If queue pair serves multiple CPUs, bind different NVMe devices to different CPUs. Modified: stable/12/sys/dev/nvme/nvme_ahci.c stable/12/sys/dev/nvme/nvme_ctrlr.c stable/12/sys/dev/nvme/nvme_ctrlr_cmd.c stable/12/sys/dev/nvme/nvme_pci.c stable/12/sys/dev/nvme/nvme_private.h stable/12/sys/dev/nvme/nvme_qpair.c stable/12/sys/dev/nvme/nvme_sysctl.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/dev/nvme/nvme_ahci.c ============================================================================== --- stable/12/sys/dev/nvme/nvme_ahci.c Fri Oct 25 14:51:21 2019 (r354073) +++ stable/12/sys/dev/nvme/nvme_ahci.c Fri Oct 25 14:55:37 2019 (r354074) @@ -96,7 +96,6 @@ nvme_ahci_attach(device_t dev) ctrlr->msix_enabled = 0; ctrlr->num_io_queues = 1; - ctrlr->num_cpus_per_ioq = mp_ncpus; if (bus_setup_intr(dev, ctrlr->res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_ctrlr_intx_handler, ctrlr, &ctrlr->tag) != 0) { Modified: stable/12/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- stable/12/sys/dev/nvme/nvme_ctrlr.c Fri Oct 25 14:51:21 2019 (r354073) +++ stable/12/sys/dev/nvme/nvme_ctrlr.c Fri Oct 25 14:55:37 2019 (r354074) @@ -41,6 +41,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include "nvme_private.h" @@ -57,6 +58,9 @@ nvme_ctrlr_construct_admin_qpair(struct nvme_controlle int error; qpair = &ctrlr->adminq; + qpair->id = 0; + qpair->cpu = CPU_FFS(&cpuset_domain[ctrlr->domain]) - 1; + qpair->domain = ctrlr->domain; num_entries = NVME_ADMIN_ENTRIES; TUNABLE_INT_FETCH("hw.nvme.admin_entries", &num_entries); @@ -75,22 +79,21 @@ nvme_ctrlr_construct_admin_qpair(struct nvme_controlle * The admin queue's max xfer size is treated differently than the * max I/O xfer size. 16KB is sufficient here - maybe even less? */ - error = nvme_qpair_construct(qpair, - 0, /* qpair ID */ - 0, /* vector */ - num_entries, - NVME_ADMIN_TRACKERS, - ctrlr); + error = nvme_qpair_construct(qpair, num_entries, NVME_ADMIN_TRACKERS, + ctrlr); return (error); } +#define QP(ctrlr, c) ((c) * (ctrlr)->num_io_queues / mp_ncpus) + static int nvme_ctrlr_construct_io_qpairs(struct nvme_controller *ctrlr) { struct nvme_qpair *qpair; uint32_t cap_lo; uint16_t mqes; - int i, error, num_entries, num_trackers, max_entries; + int c, error, i, n; + int num_entries, num_trackers, max_entries; /* * NVMe spec sets a hard limit of 64K max entries, but devices may @@ -130,32 +133,35 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller */ ctrlr->max_hw_pend_io = num_trackers * ctrlr->num_io_queues * 3 / 4; - /* - * This was calculated previously when setting up interrupts, but - * a controller could theoretically support fewer I/O queues than - * MSI-X vectors. So calculate again here just to be safe. - */ - ctrlr->num_cpus_per_ioq = howmany(mp_ncpus, ctrlr->num_io_queues); - ctrlr->ioq = malloc(ctrlr->num_io_queues * sizeof(struct nvme_qpair), M_NVME, M_ZERO | M_WAITOK); - for (i = 0; i < ctrlr->num_io_queues; i++) { + for (i = c = n = 0; i < ctrlr->num_io_queues; i++, c += n) { qpair = &ctrlr->ioq[i]; /* * Admin queue has ID=0. IO queues start at ID=1 - * hence the 'i+1' here. - * + */ + qpair->id = i + 1; + if (ctrlr->num_io_queues > 1) { + /* Find number of CPUs served by this queue. */ + for (n = 1; QP(ctrlr, c + n) == i; n++) + ; + /* Shuffle multiple NVMe devices between CPUs. */ + qpair->cpu = c + (device_get_unit(ctrlr->dev)+n/2) % n; + qpair->domain = pcpu_find(qpair->cpu)->pc_domain; + } else { + qpair->cpu = CPU_FFS(&cpuset_domain[ctrlr->domain]) - 1; + qpair->domain = ctrlr->domain; + } + + /* * For I/O queues, use the controller-wide max_xfer_size * calculated in nvme_attach(). */ - error = nvme_qpair_construct(qpair, - i+1, /* qpair ID */ - ctrlr->msix_enabled ? i+1 : 0, /* vector */ - num_entries, - num_trackers, - ctrlr); + error = nvme_qpair_construct(qpair, num_entries, num_trackers, + ctrlr); if (error) return (error); @@ -164,8 +170,7 @@ nvme_ctrlr_construct_io_qpairs(struct nvme_controller * interrupt thread for this controller. */ if (ctrlr->num_io_queues > 1) - bus_bind_intr(ctrlr->dev, qpair->res, - i * ctrlr->num_cpus_per_ioq); + bus_bind_intr(ctrlr->dev, qpair->res, qpair->cpu); } return (0); @@ -458,6 +463,8 @@ nvme_ctrlr_set_num_qpairs(struct nvme_controller *ctrl */ ctrlr->num_io_queues = min(ctrlr->num_io_queues, sq_allocated); ctrlr->num_io_queues = min(ctrlr->num_io_queues, cq_allocated); + if (ctrlr->num_io_queues > vm_ndomains) + ctrlr->num_io_queues -= ctrlr->num_io_queues % vm_ndomains; return (0); } @@ -473,7 +480,7 @@ nvme_ctrlr_create_qpairs(struct nvme_controller *ctrlr qpair = &ctrlr->ioq[i]; status.done = 0; - nvme_ctrlr_cmd_create_io_cq(ctrlr, qpair, qpair->vector, + nvme_ctrlr_cmd_create_io_cq(ctrlr, qpair, nvme_completion_poll_cb, &status); nvme_completion_poll(&status); if (nvme_completion_is_error(&status.cpl)) { @@ -1132,6 +1139,8 @@ nvme_ctrlr_construct(struct nvme_controller *ctrlr, de ctrlr->dev = dev; mtx_init(&ctrlr->lock, "nvme ctrlr lock", NULL, MTX_DEF); + if (bus_get_domain(dev, &ctrlr->domain) != 0) + ctrlr->domain = 0; cap_hi = nvme_mmio_read_4(ctrlr, cap_hi); ctrlr->dstrd = NVME_CAP_HI_DSTRD(cap_hi) + 2; @@ -1296,7 +1305,7 @@ nvme_ctrlr_submit_io_request(struct nvme_controller *c { struct nvme_qpair *qpair; - qpair = &ctrlr->ioq[curcpu / ctrlr->num_cpus_per_ioq]; + qpair = &ctrlr->ioq[QP(ctrlr, curcpu)]; nvme_qpair_submit_request(qpair, req); } Modified: stable/12/sys/dev/nvme/nvme_ctrlr_cmd.c ============================================================================== --- stable/12/sys/dev/nvme/nvme_ctrlr_cmd.c Fri Oct 25 14:51:21 2019 (r354073) +++ stable/12/sys/dev/nvme/nvme_ctrlr_cmd.c Fri Oct 25 14:55:37 2019 (r354074) @@ -76,8 +76,7 @@ nvme_ctrlr_cmd_identify_namespace(struct nvme_controll void nvme_ctrlr_cmd_create_io_cq(struct nvme_controller *ctrlr, - struct nvme_qpair *io_que, uint16_t vector, nvme_cb_fn_t cb_fn, - void *cb_arg) + struct nvme_qpair *io_que, nvme_cb_fn_t cb_fn, void *cb_arg) { struct nvme_request *req; struct nvme_command *cmd; @@ -93,7 +92,7 @@ nvme_ctrlr_cmd_create_io_cq(struct nvme_controller *ct */ cmd->cdw10 = htole32(((io_que->num_entries-1) << 16) | io_que->id); /* 0x3 = interrupts enabled | physically contiguous */ - cmd->cdw11 = htole32((vector << 16) | 0x3); + cmd->cdw11 = htole32((io_que->vector << 16) | 0x3); cmd->prp1 = htole64(io_que->cpl_bus_addr); nvme_ctrlr_submit_admin_request(ctrlr, req); Modified: stable/12/sys/dev/nvme/nvme_pci.c ============================================================================== --- stable/12/sys/dev/nvme/nvme_pci.c Fri Oct 25 14:51:21 2019 (r354073) +++ stable/12/sys/dev/nvme/nvme_pci.c Fri Oct 25 14:55:37 2019 (r354074) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -233,7 +234,6 @@ nvme_ctrlr_configure_intx(struct nvme_controller *ctrl ctrlr->msix_enabled = 0; ctrlr->num_io_queues = 1; - ctrlr->num_cpus_per_ioq = mp_ncpus; ctrlr->rid = 0; ctrlr->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, &ctrlr->rid, RF_SHAREABLE | RF_ACTIVE); @@ -259,82 +259,61 @@ static void nvme_ctrlr_setup_interrupts(struct nvme_controller *ctrlr) { device_t dev; - int per_cpu_io_queues; + int force_intx, num_io_queues, per_cpu_io_queues; int min_cpus_per_ioq; int num_vectors_requested, num_vectors_allocated; - int num_vectors_available; dev = ctrlr->dev; - min_cpus_per_ioq = 1; - TUNABLE_INT_FETCH("hw.nvme.min_cpus_per_ioq", &min_cpus_per_ioq); - if (min_cpus_per_ioq < 1) { - min_cpus_per_ioq = 1; - } else if (min_cpus_per_ioq > mp_ncpus) { - min_cpus_per_ioq = mp_ncpus; + force_intx = 0; + TUNABLE_INT_FETCH("hw.nvme.force_intx", &force_intx); + if (force_intx || pci_msix_count(dev) < 2) { + nvme_ctrlr_configure_intx(ctrlr); + return; } + num_io_queues = mp_ncpus; + TUNABLE_INT_FETCH("hw.nvme.num_io_queues", &num_io_queues); + if (num_io_queues < 1 || num_io_queues > mp_ncpus) + num_io_queues = mp_ncpus; + per_cpu_io_queues = 1; TUNABLE_INT_FETCH("hw.nvme.per_cpu_io_queues", &per_cpu_io_queues); + if (per_cpu_io_queues == 0) + num_io_queues = 1; - if (per_cpu_io_queues == 0) { - min_cpus_per_ioq = mp_ncpus; + min_cpus_per_ioq = smp_threads_per_core; + TUNABLE_INT_FETCH("hw.nvme.min_cpus_per_ioq", &min_cpus_per_ioq); + if (min_cpus_per_ioq > 1) { + num_io_queues = min(num_io_queues, + max(1, mp_ncpus / min_cpus_per_ioq)); } - ctrlr->force_intx = 0; - TUNABLE_INT_FETCH("hw.nvme.force_intx", &ctrlr->force_intx); + num_io_queues = min(num_io_queues, pci_msix_count(dev) - 1); - /* - * FreeBSD currently cannot allocate more than about 190 vectors at - * boot, meaning that systems with high core count and many devices - * requesting per-CPU interrupt vectors will not get their full - * allotment. So first, try to allocate as many as we may need to - * understand what is available, then immediately release them. - * Then figure out how many of those we will actually use, based on - * assigning an equal number of cores to each I/O queue. - */ - +again: + if (num_io_queues > vm_ndomains) + num_io_queues -= num_io_queues % vm_ndomains; /* One vector for per core I/O queue, plus one vector for admin queue. */ - num_vectors_available = min(pci_msix_count(dev), mp_ncpus + 1); - if (pci_alloc_msix(dev, &num_vectors_available) != 0) { - num_vectors_available = 0; - } - pci_release_msi(dev); - - if (ctrlr->force_intx || num_vectors_available < 2) { - nvme_ctrlr_configure_intx(ctrlr); - return; - } - - /* - * Do not use all vectors for I/O queues - one must be saved for the - * admin queue. - */ - ctrlr->num_cpus_per_ioq = max(min_cpus_per_ioq, - howmany(mp_ncpus, num_vectors_available - 1)); - - ctrlr->num_io_queues = howmany(mp_ncpus, ctrlr->num_cpus_per_ioq); - num_vectors_requested = ctrlr->num_io_queues + 1; + num_vectors_requested = num_io_queues + 1; num_vectors_allocated = num_vectors_requested; - - /* - * Now just allocate the number of vectors we need. This should - * succeed, since we previously called pci_alloc_msix() - * successfully returning at least this many vectors, but just to - * be safe, if something goes wrong just revert to INTx. - */ if (pci_alloc_msix(dev, &num_vectors_allocated) != 0) { nvme_ctrlr_configure_intx(ctrlr); return; } - - if (num_vectors_allocated < num_vectors_requested) { + if (num_vectors_allocated < 2) { pci_release_msi(dev); nvme_ctrlr_configure_intx(ctrlr); return; } + if (num_vectors_allocated != num_vectors_requested) { + pci_release_msi(dev); + num_io_queues = num_vectors_allocated - 1; + goto again; + } ctrlr->msix_enabled = 1; + ctrlr->num_io_queues = num_io_queues; } static int Modified: stable/12/sys/dev/nvme/nvme_private.h ============================================================================== --- stable/12/sys/dev/nvme/nvme_private.h Fri Oct 25 14:51:21 2019 (r354073) +++ stable/12/sys/dev/nvme/nvme_private.h Fri Oct 25 14:55:37 2019 (r354074) @@ -175,7 +175,8 @@ struct nvme_qpair { struct nvme_controller *ctrlr; uint32_t id; - uint32_t phase; + int domain; + int cpu; uint16_t vector; int rid; @@ -187,6 +188,7 @@ struct nvme_qpair { uint32_t sq_tdbl_off; uint32_t cq_hdbl_off; + uint32_t phase; uint32_t sq_head; uint32_t sq_tail; uint32_t cq_head; @@ -238,7 +240,7 @@ struct nvme_controller { device_t dev; struct mtx lock; - + int domain; uint32_t ready_timeout_in_ms; uint32_t quirks; #define QUIRK_DELAY_B4_CHK_RDY 1 /* Can't touch MMIO on disable */ @@ -258,11 +260,9 @@ struct nvme_controller { struct resource *bar4_resource; uint32_t msix_enabled; - uint32_t force_intx; uint32_t enable_aborts; uint32_t num_io_queues; - uint32_t num_cpus_per_ioq; uint32_t max_hw_pend_io; /* Fields for tracking progress during controller initialization. */ @@ -377,7 +377,7 @@ void nvme_ctrlr_cmd_get_firmware_page(struct nvme_cont nvme_cb_fn_t cb_fn, void *cb_arg); void nvme_ctrlr_cmd_create_io_cq(struct nvme_controller *ctrlr, - struct nvme_qpair *io_que, uint16_t vector, + struct nvme_qpair *io_que, nvme_cb_fn_t cb_fn, void *cb_arg); void nvme_ctrlr_cmd_create_io_sq(struct nvme_controller *ctrlr, struct nvme_qpair *io_que, @@ -413,9 +413,8 @@ void nvme_ctrlr_submit_io_request(struct nvme_controll void nvme_ctrlr_post_failed_request(struct nvme_controller *ctrlr, struct nvme_request *req); -int nvme_qpair_construct(struct nvme_qpair *qpair, uint32_t id, - uint16_t vector, uint32_t num_entries, - uint32_t num_trackers, +int nvme_qpair_construct(struct nvme_qpair *qpair, + uint32_t num_entries, uint32_t num_trackers, struct nvme_controller *ctrlr); void nvme_qpair_submit_tracker(struct nvme_qpair *qpair, struct nvme_tracker *tr); Modified: stable/12/sys/dev/nvme/nvme_qpair.c ============================================================================== --- stable/12/sys/dev/nvme/nvme_qpair.c Fri Oct 25 14:51:21 2019 (r354073) +++ stable/12/sys/dev/nvme/nvme_qpair.c Fri Oct 25 14:55:37 2019 (r354074) @@ -32,6 +32,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include @@ -637,8 +638,8 @@ nvme_qpair_msix_handler(void *arg) } int -nvme_qpair_construct(struct nvme_qpair *qpair, uint32_t id, - uint16_t vector, uint32_t num_entries, uint32_t num_trackers, +nvme_qpair_construct(struct nvme_qpair *qpair, + uint32_t num_entries, uint32_t num_trackers, struct nvme_controller *ctrlr) { struct nvme_tracker *tr; @@ -647,8 +648,7 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint32_ uint8_t *queuemem, *prpmem, *prp_list; int i, err; - qpair->id = id; - qpair->vector = vector; + qpair->vector = ctrlr->msix_enabled ? qpair->id : 0; qpair->num_entries = num_entries; qpair->num_trackers = num_trackers; qpair->ctrlr = ctrlr; @@ -659,19 +659,19 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint32_ * MSI-X vector resource IDs start at 1, so we add one to * the queue's vector to get the corresponding rid to use. */ - qpair->rid = vector + 1; + qpair->rid = qpair->vector + 1; qpair->res = bus_alloc_resource_any(ctrlr->dev, SYS_RES_IRQ, &qpair->rid, RF_ACTIVE); bus_setup_intr(ctrlr->dev, qpair->res, INTR_TYPE_MISC | INTR_MPSAFE, NULL, nvme_qpair_msix_handler, qpair, &qpair->tag); - if (id == 0) { + if (qpair->id == 0) { bus_describe_intr(ctrlr->dev, qpair->res, qpair->tag, "admin"); } else { bus_describe_intr(ctrlr->dev, qpair->res, qpair->tag, - "io%d", id - 1); + "io%d", qpair->id - 1); } } @@ -707,6 +707,7 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint32_ nvme_printf(ctrlr, "tag create failed %d\n", err); goto out; } + bus_dma_tag_set_domain(qpair->dma_tag, qpair->domain); if (bus_dmamem_alloc(qpair->dma_tag, (void **)&queuemem, BUS_DMA_NOWAIT, &qpair->queuemem_map)) { @@ -737,9 +738,9 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint32_ * it to various small values. */ qpair->sq_tdbl_off = nvme_mmio_offsetof(doorbell[0]) + - (id << (ctrlr->dstrd + 1)); + (qpair->id << (ctrlr->dstrd + 1)); qpair->cq_hdbl_off = nvme_mmio_offsetof(doorbell[0]) + - (id << (ctrlr->dstrd + 1)) + (1 << ctrlr->dstrd); + (qpair->id << (ctrlr->dstrd + 1)) + (1 << ctrlr->dstrd); TAILQ_INIT(&qpair->free_tr); TAILQ_INIT(&qpair->outstanding_tr); @@ -765,7 +766,8 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint32_ (uint8_t *)roundup2((uintptr_t)prp_list, PAGE_SIZE); } - tr = malloc(sizeof(*tr), M_NVME, M_ZERO | M_WAITOK); + tr = malloc_domainset(sizeof(*tr), M_NVME, + DOMAINSET_PREF(qpair->domain), M_ZERO | M_WAITOK); bus_dmamap_create(qpair->dma_tag_payload, 0, &tr->payload_dma_map); callout_init(&tr->timer, 1); @@ -783,8 +785,9 @@ nvme_qpair_construct(struct nvme_qpair *qpair, uint32_ goto out; } - qpair->act_tr = malloc(sizeof(struct nvme_tracker *) * - qpair->num_entries, M_NVME, M_ZERO | M_WAITOK); + qpair->act_tr = malloc_domainset(sizeof(struct nvme_tracker *) * + qpair->num_entries, M_NVME, DOMAINSET_PREF(qpair->domain), + M_ZERO | M_WAITOK); return (0); out: @@ -814,14 +817,14 @@ nvme_qpair_destroy(struct nvme_qpair *qpair) } if (qpair->act_tr) - free(qpair->act_tr, M_NVME); + free_domain(qpair->act_tr, M_NVME); while (!TAILQ_EMPTY(&qpair->free_tr)) { tr = TAILQ_FIRST(&qpair->free_tr); TAILQ_REMOVE(&qpair->free_tr, tr, tailq); bus_dmamap_destroy(qpair->dma_tag_payload, tr->payload_dma_map); - free(tr, M_NVME); + free_domain(tr, M_NVME); } if (qpair->dma_tag) @@ -938,8 +941,8 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, st ctrlr = qpair->ctrlr; if (req->timeout) - callout_reset_curcpu(&tr->timer, ctrlr->timeout_period * hz, - nvme_timeout, tr); + callout_reset_on(&tr->timer, ctrlr->timeout_period * hz, + nvme_timeout, tr, qpair->cpu); /* Copy the command from the tracker to the submission queue. */ memcpy(&qpair->cmd[qpair->sq_tail], &req->cmd, sizeof(req->cmd)); Modified: stable/12/sys/dev/nvme/nvme_sysctl.c ============================================================================== --- stable/12/sys/dev/nvme/nvme_sysctl.c Fri Oct 25 14:51:21 2019 (r354073) +++ stable/12/sys/dev/nvme/nvme_sysctl.c Fri Oct 25 14:55:37 2019 (r354074) @@ -306,9 +306,9 @@ nvme_sysctl_initialize_ctrlr(struct nvme_controller *c ctrlr_tree = device_get_sysctl_tree(ctrlr->dev); ctrlr_list = SYSCTL_CHILDREN(ctrlr_tree); - SYSCTL_ADD_UINT(ctrlr_ctx, ctrlr_list, OID_AUTO, "num_cpus_per_ioq", - CTLFLAG_RD, &ctrlr->num_cpus_per_ioq, 0, - "Number of CPUs assigned per I/O queue pair"); + SYSCTL_ADD_UINT(ctrlr_ctx, ctrlr_list, OID_AUTO, "num_io_queues", + CTLFLAG_RD, &ctrlr->num_io_queues, 0, + "Number of I/O queue pairs"); SYSCTL_ADD_PROC(ctrlr_ctx, ctrlr_list, OID_AUTO, "int_coal_time", CTLTYPE_UINT | CTLFLAG_RW, ctrlr, 0, From owner-svn-src-all@freebsd.org Fri Oct 25 15:02:50 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA6481731AC; Fri, 25 Oct 2019 15:02:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4706mV45Kxz4cX3; Fri, 25 Oct 2019 15:02:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6FB9428228; Fri, 25 Oct 2019 15:02:50 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PF2oPk010492; Fri, 25 Oct 2019 15:02:50 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PF2oJc010491; Fri, 25 Oct 2019 15:02:50 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910251502.x9PF2oJc010491@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 25 Oct 2019 15:02:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354075 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 354075 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 15:02:50 -0000 Author: mav Date: Fri Oct 25 15:02:50 2019 New Revision: 354075 URL: https://svnweb.freebsd.org/changeset/base/354075 Log: MFC r353454: Allocate device softc from the device domain. Since we are trying to bind device interrupt threads to the device domain, it should have sense to make memory often accessed by them local. If domain is not known, fall back to round-robin. Modified: stable/12/sys/kern/subr_bus.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/subr_bus.c ============================================================================== --- stable/12/sys/kern/subr_bus.c Fri Oct 25 14:55:37 2019 (r354074) +++ stable/12/sys/kern/subr_bus.c Fri Oct 25 15:02:50 2019 (r354075) @@ -34,6 +34,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -2523,7 +2524,7 @@ void device_set_softc(device_t dev, void *softc) { if (dev->softc && !(dev->flags & DF_EXTERNALSOFTC)) - free(dev->softc, M_BUS_SC); + free_domain(dev->softc, M_BUS_SC); dev->softc = softc; if (dev->softc) dev->flags |= DF_EXTERNALSOFTC; @@ -2540,7 +2541,7 @@ device_set_softc(device_t dev, void *softc) void device_free_softc(void *softc) { - free(softc, M_BUS_SC); + free_domain(softc, M_BUS_SC); } /** @@ -2789,6 +2790,9 @@ device_set_devclass_fixed(device_t dev, const char *cl int device_set_driver(device_t dev, driver_t *driver) { + int domain; + struct domainset *policy; + if (dev->state >= DS_ATTACHED) return (EBUSY); @@ -2796,7 +2800,7 @@ device_set_driver(device_t dev, driver_t *driver) return (0); if (dev->softc && !(dev->flags & DF_EXTERNALSOFTC)) { - free(dev->softc, M_BUS_SC); + free_domain(dev->softc, M_BUS_SC); dev->softc = NULL; } device_set_desc(dev, NULL); @@ -2805,8 +2809,12 @@ device_set_driver(device_t dev, driver_t *driver) if (driver) { kobj_init((kobj_t) dev, (kobj_class_t) driver); if (!(dev->flags & DF_EXTERNALSOFTC) && driver->size > 0) { - dev->softc = malloc(driver->size, M_BUS_SC, - M_NOWAIT | M_ZERO); + if (bus_get_domain(dev, &domain) == 0) + policy = DOMAINSET_PREF(domain); + else + policy = DOMAINSET_RR(); + dev->softc = malloc_domainset(driver->size, M_BUS_SC, + policy, M_NOWAIT | M_ZERO); if (!dev->softc) { kobj_delete((kobj_t) dev, NULL); kobj_init((kobj_t) dev, &null_class); From owner-svn-src-all@freebsd.org Fri Oct 25 15:38:09 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CAD18173B28; Fri, 25 Oct 2019 15:38:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4707YF4z8Mz4drB; Fri, 25 Oct 2019 15:38:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DB6B28770; Fri, 25 Oct 2019 15:38:09 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PFc9vO028314; Fri, 25 Oct 2019 15:38:09 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PFc9ii028313; Fri, 25 Oct 2019 15:38:09 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251538.x9PFc9ii028313@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 15:38:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354076 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354076 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 15:38:09 -0000 Author: avg Date: Fri Oct 25 15:38:09 2019 New Revision: 354076 URL: https://svnweb.freebsd.org/changeset/base/354076 Log: owc_gpiobus_read_data: compare times in sbintime_t units Previously the code used sbttous() before microseconds comparison in one place, sbttons() and nanoseconds in another, division by SBT_1US and microseconds in yet another. Now the code consistently uses multiplication by SBT_1US to convert microseconds to sbintime_t before comparing them with periods between calls to sbinuptime(). This is fast, this is precise enough (below 0.03%) and the periods defined by the protocol cannot overflow. Reviewed by: imp (D22108) MFC after: 2 weeks Modified: head/sys/dev/ow/owc_gpiobus.c Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019 (r354075) +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 (r354076) @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * do { now = sbinuptime(); GETPIN(sc, &sample); - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); critical_exit(); - if (sbttons(now - then) < t->t_rdv * 1000) + if (now - then < t->t_rdv * SBT_1US) *bit = 1; else *bit = 0; @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * /* Wait out the rest of t_slot */ do { now = sbinuptime(); - } while ((now - then) / SBT_1US < t->t_slot); + } while (now - then < t->t_slot * SBT_1US); RELBUS(sc); From owner-svn-src-all@freebsd.org Fri Oct 25 15:39:46 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A4AB4173BD3; Fri, 25 Oct 2019 15:39:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4707b63wMpz4f0J; Fri, 25 Oct 2019 15:39:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69E4028771; Fri, 25 Oct 2019 15:39:46 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PFdk0G028420; Fri, 25 Oct 2019 15:39:46 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PFdk6Y028419; Fri, 25 Oct 2019 15:39:46 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251539.x9PFdk6Y028419@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 15:39:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354077 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354077 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 15:39:46 -0000 Author: avg Date: Fri Oct 25 15:39:46 2019 New Revision: 354077 URL: https://svnweb.freebsd.org/changeset/base/354077 Log: owc_gpiobus_read_data: add recovery time to the read slot Reviewed by: imp MFC after: 2 weeks Modified: head/sys/dev/ow/owc_gpiobus.c Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 (r354076) +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:39:46 2019 (r354077) @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * /* Wait out the rest of t_slot */ do { now = sbinuptime(); - } while (now - then < t->t_slot * SBT_1US); + } while (now - then < (t->t_slot + t->t_rec)* SBT_1US); RELBUS(sc); From owner-svn-src-all@freebsd.org Fri Oct 25 15:46:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AFF8174028; Fri, 25 Oct 2019 15:46:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4707lM2h7pz4g1g; Fri, 25 Oct 2019 15:46:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C6DC2893D; Fri, 25 Oct 2019 15:46:55 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PFktWH034696; Fri, 25 Oct 2019 15:46:55 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PFktG8034695; Fri, 25 Oct 2019 15:46:55 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251546.x9PFktG8034695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 15:46:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354078 - head/sys/dev/ow X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/ow X-SVN-Commit-Revision: 354078 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 15:46:55 -0000 Author: avg Date: Fri Oct 25 15:46:54 2019 New Revision: 354078 URL: https://svnweb.freebsd.org/changeset/base/354078 Log: owc_gpiobus: add missing space in r354077 Modified: head/sys/dev/ow/owc_gpiobus.c Modified: head/sys/dev/ow/owc_gpiobus.c ============================================================================== --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:39:46 2019 (r354077) +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:46:54 2019 (r354078) @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing * /* Wait out the rest of t_slot */ do { now = sbinuptime(); - } while (now - then < (t->t_slot + t->t_rec)* SBT_1US); + } while (now - then < (t->t_slot + t->t_rec) * SBT_1US); RELBUS(sc); From owner-svn-src-all@freebsd.org Fri Oct 25 15:47:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EFB8B174057 for ; Fri, 25 Oct 2019 15:47:04 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4707lX0khTz4g7w for ; Fri, 25 Oct 2019 15:47:03 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1572018422; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=j1ULjZMjYS0stPqOs88zgFfnRUU2kWRw/81VqEqOBnFxwyS53A/l0vu3ylKaX4jDDiY27+6gGD36b im5UUeFIGtbnOvd9ZR6AstiKetCPYoIWwL1F0H3NOFwR+wAbmqD1m8ISNnIbaJnCpNEkk7DuqPQZat XgBqCEoCiUBUCS7pg/uYTXD1fk6Kh1UcxMrTBkuNt1vm7dCpERUrGkUQrwWKmuGh5CthZwB21ZaYue RCt8IZHIiWK0CXG9cElK2iqiGEc7teqEtBrhnGn8ehS9UTcj98IV/cOHRJrVdahd+lC6GNAkx17Xzu pZW3aI0VFKLDCeOYs8guqaVZVVolmUw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=DeOvwX+j/vkqLTfZ6ysoPHwoQy3ark/1CetsbHtK/mM=; b=Ru8PD816A3mcPR195/iBt5mMGOBRXWKAyeNNIwgZ6hDqFTRNK12IRAUMqcZf3G0rNDWK+v47JSOBq vpzco2dzvdke9uOsfByIaCylbc2fFxyqIZ7wY/H552PXsEf9R/3FehgttLpA2cw4Jg3VKhbAoPuqqq zmQGxOE2TnXTsaJw2WSswjy65O9GcK5wovaFLlRAn0twy5jzr1jss2gedcmdnBic4Lq1AnmOwU2quO KHhpBE8wqee8tSRmiab5MynVNSqFfnIkWSsss3xsfoZaZrMsyEt2yXPREu45+kV/IXoOeUwB0+dqGT uw0IQlRyReZFeG5ZA+1yeLIn4xk0lDg== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=DeOvwX+j/vkqLTfZ6ysoPHwoQy3ark/1CetsbHtK/mM=; b=QIQ56jbZDknrHD6EDIibIZNIoXU2tozx7+y/Doo0CQHWfyJ8XcwKc7e2pjildBPBa2AkRaZjm2sR/ m36W7AZH0F+jPNwXpBhx/pteh3bC6eXJTgiRXlhpkLuezFKzK+p4vixzBjmyZO5ygqdD5/KO3heMPd VB7Yg3VoapCATIBytDau9tOPGRRlbk2VWXiS/1ppmmaUqftgtjmrNPxVjFpjqftIZ7KTxQsyoeCTeQ eiX9odOF//EA/Q3UaVd/ky6BjnJC452TCAdr3v475PdcTb0BUN0K0ZvNSE35jHDbarXieAqHDdr5SI OIC2+q3yDuWpmel/QvPlrG3o8EvnUHg== X-MHO-RoutePath: aGlwcGll X-MHO-User: ae8f26c1-f73e-11e9-b80b-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id ae8f26c1-f73e-11e9-b80b-052b4a66b6b2; Fri, 25 Oct 2019 15:47:01 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x9PFkxJQ049685; Fri, 25 Oct 2019 09:46:59 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r354076 - head/sys/dev/ow From: Ian Lepore To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 25 Oct 2019 09:46:59 -0600 In-Reply-To: <201910251538.x9PFc9ii028313@repo.freebsd.org> References: <201910251538.x9PFc9ii028313@repo.freebsd.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4707lX0khTz4g7w X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.89 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.89)[-0.892,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 15:47:05 -0000 On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: > Author: avg > Date: Fri Oct 25 15:38:09 2019 > New Revision: 354076 > URL: https://svnweb.freebsd.org/changeset/base/354076 > > Log: > owc_gpiobus_read_data: compare times in sbintime_t units > > Previously the code used sbttous() before microseconds comparison > in one > place, sbttons() and nanoseconds in another, division by SBT_1US > and > microseconds in yet another. > > Now the code consistently uses multiplication by SBT_1US to convert > microseconds to sbintime_t before comparing them with periods > between > calls to sbinuptime(). This is fast, this is precise enough (below > 0.03%) and the periods defined by the protocol cannot overflow. > > Reviewed by: imp (D22108) > MFC after: 2 weeks > > Modified: > head/sys/dev/ow/owc_gpiobus.c > > Modified: head/sys/dev/ow/owc_gpiobus.c > ===================================================================== > ========= > --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019 (r354 > 075) > +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 (r354 > 076) > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct > ow_timing * > do { > now = sbinuptime(); > GETPIN(sc, &sample); > - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); > + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); > critical_exit(); > > - if (sbttons(now - then) < t->t_rdv * 1000) > + if (now - then < t->t_rdv * SBT_1US) > *bit = 1; > else > *bit = 0; > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct > ow_timing * > /* Wait out the rest of t_slot */ > do { > now = sbinuptime(); > - } while ((now - then) / SBT_1US < t->t_slot); > + } while (now - then < t->t_slot * SBT_1US); > > RELBUS(sc); > Unit conversions with sbt times should be done using the macros that carefully avoid roundoff errors. I don't understand why you've changed the code that correctly did use those macros to inline math. -- Ian From owner-svn-src-all@freebsd.org Fri Oct 25 15:51:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 966691741F4; Fri, 25 Oct 2019 15:51:24 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4707rW3C2Fz3C5W; Fri, 25 Oct 2019 15:51:22 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf1-f66.google.com with SMTP id z12so2145748lfj.9; Fri, 25 Oct 2019 08:51:22 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=es2WYxOdDw9tTbPIjIDfLqFV4mEFWacwxPd9JPD89dM=; b=Kyh+8Rt+494zrpiaCqJjGiiMjdpOHRjN6b9oaZS2KUoozab2sk+ExHvNewPUFvot25 Orb+6gwLdm57Zfo1ppXupQOfmymBYviBGtzQcxHYT0RzQcCAQGY8q5I8FWP+H5OvFXoe 0wg3XsHKxwkImsQS2iXDm+Su74cNZH/wswBuLFQOJprAelJ5mFGQPGsmwWhwgQVZQGhv BTXKC9303Tyk1CXLmgyuB0cNTNQetOCQw5Wgfi5pSePXUAUM+UmQwaeaQ3u2yanmz3nS 6m6oboISlj51bHaHAXfZBB6ZxTE5Xt4OlPx3R9+QueEbY6RaNcf0O08EWmsIzO6aS9/6 /A0A== X-Gm-Message-State: APjAAAXEmQTxAfV3P7KFRk5a9uSs745Ah5mMS1zgT5PgO1Wseea+l1qM 18rtHm8Ak+qePzyrCxHWrlvSrqu8PDE= X-Google-Smtp-Source: APXvYqw6lKSmHkypFcuixzTP3+7MDmpPe/CK1lVaTsmzp5lplNadU8QQCte6SeAtyM5vTKBTjKHbww== X-Received: by 2002:a19:6e0a:: with SMTP id j10mr3389505lfc.131.1572018678557; Fri, 25 Oct 2019 08:51:18 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id s6sm1034807ljg.43.2019.10.25.08.51.17 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Oct 2019 08:51:17 -0700 (PDT) Subject: Re: svn commit: r354076 - head/sys/dev/ow To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910251538.x9PFc9ii028313@repo.freebsd.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> Date: Fri, 25 Oct 2019 18:51:16 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4707rW3C2Fz3C5W X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.167.66 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.02 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[FreeBSD.org]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-1.02)[ip: (0.22), ipnet: 209.85.128.0/17(-3.22), asn: 15169(-2.05), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[66.167.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[66.167.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 15:51:24 -0000 On 25/10/2019 18:46, Ian Lepore wrote: > On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: >> Author: avg >> Date: Fri Oct 25 15:38:09 2019 >> New Revision: 354076 >> URL: https://svnweb.freebsd.org/changeset/base/354076 >> >> Log: >> owc_gpiobus_read_data: compare times in sbintime_t units >> >> Previously the code used sbttous() before microseconds comparison >> in one >> place, sbttons() and nanoseconds in another, division by SBT_1US >> and >> microseconds in yet another. >> >> Now the code consistently uses multiplication by SBT_1US to convert >> microseconds to sbintime_t before comparing them with periods >> between >> calls to sbinuptime(). This is fast, this is precise enough (below >> 0.03%) and the periods defined by the protocol cannot overflow. >> >> Reviewed by: imp (D22108) >> MFC after: 2 weeks >> >> Modified: >> head/sys/dev/ow/owc_gpiobus.c >> >> Modified: head/sys/dev/ow/owc_gpiobus.c >> ===================================================================== >> ========= >> --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019 (r354 >> 075) >> +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 (r354 >> 076) >> @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct >> ow_timing * >> do { >> now = sbinuptime(); >> GETPIN(sc, &sample); >> - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); >> + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); >> critical_exit(); >> >> - if (sbttons(now - then) < t->t_rdv * 1000) >> + if (now - then < t->t_rdv * SBT_1US) >> *bit = 1; >> else >> *bit = 0; >> @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct >> ow_timing * >> /* Wait out the rest of t_slot */ >> do { >> now = sbinuptime(); >> - } while ((now - then) / SBT_1US < t->t_slot); >> + } while (now - then < t->t_slot * SBT_1US); >> >> RELBUS(sc); >> > > Unit conversions with sbt times should be done using the macros that > carefully avoid roundoff errors. I don't understand why you've changed > the code that correctly did use those macros to inline math. I think that the commit message explains it: This is fast, this is precise enough (below 0.03%) and the periods defined by the protocol cannot overflow. Do you disagree? Could you please explain in which of the three lines changed the new code is worse and why? -- Andriy Gapon From owner-svn-src-all@freebsd.org Fri Oct 25 15:56:20 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 550C2174464 for ; Fri, 25 Oct 2019 15:56:20 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4707yD0fXzz3CN4 for ; Fri, 25 Oct 2019 15:56:19 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1572018977; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=h5ct80jdIctMuDRxbR/iMVwZkYn7Nkoie4Tv9MSVQD3ZPSwL2ajN6Rj4VFzR1nfIJ6yENdFWPiGBT MFXflWDCsOYn4RS74ruijMcNz7EMcFJru2t+WcS658xcT9vzvFLmiXE0FElAnpEL1yfpmSIcXhVb+T 4nehOJQ8pEGIsZ1X6PtQH5IpqxGvym9R2WGFQpM7rFuZgbVQXZq9/FYcF8pzaazt+laV0qtZ630sSX vIpCMUvM+DiKYLv9MGlRKSM8ZGGS1dbjiK+wFl7sok+Njs0+zQ+FjB2D+j1yYKWObao2krXFvjxKAB ekmvA6BmrhEaEcvOugdVEY0a2cpRRxQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=Q8RMfUnzVUfcbCTWzUmi3r1VqWc4wptLSpGU0mMHrt0=; b=ac6B0hWJsfqSuq1ScatdVqZYbbHOJdlgUYGchIvWpwTr5gsRzEhlLC1ZJvNCx6Pfazc1J6LXB0X7i 4POAFMFiuIgJYmAvSqlE5ph5i/KPiovOfClWwAeUnt2ZmvTOIiW08FOr7BQhWC4pK5dmGNKP/S6Hdb FAFfdZZtPoX27c22aMW1gwlIQ62g0MPQjAUjKRjvJ5PCuy7xvyL6D1NohffImrz+f9Z8WcjuiHCwhq Du5U4qfirk/CbZmeK2p7YdDkSOkhUAJMoviIdRaeMgy/f7Yb3yQmr2mcpITf57sT9uQhFAUrxSeN0Q dboKM/IYOgNlwWoi0Zt3FxjtUzy2S2A== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=Q8RMfUnzVUfcbCTWzUmi3r1VqWc4wptLSpGU0mMHrt0=; b=JDA7eg8WJkwNHSUGto2ECluBTSiaVtZGhs141VXOEz4lx6iRSWg5Gd6OVw5p9gZeHtRvV4rfiXG3q iyMmhZcNVFNscrGxnwWcaI/LrNiA7ZzMaltCm7GTNt8LUm90wFXQPm0bw/OBaX8o24tHAA3Ecy4kZ7 RuFQp6fgWE4d+IptMGwRfo2a2i3bL9DMUEgQ/Wh+GJnP0nB5ejfvKSUOw7tQIWC2kT30b9ZM8g/Dh6 RrS7q413cc7trZZ7Ovnz5RrlnImFNIZkJA8UGcrA/hW6yXKjJ15Q3jGzJZF27fB9awPxuRdS7W2q9L KGsI8v8rxJJ+XMmkeMtU6f7fSof7EzQ== X-MHO-RoutePath: aGlwcGll X-MHO-User: f972ee63-f73f-11e9-b80b-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id f972ee63-f73f-11e9-b80b-052b4a66b6b2; Fri, 25 Oct 2019 15:56:16 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x9PFuEgQ049723; Fri, 25 Oct 2019 09:56:14 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <0877c65ce11b0509dcc9e3ee491a37cc2a488f93.camel@freebsd.org> Subject: Re: svn commit: r354076 - head/sys/dev/ow From: Ian Lepore To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 25 Oct 2019 09:56:14 -0600 In-Reply-To: <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> References: <201910251538.x9PFc9ii028313@repo.freebsd.org> <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4707yD0fXzz3CN4 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.89 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.89)[-0.892,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 15:56:20 -0000 On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote: > On 25/10/2019 18:46, Ian Lepore wrote: > > On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: > > > Author: avg > > > Date: Fri Oct 25 15:38:09 2019 > > > New Revision: 354076 > > > URL: https://svnweb.freebsd.org/changeset/base/354076 > > > > > > Log: > > > owc_gpiobus_read_data: compare times in sbintime_t units > > > > > > Previously the code used sbttous() before microseconds > > > comparison > > > in one > > > place, sbttons() and nanoseconds in another, division by > > > SBT_1US > > > and > > > microseconds in yet another. > > > > > > Now the code consistently uses multiplication by SBT_1US to > > > convert > > > microseconds to sbintime_t before comparing them with periods > > > between > > > calls to sbinuptime(). This is fast, this is precise enough > > > (below > > > 0.03%) and the periods defined by the protocol cannot overflow. > > > > > > Reviewed by: imp (D22108) > > > MFC after: 2 weeks > > > > > > Modified: > > > head/sys/dev/ow/owc_gpiobus.c > > > > > > Modified: head/sys/dev/ow/owc_gpiobus.c > > > ================================================================= > > > ==== > > > ========= > > > --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019 ( > > > r354 > > > 075) > > > +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 ( > > > r354 > > > 076) > > > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct > > > ow_timing * > > > do { > > > now = sbinuptime(); > > > GETPIN(sc, &sample); > > > - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); > > > + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); > > > critical_exit(); > > > > > > - if (sbttons(now - then) < t->t_rdv * 1000) > > > + if (now - then < t->t_rdv * SBT_1US) > > > *bit = 1; > > > else > > > *bit = 0; > > > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct > > > ow_timing * > > > /* Wait out the rest of t_slot */ > > > do { > > > now = sbinuptime(); > > > - } while ((now - then) / SBT_1US < t->t_slot); > > > + } while (now - then < t->t_slot * SBT_1US); > > > > > > RELBUS(sc); > > > > > > > Unit conversions with sbt times should be done using the macros > > that > > carefully avoid roundoff errors. I don't understand why you've > > changed > > the code that correctly did use those macros to inline math. > > I think that the commit message explains it: > This is fast, this is precise enough (below 0.03%) and the periods > defined by > the protocol cannot overflow. > > Do you disagree? > Could you please explain in which of the three lines changed the new > code is > worse and why? > I absolutely disagree (or I wouldn't have replied). Unit conversions using sbt times should use the predefined macros, NOT incline multiplication and division. I don't know how to say it more clearly than that. The conversion macros are idiomatic (at least, they would be if people stopped writing inline conversion expressions). -- Ian From owner-svn-src-all@freebsd.org Fri Oct 25 16:03:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A766717476A; Fri, 25 Oct 2019 16:03:54 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lj1-f196.google.com (mail-lj1-f196.google.com [209.85.208.196]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 47086x1QXtz3CnP; Fri, 25 Oct 2019 16:03:52 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lj1-f196.google.com with SMTP id 139so3119961ljf.1; Fri, 25 Oct 2019 09:03:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=GYqBfrWc5dSH51xNwAjbZr3KIG2z9Qh3PYDnrdKAJYk=; b=UrW8S/Hyg/j3cPrzDn4R06MsAl3EATAXUA3Ghb3y2ukxOw+zqb3TQRp0WUXOlqyQZP ckzKghSsPiZ87fYoLz2F5Mqo1/U2a8ly7G+3+hFKz+1ykz3702V7CcptMAKx7Ck/Ckl2 cH7m5T7JWj3O+uIlWTJLFHftBv0wNBuAK090iDlAAtvQr33WBuQYB3ov1gOi3rz5e8zB 6pX9XQkpy34o7gDXzJkmA7et/WFywlXI3fVsPXPchCeTehhI2T7K78rT31XCnETiKRRK GcAXcBSKSDFnWEzGEeCjpaXngYFtpkA7B0U2pJtqwFB09VJfkO/eJ4EY3R6N6dHP5w/Q g3Kw== X-Gm-Message-State: APjAAAVNDVwymr2bo6wnZF7v8TvxR8FdESRJFrdtRNNIMJ7El2ZsbM4B dHTABMdhsgx9EHVEUJ8gEvj86GGRlOA= X-Google-Smtp-Source: APXvYqxbmQgF3ODMKNMtv51MhZOYxzOeCb23nyRo+rWojdi8YE1S2AP6jLcpkS9SIBrRp51eXxVaMw== X-Received: by 2002:a2e:3617:: with SMTP id d23mr3040338lja.169.1572019429392; Fri, 25 Oct 2019 09:03:49 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id b2sm641883ljk.64.2019.10.25.09.03.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Oct 2019 09:03:48 -0700 (PDT) Subject: Re: svn commit: r354076 - head/sys/dev/ow To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910251538.x9PFc9ii028313@repo.freebsd.org> <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> <0877c65ce11b0509dcc9e3ee491a37cc2a488f93.camel@freebsd.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: <01c62f31-1b10-6856-eb33-9238dcb0d9c6@FreeBSD.org> Date: Fri, 25 Oct 2019 19:03:47 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <0877c65ce11b0509dcc9e3ee491a37cc2a488f93.camel@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 47086x1QXtz3CnP X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.208.196 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.13 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[FreeBSD.org]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-1.13)[ip: (-0.34), ipnet: 209.85.128.0/17(-3.22), asn: 15169(-2.05), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[196.208.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[196.208.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; MID_RHS_MATCH_FROM(0.00)[]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:03:54 -0000 On 25/10/2019 18:56, Ian Lepore wrote: > On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote: >> On 25/10/2019 18:46, Ian Lepore wrote: >>> On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: >>>> Author: avg >>>> Date: Fri Oct 25 15:38:09 2019 >>>> New Revision: 354076 >>>> URL: https://svnweb.freebsd.org/changeset/base/354076 >>>> >>>> Log: >>>> owc_gpiobus_read_data: compare times in sbintime_t units >>>> >>>> Previously the code used sbttous() before microseconds >>>> comparison >>>> in one >>>> place, sbttons() and nanoseconds in another, division by >>>> SBT_1US >>>> and >>>> microseconds in yet another. >>>> >>>> Now the code consistently uses multiplication by SBT_1US to >>>> convert >>>> microseconds to sbintime_t before comparing them with periods >>>> between >>>> calls to sbinuptime(). This is fast, this is precise enough >>>> (below >>>> 0.03%) and the periods defined by the protocol cannot overflow. >>>> >>>> Reviewed by: imp (D22108) >>>> MFC after: 2 weeks >>>> >>>> Modified: >>>> head/sys/dev/ow/owc_gpiobus.c >>>> >>>> Modified: head/sys/dev/ow/owc_gpiobus.c >>>> ================================================================= >>>> ==== >>>> ========= >>>> --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019 ( >>>> r354 >>>> 075) >>>> +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 ( >>>> r354 >>>> 076) >>>> @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct >>>> ow_timing * >>>> do { >>>> now = sbinuptime(); >>>> GETPIN(sc, &sample); >>>> - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); >>>> + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); >>>> critical_exit(); >>>> >>>> - if (sbttons(now - then) < t->t_rdv * 1000) >>>> + if (now - then < t->t_rdv * SBT_1US) >>>> *bit = 1; >>>> else >>>> *bit = 0; >>>> @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct >>>> ow_timing * >>>> /* Wait out the rest of t_slot */ >>>> do { >>>> now = sbinuptime(); >>>> - } while ((now - then) / SBT_1US < t->t_slot); >>>> + } while (now - then < t->t_slot * SBT_1US); >>>> >>>> RELBUS(sc); >>>> >>> >>> Unit conversions with sbt times should be done using the macros >>> that >>> carefully avoid roundoff errors. I don't understand why you've >>> changed >>> the code that correctly did use those macros to inline math. >> >> I think that the commit message explains it: >> This is fast, this is precise enough (below 0.03%) and the periods >> defined by >> the protocol cannot overflow. >> >> Do you disagree? >> Could you please explain in which of the three lines changed the new >> code is >> worse and why? >> > > I absolutely disagree (or I wouldn't have replied). Unit conversions > using sbt times should use the predefined macros, NOT incline > multiplication and division. I don't know how to say it more clearly > than that. The conversion macros are idiomatic (at least, they would > be if people stopped writing inline conversion expressions). I can agree that I should have used ustosbt() instead of multiplication by SBT_1US, but I don't agree with your original message that I changed the code that correctly used the macros. But again, I know the times being converted, they are fixed by the protocol and I do not see why I have to use this: static __inline sbintime_t ustosbt(int64_t _us) { sbintime_t sb = 0; #ifdef KASSERT KASSERT(_us >= 0, ("Negative values illegal for ustosbt: %jd", _us)); #endif if (_us >= SBT_1S) { sb = (_us / 1000000) * SBT_1S; _us = _us % 1000000; } /* 9223372036855 = ceil(2^63 / 1000000) */ sb += ((_us * 9223372036855ull) + 0x7fffffff) >> 31; return (sb); } instead of this x * (((sbintime_t)1 << 32) / 1000000) The times: static struct ow_timing timing_regular = { .t_slot = 60, /* 60 to 120 */ .t_low0 = 60, /* really 60 to 120 */ .t_low1 = 1, /* really 1 to 15 */ .t_release = 45, /* <= 45us */ .t_rec = 1, /* at least 1us */ .t_rdv = 15, /* 15us */ .t_rstl = 480, /* 480us or more */ .t_rsth = 480, /* 480us or more */ .t_pdl = 60, /* 60us to 240us */ .t_pdh = 60, /* 15us to 60us */ .t_lowr = 1, /* 1us */ }; -- Andriy Gapon From owner-svn-src-all@freebsd.org Fri Oct 25 16:06:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DE293174866 for ; Fri, 25 Oct 2019 16:06:48 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound3d.ore.mailhop.org (outbound3d.ore.mailhop.org [54.186.57.195]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4708BJ4sGJz3D1W for ; Fri, 25 Oct 2019 16:06:48 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1572019606; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=L+toUX5s4CxFvqvE31bwLoKhKNqjCrMPwpOxNFU8yXEmO8lIRLcmwOl/Jb8xWbwkNq1YaeFnUK7HI L4e2503DggNGnpLBx7ETPQTIpl4fLCG1bITAPSMJbHBoOSeTfkx/OjYzmwvkIyktFzFme9hyoUyVH+ B5uKWRS9mAkzpqtwCHwwiDE9a+ETDjT7M1N94f2fl8WYe/rWrestsXLwIIj993zVthqoSRQDapgMTK JeHTN9dy+KhcrMv1/Kbm+pNImR3gGTNLxKOhbiKgYzlAFzk8nuIOc48PNMMpTj6XXYzk8htc5juCP8 M3/lpkhO2nsWjWS71ZoVsG3K2NM3Iqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=gpoP4SXFH0cauPXFsSGBf/VsBP5Eh/wKP4kGxvzq/NU=; b=NZYlRmC0Jf/Uy3jD0yWpl+wiznlqreyeCKttZRh4+YwpeQM2xhPARtmmjsr7l555Ccn4eNHF6IIxn lc60WJUfiIkmQdcpFqwBtnBc76CMv380RvQhR/H2VvEklQU+m9dxbxquupS89h+LWxyUhOzoxMG3M1 kVc3WiZgSAn11Z/LghKFLaA2FP/FUQqCwJA/mgsxggm7y/RofG/NnKRM6LakmLjedx9EeHvGt8F4wp IILZvze3odV72/oKlvkohG1sjneVLIRjdfW7/+bjpO269qYVPKaKJVHqoE8/sL51+BgGxUaYr4LGpP wRXrRbBoldbiPScdh9ytiEDkkHYbUFg== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=gpoP4SXFH0cauPXFsSGBf/VsBP5Eh/wKP4kGxvzq/NU=; b=cn4Xn7hFiTGGWvz6HuEdG3aDtUWWA9w1UZTnKjsb7A4kWuvvb8lKiSd3WwbgkVh6YRDXQxcscd900 zwl8P1R8iBSJwQ6KNlWES41DZAhINcFGdFanxyJpv0PiVgLHZU+eZt+9fpS5frNYrdCJvnM+xIExpj Tsxl1MnUG6sje6A0BbnZxhv4GsuV0iUWcXeBwqCM8NbkvFsnOjBKLIujsrB3mBNd10FjfhXsymWTaM IC7uVfROOFJFHCR2z+i6AhjYKJ3ekw7XZyRIYluX06b8JqhGx1WLtK9nH0STSlCrcR/ktqNwJYUygD COjkocGmnk3WIh51/4pLgo+fT2TBk8Q== X-MHO-RoutePath: aGlwcGll X-MHO-User: 7078f7db-f741-11e9-b80b-052b4a66b6b2 X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (unknown [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id 7078f7db-f741-11e9-b80b-052b4a66b6b2; Fri, 25 Oct 2019 16:06:45 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id x9PG6iFH049768; Fri, 25 Oct 2019 10:06:44 -0600 (MDT) (envelope-from ian@freebsd.org) Message-ID: <8baac891351521c9e7148a0c0db9978645158dce.camel@freebsd.org> Subject: Re: svn commit: r354076 - head/sys/dev/ow From: Ian Lepore To: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Fri, 25 Oct 2019 10:06:44 -0600 In-Reply-To: <01c62f31-1b10-6856-eb33-9238dcb0d9c6@FreeBSD.org> References: <201910251538.x9PFc9ii028313@repo.freebsd.org> <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> <0877c65ce11b0509dcc9e3ee491a37cc2a488f93.camel@freebsd.org> <01c62f31-1b10-6856-eb33-9238dcb0d9c6@FreeBSD.org> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4708BJ4sGJz3D1W X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-1.86 / 15.00]; local_wl_from(0.00)[freebsd.org]; NEURAL_HAM_MEDIUM(-0.86)[-0.861,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; ASN(0.00)[asn:16509, ipnet:54.186.0.0/15, country:US] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:06:48 -0000 On Fri, 2019-10-25 at 19:03 +0300, Andriy Gapon wrote: > On 25/10/2019 18:56, Ian Lepore wrote: > > On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote: > > > On 25/10/2019 18:46, Ian Lepore wrote: > > > > On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: > > > > > Author: avg > > > > > Date: Fri Oct 25 15:38:09 2019 > > > > > New Revision: 354076 > > > > > URL: https://svnweb.freebsd.org/changeset/base/354076 > > > > > > > > > > Log: > > > > > owc_gpiobus_read_data: compare times in sbintime_t units > > > > > > > > > > Previously the code used sbttous() before microseconds > > > > > comparison > > > > > in one > > > > > place, sbttons() and nanoseconds in another, division by > > > > > SBT_1US > > > > > and > > > > > microseconds in yet another. > > > > > > > > > > Now the code consistently uses multiplication by SBT_1US to > > > > > convert > > > > > microseconds to sbintime_t before comparing them with > > > > > periods > > > > > between > > > > > calls to sbinuptime(). This is fast, this is precise > > > > > enough > > > > > (below > > > > > 0.03%) and the periods defined by the protocol cannot > > > > > overflow. > > > > > > > > > > Reviewed by: imp (D22108) > > > > > MFC after: 2 weeks > > > > > > > > > > Modified: > > > > > head/sys/dev/ow/owc_gpiobus.c > > > > > > > > > > Modified: head/sys/dev/ow/owc_gpiobus.c > > > > > ============================================================= > > > > > ==== > > > > > ==== > > > > > ========= > > > > > --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 > > > > > 2019 ( > > > > > r354 > > > > > 075) > > > > > +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 > > > > > 2019 ( > > > > > r354 > > > > > 076) > > > > > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, > > > > > struct > > > > > ow_timing * > > > > > do { > > > > > now = sbinuptime(); > > > > > GETPIN(sc, &sample); > > > > > - } while (sbttous(now - then) < t->t_rdv + 2 && sample > > > > > == 0); > > > > > + } while (now - then < (t->t_rdv + 2) * SBT_1US && > > > > > sample == 0); > > > > > critical_exit(); > > > > > > > > > > - if (sbttons(now - then) < t->t_rdv * 1000) > > > > > + if (now - then < t->t_rdv * SBT_1US) > > > > > *bit = 1; > > > > > else > > > > > *bit = 0; > > > > > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, > > > > > struct > > > > > ow_timing * > > > > > /* Wait out the rest of t_slot */ > > > > > do { > > > > > now = sbinuptime(); > > > > > - } while ((now - then) / SBT_1US < t->t_slot); > > > > > + } while (now - then < t->t_slot * SBT_1US); > > > > > > > > > > RELBUS(sc); > > > > > > > > > > > > > Unit conversions with sbt times should be done using the macros > > > > that > > > > carefully avoid roundoff errors. I don't understand why you've > > > > changed > > > > the code that correctly did use those macros to inline math. > > > > > > I think that the commit message explains it: > > > This is fast, this is precise enough (below 0.03%) and the > > > periods > > > defined by > > > the protocol cannot overflow. > > > > > > Do you disagree? > > > Could you please explain in which of the three lines changed the > > > new > > > code is > > > worse and why? > > > > > > > I absolutely disagree (or I wouldn't have replied). Unit > > conversions > > using sbt times should use the predefined macros, NOT incline > > multiplication and division. I don't know how to say it more > > clearly > > than that. The conversion macros are idiomatic (at least, they > > would > > be if people stopped writing inline conversion expressions). > > I can agree that I should have used ustosbt() instead of > multiplication by > SBT_1US, but I don't agree with your original message that I changed > the code > that correctly used the macros. > > But again, I know the times being converted, they are fixed by the > protocol and > I do not see why I have to use this: > > static __inline sbintime_t > ustosbt(int64_t _us) > { > sbintime_t sb = 0; > > #ifdef KASSERT > KASSERT(_us >= 0, ("Negative values illegal for ustosbt: > %jd", _us)); > #endif > if (_us >= SBT_1S) { > sb = (_us / 1000000) * SBT_1S; > _us = _us % 1000000; > } > /* 9223372036855 = ceil(2^63 / 1000000) */ > sb += ((_us * 9223372036855ull) + 0x7fffffff) >> 31; > return (sb); > } > > instead of this > x * (((sbintime_t)1 << 32) / 1000000) > > The times: > static struct ow_timing timing_regular = { > .t_slot = 60, /* 60 to 120 */ > .t_low0 = 60, /* really 60 to 120 */ > .t_low1 = 1, /* really 1 to 15 */ > .t_release = 45, /* <= 45us */ > .t_rec = 1, /* at least 1us */ > .t_rdv = 15, /* 15us */ > .t_rstl = 480, /* 480us or more */ > .t_rsth = 480, /* 480us or more */ > .t_pdl = 60, /* 60us to 240us */ > .t_pdh = 60, /* 15us to 60us */ > .t_lowr = 1, /* 1us */ > }; > > The fact that you could say all that means that there is nothing I can say that is going to change your mind. I will say if you ever do anything like this to code I wrote, I will revert it immediately. -- Ian From owner-svn-src-all@freebsd.org Fri Oct 25 16:07:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 82F6A1748EA; Fri, 25 Oct 2019 16:07:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4708C12wRXz3D8C; Fri, 25 Oct 2019 16:07:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 42EC328CCB; Fri, 25 Oct 2019 16:07:25 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PG7PuB046985; Fri, 25 Oct 2019 16:07:25 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PG7OR8046983; Fri, 25 Oct 2019 16:07:24 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251607.x9PG7OR8046983@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 16:07:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354079 - head/sys/dev/superio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/superio X-SVN-Commit-Revision: 354079 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:07:25 -0000 Author: avg Date: Fri Oct 25 16:07:24 2019 New Revision: 354079 URL: https://svnweb.freebsd.org/changeset/base/354079 Log: superio: add a simple ioctl interface MFC after: 1 week Added: head/sys/dev/superio/superio_io.h (contents, props changed) Modified: head/sys/dev/superio/superio.c Modified: head/sys/dev/superio/superio.c ============================================================================== --- head/sys/dev/superio/superio.c Fri Oct 25 15:46:54 2019 (r354078) +++ head/sys/dev/superio/superio.c Fri Oct 25 16:07:24 2019 (r354079) @@ -50,6 +50,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include "isa_if.h" @@ -84,6 +85,7 @@ struct siosc { struct mtx conf_lock; STAILQ_HEAD(, superio_devinfo) devlist; struct resource* io_res; + struct cdev *chardev; int io_rid; uint16_t io_port; const struct sio_conf_methods *methods; @@ -96,6 +98,14 @@ struct siosc { uint8_t enable_reg; }; +static d_ioctl_t superio_ioctl; + +static struct cdevsw superio_cdevsw = { + .d_version = D_VERSION, + .d_ioctl = superio_ioctl, + .d_name = "superio", +}; + #define NUMPORTS 2 static uint8_t @@ -621,6 +631,12 @@ superio_attach(device_t dev) bus_generic_probe(dev); bus_generic_attach(dev); + + sc->chardev = make_dev(&superio_cdevsw, device_get_unit(dev), + UID_ROOT, GID_WHEEL, 0600, "superio%d", device_get_unit(dev)); + if (sc->chardev == NULL) + device_printf(dev, "failed to create character device\n"); + sc->chardev->si_drv1 = sc; return (0); } @@ -633,6 +649,8 @@ superio_detach(device_t dev) error = bus_generic_detach(dev); if (error != 0) return (error); + if (sc->chardev != NULL) + destroy_dev(sc->chardev); device_delete_children(dev); bus_release_resource(dev, SYS_RES_IOPORT, sc->io_rid, sc->io_res); mtx_destroy(&sc->conf_lock); @@ -913,6 +931,31 @@ superio_find_dev(device_t superio, superio_dev_type_t return (dinfo->dev); } return (NULL); +} + +static int +superio_ioctl(struct cdev *dev, u_long cmd, caddr_t data, int flags, + struct thread *td) +{ + struct siosc *sc; + struct superiocmd *s; + + sc = dev->si_drv1; + s = (struct superiocmd *)data; + switch (cmd) { + case SUPERIO_CR_READ: + sio_conf_enter(sc); + s->val = sio_ldn_read(sc, s->ldn, s->cr); + sio_conf_exit(sc); + return (0); + case SUPERIO_CR_WRITE: + sio_conf_enter(sc); + sio_ldn_write(sc, s->ldn, s->cr, s->val); + sio_conf_exit(sc); + return (0); + default: + return (ENOTTY); + } } static devclass_t superio_devclass; Added: head/sys/dev/superio/superio_io.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/superio/superio_io.h Fri Oct 25 16:07:24 2019 (r354079) @@ -0,0 +1,42 @@ +/* + * Copyright (c) 2019 Andriy Gapon + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef SUPERIO_IO_H +#define SUPERIO_IO_H + +#include + +struct superiocmd { + uint8_t ldn; + uint8_t cr; + uint8_t val; +}; + +#define SUPERIO_CR_READ _IOWR('s', 0, struct superiocmd) +#define SUPERIO_CR_WRITE _IOW('s', 1, struct superiocmd) + +#endif /*SUPERIO_IO_H*/ From owner-svn-src-all@freebsd.org Fri Oct 25 16:10:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 52A671749E0; Fri, 25 Oct 2019 16:10:17 +0000 (UTC) (envelope-from agapon@gmail.com) Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4708GJ1ZHJz3DJT; Fri, 25 Oct 2019 16:10:15 +0000 (UTC) (envelope-from agapon@gmail.com) Received: by mail-lf1-f50.google.com with SMTP id i15so2197889lfo.7; Fri, 25 Oct 2019 09:10:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:openpgp:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=vhGppseBBPVuKp7TNctLQmzqwJKoKd5PKO8Xkud/9UM=; b=jL/crt/Awa1fH1ZCDT7q6oEQf3qf4gFwFZiY+RAEYn1s8yul7UOZmK1AHMdXS8vAHP e9LBxkTSavoVfh17ACTbDxtVJuetqyloCvUFYtSBynYex92BfBVp8ATUk+7zrCL5Kj5E CIAMNxpRYLy8D3HXimOuX+X6sG0BlNX92eHYKbomyhQO97nhInTKzChrWbjSRZQ+3LQN syYaUexYLQBOVEsRG8VxECUz7UoMdf2cSOqrOMJckzLibxF9tRZgZOplTkTTbOqH8EOI NVaTZo/yv4SzfYU7rZuwUXV/zr0d5TZ1h9yFCp0R0Q0WVqvvSbPDu0yokIHG/asbIO5i S6UQ== X-Gm-Message-State: APjAAAU7pRuv5ZFlGvZBasfIlER+AsD3CazOvpDf4sWVqnTs5ZoL7vnw UGxPxa7To+2DkWlrzKgHkzVohv8NcUo= X-Google-Smtp-Source: APXvYqzpv58iLhtIev080DYGNqPUp0dnKjcU6I8MLRE3N2krVhgfNPbTDRr05TLEz+LOMPOYb9T0xQ== X-Received: by 2002:a19:6e0a:: with SMTP id j10mr3448174lfc.131.1572019814108; Fri, 25 Oct 2019 09:10:14 -0700 (PDT) Received: from [192.168.0.88] (east.meadow.volia.net. [93.72.151.96]) by smtp.googlemail.com with ESMTPSA id 12sm2228271lje.92.2019.10.25.09.10.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Oct 2019 09:10:13 -0700 (PDT) Subject: Re: svn commit: r354076 - head/sys/dev/ow To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <201910251538.x9PFc9ii028313@repo.freebsd.org> <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> <0877c65ce11b0509dcc9e3ee491a37cc2a488f93.camel@freebsd.org> <01c62f31-1b10-6856-eb33-9238dcb0d9c6@FreeBSD.org> <8baac891351521c9e7148a0c0db9978645158dce.camel@freebsd.org> From: Andriy Gapon Openpgp: preference=signencrypt Autocrypt: addr=avg@FreeBSD.org; prefer-encrypt=mutual; keydata= mQINBFm4LIgBEADNB/3lT7f15UKeQ52xCFQx/GqHkSxEdVyLFZTmY3KyNPQGBtyvVyBfprJ7 mAeXZWfhat6cKNRAGZcL5EmewdQuUfQfBdYmKjbw3a9GFDsDNuhDA2QwFt8BmkiVMRYyvI7l N0eVzszWCUgdc3qqM6qqcgBaqsVmJluwpvwp4ZBXmch5BgDDDb1MPO8AZ2QZfIQmplkj8Y6Z AiNMknkmgaekIINSJX8IzRzKD5WwMsin70psE8dpL/iBsA2cpJGzWMObVTtCxeDKlBCNqM1i gTXta1ukdUT7JgLEFZk9ceYQQMJJtUwzWu1UHfZn0Fs29HTqawfWPSZVbulbrnu5q55R4PlQ /xURkWQUTyDpqUvb4JK371zhepXiXDwrrpnyyZABm3SFLkk2bHlheeKU6Yql4pcmSVym1AS4 dV8y0oHAfdlSCF6tpOPf2+K9nW1CFA8b/tw4oJBTtfZ1kxXOMdyZU5fiG7xb1qDgpQKgHUX8 7Rd2T1UVLVeuhYlXNw2F+a2ucY+cMoqz3LtpksUiBppJhw099gEXehcN2JbUZ2TueJdt1FdS ztnZmsHUXLxrRBtGwqnFL7GSd6snpGIKuuL305iaOGODbb9c7ne1JqBbkw1wh8ci6vvwGlzx rexzimRaBzJxlkjNfMx8WpCvYebGMydNoeEtkWldtjTNVsUAtQARAQABtB5BbmRyaXkgR2Fw b24gPGF2Z0BGcmVlQlNELm9yZz6JAlQEEwEIAD4WIQS+LEO7ngQnXA4Bjr538m7TUc1yjwUC WbgsiAIbIwUJBaOagAULCQgHAgYVCAkKCwIEFgIDAQIeAQIXgAAKCRB38m7TUc1yj+JAEACV l9AK/nOWAt/9cufV2fRj0hdOqB1aCshtSrwHk/exXsDa4/FkmegxXQGY+3GWX3deIyesbVRL rYdtdK0dqJyT1SBqXK1h3/at9rxr9GQA6KWOxTjUFURsU7ok/6SIlm8uLRPNKO+yq0GDjgaO LzN+xykuBA0FlhQAXJnpZLcVfPJdWv7sSHGedL5ln8P8rxR+XnmsA5TUaaPcbhTB+mG+iKFj GghASDSfGqLWFPBlX/fpXikBDZ1gvOr8nyMY9nXhgfXpq3B6QCRYKPy58ChrZ5weeJZ29b7/ QdEO8NFNWHjSD9meiLdWQaqo9Y7uUxN3wySc/YUZxtS0bhAd8zJdNPsJYG8sXgKjeBQMVGuT eCAJFEYJqbwWvIXMfVWop4+O4xB+z2YE3jAbG/9tB/GSnQdVSj3G8MS80iLS58frnt+RSEw/ psahrfh0dh6SFHttE049xYiC+cM8J27Aaf0i9RflyITq57NuJm+AHJoU9SQUkIF0nc6lfA+o JRiyRlHZHKoRQkIg4aiKaZSWjQYRl5Txl0IZUP1dSWMX4s3XTMurC/pnja45dge/4ESOtJ9R 8XuIWg45Oq6MeIWdjKddGhRj3OohsltKgkEU3eLKYtB6qRTQypHHUawCXz88uYt5e3w4V16H lCpSTZV/EVHnNe45FVBlvK7k7HFfDDkryLkCDQRZuCyIARAAlq0slcsVboY/+IUJdcbEiJRW be9HKVz4SUchq0z9MZPX/0dcnvz/gkyYA+OuM78dNS7Mbby5dTvOqfpLJfCuhaNYOhlE0wY+ 1T6Tf1f4c/uA3U/YiadukQ3+6TJuYGAdRZD5EqYFIkreARTVWg87N9g0fT9BEqLw9lJtEGDY EWUE7L++B8o4uu3LQFEYxcrb4K/WKmgtmFcm77s0IKDrfcX4doV92QTIpLiRxcOmCC/OCYuO jB1oaaqXQzZrCutXRK0L5XN1Y1PYjIrEzHMIXmCDlLYnpFkK+itlXwlE2ZQxkfMruCWdQXye syl2fynAe8hvp7Mms9qU2r2K9EcJiR5N1t1C2/kTKNUhcRv7Yd/vwusK7BqJbhlng5ZgRx0m WxdntU/JLEntz3QBsBsWM9Y9wf2V4tLv6/DuDBta781RsCB/UrU2zNuOEkSixlUiHxw1dccI 6CVlaWkkJBxmHX22GdDFrcjvwMNIbbyfQLuBq6IOh8nvu9vuItup7qemDG3Ms6TVwA7BD3j+ 3fGprtyW8Fd/RR2bW2+LWkMrqHffAr6Y6V3h5kd2G9Q8ZWpEJk+LG6Mk3fhZhmCnHhDu6CwN MeUvxXDVO+fqc3JjFm5OxhmfVeJKrbCEUJyM8ESWLoNHLqjywdZga4Q7P12g8DUQ1mRxYg/L HgZY3zfKOqcAEQEAAYkCPAQYAQgAJhYhBL4sQ7ueBCdcDgGOvnfybtNRzXKPBQJZuCyIAhsM BQkFo5qAAAoJEHfybtNRzXKPBVwQAKfFy9P7N3OsLDMB56A4Kf+ZT+d5cIx0Yiaf4n6w7m3i ImHHHk9FIetI4Xe54a2IXh4Bq5UkAGY0667eIs+Z1Ea6I2i27Sdo7DxGwq09Qnm/Y65ADvXs 3aBvokCcm7FsM1wky395m8xUos1681oV5oxgqeRI8/76qy0hD9WR65UW+HQgZRIcIjSel9vR XDaD2HLGPTTGr7u4v00UeTMs6qvPsa2PJagogrKY8RXdFtXvweQFz78NbXhluwix2Tb9ETPk LIpDrtzV73CaE2aqBG/KrboXT2C67BgFtnk7T7Y7iKq4/XvEdDWscz2wws91BOXuMMd4c/c4 OmGW9m3RBLufFrOag1q5yUS9QbFfyqL6dftJP3Zq/xe+mr7sbWbhPVCQFrH3r26mpmy841ym dwQnNcsbIGiBASBSKksOvIDYKa2Wy8htPmWFTEOPRpFXdGQ27awcjjnB42nngyCK5ukZDHi6 w0qK5DNQQCkiweevCIC6wc3p67jl1EMFY5+z+zdTPb3h7LeVnGqW0qBQl99vVFgzLxchKcl0 R/paSFgwqXCZhAKMuUHncJuynDOP7z5LirUeFI8qsBAJi1rXpQoLJTVcW72swZ42IdPiboqx NbTMiNOiE36GqMcTPfKylCbF45JNX4nF9ElM0E+Y8gi4cizJYBRr2FBJgay0b9Cp Message-ID: Date: Fri, 25 Oct 2019 19:10:12 +0300 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0 MIME-Version: 1.0 In-Reply-To: <8baac891351521c9e7148a0c0db9978645158dce.camel@freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4708GJ1ZHJz3DJT X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of agapon@gmail.com designates 209.85.167.50 as permitted sender) smtp.mailfrom=agapon@gmail.com X-Spamd-Result: default: False [-3.17 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; TO_DN_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-1.17)[ip: (-0.54), ipnet: 209.85.128.0/17(-3.22), asn: 15169(-2.05), country: US(-0.05)]; RCVD_IN_DNSWL_NONE(0.00)[50.167.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FORGED_SENDER(0.30)[avg@FreeBSD.org,agapon@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[50.167.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[avg@FreeBSD.org,agapon@gmail.com]; RECEIVED_SPAMHAUS_PBL(0.00)[96.151.72.93.khpj7ygk5idzvmvt5x4ziurxhy.zen.dq.spamhaus.net : 127.0.0.10] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:10:17 -0000 On 25/10/2019 19:06, Ian Lepore wrote: > I will say if you ever do > anything like this to code I wrote, I will revert it immediately. I hope you never write code like: - if (sbttons(now - then) < t->t_rdv * 1000) - } while ((now - then) / SBT_1US < t->t_slot); -- Andriy Gapon From owner-svn-src-all@freebsd.org Fri Oct 25 16:28:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4E0AD174FBE; Fri, 25 Oct 2019 16:28:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4708gX1MBwz3F98; Fri, 25 Oct 2019 16:28:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1200C2903C; Fri, 25 Oct 2019 16:28:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PGSd9C058468; Fri, 25 Oct 2019 16:28:39 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PGSdVm058467; Fri, 25 Oct 2019 16:28:39 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251628.x9PGSdVm058467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 16:28:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354080 - head/sys/dev/superio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/superio X-SVN-Commit-Revision: 354080 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:28:40 -0000 Author: avg Date: Fri Oct 25 16:28:39 2019 New Revision: 354080 URL: https://svnweb.freebsd.org/changeset/base/354080 Log: superio_io.h: fix the copyright MFC after: 1 week Modified: head/sys/dev/superio/superio_io.h Modified: head/sys/dev/superio/superio_io.h ============================================================================== --- head/sys/dev/superio/superio_io.h Fri Oct 25 16:07:24 2019 (r354079) +++ head/sys/dev/superio/superio_io.h Fri Oct 25 16:28:39 2019 (r354080) @@ -1,4 +1,6 @@ -/* + /*- + * SPDX-License-Identifier: BSD-2-Clause + * * Copyright (c) 2019 Andriy Gapon * * Redistribution and use in source and binary forms, with or without @@ -10,7 +12,7 @@ * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS AS IS'' AND + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE From owner-svn-src-all@freebsd.org Fri Oct 25 16:29:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 500E117503F; Fri, 25 Oct 2019 16:29:10 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4708h61RFVz3FJl; Fri, 25 Oct 2019 16:29:10 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 14A9E2903E; Fri, 25 Oct 2019 16:29:10 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PGT99m058534; Fri, 25 Oct 2019 16:29:09 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PGT9Fo058533; Fri, 25 Oct 2019 16:29:09 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910251629.x9PGT9Fo058533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 25 Oct 2019 16:29:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354081 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 354081 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:29:10 -0000 Author: bz Date: Fri Oct 25 16:29:09 2019 New Revision: 354081 URL: https://svnweb.freebsd.org/changeset/base/354081 Log: frag6: do not leak counter in error cases When allocating the IPv6 fragement packet queue entry we do checks against counters and if we pass we increment one of the counters to claim the spot. Right after that we have two cases (malloc and MAC) which can both fail in which case we free the entry but never released our claim on the counter. In theory this can lead to not accepting new fragments after a long time, especially if it would be MAC "refusing" them. Rather than immediately subtracting the value in the error case, only increment it after these two cases so we can no longer leak it. MFC after: 3 weeks Sponsored by: Netflix Modified: head/sys/netinet6/frag6.c Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Fri Oct 25 16:28:39 2019 (r354080) +++ head/sys/netinet6/frag6.c Fri Oct 25 16:29:09 2019 (r354081) @@ -528,7 +528,6 @@ frag6_input(struct mbuf **mp, int *offp, int proto) atomic_load_int(&V_frag6_nfragpackets) >= (u_int)V_ip6_maxfragpackets) goto dropfrag; - atomic_add_int(&V_frag6_nfragpackets, 1); /* Allocate IPv6 fragement packet queue entry. */ q6 = (struct ip6q *)malloc(sizeof(struct ip6q), M_FRAG6, @@ -542,6 +541,7 @@ frag6_input(struct mbuf **mp, int *offp, int proto) } mac_ip6q_create(m, q6); #endif + atomic_add_int(&V_frag6_nfragpackets, 1); /* ip6q_nxt will be filled afterwards, from 1st fragment. */ TAILQ_INIT(&q6->ip6q_frags); From owner-svn-src-all@freebsd.org Fri Oct 25 16:30:24 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C58E017512C; Fri, 25 Oct 2019 16:30:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4708jX4tfCz3FYJ; Fri, 25 Oct 2019 16:30:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B1E929043; Fri, 25 Oct 2019 16:30:24 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PGUOdi058794; Fri, 25 Oct 2019 16:30:24 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PGUOml058793; Fri, 25 Oct 2019 16:30:24 GMT (envelope-from avg@FreeBSD.org) Message-Id: <201910251630.x9PGUOml058793@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Fri, 25 Oct 2019 16:30:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354082 - head/sys/dev/superio X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/sys/dev/superio X-SVN-Commit-Revision: 354082 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:30:24 -0000 Author: avg Date: Fri Oct 25 16:30:24 2019 New Revision: 354082 URL: https://svnweb.freebsd.org/changeset/base/354082 Log: superio: do not crash if failed to create the character device MFC after: 1 week Modified: head/sys/dev/superio/superio.c Modified: head/sys/dev/superio/superio.c ============================================================================== --- head/sys/dev/superio/superio.c Fri Oct 25 16:29:09 2019 (r354081) +++ head/sys/dev/superio/superio.c Fri Oct 25 16:30:24 2019 (r354082) @@ -636,7 +636,8 @@ superio_attach(device_t dev) UID_ROOT, GID_WHEEL, 0600, "superio%d", device_get_unit(dev)); if (sc->chardev == NULL) device_printf(dev, "failed to create character device\n"); - sc->chardev->si_drv1 = sc; + else + sc->chardev->si_drv1 = sc; return (0); } From owner-svn-src-all@freebsd.org Fri Oct 25 16:59:55 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B70CB175817; Fri, 25 Oct 2019 16:59:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4709Mb4NW9z3GqS; Fri, 25 Oct 2019 16:59:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 76901295C4; Fri, 25 Oct 2019 16:59:55 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PGxtxM076417; Fri, 25 Oct 2019 16:59:55 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PGxtLX076416; Fri, 25 Oct 2019 16:59:55 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <201910251659.x9PGxtLX076416@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Fri, 25 Oct 2019 16:59:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354083 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 354083 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 16:59:55 -0000 Author: glebius Date: Fri Oct 25 16:59:54 2019 New Revision: 354083 URL: https://svnweb.freebsd.org/changeset/base/354083 Log: Add couple more assertions to vm_pager_assert_in(). The bogus page is not allowed at ends of the request, and all non-bogus pages must be consecutive. Reviewed by: kib Modified: head/sys/vm/vm_pager.c Modified: head/sys/vm/vm_pager.c ============================================================================== --- head/sys/vm/vm_pager.c Fri Oct 25 16:30:24 2019 (r354082) +++ head/sys/vm/vm_pager.c Fri Oct 25 16:59:54 2019 (r354083) @@ -257,15 +257,20 @@ vm_pager_assert_in(vm_object_t object, vm_page_t *m, i { #ifdef INVARIANTS - VM_OBJECT_ASSERT_WLOCKED(object); - KASSERT(count > 0, ("%s: 0 count", __func__)); /* - * All pages must be busied, not mapped, not fully valid, - * not dirty and belong to the proper object. + * All pages must be consecutive, busied, not mapped, not fully valid, + * not dirty and belong to the proper object. Some pages may be the + * bogus page, but the first and last pages must be a real ones. */ + + VM_OBJECT_ASSERT_WLOCKED(object); + KASSERT(count > 0, ("%s: 0 count", __func__)); for (int i = 0 ; i < count; i++) { - if (m[i] == bogus_page) + if (m[i] == bogus_page) { + KASSERT(i != 0 && i != count - 1, + ("%s: page %d is the bogus page", __func__, i)); continue; + } vm_page_assert_xbusied(m[i]); KASSERT(!pmap_page_is_mapped(m[i]), ("%s: page %p is mapped", __func__, m[i])); @@ -275,6 +280,8 @@ vm_pager_assert_in(vm_object_t object, vm_page_t *m, i ("%s: page %p is dirty", __func__, m[i])); KASSERT(m[i]->object == object, ("%s: wrong object %p/%p", __func__, object, m[i]->object)); + KASSERT(m[i]->pindex == m[0]->pindex + i, + ("%s: page %p isn't consecutive", __func__, m[i])); } #endif } From owner-svn-src-all@freebsd.org Fri Oct 25 17:26:17 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A3ED175FE0; Fri, 25 Oct 2019 17:26:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4709y11GKfz3J4l; Fri, 25 Oct 2019 17:26:17 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro-4.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 7399615887; Fri, 25 Oct 2019 17:26:16 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r354049 - in stable/12/sys/amd64: amd64 include To: Alexander Motin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201910242110.x9OLA91Q073256@repo.freebsd.org> From: John Baldwin Openpgp: preference=signencrypt Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <4c3b715f-28c3-44d1-f472-63edafab46d0@FreeBSD.org> Date: Fri, 25 Oct 2019 10:26:15 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 In-Reply-To: <201910242110.x9OLA91Q073256@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 17:26:17 -0000 On 10/24/19 2:10 PM, Alexander Motin wrote: > Author: mav > Date: Thu Oct 24 21:10:09 2019 > New Revision: 354049 > URL: https://svnweb.freebsd.org/changeset/base/354049 > > Log: > MFC r351457 (by kib): amd64: rework PCPU allocation > > Move pcpu KVA out of .bss into dynamically allocated VA at > pmap_bootstrap(). This avoids demoting superpage mapping .data/.bss. > Also it makes possible to use pmap_qenter() for installation of > domain-local pcpu page on NUMA configs. > > Refactor pcpu and IST initialization by moving it to helper functions. I'll merge the bhyve change today, but this probably broke bhyve. There was a followup fix from kib with some other fixes for this beyond bhyve, or was that just fixes to the actual NUMA allocation of pcpu? -- John Baldwin From owner-svn-src-all@freebsd.org Fri Oct 25 17:41:08 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B1C93176237; Fri, 25 Oct 2019 17:41:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470BH84JgNz3JfS; Fri, 25 Oct 2019 17:41:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 78A5229E8F; Fri, 25 Oct 2019 17:41:08 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PHf8Dq000611; Fri, 25 Oct 2019 17:41:08 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PHf8Go000610; Fri, 25 Oct 2019 17:41:08 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910251741.x9PHf8Go000610@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 25 Oct 2019 17:41:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354084 - head/tests/sys/netinet6/frag6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: head/tests/sys/netinet6/frag6 X-SVN-Commit-Revision: 354084 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 17:41:08 -0000 Author: bz Date: Fri Oct 25 17:41:08 2019 New Revision: 354084 URL: https://svnweb.freebsd.org/changeset/base/354084 Log: frag6-test: update for r354046, conform to 8200 for overlapping fragments The change to conform to RFC 8200 for overlapping fragments now frees the entire reassembly queue if the overlapping fragments are not an exact match. As a result we do see one less packet in the timeout statistics from expiry. No other statistics change as the event is not counted. It can be argued that we should improve the statistics counters in that case. This test case update should have been committed alongside the original commit. Pointyhat to: bz MFC after: 3 weeks X-MFC with: r354046 Sponsored by: Netflix Modified: head/tests/sys/netinet6/frag6/frag6_14.sh Modified: head/tests/sys/netinet6/frag6/frag6_14.sh ============================================================================== --- head/tests/sys/netinet6/frag6/frag6_14.sh Fri Oct 25 16:59:54 2019 (r354083) +++ head/tests/sys/netinet6/frag6/frag6_14.sh Fri Oct 25 17:41:08 2019 (r354084) @@ -95,7 +95,7 @@ EOF 0 6 2 - 4 + 3 0 0 0 From owner-svn-src-all@freebsd.org Fri Oct 25 17:54:38 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7AE651766C2; Fri, 25 Oct 2019 17:54:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470BZk2dlnz3KC4; Fri, 25 Oct 2019 17:54:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3E86C2A0DF; Fri, 25 Oct 2019 17:54:38 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PHscBU011284; Fri, 25 Oct 2019 17:54:38 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PHsbu0011283; Fri, 25 Oct 2019 17:54:37 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910251754.x9PHsbu0011283@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 25 Oct 2019 17:54:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354085 - in stable/12/sys/amd64/vmm: . amd X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys/amd64/vmm: . amd X-SVN-Commit-Revision: 354085 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 17:54:38 -0000 Author: mav Date: Fri Oct 25 17:54:37 2019 New Revision: 354085 URL: https://svnweb.freebsd.org/changeset/base/354085 Log: MFC r351591 (by jhb): Use get_pcpu() to fetch the current CPU's pcpu pointer. This avoids encoding knowledge about how pcpu objects are allocated and is also a few instructions shorter. Modified: stable/12/sys/amd64/vmm/amd/svm.c stable/12/sys/amd64/vmm/vmm_host.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/vmm/amd/svm.c ============================================================================== --- stable/12/sys/amd64/vmm/amd/svm.c Fri Oct 25 17:41:08 2019 (r354084) +++ stable/12/sys/amd64/vmm/amd/svm.c Fri Oct 25 17:54:37 2019 (r354085) @@ -102,9 +102,6 @@ SYSCTL_INT(_hw_vmm_svm, OID_AUTO, vmcb_clean, CTLFLAG_ static MALLOC_DEFINE(M_SVM, "svm", "svm"); static MALLOC_DEFINE(M_SVM_VLAPIC, "svm-vlapic", "svm-vlapic"); -/* Per-CPU context area. */ -extern struct pcpu __pcpu[]; - static uint32_t svm_feature = ~0U; /* AMD SVM features. */ SYSCTL_UINT(_hw_vmm_svm, OID_AUTO, features, CTLFLAG_RDTUN, &svm_feature, 0, "SVM features advertised by CPUID.8000000AH:EDX"); @@ -2054,7 +2051,7 @@ svm_vmrun(void *arg, int vcpu, register_t rip, pmap_t /* Launch Virtual Machine. */ VCPU_CTR1(vm, vcpu, "Resume execution at %#lx", state->rip); svm_dr_enter_guest(gctx); - svm_launch(vmcb_pa, gctx, &__pcpu[curcpu]); + svm_launch(vmcb_pa, gctx, get_pcpu()); svm_dr_leave_guest(gctx); CPU_CLR_ATOMIC(curcpu, &pmap->pm_active); Modified: stable/12/sys/amd64/vmm/vmm_host.h ============================================================================== --- stable/12/sys/amd64/vmm/vmm_host.h Fri Oct 25 17:41:08 2019 (r354084) +++ stable/12/sys/amd64/vmm/vmm_host.h Fri Oct 25 17:54:37 2019 (r354085) @@ -72,14 +72,11 @@ vmm_get_host_gdtrbase(void) return ((uint64_t)&gdt[NGDT * curcpu]); } -struct pcpu; -extern struct pcpu __pcpu[]; - static __inline uint64_t vmm_get_host_gsbase(void) { - return ((uint64_t)&__pcpu[curcpu]); + return ((uint64_t)get_pcpu()); } #endif From owner-svn-src-all@freebsd.org Fri Oct 25 17:56:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 85F921767D5; Fri, 25 Oct 2019 17:56:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Bcn322Hz3KML; Fri, 25 Oct 2019 17:56:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4B1BE2A0E6; Fri, 25 Oct 2019 17:56:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PHuP1u011440; Fri, 25 Oct 2019 17:56:25 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PHuPW2011439; Fri, 25 Oct 2019 17:56:25 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910251756.x9PHuPW2011439@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 25 Oct 2019 17:56:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354086 - head/sys/dev/flash X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/flash X-SVN-Commit-Revision: 354086 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 17:56:25 -0000 Author: manu Date: Fri Oct 25 17:56:24 2019 New Revision: 354086 URL: https://svnweb.freebsd.org/changeset/base/354086 Log: flash: Add GigaDevice gd25q128 flash Add this flash chip which is a 128Mb spi flash. MFC after: 1 week Modified: head/sys/dev/flash/mx25l.c Modified: head/sys/dev/flash/mx25l.c ============================================================================== --- head/sys/dev/flash/mx25l.c Fri Oct 25 17:54:37 2019 (r354085) +++ head/sys/dev/flash/mx25l.c Fri Oct 25 17:56:24 2019 (r354086) @@ -150,6 +150,7 @@ static struct mx25l_flash_ident flash_devices[] = { /* GigaDevice */ { "gd25q64", 0xc8, 0x4017, 64 * 1024, 128, FL_ERASE_4K }, + { "gd25q128", 0xc8, 0x4018, 64 * 1024, 256, FL_ERASE_4K }, }; static int From owner-svn-src-all@freebsd.org Fri Oct 25 18:04:49 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C900176C5E; Fri, 25 Oct 2019 18:04:49 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: from mail-yb1-xb43.google.com (mail-yb1-xb43.google.com [IPv6:2607:f8b0:4864:20::b43]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470BpS2stSz3Ky5; Fri, 25 Oct 2019 18:04:48 +0000 (UTC) (envelope-from mavbsd@gmail.com) Received: by mail-yb1-xb43.google.com with SMTP id 206so1213148ybc.8; Fri, 25 Oct 2019 11:04:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:subject:to:references:from:autocrypt:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=SgfjeGdKL2/3NDTKlFdweTNR3xaVTg76lnd0MHRTIsU=; b=dLCSXm9N1p/q7vnHZ+CkFyeepkrvuuk+LaPWJ2S7m/O91wDDE9WXHDl9yGK6apMff4 2AryMOOq48DZxyS/4phIuNm3Aj3xvVplzPJz0bsNedK37iKId60r00L39tcV0MZtlyzC am6+QXLahEIDKEVJVgoA/8dROuXOkgoTeIoR9wRwqQjvCaxGSkjJEYXJQLmjXzz0/bqg obvh62vw0ENAngTECK24IGimGU6LVM4zgjmNKu+7FvOng2xOf6G0QMF3IVGw5gkdJmFo rqDLz8BSy2aZp4/4/n7eoHgH9nj+/ivGUnZ/KQX0aKurKWVPIDZBNc7HODSYyo0HrWQM 7W1g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:subject:to:references:from:autocrypt :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=SgfjeGdKL2/3NDTKlFdweTNR3xaVTg76lnd0MHRTIsU=; b=q+3K/AD+lWQbuqHOZv7gusRRIxXTRdVHk5Y5NKD8yJyQS6UMGTiIys2ILQKJZP+pc2 BV8KUofVFL3j1mBhItobRvfg1NkK4P6OWIv/iITFPlp5O9DfWurJ83y5tXM+FkUuFcR+ /NAenfvIAOqGnPBWVLJtFw1Yk9iq8lOqKmkpQ692+u93RiV5ScXLJj25+1TV/b4awlu5 FJrLgJIrXQdQX9EBMX/u63aTKAFStIcY1e2Jdu5bZso11ZKSumf4LEiXoXB+dVzWiXKy dXQc8zuxVBnlrCd/d3PQID+QjMPdRXWPxxBJyBZTq0r9WyYZrfzAUfcnWm+6QUkwpZAq Y/wA== X-Gm-Message-State: APjAAAU80ILhh+2HG5IcPP8l5hyjrIdnBkcfYl1w6k1uol6+4+cE7iKj UcGkuWJ8YQy5GP5gOAMB8PUcE5/W X-Google-Smtp-Source: APXvYqyceZyPPOgiMolA/3gYyKmEmsQDsLkJIG+4vR7v0GpE6cN7MxS52IzE9k11maOdBoxl2SF7Qg== X-Received: by 2002:a25:d604:: with SMTP id n4mr4202110ybg.460.1572026686619; Fri, 25 Oct 2019 11:04:46 -0700 (PDT) Received: from mavoffice.ixsystems.com ([12.189.233.129]) by smtp.gmail.com with ESMTPSA id d16sm1148822ywh.74.2019.10.25.11.04.45 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 25 Oct 2019 11:04:45 -0700 (PDT) Sender: Alexander Motin Subject: Re: svn commit: r354049 - in stable/12/sys/amd64: amd64 include To: John Baldwin , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org References: <201910242110.x9OLA91Q073256@repo.freebsd.org> <4c3b715f-28c3-44d1-f472-63edafab46d0@FreeBSD.org> From: Alexander Motin Autocrypt: addr=mav@FreeBSD.org; prefer-encrypt=mutual; keydata= mQENBFOzxAwBCADkPrax0pI2W/ig0CK9nRJJwsHitAGEZ2HZiFEuti+6/4UVxj81yr4ak/4g 9bKUyC7rMEAp/ZHNhd+MFCPAAcHPvtovnfykqE/vuosCS3wlSLloix2iKVLks0CwbLHGAyne 46lTQW74Xl/33c3W1Z6d8jD9gVFT/xaVzZ0U9xdzOmsYAZaAj4ki0tuxO9F7L+ct9grRe7iP g8t9hai7BL4ee3VRwk2JXnKb7UvBiVITKYWKz1jRvZIrjPokgEcCLOSlv7x/1kjuFnj3xWZU 7HSFFT8J93epBbrSSCsYsppIk2fZH41kaaFXsMQfTPH8wkeM6qwrvOh4HiQM08R+9tThABEB AAG0IUFsZXhhbmRlciBNb3RpbiA8bWF2QEZyZWVCU0Qub3JnPokBVwQTAQoAQQIbAwULCQgH AwUVCgkICwUWAwIBAAIeAQIXgAIZARYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMKuBQkN McyiAAoJEIMYw5VbqyJ/tuUIAOG3ONOSNYqjK4eTZ1TVh9jdUBAhWk5nhDFnODN49Wj0AbYm 7aIqy8O1hnCDSZG5LttjSAo3UfXJZDKQM0BLb0gpRMBnAYqO6tdolLNqAbPGJBnGoPjsh24y 6KcbDaNnis+lD4GwPXwQM+92wZGhCUFElPV9NciZGVS65TNIgk7X+yEjjhD1MSWKKijZ1r9Z zIt4OzUTxxNOvzdlABZS88nNRdJkatOQJPmFdd1mpP6UzTNCiLUo1pIqOEtJgvVVDYq5WHY6 tciWWYdmZG/tIBexJmv2mV2OLVjXR6ZeKmntVH14H72/wRHJuYHQC+r5SVRcWWayrThsY6jZ Yr4+raS5AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6Z AXgDtmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8Flv mI/c40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt 3ytU8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZ R1EdEIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm5 9R8AEQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczM AAoJEIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLq A6xe6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHu uC5vgPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15Gc sS9YcQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9 TevwGsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCg lz65AQ0EU7PEDAEIAOZgWf2cJIu+58IzP2dkXE/urj3tr4OqrB/yHGWUf71Lz6D0Fi6ZAXgD tmcFLGPfMyWuLAvSM+xmoguk7zC4hRBYvQycmIhuqBq1jO1Wp/Z+lpoPM/1cDYLn8FlvmI/c 40MhUZh345DA4jYWWaZNjQHUWVQ1fPf595vdVVMPT/abE8E5DaF6fSkRmqFTmfYRkfbt3ytU 8NdUapDcJVY7cEP2nJBVNZPnOIObR/ZIgSxjjrG5o34yXoqeup8JvwEv+/NylzzuyXEZR1Ed EIzQ/a1nh/0j4NXtzZEqKW4aTWlmSqb6wN8jh1OSOOqkYsfnE3nfxcZbxi4IRoNQYlm59R8A EQEAAYkBPAQYAQoAJgIbDBYhBOmM88TmnMPNDledVYMYw5VbqyJ/BQJZYMLYBQkNMczMAAoJ EIMYw5VbqyJ/TqgH/RQHClkvecE0262lwKoP/m0Mh4I5TLRgoJJn8S7G1BnqohYJkiLqA6xe 6urGD7OqdNAl12UbrjWbdJV+zvea3vJoM4MZuYiYrGaXWxzFXqWJcPwMU9sAh8MRghHuuC5v gPb45Tnftw9/+n0i8GfVhQhOqepUGdQg4NPcXviSkoAvig6pp9Lcxisn0groUQKt15GcsS9Y cQWg3j9Hnipc6Mu416HX98Fb113NHJqc2geTHLkRyuBFOoyIqB6N9GKjzOAIzxxsVdl9Tevw Gsrp4M4/RFzWbSgsbOnbE7454lmuVZGfReEjnUm8RHp9Q2UWKXlp3exlZjvOp/uVEpCglz4= Message-ID: Date: Fri, 25 Oct 2019 14:04:45 -0400 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:68.0) Gecko/20100101 Thunderbird/68.1.1 MIME-Version: 1.0 In-Reply-To: <4c3b715f-28c3-44d1-f472-63edafab46d0@FreeBSD.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 470BpS2stSz3Ky5 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=dLCSXm9N; dmarc=none; spf=pass (mx1.freebsd.org: domain of mavbsd@gmail.com designates 2607:f8b0:4864:20::b43 as permitted sender) smtp.mailfrom=mavbsd@gmail.com X-Spamd-Result: default: False [-2.77 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2607:f8b0:4000::/36:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[FreeBSD.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; IP_SCORE(-0.57)[ip: (1.66), ipnet: 2607:f8b0::/32(-2.41), asn: 15169(-2.05), country: US(-0.05)]; DKIM_TRACE(0.00)[gmail.com:+]; RCVD_IN_DNSWL_NONE(0.00)[3.4.b.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; FORGED_SENDER(0.30)[mav@FreeBSD.org,mavbsd@gmail.com]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[mav@FreeBSD.org,mavbsd@gmail.com]; MID_RHS_MATCH_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 18:04:49 -0000 On 25.10.2019 13:26, John Baldwin wrote: > On 10/24/19 2:10 PM, Alexander Motin wrote: >> Author: mav >> Date: Thu Oct 24 21:10:09 2019 >> New Revision: 354049 >> URL: https://svnweb.freebsd.org/changeset/base/354049 >> >> Log: >> MFC r351457 (by kib): amd64: rework PCPU allocation >> >> Move pcpu KVA out of .bss into dynamically allocated VA at >> pmap_bootstrap(). This avoids demoting superpage mapping .data/.bss. >> Also it makes possible to use pmap_qenter() for installation of >> domain-local pcpu page on NUMA configs. >> >> Refactor pcpu and IST initialization by moving it to helper functions. > > I'll merge the bhyve change today, but this probably broke bhyve. There > was a followup fix from kib with some other fixes for this beyond bhyve, > or was that just fixes to the actual NUMA allocation of pcpu? Oops, I've missed the bhyve fix. Merged it now. Thanks for notice. As far as I see, the bhyve issue was one of its kind. There were few pcpu allocation fixes, which I merged, and one header reorganization patch, which I think is cosmetic, so I haven't merged it so far, but will take another look. -- Alexander Motin From owner-svn-src-all@freebsd.org Fri Oct 25 18:08:26 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05C12176D10; Fri, 25 Oct 2019 18:08:26 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Btd6Pmfz3L7B; Fri, 25 Oct 2019 18:08:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF5292A2AA; Fri, 25 Oct 2019 18:08:25 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PI8PRx017510; Fri, 25 Oct 2019 18:08:25 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PI8Po2017509; Fri, 25 Oct 2019 18:08:25 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910251808.x9PI8Po2017509@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 25 Oct 2019 18:08:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354087 - head/sys/arm64/rockchip/clk X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm64/rockchip/clk X-SVN-Commit-Revision: 354087 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 18:08:26 -0000 Author: manu Date: Fri Oct 25 18:08:25 2019 New Revision: 354087 URL: https://svnweb.freebsd.org/changeset/base/354087 Log: arm64: rk3399: Add clock and gate for usb3 clocks MFC after: 1 month Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk3399_cru.c Fri Oct 25 17:56:24 2019 (r354086) +++ head/sys/arm64/rockchip/clk/rk3399_cru.c Fri Oct 25 18:08:25 2019 (r354087) @@ -54,9 +54,18 @@ __FBSDID("$FreeBSD$"); #define SCLK_USB2PHY0_REF 123 #define SCLK_USB2PHY1_REF 124 +#define SCLK_USB3OTG0_REF 129 +#define SCLK_USB3OTG1_REF 130 +#define SCLK_USB3OTG0_SUSPEND 131 +#define SCLK_USB3OTG1_SUSPEND 132 #define ACLK_EMMC_CORE 241 #define ACLK_EMMC_NOC 242 #define ACLK_EMMC_GRF 243 +#define ACLK_USB3_NOC 245 +#define ACLK_USB3OTG0 246 +#define ACLK_USB3OTG1 247 +#define ACLK_USB3_RKSOC_AXI_PERF 248 +#define ACLK_USB3_GRF 249 #define PCLK_GPIO2 336 #define PCLK_GPIO3 337 #define PCLK_GPIO4 338 @@ -103,6 +112,12 @@ static struct rk_cru_gate rk3399_gates[] = { CRU_GATE(0, "hclk_perilp1_cpll_src", "cpll", 0x320, 1) CRU_GATE(0, "hclk_perilp1_gpll_src", "gpll", 0x320, 0) + /* CRU_CLKGATE_CON12 */ + CRU_GATE(SCLK_USB3OTG0_REF, "sclk_usb3otg0_ref", "xin24m", 0x330, 1) + CRU_GATE(SCLK_USB3OTG1_REF, "sclk_usb3otg1_ref", "xin24m", 0x330, 2) + CRU_GATE(SCLK_USB3OTG0_SUSPEND, "sclk_usb3otg0_suspend", "xin24m", 0x330, 3) + CRU_GATE(SCLK_USB3OTG1_SUSPEND, "sclk_usb3otg1_suspend", "xin24m", 0x330, 4) + /* CRU_CLKGATE_CON20 */ CRU_GATE(HCLK_HOST0, "hclk_host0", "hclk_perihp", 0x350, 5) CRU_GATE(HCLK_HOST0_ARB, "hclk_host0_arb", "hclk_perihp", 0x350, 6) @@ -117,6 +132,13 @@ static struct rk_cru_gate rk3399_gates[] = { CRU_GATE(PCLK_I2C2, "pclk_rki2c2", "pclk_perilp1", 0x358, 9) CRU_GATE(PCLK_I2C3, "pclk_rki2c3", "pclk_perilp1", 0x358, 10) + /* CRU_CLKGATE_CON30 */ + CRU_GATE(ACLK_USB3_NOC, "aclk_usb3_noc", "aclk_usb3", 0x378, 0) + CRU_GATE(ACLK_USB3OTG0, "aclk_usb3otg0", "aclk_usb3", 0x378, 1) + CRU_GATE(ACLK_USB3OTG1, "aclk_usb3otg1", "aclk_usb3", 0x378, 2) + CRU_GATE(ACLK_USB3_RKSOC_AXI_PERF, "aclk_usb3_rksoc_axi_perf", "aclk_usb3", 0x378, 3) + CRU_GATE(ACLK_USB3_GRF, "aclk_usb3_grf", "aclk_usb3", 0x378, 4) + /* CRU_CLKGATE_CON31 */ CRU_GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_alive", 0x37c, 3) CRU_GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_alive", 0x37c, 4) @@ -1066,6 +1088,32 @@ static struct rk_clk_composite_def pclk_perilp1 = { .flags = RK_CLK_COMPOSITE_HAVE_GATE, }; +/* USB3 clock */ + +#define ACLK_USB3 244 +static const char *aclk_usb3_parents[] = {"cpll", "gpll", "npll", "npll"}; +static struct rk_clk_composite_def aclk_usb3 = { + .clkdef = { + .id = ACLK_USB3, + .name = "aclk_usb3", + .parent_names = aclk_usb3_parents, + .parent_cnt = nitems(aclk_usb3_parents), + }, + /* CRU_CLKSET_CON39 */ + .muxdiv_offset = 0x19C, + .mux_shift = 6, + .mux_width = 2, + + .div_shift = 0, + .div_width = 5, + + /* CRU_CLKGATE_CON12 */ + .gate_offset = 0x330, + .gate_shift = 0, + + .flags = RK_CLK_COMPOSITE_HAVE_GATE, +}; + /* * i2c */ @@ -1210,6 +1258,114 @@ static struct rk_clk_composite_def i2c7 = { .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, }; +/* USB3 */ + +#define SCLK_UPHY0_TCPDPHY_REF 125 +#define SCLK_UPHY0_TCPDCORE 126 + +/* Missing xin32k exported by rk808 */ +static const char *uphy0_tcpdphy_ref_parents[] = {"xin24m"}; + +static struct rk_clk_composite_def uphy0_tcpdphy_ref = { + .clkdef = { + .id = SCLK_UPHY0_TCPDPHY_REF, + .name = "uphy0_tcpdphy_ref", + .parent_names = uphy0_tcpdphy_ref_parents, + .parent_cnt = nitems(uphy0_tcpdphy_ref_parents), + }, + /* CRU_CLKSET_CON64 */ + .muxdiv_offset = 0x0200, + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 8, + .div_width = 5, + + /* CRU_CLKGATE_CON13 */ + .gate_offset = 0x0334, + .gate_shift = 4, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +/* Missing xin32k exported by rk808 */ +static const char *uphy0_tcpdcore_parents[] = {"xin24m", "xin24m", "cpll", "gpll"}; + +static struct rk_clk_composite_def uphy0_tcpdcore = { + .clkdef = { + .id = SCLK_UPHY0_TCPDCORE, + .name = "uphy0_tcpdcore", + .parent_names = uphy0_tcpdcore_parents, + .parent_cnt = nitems(uphy0_tcpdcore_parents), + }, + /* CRU_CLKSET_CON64 */ + .muxdiv_offset = 0x0200, + .mux_shift = 6, + .mux_width = 2, + + .div_shift = 0, + .div_width = 5, + + /* CRU_CLKGATE_CON13 */ + .gate_offset = 0x0334, + .gate_shift = 5, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +#define SCLK_UPHY1_TCPDPHY_REF 127 +#define SCLK_UPHY1_TCPDCORE 128 + +/* Missing xin32k exported by rk808 */ +static const char *uphy1_tcpdphy_ref_parents[] = {"xin24m"}; + +static struct rk_clk_composite_def uphy1_tcpdphy_ref = { + .clkdef = { + .id = SCLK_UPHY1_TCPDPHY_REF, + .name = "uphy1_tcpdphy_ref", + .parent_names = uphy1_tcpdphy_ref_parents, + .parent_cnt = nitems(uphy1_tcpdphy_ref_parents), + }, + /* CRU_CLKSET_CON65 */ + .muxdiv_offset = 0x0204, + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 8, + .div_width = 5, + + /* CRU_CLKGATE_CON13 */ + .gate_offset = 0x0334, + .gate_shift = 6, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +/* Missing xin32k exported by rk808 */ +static const char *uphy1_tcpdcore_parents[] = {"xin24m", "xin24m", "cpll", "gpll"}; + +static struct rk_clk_composite_def uphy1_tcpdcore = { + .clkdef = { + .id = SCLK_UPHY1_TCPDCORE, + .name = "uphy1_tcpdcore", + .parent_names = uphy1_tcpdcore_parents, + .parent_cnt = nitems(uphy1_tcpdcore_parents), + }, + /* CRU_CLKSET_CON65 */ + .muxdiv_offset = 0x0204, + .mux_shift = 6, + .mux_width = 2, + + .div_shift = 0, + .div_width = 5, + + /* CRU_CLKGATE_CON13 */ + .gate_offset = 0x0334, + .gate_shift = 7, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + /* * ARM CPU clocks (LITTLE and big) */ @@ -1593,6 +1749,10 @@ static struct rk_clk rk3399_clks[] = { }, { .type = RK_CLK_COMPOSITE, + .clk.composite = &aclk_usb3, + }, + { + .type = RK_CLK_COMPOSITE, .clk.composite = &i2c1, }, { @@ -1614,6 +1774,22 @@ static struct rk_clk rk3399_clks[] = { { .type = RK_CLK_COMPOSITE, .clk.composite = &i2c7, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &uphy0_tcpdphy_ref, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &uphy0_tcpdcore, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &uphy1_tcpdphy_ref, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &uphy1_tcpdcore, }, { From owner-svn-src-all@freebsd.org Fri Oct 25 18:09:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0BDD176D94; Fri, 25 Oct 2019 18:09:00 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470BvJ3nRWz3LGR; Fri, 25 Oct 2019 18:09:00 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 66B0B2A2AB; Fri, 25 Oct 2019 18:09:00 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PI90c1017579; Fri, 25 Oct 2019 18:09:00 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PI8xgg017572; Fri, 25 Oct 2019 18:08:59 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910251808.x9PI8xgg017572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 25 Oct 2019 18:08:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354088 - in head/sys: arm64/conf arm64/rockchip conf X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm64/conf arm64/rockchip conf X-SVN-Commit-Revision: 354088 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 18:09:00 -0000 Author: manu Date: Fri Oct 25 18:08:59 2019 New Revision: 354088 URL: https://svnweb.freebsd.org/changeset/base/354088 Log: arm64: rockchip: Add rk_dwc3 driver This is a simplebus like driver that attaches the dwc3 child node and enable the clocks needed for the module. MFC after: 1 month Added: head/sys/arm64/rockchip/rk_dwc3.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Fri Oct 25 18:08:25 2019 (r354087) +++ head/sys/arm64/conf/GENERIC Fri Oct 25 18:08:59 2019 (r354088) @@ -215,6 +215,7 @@ device ehci_mv # Marvell EHCI USB interface device xhci # XHCI USB interface (USB 3.0) device dwc3 # Synopsys DWC controller device aw_dwc3 # Allwinner DWC3 controller +device rk_dwc3 # Rockchip DWC3 controller device usb # USB Bus (required) device ukbd # Keyboard device umass # Disks/Mass storage - Requires scbus and da Added: head/sys/arm64/rockchip/rk_dwc3.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/rockchip/rk_dwc3.c Fri Oct 25 18:08:59 2019 (r354088) @@ -0,0 +1,201 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Emmanuel Vadot + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Rockchip DWC3 glue + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + + +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +static struct ofw_compat_data compat_data[] = { + { "rockchip,rk3399-dwc3", 1 }, + { NULL, 0 } +}; + +struct rk_dwc3_softc { + struct simplebus_softc sc; + device_t dev; + clk_t clk_ref; + clk_t clk_suspend; + clk_t clk_bus; + clk_t clk_axi_perf; + clk_t clk_usb3; + clk_t clk_grf; + hwreset_t rst_usb3; +}; + +static int +rk_dwc3_probe(device_t dev) +{ + phandle_t node; + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + /* Binding says that we need a child node for the actual dwc3 controller */ + node = ofw_bus_get_node(dev); + if (OF_child(node) <= 0) + return (ENXIO); + + device_set_desc(dev, "Rockchip RK3399 DWC3"); + return (BUS_PROBE_DEFAULT); +} + +static int +rk_dwc3_attach(device_t dev) +{ + struct rk_dwc3_softc *sc; + device_t cdev; + phandle_t node, child; + int err; + + sc = device_get_softc(dev); + sc->dev = dev; + node = ofw_bus_get_node(dev); + + /* Mandatory clocks */ + if (clk_get_by_ofw_name(dev, 0, "ref_clk", &sc->clk_ref) != 0) { + device_printf(dev, "Cannot get ref_clk clock\n"); + return (ENXIO); + } + err = clk_enable(sc->clk_ref); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->clk_ref)); + return (ENXIO); + } + if (clk_get_by_ofw_name(dev, 0, "suspend_clk", &sc->clk_suspend) != 0) { + device_printf(dev, "Cannot get suspend_clk clock\n"); + return (ENXIO); + } + err = clk_enable(sc->clk_suspend); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->clk_suspend)); + return (ENXIO); + } + if (clk_get_by_ofw_name(dev, 0, "bus_clk", &sc->clk_bus) != 0) { + device_printf(dev, "Cannot get bus_clk clock\n"); + return (ENXIO); + } + err = clk_enable(sc->clk_bus); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->clk_bus)); + return (ENXIO); + } + if (clk_get_by_ofw_name(dev, 0, "grf_clk", &sc->clk_grf) != 0) { + device_printf(dev, "Cannot get grf_clk clock\n"); + return (ENXIO); + } + err = clk_enable(sc->clk_grf); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->clk_grf)); + return (ENXIO); + } + + /* Optional clocks */ + if (clk_get_by_ofw_name(dev, 0, "aclk_usb3_rksoc_axi_perf", &sc->clk_axi_perf) == 0) { + err = clk_enable(sc->clk_axi_perf); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->clk_axi_perf)); + return (ENXIO); + } + } + if (clk_get_by_ofw_name(dev, 0, "aclk_usb3", &sc->clk_usb3) == 0) { + err = clk_enable(sc->clk_usb3); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->clk_usb3)); + return (ENXIO); + } + } + + /* Put module out of reset */ + if (hwreset_get_by_ofw_name(dev, node, "usb3-otg", &sc->rst_usb3) == 0) { + if (hwreset_deassert(sc->rst_usb3) != 0) { + device_printf(dev, "Cannot deassert reset\n"); + return (ENXIO); + } + } + + simplebus_init(dev, node); + if (simplebus_fill_ranges(node, &sc->sc) < 0) { + device_printf(dev, "could not get ranges\n"); + return (ENXIO); + } + + for (child = OF_child(node); child > 0; child = OF_peer(child)) { + cdev = simplebus_add_device(dev, child, 0, NULL, -1, NULL); + if (cdev != NULL) + device_probe_and_attach(cdev); + } + + return (bus_generic_attach(dev)); +} + +static device_method_t rk_dwc3_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, rk_dwc3_probe), + DEVMETHOD(device_attach, rk_dwc3_attach), + + DEVMETHOD_END +}; + +static devclass_t rk_dwc3_devclass; + +DEFINE_CLASS_1(rk_dwc3, rk_dwc3_driver, rk_dwc3_methods, + sizeof(struct rk_dwc3_softc), simplebus_driver); +DRIVER_MODULE(rk_dwc3, simplebus, rk_dwc3_driver, rk_dwc3_devclass, 0, 0); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Oct 25 18:08:25 2019 (r354087) +++ head/sys/conf/files.arm64 Fri Oct 25 18:08:59 2019 (r354088) @@ -292,6 +292,7 @@ cddl/dev/fbt/aarch64/fbt_isa.c optional dtrace_fbt # RockChip Drivers arm64/rockchip/rk3399_emmcphy.c optional fdt rk_emmcphy soc_rockchip_rk3399 +arm64/rockchip/rk_dwc3.c optional fdt rk_dwc3 soc_rockchip_rk3399 arm64/rockchip/rk_i2c.c optional fdt rk_i2c soc_rockchip_rk3328 | fdt rk_i2c soc_rockchip_rk3399 arm64/rockchip/rk805.c optional fdt rk805 soc_rockchip_rk3328 | fdt rk805 soc_rockchip_rk3399 arm64/rockchip/rk_grf.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 From owner-svn-src-all@freebsd.org Fri Oct 25 18:10:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0DB8176E32; Fri, 25 Oct 2019 18:10:03 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470BwW4WCjz3LQg; Fri, 25 Oct 2019 18:10:03 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 65A7E2A2AF; Fri, 25 Oct 2019 18:10:03 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PIA37d017730; Fri, 25 Oct 2019 18:10:03 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PIA3Tg017727; Fri, 25 Oct 2019 18:10:03 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910251810.x9PIA3Tg017727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Fri, 25 Oct 2019 18:10:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354089 - in head/sys: arm64/conf arm64/rockchip conf X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: in head/sys: arm64/conf arm64/rockchip conf X-SVN-Commit-Revision: 354089 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 18:10:03 -0000 Author: manu Date: Fri Oct 25 18:10:02 2019 New Revision: 354089 URL: https://svnweb.freebsd.org/changeset/base/354089 Log: arm64: rockchip: Add RK3399 TypeC phy driver This is a driver for the USB3 PHY present in the RK3399. While the phy support DP (Display Port) the driver doesn't has we have no driver to test this with for now. All the lane and pll configuration is just magic values from rockchip. While the manual have some info on those registers it's really hard to understand how to calculate those values (if there is a way). MFC after: 1 month Added: head/sys/arm64/rockchip/rk_typec_phy.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Fri Oct 25 18:08:59 2019 (r354088) +++ head/sys/arm64/conf/GENERIC Fri Oct 25 18:10:02 2019 (r354089) @@ -208,6 +208,7 @@ device pl011 # USB support device aw_usbphy # Allwinner USB PHY device rk_usb2phy # Rockchip USB2PHY +device rk_typec_phy # Rockchip TypeC PHY device dwcotg # DWC OTG controller device ohci # OHCI USB interface device ehci # EHCI USB interface (USB 2.0) Added: head/sys/arm64/rockchip/rk_typec_phy.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/rockchip/rk_typec_phy.c Fri Oct 25 18:10:02 2019 (r354089) @@ -0,0 +1,474 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Emmanuel Vadot + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +/* + * Rockchip PHY TYPEC + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include "syscon_if.h" + +#define GRF_USB3OTG_BASE(x) (0x2430 + (0x10 * x)) +#define GRF_USB3OTG_CON0(x) (GRF_USB3OTG_BASE(x) + 0x0) +#define GRF_USB3OTG_CON1(x) (GRF_USB3OTG_BASE(x) + 0x4) +#define USB3OTG_CON1_U3_DIS (1 << 0) + +#define GRF_USB3PHY_BASE(x) (0x0e580 + (0xc * (x))) +#define GRF_USB3PHY_CON0(x) (GRF_USB3PHY_BASE(x) + 0x0) +#define USB3PHY_CON0_USB2_ONLY (1 << 3) +#define GRF_USB3PHY_CON1(x) (GRF_USB3PHY_BASE(x) + 0x4) +#define GRF_USB3PHY_CON2(x) (GRF_USB3PHY_BASE(x) + 0x8) +#define GRF_USB3PHY_STATUS0 0x0e5c0 +#define GRF_USB3PHY_STATUS1 0x0e5c4 + +#define CMN_PLL0_VCOCAL_INIT (0x84 << 2) +#define CMN_PLL0_VCOCAL_ITER (0x85 << 2) +#define CMN_PLL0_INTDIV (0x94 << 2) +#define CMN_PLL0_FRACDIV (0x95 << 2) +#define CMN_PLL0_HIGH_THR (0x96 << 2) +#define CMN_PLL0_DSM_DIAG (0x97 << 2) +#define CMN_PLL0_SS_CTRL1 (0x98 << 2) +#define CMN_PLL0_SS_CTRL2 (0x99 << 2) +#define CMN_DIAG_PLL0_FBH_OVRD (0x1c0 << 2) +#define CMN_DIAG_PLL0_FBL_OVRD (0x1c1 << 2) +#define CMN_DIAG_PLL0_OVRD (0x1c2 << 2) +#define CMN_DIAG_PLL0_V2I_TUNE (0x1c5 << 2) +#define CMN_DIAG_PLL0_CP_TUNE (0x1c6 << 2) +#define CMN_DIAG_PLL0_LF_PROG (0x1c7 << 2) +#define CMN_DIAG_HSCLK_SEL (0x1e0 << 2) +#define CMN_DIAG_HSCLK_SEL_PLL_CONFIG 0x30 +#define CMN_DIAG_HSCLK_SEL_PLL_MASK 0x33 + +#define TX_TXCC_MGNFS_MULT_000(lane) ((0x4050 | ((lane) << 9)) << 2) +#define XCVR_DIAG_BIDI_CTRL(lane) ((0x40e8 | ((lane) << 9)) << 2) +#define XCVR_DIAG_LANE_FCM_EN_MGN(lane) ((0x40f2 | ((lane) << 9)) << 2) +#define TX_PSC_A0(lane) ((0x4100 | ((lane) << 9)) << 2) +#define TX_PSC_A1(lane) ((0x4101 | ((lane) << 9)) << 2) +#define TX_PSC_A2(lane) ((0x4102 | ((lane) << 9)) << 2) +#define TX_PSC_A3(lane) ((0x4103 | ((lane) << 9)) << 2) +#define TX_RCVDET_EN_TMR(lane) ((0x4122 | ((lane) << 9)) << 2) +#define TX_RCVDET_ST_TMR(lane) ((0x4123 | ((lane) << 9)) << 2) + +#define RX_PSC_A0(lane) ((0x8000 | ((lane) << 9)) << 2) +#define RX_PSC_A1(lane) ((0x8001 | ((lane) << 9)) << 2) +#define RX_PSC_A2(lane) ((0x8002 | ((lane) << 9)) << 2) +#define RX_PSC_A3(lane) ((0x8003 | ((lane) << 9)) << 2) +#define RX_PSC_CAL(lane) ((0x8006 | ((lane) << 9)) << 2) +#define RX_PSC_RDY(lane) ((0x8007 | ((lane) << 9)) << 2) +#define RX_SIGDET_HL_FILT_TMR(lane) ((0x8090 | ((lane) << 9)) << 2) +#define RX_REE_CTRL_DATA_MASK(lane) ((0x81bb | ((lane) << 9)) << 2) +#define RX_DIAG_SIGDET_TUNE(lane) ((0x81dc | ((lane) << 9)) << 2) + +#define PMA_LANE_CFG (0xc000 << 2) +#define PIN_ASSIGN_D_F 0x5100 +#define DP_MODE_CTL (0xc008 << 2) +#define DP_MODE_ENTER_A2 0xc104 +#define PMA_CMN_CTRL1 (0xc800 << 2) +#define PMA_CMN_CTRL1_READY (1 << 0) + +static struct ofw_compat_data compat_data[] = { + { "rockchip,rk3399-typec-phy", 1 }, + { NULL, 0 } +}; + +static struct resource_spec rk_typec_phy_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { -1, 0 } +}; + +struct rk_typec_phy_softc { + device_t dev; + struct resource *res; + struct syscon *grf; + clk_t tcpdcore; + clk_t tcpdphy_ref; + hwreset_t rst_uphy; + hwreset_t rst_pipe; + hwreset_t rst_tcphy; + int mode; + int phy_ctrl_id; +}; + +#define RK_TYPEC_PHY_READ(sc, reg) bus_read_4(sc->res, (reg)) +#define RK_TYPEC_PHY_WRITE(sc, reg, val) bus_write_4(sc->res, (reg), (val)) + +/* Phy class and methods. */ +static int rk_typec_phy_enable(struct phynode *phynode, bool enable); +static int rk_typec_phy_get_mode(struct phynode *phy, int *mode); +static int rk_typec_phy_set_mode(struct phynode *phy, int mode); +static phynode_method_t rk_typec_phy_phynode_methods[] = { + PHYNODEMETHOD(phynode_enable, rk_typec_phy_enable), + PHYNODEMETHOD(phynode_usb_get_mode, rk_typec_phy_get_mode), + PHYNODEMETHOD(phynode_usb_set_mode, rk_typec_phy_set_mode), + + PHYNODEMETHOD_END +}; + +DEFINE_CLASS_1(rk_typec_phy_phynode, rk_typec_phy_phynode_class, + rk_typec_phy_phynode_methods, + sizeof(struct phynode_usb_sc), phynode_usb_class); + +enum RK3399_USBPHY { + RK3399_TYPEC_PHY_DP = 0, + RK3399_TYPEC_PHY_USB3, +}; + +static void +rk_typec_phy_set_usb2_only(struct rk_typec_phy_softc *sc, bool usb2only) +{ + uint32_t reg; + + /* Disable usb3tousb2 only */ + reg = SYSCON_READ_4(sc->grf, GRF_USB3PHY_CON0(sc->phy_ctrl_id)); + if (usb2only) + reg |= USB3PHY_CON0_USB2_ONLY; + else + reg &= ~USB3PHY_CON0_USB2_ONLY; + /* Write Mask */ + reg |= (USB3PHY_CON0_USB2_ONLY) << 16; + SYSCON_WRITE_4(sc->grf, GRF_USB3PHY_CON0(sc->phy_ctrl_id), reg); + + /* Enable the USB3 Super Speed port */ + reg = SYSCON_READ_4(sc->grf, GRF_USB3OTG_CON1(sc->phy_ctrl_id)); + if (usb2only) + reg |= USB3OTG_CON1_U3_DIS; + else + reg &= ~USB3OTG_CON1_U3_DIS; + /* Write Mask */ + reg |= (USB3OTG_CON1_U3_DIS) << 16; + SYSCON_WRITE_4(sc->grf, GRF_USB3OTG_CON1(sc->phy_ctrl_id), reg); +} + +static int +rk_typec_phy_enable(struct phynode *phynode, bool enable) +{ + struct rk_typec_phy_softc *sc; + device_t dev; + intptr_t phy; + uint32_t reg; + int err; + + dev = phynode_get_device(phynode); + phy = phynode_get_id(phynode); + sc = device_get_softc(dev); + + if (phy != RK3399_TYPEC_PHY_USB3) + return (ERANGE); + + rk_typec_phy_set_usb2_only(sc, false); + + err = clk_enable(sc->tcpdcore); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->tcpdcore)); + return (ENXIO); + } + err = clk_enable(sc->tcpdphy_ref); + if (err != 0) { + device_printf(dev, "Could not enable clock %s\n", + clk_get_name(sc->tcpdphy_ref)); + clk_disable(sc->tcpdcore); + return (ENXIO); + } + + hwreset_deassert(sc->rst_tcphy); + + /* 24M configuration, magic values from rockchip */ + RK_TYPEC_PHY_WRITE(sc, PMA_CMN_CTRL1, 0x830); + for (int i = 0; i < 4; i++) { + RK_TYPEC_PHY_WRITE(sc, XCVR_DIAG_LANE_FCM_EN_MGN(i), 0x90); + RK_TYPEC_PHY_WRITE(sc, TX_RCVDET_EN_TMR(i), 0x960); + RK_TYPEC_PHY_WRITE(sc, TX_RCVDET_ST_TMR(i), 0x30); + } + reg = RK_TYPEC_PHY_READ(sc, CMN_DIAG_HSCLK_SEL); + reg &= ~CMN_DIAG_HSCLK_SEL_PLL_MASK; + reg |= CMN_DIAG_HSCLK_SEL_PLL_CONFIG; + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_HSCLK_SEL, reg); + + /* PLL configuration, magic values from rockchip */ + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_VCOCAL_INIT, 0xf0); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_VCOCAL_ITER, 0x18); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_INTDIV, 0xd0); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_FRACDIV, 0x4a4a); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_HIGH_THR, 0x34); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_SS_CTRL1, 0x1ee); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_SS_CTRL2, 0x7f03); + RK_TYPEC_PHY_WRITE(sc, CMN_PLL0_DSM_DIAG, 0x20); + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_PLL0_OVRD, 0); + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_PLL0_FBH_OVRD, 0); + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_PLL0_FBL_OVRD, 0); + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_PLL0_V2I_TUNE, 0x7); + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_PLL0_CP_TUNE, 0x45); + RK_TYPEC_PHY_WRITE(sc, CMN_DIAG_PLL0_LF_PROG, 0x8); + + /* Configure the TX and RX line, magic values from rockchip */ + RK_TYPEC_PHY_WRITE(sc, TX_PSC_A0(0), 0x7799); + RK_TYPEC_PHY_WRITE(sc, TX_PSC_A1(0), 0x7798); + RK_TYPEC_PHY_WRITE(sc, TX_PSC_A2(0), 0x5098); + RK_TYPEC_PHY_WRITE(sc, TX_PSC_A3(0), 0x5098); + RK_TYPEC_PHY_WRITE(sc, TX_TXCC_MGNFS_MULT_000(0), 0x0); + RK_TYPEC_PHY_WRITE(sc, XCVR_DIAG_BIDI_CTRL(0), 0xbf); + + RK_TYPEC_PHY_WRITE(sc, RX_PSC_A0(1), 0xa6fd); + RK_TYPEC_PHY_WRITE(sc, RX_PSC_A1(1), 0xa6fd); + RK_TYPEC_PHY_WRITE(sc, RX_PSC_A2(1), 0xa410); + RK_TYPEC_PHY_WRITE(sc, RX_PSC_A3(1), 0x2410); + RK_TYPEC_PHY_WRITE(sc, RX_PSC_CAL(1), 0x23ff); + RK_TYPEC_PHY_WRITE(sc, RX_SIGDET_HL_FILT_TMR(1), 0x13); + RK_TYPEC_PHY_WRITE(sc, RX_REE_CTRL_DATA_MASK(1), 0x03e7); + RK_TYPEC_PHY_WRITE(sc, RX_DIAG_SIGDET_TUNE(1), 0x1004); + RK_TYPEC_PHY_WRITE(sc, RX_PSC_RDY(1), 0x2010); + RK_TYPEC_PHY_WRITE(sc, XCVR_DIAG_BIDI_CTRL(1), 0xfb); + + RK_TYPEC_PHY_WRITE(sc, PMA_LANE_CFG, PIN_ASSIGN_D_F); + + RK_TYPEC_PHY_WRITE(sc, DP_MODE_CTL, DP_MODE_ENTER_A2); + + hwreset_deassert(sc->rst_uphy); + + for (int timeout = 10000; timeout > 0; timeout--) { + reg = RK_TYPEC_PHY_READ(sc, PMA_CMN_CTRL1); + if (reg & PMA_CMN_CTRL1_READY) + break; + DELAY(10); + } + if (timeout == 0) { + device_printf(sc->dev, "Timeout waiting for PMA\n"); + return (ENXIO); + } + + hwreset_deassert(sc->rst_pipe); + + return (0); +} + +static int +rk_typec_phy_get_mode(struct phynode *phynode, int *mode) +{ + struct rk_typec_phy_softc *sc; + intptr_t phy; + device_t dev; + + dev = phynode_get_device(phynode); + phy = phynode_get_id(phynode); + sc = device_get_softc(dev); + + if (phy != RK3399_TYPEC_PHY_USB3) + return (ERANGE); + + *mode = sc->mode; + + return (0); +} + +static int +rk_typec_phy_set_mode(struct phynode *phynode, int mode) +{ + struct rk_typec_phy_softc *sc; + intptr_t phy; + device_t dev; + + dev = phynode_get_device(phynode); + phy = phynode_get_id(phynode); + sc = device_get_softc(dev); + + if (phy != RK3399_TYPEC_PHY_USB3) + return (ERANGE); + + sc->mode = mode; + + return (0); +} + +static int +rk_typec_phy_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "Rockchip RK3399 PHY TYPEC"); + return (BUS_PROBE_DEFAULT); +} + +static int +rk_typec_phy_attach(device_t dev) +{ + struct rk_typec_phy_softc *sc; + struct phynode_init_def phy_init; + struct phynode *phynode; + phandle_t node, usb3; + phandle_t reg_prop[4]; + + sc = device_get_softc(dev); + sc->dev = dev; + node = ofw_bus_get_node(dev); + + /* + * Find out which phy we are. + * There is not property for this so we need to know the + * address to use the correct GRF registers. + */ + if (OF_getencprop(node, "reg", reg_prop, sizeof(reg_prop)) <= 0) { + device_printf(dev, "Cannot guess phy controller id\n"); + return (ENXIO); + } + switch (reg_prop[1]) { + case 0xff7c0000: + sc->phy_ctrl_id = 0; + break; + case 0xff800000: + sc->phy_ctrl_id = 1; + break; + default: + device_printf(dev, "Unknown address %x for typec-phy\n", reg_prop[1]); + return (ENXIO); + } + + if (bus_alloc_resources(dev, rk_typec_phy_spec, &sc->res) != 0) { + device_printf(dev, "cannot allocate resources for device\n"); + goto fail; + } + + if (syscon_get_by_ofw_property(dev, node, + "rockchip,grf", &sc->grf) != 0) { + device_printf(dev, "Cannot get syscon handle\n"); + goto fail; + } + + if (clk_get_by_ofw_name(dev, 0, "tcpdcore", &sc->tcpdcore) != 0) { + device_printf(dev, "Cannot get tcpdcore clock\n"); + goto fail; + } + if (clk_get_by_ofw_name(dev, 0, "tcpdphy-ref", &sc->tcpdphy_ref) != 0) { + device_printf(dev, "Cannot get tcpdphy-ref clock\n"); + goto fail; + } + + if (hwreset_get_by_ofw_name(dev, 0, "uphy", &sc->rst_uphy) != 0) { + device_printf(dev, "Cannot get uphy reset\n"); + goto fail; + } + if (hwreset_get_by_ofw_name(dev, 0, "uphy-pipe", &sc->rst_pipe) != 0) { + device_printf(dev, "Cannot get uphy-pipe reset\n"); + goto fail; + } + if (hwreset_get_by_ofw_name(dev, 0, "uphy-tcphy", &sc->rst_tcphy) != 0) { + device_printf(dev, "Cannot get uphy-tcphy reset\n"); + goto fail; + } + + /* + * Make sure that the module is asserted + * We need to deassert in a certain order when we enable the phy + */ + hwreset_assert(sc->rst_uphy); + hwreset_assert(sc->rst_pipe); + hwreset_assert(sc->rst_tcphy); + + /* Set the assigned clocks parent and freq */ + if (clk_set_assigned(dev, node) != 0) { + device_printf(dev, "clk_set_assigned failed\n"); + goto fail; + } + + /* Only usb3 port is supported right now */ + usb3 = ofw_bus_find_child(node, "usb3-port"); + if (usb3 == 0) { + device_printf(dev, "Cannot find usb3-port child node\n"); + goto fail; + } + /* If the child isn't enable attach the driver + * but do not register the PHY. + */ + if (!ofw_bus_node_status_okay(usb3)) + return (0); + + phy_init.id = RK3399_TYPEC_PHY_USB3; + phy_init.ofw_node = usb3; + phynode = phynode_create(dev, &rk_typec_phy_phynode_class, &phy_init); + if (phynode == NULL) { + device_printf(dev, "failed to create phy usb3-port\n"); + goto fail; + } + if (phynode_register(phynode) == NULL) { + device_printf(dev, "failed to register phy usb3-port\n"); + goto fail; + } + + OF_device_register_xref(OF_xref_from_node(usb3), dev); + + return (0); + +fail: + bus_release_resources(dev, rk_typec_phy_spec, &sc->res); + + return (ENXIO); +} + +static device_method_t rk_typec_phy_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, rk_typec_phy_probe), + DEVMETHOD(device_attach, rk_typec_phy_attach), + + DEVMETHOD_END +}; + +static driver_t rk_typec_phy_driver = { + "rk_typec_phy", + rk_typec_phy_methods, + sizeof(struct rk_typec_phy_softc) +}; + +static devclass_t rk_typec_phy_devclass; +EARLY_DRIVER_MODULE(rk_typec_phy, simplebus, rk_typec_phy_driver, + rk_typec_phy_devclass, 0, 0, BUS_PASS_SUPPORTDEV + BUS_PASS_ORDER_MIDDLE); +MODULE_VERSION(rk_typec_phy, 1); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Oct 25 18:08:59 2019 (r354088) +++ head/sys/conf/files.arm64 Fri Oct 25 18:10:02 2019 (r354089) @@ -299,6 +299,7 @@ arm64/rockchip/rk_grf.c optional fdt soc_rockchip_rk arm64/rockchip/rk_pinctrl.c optional fdt rk_pinctrl soc_rockchip_rk3328 | fdt rk_pinctrl soc_rockchip_rk3399 arm64/rockchip/rk_gpio.c optional fdt rk_gpio soc_rockchip_rk3328 | fdt rk_gpio soc_rockchip_rk3399 arm64/rockchip/rk_usb2phy.c optional fdt rk_usb2phy soc_rockchip_rk3328 | soc_rockchip_rk3399 +arm64/rockchip/rk_typec_phy.c optional fdt rk_typec_phy soc_rockchip_rk3399 arm64/rockchip/if_dwc_rk.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 dev/dwc/if_dwc.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 dev/dwc/if_dwc_if.m optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 From owner-svn-src-all@freebsd.org Fri Oct 25 18:17:58 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 18DC6177B04; Fri, 25 Oct 2019 18:17:58 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470C5d6wcdz3MgP; Fri, 25 Oct 2019 18:17:57 +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 CBC7E2A472; Fri, 25 Oct 2019 18:17:57 +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 x9PIHvbV023880; Fri, 25 Oct 2019 18:17:57 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PIHvpw023878; Fri, 25 Oct 2019 18:17:57 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910251817.x9PIHvpw023878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 25 Oct 2019 18:17:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354090 - in stable/12/sys: netinet netinet6 X-SVN-Group: stable-12 X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in stable/12/sys: netinet netinet6 X-SVN-Commit-Revision: 354090 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 18:17:58 -0000 Author: tuexen Date: Fri Oct 25 18:17:56 2019 New Revision: 354090 URL: https://svnweb.freebsd.org/changeset/base/354090 Log: MFC r354044: Ensure that the flags indicating IPv4/IPv6 are not changed by failing bind() calls. This would lead to inconsistent state resulting in a panic. A fix for stable/11 was committed in https://svnweb.freebsd.org/base?view=revision&revision=338986 Reported by: syzbot+2609a378d89264ff5a42@syzkaller.appspotmail.com Obtained from: jtl@ Sponsored by: Netflix, Inc. Modified: stable/12/sys/netinet/tcp_usrreq.c stable/12/sys/netinet6/sctp6_usrreq.c stable/12/sys/netinet6/udp6_usrreq.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/netinet/tcp_usrreq.c ============================================================================== --- stable/12/sys/netinet/tcp_usrreq.c Fri Oct 25 18:10:02 2019 (r354089) +++ stable/12/sys/netinet/tcp_usrreq.c Fri Oct 25 18:17:56 2019 (r354090) @@ -345,6 +345,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct inpcb *inp; struct tcpcb *tp = NULL; struct sockaddr_in6 *sin6p; + u_char vflagsav; sin6p = (struct sockaddr_in6 *)nam; if (nam->sa_len != sizeof (*sin6p)) @@ -361,6 +362,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { error = EINVAL; goto out; @@ -395,6 +397,8 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, error = in6_pcbbind(inp, nam, td->td_ucred); INP_HASH_WUNLOCK(&V_tcbinfo); out: + if (error != 0) + inp->inp_vflag = vflagsav; TCPDEBUG2(PRU_BIND); TCP_PROBE2(debug__user, tp, PRU_BIND); INP_WUNLOCK(inp); @@ -457,6 +461,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct int error = 0; struct inpcb *inp; struct tcpcb *tp = NULL; + u_char vflagsav; TCPDEBUG0; inp = sotoinpcb(so); @@ -466,6 +471,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct error = EINVAL; goto out; } + vflagsav = inp->inp_vflag; tp = intotcpcb(inp); TCPDEBUG1(); SOCK_LOCK(so); @@ -491,6 +497,9 @@ tcp6_usr_listen(struct socket *so, int backlog, struct if (IS_FASTOPEN(tp->t_flags)) tp->t_tfo_pending = tcp_fastopen_alloc_counter(); + if (error != 0) + inp->inp_vflag = vflagsav; + out: TCPDEBUG2(PRU_LISTEN); TCP_PROBE2(debug__user, tp, PRU_LISTEN); @@ -567,6 +576,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n struct inpcb *inp; struct tcpcb *tp = NULL; struct sockaddr_in6 *sin6p; + u_int8_t incflagsav; + u_char vflagsav; TCPDEBUG0; @@ -583,6 +594,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; + incflagsav = inp->inp_inc.inc_flags; if (inp->inp_flags & INP_TIMEWAIT) { error = EADDRINUSE; goto out; @@ -616,11 +629,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n error = EAFNOSUPPORT; goto out; } - inp->inp_vflag |= INP_IPV4; - inp->inp_vflag &= ~INP_IPV6; if ((error = prison_remote_ip4(td->td_ucred, &sin.sin_addr)) != 0) goto out; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; if ((error = tcp_connect(tp, (struct sockaddr *)&sin, td)) != 0) goto out; #ifdef TCP_OFFLOAD @@ -638,11 +651,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n } } #endif + if ((error = prison_remote_ip6(td->td_ucred, &sin6p->sin6_addr)) != 0) + goto out; inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; inp->inp_inc.inc_flags |= INC_ISIPV6; - if ((error = prison_remote_ip6(td->td_ucred, &sin6p->sin6_addr)) != 0) - goto out; if ((error = tcp6_connect(tp, nam, td)) != 0) goto out; #ifdef TCP_OFFLOAD @@ -655,6 +668,15 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n error = tp->t_fb->tfb_tcp_output(tp); out: + /* + * If the implicit bind in the connect call fails, restore + * the flags we modified. + */ + if (error != 0 && inp->inp_lport == 0) { + inp->inp_vflag = vflagsav; + inp->inp_inc.inc_flags = incflagsav; + } + TCPDEBUG2(PRU_CONNECT); TCP_PROBE2(debug__user, tp, PRU_CONNECT); INP_WUNLOCK(inp); @@ -910,6 +932,9 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf #ifdef INET6 int isipv6; #endif + u_int8_t incflagsav; + u_char vflagsav; + bool restoreflags; TCPDEBUG0; /* @@ -921,6 +946,9 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_send: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; + incflagsav = inp->inp_inc.inc_flags; + restoreflags = false; if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { if (control) m_freem(control); @@ -1001,6 +1029,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf m_freem(m); goto out; } + restoreflags = true; inp->inp_vflag &= ~INP_IPV6; sinp = &sin; in6_sin6_2_sin(sinp, sin6p); @@ -1031,6 +1060,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf error = EAFNOSUPPORT; goto out; } + restoreflags = true; inp->inp_vflag &= ~INP_IPV4; inp->inp_inc.inc_flags |= INC_ISIPV6; if ((error = prison_remote_ip6(td->td_ucred, @@ -1081,6 +1111,14 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf error = tcp_connect(tp, (struct sockaddr *)sinp, td); #endif + /* + * The bind operation in tcp_connect succeeded. We + * no longer want to restore the flags if later + * operations fail. + */ + if (error == 0 || inp->inp_lport != 0) + restoreflags = false; + if (error) goto out; if (IS_FASTOPEN(tp->t_flags)) @@ -1151,6 +1189,14 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf error = tcp_connect(tp, (struct sockaddr *)sinp, td); #endif + /* + * The bind operation in tcp_connect succeeded. We + * no longer want to restore the flags if later + * operations fail. + */ + if (error == 0 || inp->inp_lport != 0) + restoreflags = false; + if (error) goto out; tp->snd_wnd = TTCP_CLIENT_SND_WND; @@ -1169,6 +1215,14 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf TCP_LOG_USERSEND, error, 0, NULL, false); out: + /* + * If the request was unsuccessful and we changed flags, + * restore the original flags. + */ + if (error != 0 && restoreflags) { + inp->inp_vflag = vflagsav; + inp->inp_inc.inc_flags = incflagsav; + } TCPDEBUG2((flags & PRUS_OOB) ? PRU_SENDOOB : ((flags & PRUS_EOF) ? PRU_SEND_EOF : PRU_SEND)); TCP_PROBE2(debug__user, tp, (flags & PRUS_OOB) ? PRU_SENDOOB : Modified: stable/12/sys/netinet6/sctp6_usrreq.c ============================================================================== --- stable/12/sys/netinet6/sctp6_usrreq.c Fri Oct 25 18:10:02 2019 (r354089) +++ stable/12/sys/netinet6/sctp6_usrreq.c Fri Oct 25 18:17:56 2019 (r354090) @@ -563,6 +563,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s struct sctp_inpcb *inp; struct in6pcb *inp6; int error; + u_char vflagsav; inp = (struct sctp_inpcb *)so->so_pcb; if (inp == NULL) { @@ -594,6 +595,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s } } inp6 = (struct in6pcb *)inp; + vflagsav = inp6->inp_vflag; inp6->inp_vflag &= ~INP_IPV4; inp6->inp_vflag |= INP_IPV6; if ((addr != NULL) && (SCTP_IPV6_V6ONLY(inp6) == 0)) { @@ -623,7 +625,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s inp6->inp_vflag |= INP_IPV4; inp6->inp_vflag &= ~INP_IPV6; error = sctp_inpcb_bind(so, (struct sockaddr *)&sin, NULL, p); - return (error); + goto out; } #endif break; @@ -640,7 +642,8 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s if (addr->sa_family == AF_INET) { /* can't bind v4 addr to v6 only socket! */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); - return (EINVAL); + error = EINVAL; + goto out; } #endif sin6_p = (struct sockaddr_in6 *)addr; @@ -649,10 +652,14 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s /* can't bind v4-mapped addrs either! */ /* NOTE: we don't support SIIT */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); - return (EINVAL); + error = EINVAL; + goto out; } } error = sctp_inpcb_bind(so, addr, NULL, p); +out: + if (error != 0) + inp6->inp_vflag = vflagsav; return (error); } Modified: stable/12/sys/netinet6/udp6_usrreq.c ============================================================================== --- stable/12/sys/netinet6/udp6_usrreq.c Fri Oct 25 18:10:02 2019 (r354089) +++ stable/12/sys/netinet6/udp6_usrreq.c Fri Oct 25 18:17:56 2019 (r354090) @@ -1143,6 +1143,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str struct inpcb *inp; struct inpcbinfo *pcbinfo; int error; + u_char vflagsav; pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); @@ -1150,6 +1151,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str INP_WLOCK(inp); INP_HASH_WLOCK(pcbinfo); + vflagsav = inp->inp_vflag; inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { @@ -1177,6 +1179,8 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str #ifdef INET out: #endif + if (error != 0) + inp->inp_vflag = vflagsav; INP_HASH_WUNLOCK(pcbinfo); INP_WUNLOCK(inp); return (error); @@ -1223,6 +1227,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct inpcbinfo *pcbinfo; struct sockaddr_in6 *sin6; int error; + u_char vflagsav; pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); @@ -1250,17 +1255,26 @@ udp6_connect(struct socket *so, struct sockaddr *nam, goto out; } in6_sin6_2_sin(&sin, sin6); - inp->inp_vflag |= INP_IPV4; - inp->inp_vflag &= ~INP_IPV6; error = prison_remote_ip4(td->td_ucred, &sin.sin_addr); if (error != 0) goto out; + vflagsav = inp->inp_vflag; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; INP_HASH_WLOCK(pcbinfo); error = in_pcbconnect(inp, (struct sockaddr *)&sin, td->td_ucred); INP_HASH_WUNLOCK(pcbinfo); + /* + * If connect succeeds, mark socket as connected. If + * connect fails and socket is unbound, reset inp_vflag + * field. + */ if (error == 0) soisconnected(so); + else if (inp->inp_laddr.s_addr == INADDR_ANY && + inp->inp_lport == 0) + inp->inp_vflag = vflagsav; goto out; } else { if ((inp->inp_vflag & INP_IPV6) == 0) { @@ -1273,16 +1287,25 @@ udp6_connect(struct socket *so, struct sockaddr *nam, error = EISCONN; goto out; } - inp->inp_vflag &= ~INP_IPV4; - inp->inp_vflag |= INP_IPV6; error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr); if (error != 0) goto out; + vflagsav = inp->inp_vflag; + inp->inp_vflag &= ~INP_IPV4; + inp->inp_vflag |= INP_IPV6; INP_HASH_WLOCK(pcbinfo); error = in6_pcbconnect(inp, nam, td->td_ucred); INP_HASH_WUNLOCK(pcbinfo); + /* + * If connect succeeds, mark socket as connected. If + * connect fails and socket is unbound, reset inp_vflag + * field. + */ if (error == 0) soisconnected(so); + else if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) && + inp->inp_lport == 0) + inp->inp_vflag = vflagsav; out: INP_WUNLOCK(inp); return (error); From owner-svn-src-all@freebsd.org Fri Oct 25 18:46:54 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2A5E158365; Fri, 25 Oct 2019 18:46:54 +0000 (UTC) (envelope-from tuexen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Cl22fjrz3NxK; Fri, 25 Oct 2019 18:46:54 +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 3E6892A9F9; Fri, 25 Oct 2019 18:46:54 +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 x9PIksjf041536; Fri, 25 Oct 2019 18:46:54 GMT (envelope-from tuexen@FreeBSD.org) Received: (from tuexen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PIkrTO041533; Fri, 25 Oct 2019 18:46:53 GMT (envelope-from tuexen@FreeBSD.org) Message-Id: <201910251846.x9PIkrTO041533@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tuexen set sender to tuexen@FreeBSD.org using -f From: Michael Tuexen Date: Fri, 25 Oct 2019 18:46:53 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-releng@freebsd.org Subject: svn commit: r354091 - in releng/12.1/sys: netinet netinet6 X-SVN-Group: releng X-SVN-Commit-Author: tuexen X-SVN-Commit-Paths: in releng/12.1/sys: netinet netinet6 X-SVN-Commit-Revision: 354091 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 18:46:54 -0000 Author: tuexen Date: Fri Oct 25 18:46:53 2019 New Revision: 354091 URL: https://svnweb.freebsd.org/changeset/base/354091 Log: MFS r354090: Ensure that the flags indicating IPv4/IPv6 are not changed by failing bind() calls. This would lead to inconsistent state resulting in a panic. A fix for stable/11 was committed in https://svnweb.freebsd.org/base?view=revision&revision=338986 Reported by: syzbot+2609a378d89264ff5a42@syzkaller.appspotmail.com Obtained from: jtl@ Sponsored by: Netflix, Inc. Approved by: re (gjb@) Modified: releng/12.1/sys/netinet/tcp_usrreq.c releng/12.1/sys/netinet6/sctp6_usrreq.c releng/12.1/sys/netinet6/udp6_usrreq.c Directory Properties: releng/12.1/ (props changed) Modified: releng/12.1/sys/netinet/tcp_usrreq.c ============================================================================== --- releng/12.1/sys/netinet/tcp_usrreq.c Fri Oct 25 18:17:56 2019 (r354090) +++ releng/12.1/sys/netinet/tcp_usrreq.c Fri Oct 25 18:46:53 2019 (r354091) @@ -345,6 +345,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, struct inpcb *inp; struct tcpcb *tp = NULL; struct sockaddr_in6 *sin6p; + u_char vflagsav; sin6p = (struct sockaddr_in6 *)nam; if (nam->sa_len != sizeof (*sin6p)) @@ -361,6 +362,7 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { error = EINVAL; goto out; @@ -395,6 +397,8 @@ tcp6_usr_bind(struct socket *so, struct sockaddr *nam, error = in6_pcbbind(inp, nam, td->td_ucred); INP_HASH_WUNLOCK(&V_tcbinfo); out: + if (error != 0) + inp->inp_vflag = vflagsav; TCPDEBUG2(PRU_BIND); TCP_PROBE2(debug__user, tp, PRU_BIND); INP_WUNLOCK(inp); @@ -457,6 +461,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct int error = 0; struct inpcb *inp; struct tcpcb *tp = NULL; + u_char vflagsav; TCPDEBUG0; inp = sotoinpcb(so); @@ -466,6 +471,7 @@ tcp6_usr_listen(struct socket *so, int backlog, struct error = EINVAL; goto out; } + vflagsav = inp->inp_vflag; tp = intotcpcb(inp); TCPDEBUG1(); SOCK_LOCK(so); @@ -491,6 +497,9 @@ tcp6_usr_listen(struct socket *so, int backlog, struct if (IS_FASTOPEN(tp->t_flags)) tp->t_tfo_pending = tcp_fastopen_alloc_counter(); + if (error != 0) + inp->inp_vflag = vflagsav; + out: TCPDEBUG2(PRU_LISTEN); TCP_PROBE2(debug__user, tp, PRU_LISTEN); @@ -567,6 +576,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n struct inpcb *inp; struct tcpcb *tp = NULL; struct sockaddr_in6 *sin6p; + u_int8_t incflagsav; + u_char vflagsav; TCPDEBUG0; @@ -583,6 +594,8 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_connect: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; + incflagsav = inp->inp_inc.inc_flags; if (inp->inp_flags & INP_TIMEWAIT) { error = EADDRINUSE; goto out; @@ -616,11 +629,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n error = EAFNOSUPPORT; goto out; } - inp->inp_vflag |= INP_IPV4; - inp->inp_vflag &= ~INP_IPV6; if ((error = prison_remote_ip4(td->td_ucred, &sin.sin_addr)) != 0) goto out; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; if ((error = tcp_connect(tp, (struct sockaddr *)&sin, td)) != 0) goto out; #ifdef TCP_OFFLOAD @@ -638,11 +651,11 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n } } #endif + if ((error = prison_remote_ip6(td->td_ucred, &sin6p->sin6_addr)) != 0) + goto out; inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; inp->inp_inc.inc_flags |= INC_ISIPV6; - if ((error = prison_remote_ip6(td->td_ucred, &sin6p->sin6_addr)) != 0) - goto out; if ((error = tcp6_connect(tp, nam, td)) != 0) goto out; #ifdef TCP_OFFLOAD @@ -655,6 +668,15 @@ tcp6_usr_connect(struct socket *so, struct sockaddr *n error = tp->t_fb->tfb_tcp_output(tp); out: + /* + * If the implicit bind in the connect call fails, restore + * the flags we modified. + */ + if (error != 0 && inp->inp_lport == 0) { + inp->inp_vflag = vflagsav; + inp->inp_inc.inc_flags = incflagsav; + } + TCPDEBUG2(PRU_CONNECT); TCP_PROBE2(debug__user, tp, PRU_CONNECT); INP_WUNLOCK(inp); @@ -910,6 +932,9 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf #ifdef INET6 int isipv6; #endif + u_int8_t incflagsav; + u_char vflagsav; + bool restoreflags; TCPDEBUG0; /* @@ -921,6 +946,9 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_send: inp == NULL")); INP_WLOCK(inp); + vflagsav = inp->inp_vflag; + incflagsav = inp->inp_inc.inc_flags; + restoreflags = false; if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { if (control) m_freem(control); @@ -1001,6 +1029,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf m_freem(m); goto out; } + restoreflags = true; inp->inp_vflag &= ~INP_IPV6; sinp = &sin; in6_sin6_2_sin(sinp, sin6p); @@ -1031,6 +1060,7 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf error = EAFNOSUPPORT; goto out; } + restoreflags = true; inp->inp_vflag &= ~INP_IPV4; inp->inp_inc.inc_flags |= INC_ISIPV6; if ((error = prison_remote_ip6(td->td_ucred, @@ -1081,6 +1111,14 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf error = tcp_connect(tp, (struct sockaddr *)sinp, td); #endif + /* + * The bind operation in tcp_connect succeeded. We + * no longer want to restore the flags if later + * operations fail. + */ + if (error == 0 || inp->inp_lport != 0) + restoreflags = false; + if (error) goto out; if (IS_FASTOPEN(tp->t_flags)) @@ -1151,6 +1189,14 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf error = tcp_connect(tp, (struct sockaddr *)sinp, td); #endif + /* + * The bind operation in tcp_connect succeeded. We + * no longer want to restore the flags if later + * operations fail. + */ + if (error == 0 || inp->inp_lport != 0) + restoreflags = false; + if (error) goto out; tp->snd_wnd = TTCP_CLIENT_SND_WND; @@ -1169,6 +1215,14 @@ tcp_usr_send(struct socket *so, int flags, struct mbuf TCP_LOG_USERSEND, error, 0, NULL, false); out: + /* + * If the request was unsuccessful and we changed flags, + * restore the original flags. + */ + if (error != 0 && restoreflags) { + inp->inp_vflag = vflagsav; + inp->inp_inc.inc_flags = incflagsav; + } TCPDEBUG2((flags & PRUS_OOB) ? PRU_SENDOOB : ((flags & PRUS_EOF) ? PRU_SEND_EOF : PRU_SEND)); TCP_PROBE2(debug__user, tp, (flags & PRUS_OOB) ? PRU_SENDOOB : Modified: releng/12.1/sys/netinet6/sctp6_usrreq.c ============================================================================== --- releng/12.1/sys/netinet6/sctp6_usrreq.c Fri Oct 25 18:17:56 2019 (r354090) +++ releng/12.1/sys/netinet6/sctp6_usrreq.c Fri Oct 25 18:46:53 2019 (r354091) @@ -563,6 +563,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s struct sctp_inpcb *inp; struct in6pcb *inp6; int error; + u_char vflagsav; inp = (struct sctp_inpcb *)so->so_pcb; if (inp == NULL) { @@ -594,6 +595,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s } } inp6 = (struct in6pcb *)inp; + vflagsav = inp6->inp_vflag; inp6->inp_vflag &= ~INP_IPV4; inp6->inp_vflag |= INP_IPV6; if ((addr != NULL) && (SCTP_IPV6_V6ONLY(inp6) == 0)) { @@ -623,7 +625,7 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s inp6->inp_vflag |= INP_IPV4; inp6->inp_vflag &= ~INP_IPV6; error = sctp_inpcb_bind(so, (struct sockaddr *)&sin, NULL, p); - return (error); + goto out; } #endif break; @@ -640,7 +642,8 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s if (addr->sa_family == AF_INET) { /* can't bind v4 addr to v6 only socket! */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); - return (EINVAL); + error = EINVAL; + goto out; } #endif sin6_p = (struct sockaddr_in6 *)addr; @@ -649,10 +652,14 @@ sctp6_bind(struct socket *so, struct sockaddr *addr, s /* can't bind v4-mapped addrs either! */ /* NOTE: we don't support SIIT */ SCTP_LTRACE_ERR_RET(inp, NULL, NULL, SCTP_FROM_SCTP6_USRREQ, EINVAL); - return (EINVAL); + error = EINVAL; + goto out; } } error = sctp_inpcb_bind(so, addr, NULL, p); +out: + if (error != 0) + inp6->inp_vflag = vflagsav; return (error); } Modified: releng/12.1/sys/netinet6/udp6_usrreq.c ============================================================================== --- releng/12.1/sys/netinet6/udp6_usrreq.c Fri Oct 25 18:17:56 2019 (r354090) +++ releng/12.1/sys/netinet6/udp6_usrreq.c Fri Oct 25 18:46:53 2019 (r354091) @@ -1143,6 +1143,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str struct inpcb *inp; struct inpcbinfo *pcbinfo; int error; + u_char vflagsav; pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); @@ -1150,6 +1151,7 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str INP_WLOCK(inp); INP_HASH_WLOCK(pcbinfo); + vflagsav = inp->inp_vflag; inp->inp_vflag &= ~INP_IPV4; inp->inp_vflag |= INP_IPV6; if ((inp->inp_flags & IN6P_IPV6_V6ONLY) == 0) { @@ -1177,6 +1179,8 @@ udp6_bind(struct socket *so, struct sockaddr *nam, str #ifdef INET out: #endif + if (error != 0) + inp->inp_vflag = vflagsav; INP_HASH_WUNLOCK(pcbinfo); INP_WUNLOCK(inp); return (error); @@ -1223,6 +1227,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct inpcbinfo *pcbinfo; struct sockaddr_in6 *sin6; int error; + u_char vflagsav; pcbinfo = udp_get_inpcbinfo(so->so_proto->pr_protocol); inp = sotoinpcb(so); @@ -1250,17 +1255,26 @@ udp6_connect(struct socket *so, struct sockaddr *nam, goto out; } in6_sin6_2_sin(&sin, sin6); - inp->inp_vflag |= INP_IPV4; - inp->inp_vflag &= ~INP_IPV6; error = prison_remote_ip4(td->td_ucred, &sin.sin_addr); if (error != 0) goto out; + vflagsav = inp->inp_vflag; + inp->inp_vflag |= INP_IPV4; + inp->inp_vflag &= ~INP_IPV6; INP_HASH_WLOCK(pcbinfo); error = in_pcbconnect(inp, (struct sockaddr *)&sin, td->td_ucred); INP_HASH_WUNLOCK(pcbinfo); + /* + * If connect succeeds, mark socket as connected. If + * connect fails and socket is unbound, reset inp_vflag + * field. + */ if (error == 0) soisconnected(so); + else if (inp->inp_laddr.s_addr == INADDR_ANY && + inp->inp_lport == 0) + inp->inp_vflag = vflagsav; goto out; } else { if ((inp->inp_vflag & INP_IPV6) == 0) { @@ -1273,16 +1287,25 @@ udp6_connect(struct socket *so, struct sockaddr *nam, error = EISCONN; goto out; } - inp->inp_vflag &= ~INP_IPV4; - inp->inp_vflag |= INP_IPV6; error = prison_remote_ip6(td->td_ucred, &sin6->sin6_addr); if (error != 0) goto out; + vflagsav = inp->inp_vflag; + inp->inp_vflag &= ~INP_IPV4; + inp->inp_vflag |= INP_IPV6; INP_HASH_WLOCK(pcbinfo); error = in6_pcbconnect(inp, nam, td->td_ucred); INP_HASH_WUNLOCK(pcbinfo); + /* + * If connect succeeds, mark socket as connected. If + * connect fails and socket is unbound, reset inp_vflag + * field. + */ if (error == 0) soisconnected(so); + else if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr) && + inp->inp_lport == 0) + inp->inp_vflag = vflagsav; out: INP_WUNLOCK(inp); return (error); From owner-svn-src-all@freebsd.org Fri Oct 25 18:54:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 12DF21585E7; Fri, 25 Oct 2019 18:54:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470CvL6kV5z3PQV; Fri, 25 Oct 2019 18:54:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CB9012ABB5; Fri, 25 Oct 2019 18:54:06 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PIs6JH047469; Fri, 25 Oct 2019 18:54:06 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PIs6Vf047467; Fri, 25 Oct 2019 18:54:06 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910251854.x9PIs6Vf047467@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Fri, 25 Oct 2019 18:54:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354092 - in head/sys: netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head/sys: netinet netinet6 X-SVN-Commit-Revision: 354092 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 18:54:07 -0000 Author: bz Date: Fri Oct 25 18:54:06 2019 New Revision: 354092 URL: https://svnweb.freebsd.org/changeset/base/354092 Log: Properly set VNET when nuking recvif from fragment queues. In theory the eventhandler invoke should be in the same VNET as the the current interface. We however cannot guarantee that for all cases in the future. So before checking if the fragmentation handling for this VNET is active, switch the VNET to the VNET of the interface to always get the one we want. Reviewed by: hselasky MFC after: 3 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22153 Modified: head/sys/netinet/ip_reass.c head/sys/netinet6/frag6.c Modified: head/sys/netinet/ip_reass.c ============================================================================== --- head/sys/netinet/ip_reass.c Fri Oct 25 18:46:53 2019 (r354091) +++ head/sys/netinet/ip_reass.c Fri Oct 25 18:54:06 2019 (r354092) @@ -632,14 +632,17 @@ ipreass_cleanup(void *arg __unused, struct ifnet *ifp) KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); + CURVNET_SET_QUIET(ifp->if_vnet); + /* * Skip processing if IPv4 reassembly is not initialised or * torn down by ipreass_destroy(). */ - if (V_ipq_zone == NULL) + if (V_ipq_zone == NULL) { + CURVNET_RESTORE(); return; + } - CURVNET_SET_QUIET(ifp->if_vnet); for (i = 0; i < IPREASS_NHASH; i++) { IPQ_LOCK(i); /* Scan fragment list. */ Modified: head/sys/netinet6/frag6.c ============================================================================== --- head/sys/netinet6/frag6.c Fri Oct 25 18:46:53 2019 (r354091) +++ head/sys/netinet6/frag6.c Fri Oct 25 18:54:06 2019 (r354092) @@ -307,16 +307,18 @@ frag6_cleanup(void *arg __unused, struct ifnet *ifp) KASSERT(ifp != NULL, ("%s: ifp is NULL", __func__)); + CURVNET_SET_QUIET(ifp->if_vnet); #ifdef VIMAGE /* * Skip processing if IPv6 reassembly is not initialised or * torn down by frag6_destroy(). */ - if (!V_frag6_on) + if (!V_frag6_on) { + CURVNET_RESTORE(); return; + } #endif - CURVNET_SET_QUIET(ifp->if_vnet); for (bucket = 0; bucket < IP6REASS_NHASH; bucket++) { IP6QB_LOCK(bucket); head = IP6QB_HEAD(bucket); From owner-svn-src-all@freebsd.org Fri Oct 25 18:56:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 942A31586A1; Fri, 25 Oct 2019 18:56:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470CyX48nLz3Pc1; Fri, 25 Oct 2019 18:56:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71A8B2ABDB; Fri, 25 Oct 2019 18:56:52 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PIuqG6047694; Fri, 25 Oct 2019 18:56:52 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PIuk3B047667; Fri, 25 Oct 2019 18:56:46 GMT (envelope-from mav@FreeBSD.org) Message-Id: <201910251856.x9PIuk3B047667@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Fri, 25 Oct 2019 18:56:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354093 - in stable/12/sys: amd64/amd64 amd64/include arm/arm arm/include arm64/arm64 arm64/include i386/i386 i386/include mips/include powerpc/include powerpc/powerpc riscv/include ris... X-SVN-Group: stable-12 X-SVN-Commit-Author: mav X-SVN-Commit-Paths: in stable/12/sys: amd64/amd64 amd64/include arm/arm arm/include arm64/arm64 arm64/include i386/i386 i386/include mips/include powerpc/include powerpc/powerpc riscv/include riscv/riscv sparc64/include ... X-SVN-Commit-Revision: 354093 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 18:56:52 -0000 Author: mav Date: Fri Oct 25 18:56:46 2019 New Revision: 354093 URL: https://svnweb.freebsd.org/changeset/base/354093 Log: MFC r351594 (by kib): Centralize __pcpu definitions. Many extern struct pcpu __pcpu declarations were copied/pasted in sources. The issue is that the definition is MD, but it cannot be provided by machine/pcpu.h due to actual struct pcpu defined in sys/pcpu.h later than the inclusion of machine/pcpu.h. This forced the copying when other code needed direct access to __pcpu. There is no way around it, due to machine/pcpu.h supplying part of struct pcpu fields. To work around the problem, add a new machine/pcpu_aux.h header, which should fill any needed MD definitions after struct pcpu definition is completed. This allows to remove copies of __pcpu spread around the source. Also on x86 it makes it possible to remove work arounds like OFFSETOF_CURTHREAD or clang specific warnings supressions. Added: stable/12/sys/amd64/include/pcpu_aux.h - copied unchanged from r351594, head/sys/amd64/include/pcpu_aux.h stable/12/sys/arm/include/pcpu_aux.h - copied unchanged from r351594, head/sys/arm/include/pcpu_aux.h stable/12/sys/arm64/include/pcpu_aux.h - copied unchanged from r351594, head/sys/arm64/include/pcpu_aux.h stable/12/sys/i386/include/pcpu_aux.h - copied unchanged from r351594, head/sys/i386/include/pcpu_aux.h stable/12/sys/mips/include/pcpu_aux.h - copied unchanged from r351594, head/sys/mips/include/pcpu_aux.h stable/12/sys/powerpc/include/pcpu_aux.h - copied unchanged from r351594, head/sys/powerpc/include/pcpu_aux.h stable/12/sys/riscv/include/pcpu_aux.h - copied unchanged from r351594, head/sys/riscv/include/pcpu_aux.h stable/12/sys/sparc64/include/pcpu_aux.h - copied unchanged from r351594, head/sys/sparc64/include/pcpu_aux.h Modified: stable/12/sys/amd64/amd64/mp_machdep.c stable/12/sys/amd64/amd64/pmap.c stable/12/sys/amd64/amd64/vm_machdep.c stable/12/sys/amd64/include/counter.h stable/12/sys/amd64/include/pcpu.h stable/12/sys/arm/arm/mp_machdep.c stable/12/sys/arm/include/counter.h stable/12/sys/arm64/arm64/mp_machdep.c stable/12/sys/arm64/include/counter.h stable/12/sys/i386/i386/mp_machdep.c stable/12/sys/i386/i386/vm_machdep.c stable/12/sys/i386/include/counter.h stable/12/sys/i386/include/pcpu.h stable/12/sys/powerpc/include/counter.h stable/12/sys/powerpc/powerpc/mp_machdep.c stable/12/sys/riscv/include/counter.h stable/12/sys/riscv/riscv/mp_machdep.c stable/12/sys/sys/pcpu.h Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/amd64/amd64/mp_machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/mp_machdep.c Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/amd64/amd64/mp_machdep.c Fri Oct 25 18:56:46 2019 (r354093) @@ -94,8 +94,6 @@ __FBSDID("$FreeBSD$"); #define AP_BOOTPT_SZ (PAGE_SIZE * 3) -extern struct pcpu *__pcpu; - /* Temporary variables for init_secondary() */ char *doublefault_stack; char *mce_stack; Modified: stable/12/sys/amd64/amd64/pmap.c ============================================================================== --- stable/12/sys/amd64/amd64/pmap.c Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/amd64/amd64/pmap.c Fri Oct 25 18:56:46 2019 (r354093) @@ -446,10 +446,6 @@ static pml4_entry_t *pti_pml4; static vm_pindex_t pti_pg_idx; static bool pti_finalized; -extern struct pcpu *__pcpu; -extern struct pcpu temp_bsp_pcpu; -extern pt_entry_t *pcpu_pte; - struct pmap_pkru_range { struct rs_el pkru_rs_el; u_int pkru_keyidx; Modified: stable/12/sys/amd64/amd64/vm_machdep.c ============================================================================== --- stable/12/sys/amd64/amd64/vm_machdep.c Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/amd64/amd64/vm_machdep.c Fri Oct 25 18:56:46 2019 (r354093) @@ -84,10 +84,6 @@ __FBSDID("$FreeBSD$"); #include #include -_Static_assert(OFFSETOF_CURTHREAD == offsetof(struct pcpu, pc_curthread), - "OFFSETOF_CURTHREAD does not correspond with offset of pc_curthread."); -_Static_assert(OFFSETOF_CURPCB == offsetof(struct pcpu, pc_curpcb), - "OFFSETOF_CURPCB does not correspond with offset of pc_curpcb."); _Static_assert(OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf), "OFFSETOF_MONITORBUF does not correspond with offset of pc_monitorbuf."); Modified: stable/12/sys/amd64/include/counter.h ============================================================================== --- stable/12/sys/amd64/include/counter.h Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/amd64/include/counter.h Fri Oct 25 18:56:46 2019 (r354093) @@ -33,9 +33,6 @@ #include -extern struct pcpu *__pcpu; -extern struct pcpu temp_bsp_pcpu; - #define EARLY_COUNTER &temp_bsp_pcpu.pc_early_dummy_counter #define counter_enter() do {} while (0) Modified: stable/12/sys/amd64/include/pcpu.h ============================================================================== --- stable/12/sys/amd64/include/pcpu.h Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/amd64/include/pcpu.h Fri Oct 25 18:56:46 2019 (r354093) @@ -221,35 +221,6 @@ #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) -#define OFFSETOF_CURTHREAD 0 -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnull-dereference" -#endif -static __inline __pure2 struct thread * -__curthread(void) -{ - struct thread *td; - - __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (OFFSETOF_CURTHREAD)); - return (td); -} -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#define curthread (__curthread()) - -#define OFFSETOF_CURPCB 32 -static __inline __pure2 struct pcb * -__curpcb(void) -{ - struct pcb *pcb; - - __asm("movq %%gs:%P1,%0" : "=r" (pcb) : "n" (OFFSETOF_CURPCB)); - return (pcb); -} -#define curpcb (__curpcb()) - #define IS_BSP() (PCPU_GET(cpuid) == 0) #else /* !__GNUCLIKE_ASM || !__GNUCLIKE___TYPEOF */ Copied: stable/12/sys/amd64/include/pcpu_aux.h (from r351594, head/sys/amd64/include/pcpu_aux.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/amd64/include/pcpu_aux.h Fri Oct 25 18:56:46 2019 (r354093, copy of r351594, head/sys/amd64/include/pcpu_aux.h) @@ -0,0 +1,72 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * 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. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* Required for counters(9) to work on x86. */ +_Static_assert(sizeof(struct pcpu) == UMA_PCPU_ALLOC_SIZE, "fix pcpu size"); + +extern struct pcpu *__pcpu; +extern struct pcpu temp_bsp_pcpu; + +static __inline __pure2 struct thread * +__curthread(void) +{ + struct thread *td; + + __asm("movq %%gs:%P1,%0" : "=r" (td) : "n" (offsetof(struct pcpu, + pc_curthread))); + return (td); +} +#define curthread (__curthread()) + +static __inline __pure2 struct pcb * +__curpcb(void) +{ + struct pcb *pcb; + + __asm("movq %%gs:%P1,%0" : "=r" (pcb) : "n" (offsetof(struct pcpu, + pc_curpcb))); + return (pcb); +} +#define curpcb (__curpcb()) + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: stable/12/sys/arm/arm/mp_machdep.c ============================================================================== --- stable/12/sys/arm/arm/mp_machdep.c Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/arm/arm/mp_machdep.c Fri Oct 25 18:56:46 2019 (r354093) @@ -63,7 +63,6 @@ __FBSDID("$FreeBSD$"); #include #endif -extern struct pcpu __pcpu[]; /* used to hold the AP's until we are ready to release them */ struct mtx ap_boot_mtx; struct pcb stoppcbs[MAXCPU]; Modified: stable/12/sys/arm/include/counter.h ============================================================================== --- stable/12/sys/arm/include/counter.h Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/arm/include/counter.h Fri Oct 25 18:56:46 2019 (r354093) @@ -34,8 +34,6 @@ #include #include -extern struct pcpu __pcpu[]; - #define EARLY_COUNTER &__pcpu[0].pc_early_dummy_counter #define counter_enter() do {} while (0) Copied: stable/12/sys/arm/include/pcpu_aux.h (from r351594, head/sys/arm/include/pcpu_aux.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/arm/include/pcpu_aux.h Fri Oct 25 18:56:46 2019 (r354093, copy of r351594, head/sys/arm/include/pcpu_aux.h) @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * 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. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* + * To minimize memory waste in per-cpu UMA zones, the page size should + * be a multiple of the size of struct pcpu. + */ +_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); + +extern struct pcpu __pcpu[]; + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: stable/12/sys/arm64/arm64/mp_machdep.c ============================================================================== --- stable/12/sys/arm64/arm64/mp_machdep.c Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/arm64/arm64/mp_machdep.c Fri Oct 25 18:56:46 2019 (r354093) @@ -43,6 +43,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -110,8 +111,6 @@ static struct intr_ipi ipi_sources[INTR_IPI_COUNT]; static struct intr_ipi *intr_ipi_lookup(u_int); static void intr_pic_ipi_setup(u_int, const char *, intr_ipi_handler_t *, void *); - -extern struct pcpu __pcpu[]; static device_identify_t arm64_cpu_identify; static device_probe_t arm64_cpu_probe; Modified: stable/12/sys/arm64/include/counter.h ============================================================================== --- stable/12/sys/arm64/include/counter.h Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/arm64/include/counter.h Fri Oct 25 18:56:46 2019 (r354093) @@ -32,8 +32,6 @@ #include #include -extern struct pcpu __pcpu[]; - #define EARLY_COUNTER &__pcpu[0].pc_early_dummy_counter #define counter_enter() do {} while (0) Copied: stable/12/sys/arm64/include/pcpu_aux.h (from r351594, head/sys/arm64/include/pcpu_aux.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/arm64/include/pcpu_aux.h Fri Oct 25 18:56:46 2019 (r354093, copy of r351594, head/sys/arm64/include/pcpu_aux.h) @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * 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. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* + * To minimize memory waste in per-cpu UMA zones, the page size should + * be a multiple of the size of struct pcpu. + */ +_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); + +extern struct pcpu __pcpu[]; + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: stable/12/sys/i386/i386/mp_machdep.c ============================================================================== --- stable/12/sys/i386/i386/mp_machdep.c Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/i386/i386/mp_machdep.c Fri Oct 25 18:56:46 2019 (r354093) @@ -130,8 +130,6 @@ __FBSDID("$FreeBSD$"); #endif /* CHECK_POINTS */ -extern struct pcpu __pcpu[]; - /* * Local data and functions. */ Modified: stable/12/sys/i386/i386/vm_machdep.c ============================================================================== --- stable/12/sys/i386/i386/vm_machdep.c Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/i386/i386/vm_machdep.c Fri Oct 25 18:56:46 2019 (r354093) @@ -90,10 +90,6 @@ __FBSDID("$FreeBSD$"); #define NSFBUFS (512 + maxusers * 16) #endif -_Static_assert(OFFSETOF_CURTHREAD == offsetof(struct pcpu, pc_curthread), - "OFFSETOF_CURTHREAD does not correspond with offset of pc_curthread."); -_Static_assert(OFFSETOF_CURPCB == offsetof(struct pcpu, pc_curpcb), - "OFFSETOF_CURPCB does not correspond with offset of pc_curpcb."); _Static_assert(__OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf), "__OFFSETOF_MONITORBUF does not correspond with offset of pc_monitorbuf."); Modified: stable/12/sys/i386/include/counter.h ============================================================================== --- stable/12/sys/i386/include/counter.h Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/i386/include/counter.h Fri Oct 25 18:56:46 2019 (r354093) @@ -38,8 +38,6 @@ #include #include -extern struct pcpu __pcpu[]; - #define EARLY_COUNTER &__pcpu[0].pc_early_dummy_counter #define counter_enter() do { \ Modified: stable/12/sys/i386/include/pcpu.h ============================================================================== --- stable/12/sys/i386/include/pcpu.h Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/i386/include/pcpu.h Fri Oct 25 18:56:46 2019 (r354093) @@ -217,36 +217,6 @@ #define PCPU_PTR(member) __PCPU_PTR(pc_ ## member) #define PCPU_SET(member, val) __PCPU_SET(pc_ ## member, val) -#define OFFSETOF_CURTHREAD 0 -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wnull-dereference" -#endif -static __inline __pure2 struct thread * -__curthread(void) -{ - struct thread *td; - - __asm("movl %%fs:%1,%0" : "=r" (td) - : "m" (*(char *)OFFSETOF_CURTHREAD)); - return (td); -} -#ifdef __clang__ -#pragma clang diagnostic pop -#endif -#define curthread (__curthread()) - -#define OFFSETOF_CURPCB 16 -static __inline __pure2 struct pcb * -__curpcb(void) -{ - struct pcb *pcb; - - __asm("movl %%fs:%1,%0" : "=r" (pcb) : "m" (*(char *)OFFSETOF_CURPCB)); - return (pcb); -} -#define curpcb (__curpcb()) - #define IS_BSP() (PCPU_GET(cpuid) == 0) #else /* defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) */ Copied: stable/12/sys/i386/include/pcpu_aux.h (from r351594, head/sys/i386/include/pcpu_aux.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/i386/include/pcpu_aux.h Fri Oct 25 18:56:46 2019 (r354093, copy of r351594, head/sys/i386/include/pcpu_aux.h) @@ -0,0 +1,71 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * 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. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* Required for counters(9) to work on x86. */ +_Static_assert(sizeof(struct pcpu) == UMA_PCPU_ALLOC_SIZE, "fix pcpu size"); + +extern struct pcpu __pcpu[]; + +static __inline __pure2 struct thread * +__curthread(void) +{ + struct thread *td; + + __asm("movl %%fs:%1,%0" : "=r" (td) + : "m" (*(char *)offsetof(struct pcpu, pc_curthread))); + return (td); +} +#define curthread (__curthread()) + +static __inline __pure2 struct pcb * +__curpcb(void) +{ + struct pcb *pcb; + + __asm("movl %%fs:%1,%0" : "=r" (pcb) + : "m" (*(char *)offsetof(struct pcpu, pc_curpcb))); + return (pcb); +} +#define curpcb (__curpcb()) + +#endif /* _MACHINE_PCPU_AUX_H_ */ Copied: stable/12/sys/mips/include/pcpu_aux.h (from r351594, head/sys/mips/include/pcpu_aux.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/mips/include/pcpu_aux.h Fri Oct 25 18:56:46 2019 (r354093, copy of r351594, head/sys/mips/include/pcpu_aux.h) @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * 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. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* + * To minimize memory waste in per-cpu UMA zones, the page size should + * be a multiple of the size of struct pcpu. + */ +_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); + +extern struct pcpu __pcpu[]; + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: stable/12/sys/powerpc/include/counter.h ============================================================================== --- stable/12/sys/powerpc/include/counter.h Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/powerpc/include/counter.h Fri Oct 25 18:56:46 2019 (r354093) @@ -36,8 +36,6 @@ #include #endif -extern struct pcpu __pcpu[]; - #define EARLY_COUNTER &__pcpu[0].pc_early_dummy_counter #ifdef __powerpc64__ Copied: stable/12/sys/powerpc/include/pcpu_aux.h (from r351594, head/sys/powerpc/include/pcpu_aux.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/powerpc/include/pcpu_aux.h Fri Oct 25 18:56:46 2019 (r354093, copy of r351594, head/sys/powerpc/include/pcpu_aux.h) @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * 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. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* + * To minimize memory waste in per-cpu UMA zones, the page size should + * be a multiple of the size of struct pcpu. + */ +_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); + +extern struct pcpu __pcpu[]; + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: stable/12/sys/powerpc/powerpc/mp_machdep.c ============================================================================== --- stable/12/sys/powerpc/powerpc/mp_machdep.c Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/powerpc/powerpc/mp_machdep.c Fri Oct 25 18:56:46 2019 (r354093) @@ -61,8 +61,6 @@ __FBSDID("$FreeBSD$"); #include "pic_if.h" -extern struct pcpu __pcpu[MAXCPU]; - volatile static int ap_awake; volatile static u_int ap_letgo; volatile static u_quad_t ap_timebase; Modified: stable/12/sys/riscv/include/counter.h ============================================================================== --- stable/12/sys/riscv/include/counter.h Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/riscv/include/counter.h Fri Oct 25 18:56:46 2019 (r354093) @@ -34,8 +34,6 @@ #include #endif -extern struct pcpu __pcpu[]; - #define EARLY_COUNTER &__pcpu[0].pc_early_dummy_counter #define counter_enter() critical_enter() Copied: stable/12/sys/riscv/include/pcpu_aux.h (from r351594, head/sys/riscv/include/pcpu_aux.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/riscv/include/pcpu_aux.h Fri Oct 25 18:56:46 2019 (r354093, copy of r351594, head/sys/riscv/include/pcpu_aux.h) @@ -0,0 +1,52 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * 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. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* + * To minimize memory waste in per-cpu UMA zones, the page size should + * be a multiple of the size of struct pcpu. + */ +_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); + +extern struct pcpu __pcpu[]; + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: stable/12/sys/riscv/riscv/mp_machdep.c ============================================================================== --- stable/12/sys/riscv/riscv/mp_machdep.c Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/riscv/riscv/mp_machdep.c Fri Oct 25 18:56:46 2019 (r354093) @@ -71,8 +71,6 @@ __FBSDID("$FreeBSD$"); boolean_t ofw_cpu_reg(phandle_t node, u_int, cell_t *); -extern struct pcpu __pcpu[]; - uint32_t __riscv_boot_ap[MAXCPU]; static enum { Copied: stable/12/sys/sparc64/include/pcpu_aux.h (from r351594, head/sys/sparc64/include/pcpu_aux.h) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ stable/12/sys/sparc64/include/pcpu_aux.h Fri Oct 25 18:56:46 2019 (r354093, copy of r351594, head/sys/sparc64/include/pcpu_aux.h) @@ -0,0 +1,50 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 The FreeBSD Foundation + * + * 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. + * + * $FreeBSD$ + */ + +#ifndef _MACHINE_PCPU_AUX_H_ +#define _MACHINE_PCPU_AUX_H_ + +#ifndef _KERNEL +#error "Not for userspace" +#endif + +#ifndef _SYS_PCPU_H_ +#error "Do not include machine/pcpu_aux.h directly" +#endif + +/* + * To minimize memory waste in per-cpu UMA zones, the page size should + * be a multiple of the size of struct pcpu. + */ +_Static_assert(PAGE_SIZE % sizeof(struct pcpu) == 0, "fix pcpu size"); + +#endif /* _MACHINE_PCPU_AUX_H_ */ Modified: stable/12/sys/sys/pcpu.h ============================================================================== --- stable/12/sys/sys/pcpu.h Fri Oct 25 18:54:06 2019 (r354092) +++ stable/12/sys/sys/pcpu.h Fri Oct 25 18:56:46 2019 (r354093) @@ -213,26 +213,16 @@ extern struct cpuhead cpuhead; extern struct pcpu *cpuid_to_pcpu[]; #define curcpu PCPU_GET(cpuid) -#define curproc (curthread->td_proc) -#ifndef curthread -#define curthread PCPU_GET(curthread) -#endif #define curvidata PCPU_GET(vidata) #define UMA_PCPU_ALLOC_SIZE PAGE_SIZE -#ifdef CTASSERT -#if defined(__i386__) || defined(__amd64__) -/* Required for counters(9) to work on x86. */ -CTASSERT(sizeof(struct pcpu) == UMA_PCPU_ALLOC_SIZE); -#else -/* - * To minimize memory waste in per-cpu UMA zones, size of struct pcpu - * should be denominator of PAGE_SIZE. - */ -CTASSERT((PAGE_SIZE / sizeof(struct pcpu)) * sizeof(struct pcpu) == PAGE_SIZE); -#endif /* UMA_PCPU_ALLOC_SIZE && x86 */ -#endif /* CTASSERT */ +#include + +#ifndef curthread +#define curthread PCPU_GET(curthread) +#endif +#define curproc (curthread->td_proc) /* Accessor to elements allocated via UMA_ZONE_PCPU zone. */ static inline void * From owner-svn-src-all@freebsd.org Fri Oct 25 19:38:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 093801598B8; Fri, 25 Oct 2019 19:38:03 +0000 (UTC) (envelope-from peterj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Dt26D25z3yt7; Fri, 25 Oct 2019 19:38:02 +0000 (UTC) (envelope-from peterj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B44362B30F; Fri, 25 Oct 2019 19:38:02 +0000 (UTC) (envelope-from peterj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PJc2Mr074992; Fri, 25 Oct 2019 19:38:02 GMT (envelope-from peterj@FreeBSD.org) Received: (from peterj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PJc2cu074991; Fri, 25 Oct 2019 19:38:02 GMT (envelope-from peterj@FreeBSD.org) Message-Id: <201910251938.x9PJc2cu074991@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: peterj set sender to peterj@FreeBSD.org using -f From: Peter Jeremy Date: Fri, 25 Oct 2019 19:38:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354094 - head/sys/arm64/rockchip X-SVN-Group: head X-SVN-Commit-Author: peterj X-SVN-Commit-Paths: head/sys/arm64/rockchip X-SVN-Commit-Revision: 354094 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 19:38:03 -0000 Author: peterj Date: Fri Oct 25 19:38:02 2019 New Revision: 354094 URL: https://svnweb.freebsd.org/changeset/base/354094 Log: Fix use of uninitialised variable. The RK805 regs array was being allocated before it's required size was known, causing the driver to use memory it didn't own. That memory was subsequently allocated and used elsewhere causing later fatal data aborts in rk805_map(). Whilst I'm here, add a sanity check to catch unsupported PMICs (this shouldn't ever get hit because the probe should have failed). Reviewed by: manu MFC after: 1 week Sponsored by: Google Modified: head/sys/arm64/rockchip/rk805.c Modified: head/sys/arm64/rockchip/rk805.c ============================================================================== --- head/sys/arm64/rockchip/rk805.c Fri Oct 25 18:56:46 2019 (r354093) +++ head/sys/arm64/rockchip/rk805.c Fri Oct 25 19:38:02 2019 (r354094) @@ -467,9 +467,6 @@ rk805_attach(device_t dev) if (config_intrhook_establish(&sc->intr_hook) != 0) return (ENOMEM); - sc->regs = malloc(sizeof(struct rk805_reg_sc *) * sc->nregs, - M_RK805_REG, M_WAITOK | M_ZERO); - sc->type = ofw_bus_search_compatible(dev, compat_data)->ocd_data; switch (sc->type) { case RK805: @@ -480,7 +477,13 @@ rk805_attach(device_t dev) regdefs = rk808_regdefs; sc->nregs = nitems(rk808_regdefs); break; + default: + device_printf(dev, "Unknown type %d\n", sc->type); + return (ENXIO); } + + sc->regs = malloc(sizeof(struct rk805_reg_sc *) * sc->nregs, + M_RK805_REG, M_WAITOK | M_ZERO); rnode = ofw_bus_find_child(ofw_bus_get_node(dev), "regulators"); if (rnode > 0) { From owner-svn-src-all@freebsd.org Fri Oct 25 20:09:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4AAC15A07B; Fri, 25 Oct 2019 20:09:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470FZc5Tryz40yj; Fri, 25 Oct 2019 20:09:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9AFE82B850; Fri, 25 Oct 2019 20:09:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PK9iqN092668; Fri, 25 Oct 2019 20:09:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PK9gIV092660; Fri, 25 Oct 2019 20:09:42 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910252009.x9PK9gIV092660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 25 Oct 2019 20:09:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: amd64/amd64 amd64/include kern X-SVN-Commit-Revision: 354095 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 20:09:45 -0000 Author: kib Date: Fri Oct 25 20:09:42 2019 New Revision: 354095 URL: https://svnweb.freebsd.org/changeset/base/354095 Log: amd64: move pcb out of kstack to struct thread. This saves 320 bytes of the precious stack space. The only negative aspect of the change I can think of is that the struct thread increased by 320 bytes obviously, and that 320 bytes are not swapped out anymore. I believe the freed stack space is much more important than that. Also, current struct thread size is 1392 bytes on amd64, so UMA will allocate two thread structures per (4KB) slab, which leaves a space for pcb without increasing zone memory use. Reviewed by: alc, markj Tested by: pho Sponsored by: The FreeBSD Foundation MFC after: 2 weeks Differential revision: https://reviews.freebsd.org/D22138 Modified: head/sys/amd64/amd64/cpu_switch.S head/sys/amd64/amd64/genassym.c head/sys/amd64/amd64/machdep.c head/sys/amd64/amd64/vm_machdep.c head/sys/amd64/include/md_var.h head/sys/amd64/include/pcpu_aux.h head/sys/amd64/include/proc.h head/sys/kern/kern_thread.c Modified: head/sys/amd64/amd64/cpu_switch.S ============================================================================== --- head/sys/amd64/amd64/cpu_switch.S Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/amd64/cpu_switch.S Fri Oct 25 20:09:42 2019 (r354095) @@ -74,7 +74,7 @@ END(cpu_throw) */ ENTRY(cpu_switch) /* Switch to new thread. First, save context. */ - movq TD_PCB(%rdi),%r8 + leaq TD_MD_PCB(%rdi),%r8 movq (%rsp),%rax /* Hardware registers */ movq %r15,PCB_R15(%r8) @@ -140,7 +140,7 @@ ctx_switch_xsave: callq pmap_activate_sw movq %r15,TD_LOCK(%r13) /* Release the old thread */ sw1: - movq TD_PCB(%r12),%r8 + leaq TD_MD_PCB(%r12),%r8 #if defined(SCHED_ULE) && defined(SMP) movq $blocked_lock, %rdx movq TD_LOCK(%r12),%rcx @@ -193,11 +193,12 @@ do_kthread: cmpq %rax,%rdx jne do_tss done_tss: - movq %r8,PCPU(RSP0) + movq TD_MD_STACK_BASE(%r12),%r9 + movq %r9,PCPU(RSP0) movq %r8,PCPU(CURPCB) movq PCPU(PTI_RSP0),%rax cmpq $~0,PCPU(UCR3) - cmove %r8,%rax + cmove %r9,%rax movq %rax,TSS_RSP0(%rdx) movq %r12,PCPU(CURTHREAD) /* into next thread */ Modified: head/sys/amd64/amd64/genassym.c ============================================================================== --- head/sys/amd64/amd64/genassym.c Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/amd64/genassym.c Fri Oct 25 20:09:42 2019 (r354095) @@ -87,6 +87,8 @@ ASSYM(TD_PFLAGS, offsetof(struct thread, td_pflags)); ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_FRAME, offsetof(struct thread, td_frame)); ASSYM(TD_MD, offsetof(struct thread, td_md)); +ASSYM(TD_MD_PCB, offsetof(struct thread, td_md.md_pcb)); +ASSYM(TD_MD_STACK_BASE, offsetof(struct thread, td_md.md_stack_base)); ASSYM(TDF_ASTPENDING, TDF_ASTPENDING); ASSYM(TDF_NEEDRESCHED, TDF_NEEDRESCHED); Modified: head/sys/amd64/amd64/machdep.c ============================================================================== --- head/sys/amd64/amd64/machdep.c Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/amd64/machdep.c Fri Oct 25 20:09:42 2019 (r354095) @@ -1789,12 +1789,12 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) amd64_conf_fast_syscall(); /* - * Temporary forge some valid pointer to PCB, for exception - * handlers. It is reinitialized properly below after FPU is - * set up. Also set up td_critnest to short-cut the page - * fault handler. + * We initialize the PCB pointer early so that exception + * handlers will work. Also set up td_critnest to short-cut + * the page fault handler. */ cpu_max_ext_state_size = sizeof(struct savefpu); + set_top_of_stack_td(&thread0); thread0.td_pcb = get_pcb_td(&thread0); thread0.td_critnest = 1; @@ -1850,11 +1850,10 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) fpuinit(); /* - * Set up thread0 pcb after fpuinit calculated pcb + fpu save + * Set up thread0 pcb save area after fpuinit calculated fpu save * area size. Zero out the extended state header in fpu save * area. */ - thread0.td_pcb = get_pcb_td(&thread0); thread0.td_pcb->pcb_save = get_pcb_user_save_td(&thread0); bzero(get_pcb_user_save_td(&thread0), cpu_max_ext_state_size); if (use_xsave) { @@ -1863,7 +1862,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) xhdr->xstate_bv = xsave_mask; } /* make an initial tss so cpu can get interrupt stack on syscall! */ - rsp0 = (vm_offset_t)thread0.td_pcb; + rsp0 = thread0.td_md.md_stack_base; /* Ensure the stack is aligned to 16 bytes */ rsp0 &= ~0xFul; common_tss[0].tss_rsp0 = rsp0; @@ -1899,7 +1898,7 @@ hammer_time(u_int64_t modulep, u_int64_t physfree) TSEXIT(); /* Location of kernel stack for locore */ - return ((u_int64_t)thread0.td_pcb); + return (thread0.td_md.md_stack_base); } void Modified: head/sys/amd64/amd64/vm_machdep.c ============================================================================== --- head/sys/amd64/amd64/vm_machdep.c Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/amd64/vm_machdep.c Fri Oct 25 20:09:42 2019 (r354095) @@ -87,37 +87,41 @@ __FBSDID("$FreeBSD$"); _Static_assert(OFFSETOF_MONITORBUF == offsetof(struct pcpu, pc_monitorbuf), "OFFSETOF_MONITORBUF does not correspond with offset of pc_monitorbuf."); -struct savefpu * -get_pcb_user_save_td(struct thread *td) +void +set_top_of_stack_td(struct thread *td) { - vm_offset_t p; - - p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE - + td->td_md.md_stack_base = td->td_kstack + + td->td_kstack_pages * PAGE_SIZE - roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN); - KASSERT((p % XSAVE_AREA_ALIGN) == 0, ("Unaligned pcb_user_save area")); - return ((struct savefpu *)p); } struct savefpu * -get_pcb_user_save_pcb(struct pcb *pcb) +get_pcb_user_save_td(struct thread *td) { vm_offset_t p; - p = (vm_offset_t)(pcb + 1); + p = td->td_md.md_stack_base; + KASSERT((p % XSAVE_AREA_ALIGN) == 0, + ("Unaligned pcb_user_save area ptr %#lx td %p", p, td)); return ((struct savefpu *)p); } struct pcb * get_pcb_td(struct thread *td) { - vm_offset_t p; - p = td->td_kstack + td->td_kstack_pages * PAGE_SIZE - - roundup2(cpu_max_ext_state_size, XSAVE_AREA_ALIGN) - - sizeof(struct pcb); - return ((struct pcb *)p); + return (&td->td_md.md_pcb); } +struct savefpu * +get_pcb_user_save_pcb(struct pcb *pcb) +{ + struct thread *td; + + td = __containerof(pcb, struct thread, td_md.md_pcb); + return (get_pcb_user_save_td(td)); +} + void * alloc_fpusave(int flags) { @@ -165,9 +169,9 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t fpuexit(td1); update_pcb_bases(td1->td_pcb); - /* Point the pcb to the top of the stack */ - pcb2 = get_pcb_td(td2); - td2->td_pcb = pcb2; + /* Point the stack and pcb to the actual location */ + set_top_of_stack_td(td2); + td2->td_pcb = pcb2 = get_pcb_td(td2); /* Copy td1's pcb */ bcopy(td1->td_pcb, pcb2, sizeof(*pcb2)); @@ -186,7 +190,7 @@ cpu_fork(struct thread *td1, struct proc *p2, struct t * Copy the trap frame for the return to user mode as if from a * syscall. This copies most of the user mode register values. */ - td2->td_frame = (struct trapframe *)td2->td_pcb - 1; + td2->td_frame = (struct trapframe *)td2->td_md.md_stack_base - 1; bcopy(td1->td_frame, td2->td_frame, sizeof(struct trapframe)); td2->td_frame->tf_rax = 0; /* Child returns zero */ @@ -351,8 +355,9 @@ cpu_thread_alloc(struct thread *td) struct pcb *pcb; struct xstate_hdr *xhdr; + set_top_of_stack_td(td); td->td_pcb = pcb = get_pcb_td(td); - td->td_frame = (struct trapframe *)pcb - 1; + td->td_frame = (struct trapframe *)td->td_md.md_stack_base - 1; pcb->pcb_save = get_pcb_user_save_pcb(pcb); if (use_xsave) { xhdr = (struct xstate_hdr *)(pcb->pcb_save + 1); @@ -490,7 +495,6 @@ cpu_copy_thread(struct thread *td, struct thread *td0) { struct pcb *pcb2; - /* Point the pcb to the top of the stack. */ pcb2 = td->td_pcb; /* Modified: head/sys/amd64/include/md_var.h ============================================================================== --- head/sys/amd64/include/md_var.h Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/include/md_var.h Fri Oct 25 20:09:42 2019 (r354095) @@ -83,6 +83,7 @@ void fpstate_drop(struct thread *td); void pagezero(void *addr); void setidt(int idx, alias_for_inthand_t *func, int typ, int dpl, int ist); void sse2_pagezero(void *addr); +void set_top_of_stack_td(struct thread *td); struct savefpu *get_pcb_user_save_td(struct thread *td); struct savefpu *get_pcb_user_save_pcb(struct pcb *pcb); void pci_early_quirks(void); Modified: head/sys/amd64/include/pcpu_aux.h ============================================================================== --- head/sys/amd64/include/pcpu_aux.h Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/include/pcpu_aux.h Fri Oct 25 20:09:42 2019 (r354095) @@ -57,16 +57,6 @@ __curthread(void) return (td); } #define curthread (__curthread()) - -static __inline __pure2 struct pcb * -__curpcb(void) -{ - struct pcb *pcb; - - __asm("movq %%gs:%P1,%0" : "=r" (pcb) : "n" (offsetof(struct pcpu, - pc_curpcb))); - return (pcb); -} -#define curpcb (__curpcb()) +#define curpcb (&curthread->td_md.md_pcb) #endif /* _MACHINE_PCPU_AUX_H_ */ Modified: head/sys/amd64/include/proc.h ============================================================================== --- head/sys/amd64/include/proc.h Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/amd64/include/proc.h Fri Oct 25 20:09:42 2019 (r354095) @@ -36,6 +36,7 @@ #define _MACHINE_PROC_H_ #include +#include #include /* @@ -72,6 +73,8 @@ struct mdthread { struct pmap_invl_gen md_invl_gen; register_t md_efirt_tmp; /* (k) */ int md_efirt_dis_pf; /* (k) */ + struct pcb md_pcb; + vm_offset_t md_stack_base; }; struct mdproc { Modified: head/sys/kern/kern_thread.c ============================================================================== --- head/sys/kern/kern_thread.c Fri Oct 25 19:38:02 2019 (r354094) +++ head/sys/kern/kern_thread.c Fri Oct 25 20:09:42 2019 (r354095) @@ -84,7 +84,7 @@ _Static_assert(offsetof(struct thread, td_pflags) == 0 "struct thread KBI td_pflags"); _Static_assert(offsetof(struct thread, td_frame) == 0x478, "struct thread KBI td_frame"); -_Static_assert(offsetof(struct thread, td_emuldata) == 0x540, +_Static_assert(offsetof(struct thread, td_emuldata) == 0x690, "struct thread KBI td_emuldata"); _Static_assert(offsetof(struct proc, p_flag) == 0xb0, "struct proc KBI p_flag"); From owner-svn-src-all@freebsd.org Fri Oct 25 20:15:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5BF4615A379; Fri, 25 Oct 2019 20:15:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Fhn1lYKz41Vd; Fri, 25 Oct 2019 20:15:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1F4022BA6E; Fri, 25 Oct 2019 20:15:05 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PKF5So098216; Fri, 25 Oct 2019 20:15:05 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PKF4Tu098215; Fri, 25 Oct 2019 20:15:05 GMT (envelope-from markj@FreeBSD.org) Message-Id: <201910252015.x9PKF4Tu098215@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Fri, 25 Oct 2019 20:15:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354096 - head/sys/conf X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/conf X-SVN-Commit-Revision: 354096 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 20:15:05 -0000 Author: markj Date: Fri Oct 25 20:15:04 2019 New Revision: 354096 URL: https://svnweb.freebsd.org/changeset/base/354096 Log: Apply kernel module linker scripts to firmware files. Use a separate make variable to specify the linker script so that it is only applied at link time and not during intermediate generation of .fwo files. This ensures that the .text padding inserted by the amd64 linker script is applied to the stub module load handlers embedded in firmware modules. Reviewed by: kib MFC after: 2 weeks Sponsored by: Netflix Differential Revision: https://reviews.freebsd.org/D22125 Modified: head/sys/conf/kmod.mk Modified: head/sys/conf/kmod.mk ============================================================================== --- head/sys/conf/kmod.mk Fri Oct 25 20:09:42 2019 (r354095) +++ head/sys/conf/kmod.mk Fri Oct 25 20:15:04 2019 (r354096) @@ -242,8 +242,8 @@ EXPORT_SYMS?= NO CLEANFILES+= export_syms .endif -.if !defined(FIRMWS) && exists(${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH}) -_LDFLAGS+=-T ${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH} +.if exists(${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH}) +LDSCRIPT_FLAGS?= -T ${SYSDIR}/conf/ldscript.kmod.${MACHINE_ARCH} .endif .if ${__KLD_SHARED} == yes @@ -251,7 +251,8 @@ ${KMOD}.kld: ${OBJS} .else ${FULLPROG}: ${OBJS} .endif - ${LD} -m ${LD_EMULATION} ${_LDFLAGS} -r -d -o ${.TARGET} ${OBJS} + ${LD} -m ${LD_EMULATION} ${_LDFLAGS} ${LDSCRIPT_FLAGS} -r -d \ + -o ${.TARGET} ${OBJS} .if ${MK_CTF} != "no" ${CTFMERGE} ${CTFFLAGS} -o ${.TARGET} ${OBJS} .endif From owner-svn-src-all@freebsd.org Fri Oct 25 21:00:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EA4C15B395; Fri, 25 Oct 2019 21:00:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Gjc3C12z43RV; Fri, 25 Oct 2019 21:00:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 376582C230; Fri, 25 Oct 2019 21:00:52 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PL0qCT022105; Fri, 25 Oct 2019 21:00:52 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PL0oYV022095; Fri, 25 Oct 2019 21:00:50 GMT (envelope-from dim@FreeBSD.org) Message-Id: <201910252100.x9PL0oYV022095@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Fri, 25 Oct 2019 21:00:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354097 - in head/contrib/llvm: lib/Object lib/Support lib/Target/ARM lib/Target/ARM/AsmParser lib/Target/ARM/MCTargetDesc tools/clang/lib/Basic/Targets tools/clang/lib/Driver/ToolChain... X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: in head/contrib/llvm: lib/Object lib/Support lib/Target/ARM lib/Target/ARM/AsmParser lib/Target/ARM/MCTargetDesc tools/clang/lib/Basic/Targets tools/clang/lib/Driver/ToolChains/Arch X-SVN-Commit-Revision: 354097 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:00:52 -0000 Author: dim Date: Fri Oct 25 21:00:49 2019 New Revision: 354097 URL: https://svnweb.freebsd.org/changeset/base/354097 Log: Pull in r372186 from upstream llvm trunk (by Eli Friedman): [ARM] VFPv2 only supports 16 D registers. r361845 changed the way we handle "D16" vs. "D32" targets; there used to be a negative "d16" which removed instructions from the instruction set, and now there's a "d32" feature which adds instructions to the instruction set. This is good, but there was an oversight in the implementation: the behavior of VFPv2 was changed. In particular, the "vfp2" feature was changed to imply "d32". This is wrong: VFPv2 only supports 16 D registers. In practice, this means if you specify -mfpu=vfpv2, the compiler will generate illegal instructions. This patch gets rid of "vfp2d16" and "vfp2d16sp", and fixes "vfp2" and "vfp2sp" so they don't imply "d32". Differential Revision: https://reviews.llvm.org/D67375 Pull in r372187 from upstream clang trunk (by Eli Friedman): [ARM] Update clang for removal of vfp2d16 and vfp2d16sp Matching fix for https://reviews.llvm.org/D67375 (r372186). Differential Revision: https://reviews.llvm.org/D67467 This should fix clang generating invalid opcodes for floating point operations on armv6. Requested by: mmel MFC after: 3 days Modified: head/contrib/llvm/lib/Object/ELFObjectFile.cpp head/contrib/llvm/lib/Support/ARMTargetParser.cpp head/contrib/llvm/lib/Target/ARM/ARM.td head/contrib/llvm/lib/Target/ARM/ARMPredicates.td head/contrib/llvm/lib/Target/ARM/ARMSubtarget.h head/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp head/contrib/llvm/tools/clang/lib/Basic/Targets/ARM.cpp head/contrib/llvm/tools/clang/lib/Driver/ToolChains/Arch/ARM.cpp Modified: head/contrib/llvm/lib/Object/ELFObjectFile.cpp ============================================================================== --- head/contrib/llvm/lib/Object/ELFObjectFile.cpp Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Object/ELFObjectFile.cpp Fri Oct 25 21:00:49 2019 (r354097) @@ -194,7 +194,7 @@ SubtargetFeatures ELFObjectFileBase::getARMFeatures() default: break; case ARMBuildAttrs::Not_Allowed: - Features.AddFeature("vfp2d16sp", false); + Features.AddFeature("vfp2sp", false); Features.AddFeature("vfp3d16sp", false); Features.AddFeature("vfp4d16sp", false); break; Modified: head/contrib/llvm/lib/Support/ARMTargetParser.cpp ============================================================================== --- head/contrib/llvm/lib/Support/ARMTargetParser.cpp Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Support/ARMTargetParser.cpp Fri Oct 25 21:00:49 2019 (r354097) @@ -176,10 +176,8 @@ bool ARM::getFPUFeatures(unsigned FPUKind, std::vector // exist). {"+fpregs", "-fpregs", FPUVersion::VFPV2, FPURestriction::SP_D16}, - {"+vfp2", "-vfp2", FPUVersion::VFPV2, FPURestriction::None}, - {"+vfp2d16", "-vfp2d16", FPUVersion::VFPV2, FPURestriction::D16}, - {"+vfp2d16sp", "-vfp2d16sp", FPUVersion::VFPV2, FPURestriction::SP_D16}, - {"+vfp2sp", "-vfp2sp", FPUVersion::VFPV2, FPURestriction::None}, + {"+vfp2", "-vfp2", FPUVersion::VFPV2, FPURestriction::D16}, + {"+vfp2sp", "-vfp2sp", FPUVersion::VFPV2, FPURestriction::SP_D16}, {"+vfp3", "-vfp3", FPUVersion::VFPV3, FPURestriction::None}, {"+vfp3d16", "-vfp3d16", FPUVersion::VFPV3, FPURestriction::D16}, {"+vfp3d16sp", "-vfp3d16sp", FPUVersion::VFPV3, FPURestriction::SP_D16}, @@ -195,7 +193,7 @@ bool ARM::getFPUFeatures(unsigned FPUKind, std::vector {"+fp-armv8sp", "-fp-armv8sp", FPUVersion::VFPV5, FPURestriction::None}, {"+fullfp16", "-fullfp16", FPUVersion::VFPV5_FULLFP16, FPURestriction::SP_D16}, {"+fp64", "-fp64", FPUVersion::VFPV2, FPURestriction::D16}, - {"+d32", "-d32", FPUVersion::VFPV2, FPURestriction::None}, + {"+d32", "-d32", FPUVersion::VFPV3, FPURestriction::None}, }; for (const auto &Info: FPUFeatureInfoList) { Modified: head/contrib/llvm/lib/Target/ARM/ARM.td ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARM.td Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Target/ARM/ARM.td Fri Oct 25 21:00:49 2019 (r354097) @@ -57,12 +57,15 @@ def FeatureD32 : SubtargetFeature<"d32", "H "Extend FP to 32 double registers">; multiclass VFPver prev = [], - list otherimplies = []> { + list prev, + list otherimplies, + list vfp2prev = []> { def _D16_SP: SubtargetFeature< name#"d16sp", query#"D16SP", "true", description#" with only 16 d-registers and no double precision", - !foreach(v, prev, !cast(v # "_D16_SP")) # otherimplies>; + !foreach(v, prev, !cast(v # "_D16_SP")) # + !foreach(v, vfp2prev, !cast(v # "_SP")) # + otherimplies>; def _SP: SubtargetFeature< name#"sp", query#"SP", "true", description#" with no double precision", @@ -72,6 +75,7 @@ multiclass VFPver(v # "_D16")) # + vfp2prev # otherimplies # [FeatureFP64, !cast(NAME # "_D16_SP")]>; def "": SubtargetFeature< name, query, "true", description, @@ -80,11 +84,17 @@ multiclass VFPver(NAME # "_SP")]>; } -defm FeatureVFP2: VFPver<"vfp2", "HasVFPv2", "Enable VFP2 instructions", - [], [FeatureFPRegs]>; +def FeatureVFP2_SP : SubtargetFeature<"vfp2sp", "HasVFPv2SP", "true", + "Enable VFP2 instructions with " + "no double precision", + [FeatureFPRegs]>; +def FeatureVFP2 : SubtargetFeature<"vfp2", "HasVFPv2", "true", + "Enable VFP2 instructions", + [FeatureFP64, FeatureVFP2_SP]>; + defm FeatureVFP3: VFPver<"vfp3", "HasVFPv3", "Enable VFP3 instructions", - [FeatureVFP2]>; + [], [], [FeatureVFP2]>; def FeatureNEON : SubtargetFeature<"neon", "HasNEON", "true", "Enable NEON instructions", @@ -98,7 +108,7 @@ defm FeatureVFP4: VFPver<"vfp4", "HasVFPv4", "Enable V [FeatureVFP3], [FeatureFP16]>; defm FeatureFPARMv8: VFPver<"fp-armv8", "HasFPARMv8", "Enable ARMv8 FP", - [FeatureVFP4]>; + [FeatureVFP4], []>; def FeatureFullFP16 : SubtargetFeature<"fullfp16", "HasFullFP16", "true", "Enable full half-precision " Modified: head/contrib/llvm/lib/Target/ARM/ARMPredicates.td ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMPredicates.td Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Target/ARM/ARMPredicates.td Fri Oct 25 21:00:49 2019 (r354097) @@ -71,7 +71,7 @@ def HasV8_5a : Predicate<"Subtarget->hasV8_5aO AssemblerPredicate<"HasV8_5aOps", "armv8.5a">; def NoVFP : Predicate<"!Subtarget->hasVFP2Base()">; def HasVFP2 : Predicate<"Subtarget->hasVFP2Base()">, - AssemblerPredicate<"FeatureVFP2_D16_SP", "VFP2">; + AssemblerPredicate<"FeatureVFP2_SP", "VFP2">; def HasVFP3 : Predicate<"Subtarget->hasVFP3Base()">, AssemblerPredicate<"FeatureVFP3_D16_SP", "VFP3">; def HasVFP4 : Predicate<"Subtarget->hasVFP4Base()">, Modified: head/contrib/llvm/lib/Target/ARM/ARMSubtarget.h ============================================================================== --- head/contrib/llvm/lib/Target/ARM/ARMSubtarget.h Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Target/ARM/ARMSubtarget.h Fri Oct 25 21:00:49 2019 (r354097) @@ -179,11 +179,9 @@ class ARMSubtarget : public ARMGenSubtargetInfo { (pro bool HasVFPv3SP = false; bool HasVFPv4SP = false; bool HasFPARMv8SP = false; - bool HasVFPv2D16 = false; bool HasVFPv3D16 = false; bool HasVFPv4D16 = false; bool HasFPARMv8D16 = false; - bool HasVFPv2D16SP = false; bool HasVFPv3D16SP = false; bool HasVFPv4D16SP = false; bool HasFPARMv8D16SP = false; @@ -600,7 +598,7 @@ class ARMSubtarget : public ARMGenSubtargetInfo { (pro bool hasARMOps() const { return !NoARM; } - bool hasVFP2Base() const { return HasVFPv2D16SP; } + bool hasVFP2Base() const { return HasVFPv2SP; } bool hasVFP3Base() const { return HasVFPv3D16SP; } bool hasVFP4Base() const { return HasVFPv4D16SP; } bool hasFPARMv8Base() const { return HasFPARMv8D16SP; } Modified: head/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Fri Oct 25 21:00:49 2019 (r354097) @@ -11694,14 +11694,14 @@ bool ARMAsmParser::parseDirectiveArchExtension(SMLoc L { ARM::AEK_CRYPTO, {Feature_HasV8Bit}, {ARM::FeatureCrypto, ARM::FeatureNEON, ARM::FeatureFPARMv8} }, { ARM::AEK_FP, {Feature_HasV8Bit}, - {ARM::FeatureVFP2_D16_SP, ARM::FeatureFPARMv8} }, + {ARM::FeatureVFP2_SP, ARM::FeatureFPARMv8} }, { (ARM::AEK_HWDIVTHUMB | ARM::AEK_HWDIVARM), {Feature_HasV7Bit, Feature_IsNotMClassBit}, {ARM::FeatureHWDivThumb, ARM::FeatureHWDivARM} }, { ARM::AEK_MP, {Feature_HasV7Bit, Feature_IsNotMClassBit}, {ARM::FeatureMP} }, { ARM::AEK_SIMD, {Feature_HasV8Bit}, - {ARM::FeatureNEON, ARM::FeatureVFP2_D16_SP, ARM::FeatureFPARMv8} }, + {ARM::FeatureNEON, ARM::FeatureVFP2_SP, ARM::FeatureFPARMv8} }, { ARM::AEK_SEC, {Feature_HasV6KBit}, {ARM::FeatureTrustZone} }, // FIXME: Only available in A-class, isel not predicated { ARM::AEK_VIRT, {Feature_HasV7Bit}, {ARM::FeatureVirtualization} }, Modified: head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp ============================================================================== --- head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/lib/Target/ARM/MCTargetDesc/ARMTargetStreamer.cpp Fri Oct 25 21:00:49 2019 (r354097) @@ -249,12 +249,12 @@ void ARMTargetStreamer::emitTargetAttributes(const MCS : ARM::FK_VFPV3_D16) : (STI.hasFeature(ARM::FeatureFP16) ? ARM::FK_VFPV3XD_FP16 : ARM::FK_VFPV3XD))); - else if (STI.hasFeature(ARM::FeatureVFP2_D16_SP)) + else if (STI.hasFeature(ARM::FeatureVFP2_SP)) emitFPU(ARM::FK_VFPV2); } // ABI_HardFP_use attribute to indicate single precision FP. - if (STI.hasFeature(ARM::FeatureVFP2_D16_SP) && !STI.hasFeature(ARM::FeatureFP64)) + if (STI.hasFeature(ARM::FeatureVFP2_SP) && !STI.hasFeature(ARM::FeatureFP64)) emitAttribute(ARMBuildAttrs::ABI_HardFP_use, ARMBuildAttrs::HardFPSinglePrecision); Modified: head/contrib/llvm/tools/clang/lib/Basic/Targets/ARM.cpp ============================================================================== --- head/contrib/llvm/tools/clang/lib/Basic/Targets/ARM.cpp Fri Oct 25 20:15:04 2019 (r354096) +++ head/contrib/llvm/tools/clang/lib/Basic/Targets/ARM.cpp Fri Oct 25 21:00:49 2019 (r354097) @@ -427,11 +427,10 @@ bool ARMTargetInfo::handleTargetFeatures(std::vector Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 059C515B668; Fri, 25 Oct 2019 21:14:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470H1b6PS4z4448; Fri, 25 Oct 2019 21:14:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C05762C583; Fri, 25 Oct 2019 21:14:43 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLEhaP033626; Fri, 25 Oct 2019 21:14:43 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLEhIM033625; Fri, 25 Oct 2019 21:14:43 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910252114.x9PLEhIM033625@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Oct 2019 21:14:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354098 - in stable: 11/sys/dev/cxgbe/crypto 12/sys/dev/cxgbe/crypto X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/dev/cxgbe/crypto 12/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 354098 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:14:44 -0000 Author: jhb Date: Fri Oct 25 21:14:43 2019 New Revision: 354098 URL: https://svnweb.freebsd.org/changeset/base/354098 Log: MFC 353323: Set the FID field in lookaside crypto requests to the rx queue ID. The PCI block in the adapter requires this field to be set to a valid queue ID. It is not clear why it did not fail on all machines, but the effect was that crypto operations reading input data via DMA failed with an internal PCI read error on machines with 128G or more of RAM. Modified: stable/12/sys/dev/cxgbe/crypto/t4_crypto.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/cxgbe/crypto/t4_crypto.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- stable/12/sys/dev/cxgbe/crypto/t4_crypto.c Fri Oct 25 21:00:49 2019 (r354097) +++ stable/12/sys/dev/cxgbe/crypto/t4_crypto.c Fri Oct 25 21:14:43 2019 (r354098) @@ -419,7 +419,7 @@ ccr_populate_wreq(struct ccr_softc *sc, struct chcr_wr crwr->ulptx.cmd_dest = htobe32(V_ULPTX_CMD(ULP_TX_PKT) | V_ULP_TXPKT_DATAMODIFY(0) | V_ULP_TXPKT_CHANNELID(sc->tx_channel_id) | V_ULP_TXPKT_DEST(0) | - V_ULP_TXPKT_FID(0) | V_ULP_TXPKT_RO(1)); + V_ULP_TXPKT_FID(sc->rxq->iq.abs_id) | V_ULP_TXPKT_RO(1)); crwr->ulptx.len = htobe32( ((wr_len - sizeof(struct fw_crypto_lookaside_wr)) / 16)); From owner-svn-src-all@freebsd.org Fri Oct 25 21:14:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5B62415B66C; Fri, 25 Oct 2019 21:14:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470H1c1mykz4449; Fri, 25 Oct 2019 21:14:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 204052C584; Fri, 25 Oct 2019 21:14:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLEihQ033632; Fri, 25 Oct 2019 21:14:44 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLEiDA033631; Fri, 25 Oct 2019 21:14:44 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910252114.x9PLEiDA033631@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Oct 2019 21:14:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354098 - in stable: 11/sys/dev/cxgbe/crypto 12/sys/dev/cxgbe/crypto X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/dev/cxgbe/crypto 12/sys/dev/cxgbe/crypto X-SVN-Commit-Revision: 354098 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:14:44 -0000 Author: jhb Date: Fri Oct 25 21:14:43 2019 New Revision: 354098 URL: https://svnweb.freebsd.org/changeset/base/354098 Log: MFC 353323: Set the FID field in lookaside crypto requests to the rx queue ID. The PCI block in the adapter requires this field to be set to a valid queue ID. It is not clear why it did not fail on all machines, but the effect was that crypto operations reading input data via DMA failed with an internal PCI read error on machines with 128G or more of RAM. Modified: stable/11/sys/dev/cxgbe/crypto/t4_crypto.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/dev/cxgbe/crypto/t4_crypto.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/dev/cxgbe/crypto/t4_crypto.c ============================================================================== --- stable/11/sys/dev/cxgbe/crypto/t4_crypto.c Fri Oct 25 21:00:49 2019 (r354097) +++ stable/11/sys/dev/cxgbe/crypto/t4_crypto.c Fri Oct 25 21:14:43 2019 (r354098) @@ -411,7 +411,7 @@ ccr_populate_wreq(struct ccr_softc *sc, struct chcr_wr crwr->ulptx.cmd_dest = htobe32(V_ULPTX_CMD(ULP_TX_PKT) | V_ULP_TXPKT_DATAMODIFY(0) | V_ULP_TXPKT_CHANNELID(sc->tx_channel_id) | V_ULP_TXPKT_DEST(0) | - V_ULP_TXPKT_FID(0) | V_ULP_TXPKT_RO(1)); + V_ULP_TXPKT_FID(sc->rxq->iq.abs_id) | V_ULP_TXPKT_RO(1)); crwr->ulptx.len = htobe32( ((wr_len - sizeof(struct fw_crypto_lookaside_wr)) / 16)); From owner-svn-src-all@freebsd.org Fri Oct 25 21:20:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A898915B821; Fri, 25 Oct 2019 21:20:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470H7n3y4qz44Kv; Fri, 25 Oct 2019 21:20:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6AEF82C58C; Fri, 25 Oct 2019 21:20:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLK5HD033968; Fri, 25 Oct 2019 21:20:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLK5km033967; Fri, 25 Oct 2019 21:20:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910252120.x9PLK5km033967@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Oct 2019 21:20:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354099 - in stable: 11/sys/dev/cxgbe 12/sys/dev/cxgbe X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/dev/cxgbe 12/sys/dev/cxgbe X-SVN-Commit-Revision: 354099 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:20:05 -0000 Author: jhb Date: Fri Oct 25 21:20:04 2019 New Revision: 354099 URL: https://svnweb.freebsd.org/changeset/base/354099 Log: MFC 353369: Remove adapters from t4_list earlier during detach. This ensures the clip task won't race with t4_destroy_clip_table. While here, make some mutex destroys unconditional since attach always initializes them. Sponsored by: Chelsio Communications Modified: stable/12/sys/dev/cxgbe/t4_main.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/cxgbe/t4_main.c Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/12/sys/dev/cxgbe/t4_main.c Fri Oct 25 21:14:43 2019 (r354098) +++ stable/12/sys/dev/cxgbe/t4_main.c Fri Oct 25 21:20:04 2019 (r354099) @@ -1475,6 +1475,10 @@ t4_detach_common(device_t dev) sc->cdev = NULL; } + sx_xlock(&t4_list_lock); + SLIST_REMOVE(&t4_list, sc, adapter, link); + sx_xunlock(&t4_list_lock); + sc->flags &= ~CHK_MBOX_ACCESS; if (sc->flags & FULL_INIT_DONE) { if (!(sc->flags & IS_VF)) @@ -1568,12 +1572,6 @@ t4_detach_common(device_t dev) free(sc->tids.tid_tab, M_CXGBE); free(sc->tt.tls_rx_ports, M_CXGBE); t4_destroy_dma_tag(sc); - if (mtx_initialized(&sc->sc_lock)) { - sx_xlock(&t4_list_lock); - SLIST_REMOVE(&t4_list, sc, adapter, link); - sx_xunlock(&t4_list_lock); - mtx_destroy(&sc->sc_lock); - } callout_drain(&sc->sfl_callout); if (mtx_initialized(&sc->tids.ftid_lock)) { @@ -1582,12 +1580,8 @@ t4_detach_common(device_t dev) } if (mtx_initialized(&sc->tids.atid_lock)) mtx_destroy(&sc->tids.atid_lock); - if (mtx_initialized(&sc->sfl_lock)) - mtx_destroy(&sc->sfl_lock); if (mtx_initialized(&sc->ifp_lock)) mtx_destroy(&sc->ifp_lock); - if (mtx_initialized(&sc->reg_lock)) - mtx_destroy(&sc->reg_lock); if (rw_initialized(&sc->policy_lock)) { rw_destroy(&sc->policy_lock); @@ -1603,6 +1597,10 @@ t4_detach_common(device_t dev) if (rw_initialized(&mw->mw_lock)) rw_destroy(&mw->mw_lock); } + + mtx_destroy(&sc->sfl_lock); + mtx_destroy(&sc->reg_lock); + mtx_destroy(&sc->sc_lock); bzero(sc, sizeof(*sc)); From owner-svn-src-all@freebsd.org Fri Oct 25 21:20:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05B3A15B829; Fri, 25 Oct 2019 21:20:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470H7n6Q2vz44Kw; Fri, 25 Oct 2019 21:20:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BF7762C58D; Fri, 25 Oct 2019 21:20:05 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLK5gn033974; Fri, 25 Oct 2019 21:20:05 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLK5pp033973; Fri, 25 Oct 2019 21:20:05 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910252120.x9PLK5pp033973@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Oct 2019 21:20:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354099 - in stable: 11/sys/dev/cxgbe 12/sys/dev/cxgbe X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/dev/cxgbe 12/sys/dev/cxgbe X-SVN-Commit-Revision: 354099 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:20:06 -0000 Author: jhb Date: Fri Oct 25 21:20:04 2019 New Revision: 354099 URL: https://svnweb.freebsd.org/changeset/base/354099 Log: MFC 353369: Remove adapters from t4_list earlier during detach. This ensures the clip task won't race with t4_destroy_clip_table. While here, make some mutex destroys unconditional since attach always initializes them. Sponsored by: Chelsio Communications Modified: stable/11/sys/dev/cxgbe/t4_main.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/dev/cxgbe/t4_main.c Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/dev/cxgbe/t4_main.c ============================================================================== --- stable/11/sys/dev/cxgbe/t4_main.c Fri Oct 25 21:14:43 2019 (r354098) +++ stable/11/sys/dev/cxgbe/t4_main.c Fri Oct 25 21:20:04 2019 (r354099) @@ -1452,6 +1452,10 @@ t4_detach_common(device_t dev) sc->cdev = NULL; } + sx_xlock(&t4_list_lock); + SLIST_REMOVE(&t4_list, sc, adapter, link); + sx_xunlock(&t4_list_lock); + sc->flags &= ~CHK_MBOX_ACCESS; if (sc->flags & FULL_INIT_DONE) { if (!(sc->flags & IS_VF)) @@ -1540,12 +1544,6 @@ t4_detach_common(device_t dev) free(sc->tids.tid_tab, M_CXGBE); free(sc->tt.tls_rx_ports, M_CXGBE); t4_destroy_dma_tag(sc); - if (mtx_initialized(&sc->sc_lock)) { - sx_xlock(&t4_list_lock); - SLIST_REMOVE(&t4_list, sc, adapter, link); - sx_xunlock(&t4_list_lock); - mtx_destroy(&sc->sc_lock); - } callout_drain(&sc->sfl_callout); if (mtx_initialized(&sc->tids.ftid_lock)) { @@ -1554,12 +1552,8 @@ t4_detach_common(device_t dev) } if (mtx_initialized(&sc->tids.atid_lock)) mtx_destroy(&sc->tids.atid_lock); - if (mtx_initialized(&sc->sfl_lock)) - mtx_destroy(&sc->sfl_lock); if (mtx_initialized(&sc->ifp_lock)) mtx_destroy(&sc->ifp_lock); - if (mtx_initialized(&sc->reg_lock)) - mtx_destroy(&sc->reg_lock); if (rw_initialized(&sc->policy_lock)) { rw_destroy(&sc->policy_lock); @@ -1575,6 +1569,10 @@ t4_detach_common(device_t dev) if (rw_initialized(&mw->mw_lock)) rw_destroy(&mw->mw_lock); } + + mtx_destroy(&sc->sfl_lock); + mtx_destroy(&sc->reg_lock); + mtx_destroy(&sc->sc_lock); bzero(sc, sizeof(*sc)); From owner-svn-src-all@freebsd.org Fri Oct 25 21:21:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B54715B921; Fri, 25 Oct 2019 21:21:22 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470H9F6y5wz44cj; Fri, 25 Oct 2019 21:21:21 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D2BA42C5D6; Fri, 25 Oct 2019 21:21:21 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLLLf8036357; Fri, 25 Oct 2019 21:21:21 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLLL5h036356; Fri, 25 Oct 2019 21:21:21 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201910252121.x9PLLL5h036356@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 25 Oct 2019 21:21:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354100 - head/sys/arm64/rockchip/clk X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/arm64/rockchip/clk X-SVN-Commit-Revision: 354100 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:21:22 -0000 Author: gonzo Date: Fri Oct 25 21:21:21 2019 New Revision: 354100 URL: https://svnweb.freebsd.org/changeset/base/354100 Log: arm64: rk3399: Add clock and gate for SPI clocks MFC after: 1 month Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c Modified: head/sys/arm64/rockchip/clk/rk3399_cru.c ============================================================================== --- head/sys/arm64/rockchip/clk/rk3399_cru.c Fri Oct 25 21:20:04 2019 (r354099) +++ head/sys/arm64/rockchip/clk/rk3399_cru.c Fri Oct 25 21:21:21 2019 (r354100) @@ -75,6 +75,11 @@ __FBSDID("$FreeBSD$"); #define PCLK_I2C5 344 #define PCLK_I2C6 345 #define PCLK_I2C7 346 +#define PCLK_SPI0 347 +#define PCLK_SPI1 348 +#define PCLK_SPI2 349 +#define PCLK_SPI4 350 +#define PCLK_SPI5 351 #define HCLK_HOST0 456 #define HCLK_HOST0_ARB 457 #define HCLK_HOST1 458 @@ -132,6 +137,12 @@ static struct rk_cru_gate rk3399_gates[] = { CRU_GATE(PCLK_I2C2, "pclk_rki2c2", "pclk_perilp1", 0x358, 9) CRU_GATE(PCLK_I2C3, "pclk_rki2c3", "pclk_perilp1", 0x358, 10) + /* CRU_CLKGATE_CON23 */ + CRU_GATE(PCLK_SPI0, "pclk_spi0", "pclk_perilp1", 0x35C, 10) + CRU_GATE(PCLK_SPI1, "pclk_spi1", "pclk_perilp1", 0x35C, 11) + CRU_GATE(PCLK_SPI2, "pclk_spi2", "pclk_perilp1", 0x35C, 12) + CRU_GATE(PCLK_SPI4, "pclk_spi4", "pclk_perilp1", 0x35C, 13) + /* CRU_CLKGATE_CON30 */ CRU_GATE(ACLK_USB3_NOC, "aclk_usb3_noc", "aclk_usb3", 0x378, 0) CRU_GATE(ACLK_USB3OTG0, "aclk_usb3otg0", "aclk_usb3", 0x378, 1) @@ -151,6 +162,9 @@ static struct rk_cru_gate rk3399_gates[] = { /* CRU_CLKGATE_CON33 */ CRU_GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_sd", 0x384, 8) + + /* CRU_CLKGATE_CON34 */ + CRU_GATE(PCLK_SPI4, "pclk_spi5", "pclk_perilp1", 0x388, 5) }; @@ -1367,6 +1381,127 @@ static struct rk_clk_composite_def uphy1_tcpdcore = { }; /* + * spi + */ +static const char *spi_parents[] = {"cpll", "gpll"}; + +#define SCLK_SPI0 71 +#define SCLK_SPI1 72 +#define SCLK_SPI2 73 +#define SCLK_SPI4 74 +#define SCLK_SPI5 75 + +static struct rk_clk_composite_def spi0 = { + .clkdef = { + .id = SCLK_SPI0, + .name = "clk_spi0", + .parent_names = spi_parents, + .parent_cnt = nitems(spi_parents), + }, + /* CRU_CLKSEL_CON59 */ + .muxdiv_offset = 0x01ec, + .mux_shift = 7, + .mux_width = 1, + + .div_shift = 0, + .div_width = 7, + + /* CRU_CLKGATE_CON9 */ + .gate_offset = 0x0324, + .gate_shift = 12, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +static struct rk_clk_composite_def spi1 = { + .clkdef = { + .id = SCLK_SPI1, + .name = "clk_spi1", + .parent_names = spi_parents, + .parent_cnt = nitems(spi_parents), + }, + /* CRU_CLKSEL_CON59 */ + .muxdiv_offset = 0x01ec, + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 8, + .div_width = 7, + + /* CRU_CLKGATE_CON9 */ + .gate_offset = 0x0324, + .gate_shift = 13, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +static struct rk_clk_composite_def spi2 = { + .clkdef = { + .id = SCLK_SPI2, + .name = "clk_spi2", + .parent_names = spi_parents, + .parent_cnt = nitems(spi_parents), + }, + /* CRU_CLKSEL_CON60 */ + .muxdiv_offset = 0x01f0, + .mux_shift = 7, + .mux_width = 1, + + .div_shift = 0, + .div_width = 7, + + /* CRU_CLKGATE_CON9 */ + .gate_offset = 0x0324, + .gate_shift = 14, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +static struct rk_clk_composite_def spi4 = { + .clkdef = { + .id = SCLK_SPI4, + .name = "clk_spi4", + .parent_names = spi_parents, + .parent_cnt = nitems(spi_parents), + }, + /* CRU_CLKSEL_CON60 */ + .muxdiv_offset = 0x01f0, + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 8, + .div_width = 7, + + /* CRU_CLKGATE_CON9 */ + .gate_offset = 0x0324, + .gate_shift = 15, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +static struct rk_clk_composite_def spi5 = { + .clkdef = { + .id = SCLK_SPI5, + .name = "clk_spi5", + .parent_names = spi_parents, + .parent_cnt = nitems(spi_parents), + }, + /* CRU_CLKSEL_CON58 */ + .muxdiv_offset = 0x01e8, + .mux_shift = 15, + .mux_width = 1, + + .div_shift = 8, + .div_width = 7, + + /* CRU_CLKGATE_CON13 */ + .gate_offset = 0x0334, + .gate_shift = 13, + + .flags = RK_CLK_COMPOSITE_HAVE_MUX | RK_CLK_COMPOSITE_HAVE_GATE, +}; + +/* * ARM CPU clocks (LITTLE and big) */ #define ARMCLKL 8 @@ -1790,6 +1925,27 @@ static struct rk_clk rk3399_clks[] = { { .type = RK_CLK_COMPOSITE, .clk.composite = &uphy1_tcpdcore, + }, + + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &spi0, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &spi1, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &spi2, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &spi4, + }, + { + .type = RK_CLK_COMPOSITE, + .clk.composite = &spi5, }, { From owner-svn-src-all@freebsd.org Fri Oct 25 21:23:45 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6EB2C15BB56; Fri, 25 Oct 2019 21:23:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470HD12N3cz44xF; Fri, 25 Oct 2019 21:23:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 34BFC2C758; Fri, 25 Oct 2019 21:23:45 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLNjZj039667; Fri, 25 Oct 2019 21:23:45 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLNjJX039666; Fri, 25 Oct 2019 21:23:45 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910252123.x9PLNjJX039666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Oct 2019 21:23:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354101 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 354101 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:23:45 -0000 Author: jhb Date: Fri Oct 25 21:23:44 2019 New Revision: 354101 URL: https://svnweb.freebsd.org/changeset/base/354101 Log: MFC 353371: Don't free the cursor boundary tag during vmem_destroy(). The cursor boundary tag is statically allocated in the vmem instead of from the vmem_bt_zone. Explicitly remove it from the vmem's segment list in vmem_destroy before freeing all the segments from the vmem. Modified: stable/12/sys/kern/subr_vmem.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/subr_vmem.c ============================================================================== --- stable/12/sys/kern/subr_vmem.c Fri Oct 25 21:21:21 2019 (r354100) +++ stable/12/sys/kern/subr_vmem.c Fri Oct 25 21:23:44 2019 (r354101) @@ -466,6 +466,7 @@ static void bt_remseg(vmem_t *vm, bt_t *bt) { + MPASS(bt->bt_type != BT_TYPE_CURSOR); TAILQ_REMOVE(&vm->vm_seglist, bt, bt_seglist); bt_free(vm, bt); } @@ -843,6 +844,7 @@ vmem_destroy1(vmem_t *vm) VMEM_LOCK(vm); MPASS(vm->vm_nbusytag == 0); + TAILQ_REMOVE(&vm->vm_seglist, &vm->vm_cursor, bt_seglist); while ((bt = TAILQ_FIRST(&vm->vm_seglist)) != NULL) bt_remseg(vm, bt); From owner-svn-src-all@freebsd.org Fri Oct 25 21:32:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0A1715BE1E; Fri, 25 Oct 2019 21:32:29 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470HQ53pTcz45J7; Fri, 25 Oct 2019 21:32:29 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 675342C957; Fri, 25 Oct 2019 21:32:29 +0000 (UTC) (envelope-from rpokala@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLWTGC045286; Fri, 25 Oct 2019 21:32:29 GMT (envelope-from rpokala@FreeBSD.org) Received: (from rpokala@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLWTOZ045285; Fri, 25 Oct 2019 21:32:29 GMT (envelope-from rpokala@FreeBSD.org) Message-Id: <201910252132.x9PLWTOZ045285@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rpokala set sender to rpokala@FreeBSD.org using -f From: Ravi Pokala Date: Fri, 25 Oct 2019 21:32:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354102 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: rpokala X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 354102 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:32:29 -0000 Author: rpokala Date: Fri Oct 25 21:32:28 2019 New Revision: 354102 URL: https://svnweb.freebsd.org/changeset/base/354102 Log: Args for buf_track() might be unused If neither FULL_BUF_TRACKING nor BUF_TRACKING are defined, then the body of buf_track() becomes empty. Mark the arguments with "__unused" so the compiler doesn't complain about unused arguments in that case. Reported by: Bruce Leverett (Panasas) Reviewed by: cem (on IRC) MFC after: 1 month Sponsored by: Panasas Modified: head/sys/sys/buf.h Modified: head/sys/sys/buf.h ============================================================================== --- head/sys/sys/buf.h Fri Oct 25 21:23:44 2019 (r354101) +++ head/sys/sys/buf.h Fri Oct 25 21:32:28 2019 (r354102) @@ -457,7 +457,7 @@ buf_countdeps(struct buf *bp, int i) } static __inline void -buf_track(struct buf *bp, const char *location) +buf_track(struct buf *bp __unused, const char *location __unused) { #if defined(FULL_BUF_TRACKING) From owner-svn-src-all@freebsd.org Fri Oct 25 21:38:40 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2816015BF75; Fri, 25 Oct 2019 21:38:40 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470HYD0pr8z45cj; Fri, 25 Oct 2019 21:38:40 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D4B8E2C96B; Fri, 25 Oct 2019 21:38:39 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLcd0p045610; Fri, 25 Oct 2019 21:38:39 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLcdYV045607; Fri, 25 Oct 2019 21:38:39 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <201910252138.x9PLcdYV045607@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Fri, 25 Oct 2019 21:38:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354103 - in head/sys: arm64/conf arm64/rockchip conf X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: in head/sys: arm64/conf arm64/rockchip conf X-SVN-Commit-Revision: 354103 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:38:40 -0000 Author: gonzo Date: Fri Oct 25 21:38:38 2019 New Revision: 354103 URL: https://svnweb.freebsd.org/changeset/base/354103 Log: arm64: rk3399: add SPI driver and include it in GENERIC config SPI driver for Rockchip's RK3399 SoC. Implements PIO mode, CS selection, SPI mode and frequency configuration. Reviewed by: manu MFC after: 1 month Differential Revision: https://reviews.freebsd.org/D22148 Added: head/sys/arm64/rockchip/rk_spi.c (contents, props changed) Modified: head/sys/arm64/conf/GENERIC head/sys/conf/files.arm64 Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Fri Oct 25 21:32:28 2019 (r354102) +++ head/sys/arm64/conf/GENERIC Fri Oct 25 21:38:38 2019 (r354103) @@ -286,6 +286,7 @@ device mv_thermal # Marvell Thermal Sensor Controller # SPI device spibus device bcm2835_spi # Broadcom BCM283x SPI bus +device rk_spi # RockChip SPI controller # PWM device pwm Added: head/sys/arm64/rockchip/rk_spi.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/rockchip/rk_spi.c Fri Oct 25 21:38:38 2019 (r354103) @@ -0,0 +1,483 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Oleksandr Tymoshenko + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include +#include + +#include "spibus_if.h" + +#define RK_SPI_CTRLR0 0x0000 +#define CTRLR0_OPM_MASTER (0 << 20) +#define CTRLR0_XFM_TR (0 << 18) +#define CTRLR0_FRF_MOTO (0 << 16) +#define CTRLR0_BHT_8BIT (1 << 13) +#define CTRLR0_EM_BIG (1 << 11) +#define CTRLR0_SSD_ONE (1 << 10) +#define CTRLR0_SCPOL (1 << 7) +#define CTRLR0_SCPH (1 << 6) +#define CTRLR0_DFS_8BIT (1 << 0) +#define RK_SPI_CTRLR1 0x0004 +#define RK_SPI_ENR 0x0008 +#define RK_SPI_SER 0x000c +#define RK_SPI_BAUDR 0x0010 +#define RK_SPI_TXFTLR 0x0014 +#define RK_SPI_RXFTLR 0x0018 +#define RK_SPI_TXFLR 0x001c +#define RK_SPI_RXFLR 0x0020 +#define RK_SPI_SR 0x0024 +#define SR_BUSY (1 << 0) +#define RK_SPI_IPR 0x0028 +#define RK_SPI_IMR 0x002c +#define IMR_RFFIM (1 << 4) +#define IMR_TFEIM (1 << 0) +#define RK_SPI_ISR 0x0030 +#define ISR_RFFIS (1 << 4) +#define ISR_TFEIS (1 << 0) +#define RK_SPI_RISR 0x0034 +#define RK_SPI_ICR 0x0038 +#define RK_SPI_DMACR 0x003c +#define RK_SPI_DMATDLR 0x0040 +#define RK_SPI_DMARDLR 0x0044 +#define RK_SPI_TXDR 0x0400 +#define RK_SPI_RXDR 0x0800 + +#define CS_MAX 1 + +static struct ofw_compat_data compat_data[] = { + { "rockchip,rk3399-spi", 1 }, + { NULL, 0 } +}; + +static struct resource_spec rk_spi_spec[] = { + { SYS_RES_MEMORY, 0, RF_ACTIVE }, + { SYS_RES_IRQ, 0, RF_ACTIVE | RF_SHAREABLE }, + { -1, 0 } +}; + +struct rk_spi_softc { + device_t dev; + device_t spibus; + struct resource *res[2]; + struct mtx mtx; + clk_t clk_apb; + clk_t clk_spi; + void * intrhand; + int transfer; + uint32_t fifo_size; + uint64_t max_freq; + + uint32_t intreg; + uint8_t *rxbuf; + uint32_t rxidx; + uint8_t *txbuf; + uint32_t txidx; + uint32_t txlen; + uint32_t rxlen; +}; + +#define RK_SPI_LOCK(sc) mtx_lock(&(sc)->mtx) +#define RK_SPI_UNLOCK(sc) mtx_unlock(&(sc)->mtx) +#define RK_SPI_READ_4(sc, reg) bus_read_4((sc)->res[0], (reg)) +#define RK_SPI_WRITE_4(sc, reg, val) bus_write_4((sc)->res[0], (reg), (val)) + +static int rk_spi_probe(device_t dev); +static int rk_spi_attach(device_t dev); +static int rk_spi_detach(device_t dev); +static void rk_spi_intr(void *arg); + +static void +rk_spi_enable_chip(struct rk_spi_softc *sc, int enable) +{ + + RK_SPI_WRITE_4(sc, RK_SPI_ENR, enable ? 1 : 0); +} + +static int +rk_spi_set_cs(struct rk_spi_softc *sc, uint32_t cs, bool active) +{ + uint32_t reg; + + if (cs & SPIBUS_CS_HIGH) { + device_printf(sc->dev, "SPIBUS_CS_HIGH is not supported\n"); + return (EINVAL); + } + + if (cs > CS_MAX) + return (EINVAL); + + reg = RK_SPI_READ_4(sc, RK_SPI_SER); + if (active) + reg |= (1 << cs); + else + reg &= ~(1 << cs); + RK_SPI_WRITE_4(sc, RK_SPI_SER, reg); + + return (0); +} + +static void +rk_spi_hw_setup(struct rk_spi_softc *sc, uint32_t mode, uint32_t freq) +{ + uint32_t cr0; + uint32_t div; + + cr0 = CTRLR0_OPM_MASTER | CTRLR0_XFM_TR | CTRLR0_FRF_MOTO | + CTRLR0_BHT_8BIT | CTRLR0_EM_BIG | CTRLR0_SSD_ONE | + CTRLR0_DFS_8BIT; + + if (mode & SPIBUS_MODE_CPHA) + cr0 |= CTRLR0_SCPH; + if (mode & SPIBUS_MODE_CPOL) + cr0 |= CTRLR0_SCPOL; + + /* minimum divider is 2 */ + if (sc->max_freq < freq*2) { + clk_set_freq(sc->clk_spi, 2 * freq, CLK_SET_ROUND_DOWN); + clk_get_freq(sc->clk_spi, &sc->max_freq); + } + + div = ((sc->max_freq + freq - 1) / freq); + div = (div + 1) & 0xfffe; + RK_SPI_WRITE_4(sc, RK_SPI_BAUDR, div); + + RK_SPI_WRITE_4(sc, RK_SPI_CTRLR0, cr0); +} + +static uint32_t +rk_spi_fifo_size(struct rk_spi_softc *sc) +{ + uint32_t txftlr, reg; + + for (txftlr = 2; txftlr < 32; txftlr++) { + RK_SPI_WRITE_4(sc, RK_SPI_TXFTLR, txftlr); + reg = RK_SPI_READ_4(sc, RK_SPI_TXFTLR); + if (reg != txftlr) + break; + } + RK_SPI_WRITE_4(sc, RK_SPI_TXFTLR, 0); + + if (txftlr == 31) + return 0; + + return txftlr; +} + +static void +rk_spi_empty_rxfifo(struct rk_spi_softc *sc) +{ + uint32_t rxlevel; + rxlevel = RK_SPI_READ_4(sc, RK_SPI_RXFLR); + while (sc->rxidx < sc->rxlen && + (rxlevel-- > 0)) { + sc->rxbuf[sc->rxidx++] = (uint8_t)RK_SPI_READ_4(sc, RK_SPI_RXDR); + } +} + +static void +rk_spi_fill_txfifo(struct rk_spi_softc *sc) +{ + uint32_t txlevel; + txlevel = RK_SPI_READ_4(sc, RK_SPI_TXFLR); + int cnt = 0; + + while (sc->txidx < sc->txlen && txlevel < sc->fifo_size) { + RK_SPI_WRITE_4(sc, RK_SPI_TXDR, sc->txbuf[sc->txidx++]); + txlevel++; + cnt++; + } + + if (sc->txidx != sc->txlen) + sc->intreg |= (IMR_TFEIM | IMR_RFFIM); +} + +static int +rk_spi_xfer_buf(struct rk_spi_softc *sc, void *rxbuf, void *txbuf, uint32_t len) +{ + int err; + + if (len == 0) + return (0); + + sc->rxbuf = rxbuf; + sc->rxlen = len; + sc->rxidx = 0; + sc->txbuf = txbuf; + sc->txlen = len; + sc->txidx = 0; + sc->intreg = 0; + rk_spi_fill_txfifo(sc); + + RK_SPI_WRITE_4(sc, RK_SPI_IMR, sc->intreg); + + err = 0; + while (err == 0 && sc->intreg != 0) + err = msleep(sc, &sc->mtx, 0, "rk_spi", 10 * hz); + + while (err == 0 && sc->rxidx != sc->txidx) { + /* read residual data from RX fifo */ + rk_spi_empty_rxfifo(sc); + } + + if (sc->rxidx != sc->rxlen || sc->txidx != sc->txlen) + err = EIO; + + return (err); +} + +static int +rk_spi_probe(device_t dev) +{ + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + + device_set_desc(dev, "Rockchip SPI"); + return (BUS_PROBE_DEFAULT); +} + +static int +rk_spi_attach(device_t dev) +{ + struct rk_spi_softc *sc; + int error; + + sc = device_get_softc(dev); + sc->dev = dev; + + mtx_init(&sc->mtx, device_get_nameunit(dev), NULL, MTX_DEF); + + if (bus_alloc_resources(dev, rk_spi_spec, sc->res) != 0) { + device_printf(dev, "cannot allocate resources for device\n"); + error = ENXIO; + goto fail; + } + + if (bus_setup_intr(dev, sc->res[1], + INTR_TYPE_MISC | INTR_MPSAFE, NULL, rk_spi_intr, sc, + &sc->intrhand)) { + bus_release_resources(dev, rk_spi_spec, sc->res); + device_printf(dev, "cannot setup interrupt handler\n"); + return (ENXIO); + } + + /* Activate the module clock. */ + error = clk_get_by_ofw_name(dev, 0, "apb_pclk", &sc->clk_apb); + if (error != 0) { + device_printf(dev, "cannot get apb_pclk clock\n"); + goto fail; + } + error = clk_get_by_ofw_name(dev, 0, "spiclk", &sc->clk_spi); + if (error != 0) { + device_printf(dev, "cannot get spiclk clock\n"); + goto fail; + } + error = clk_enable(sc->clk_apb); + if (error != 0) { + device_printf(dev, "cannot enable ahb clock\n"); + goto fail; + } + error = clk_enable(sc->clk_spi); + if (error != 0) { + device_printf(dev, "cannot enable spiclk clock\n"); + goto fail; + } + clk_get_freq(sc->clk_spi, &sc->max_freq); + + sc->fifo_size = rk_spi_fifo_size(sc); + if (sc->fifo_size == 0) { + device_printf(dev, "failed to get fifo size\n"); + goto fail; + } + + sc->spibus = device_add_child(dev, "spibus", -1); + + RK_SPI_WRITE_4(sc, RK_SPI_IMR, 0); + RK_SPI_WRITE_4(sc, RK_SPI_TXFTLR, sc->fifo_size/2 - 1); + RK_SPI_WRITE_4(sc, RK_SPI_RXFTLR, sc->fifo_size/2 - 1); + + return (bus_generic_attach(dev)); + +fail: + rk_spi_detach(dev); + return (error); +} + +static int +rk_spi_detach(device_t dev) +{ + struct rk_spi_softc *sc; + + sc = device_get_softc(dev); + + bus_generic_detach(sc->dev); + if (sc->spibus != NULL) + device_delete_child(dev, sc->spibus); + + if (sc->clk_spi != NULL) + clk_release(sc->clk_spi); + if (sc->clk_apb) + clk_release(sc->clk_apb); + + if (sc->intrhand != NULL) + bus_teardown_intr(sc->dev, sc->res[1], sc->intrhand); + + bus_release_resources(dev, rk_spi_spec, sc->res); + mtx_destroy(&sc->mtx); + + return (0); +} + +static void +rk_spi_intr(void *arg) +{ + struct rk_spi_softc *sc; + uint32_t intreg, isr; + + sc = arg; + + RK_SPI_LOCK(sc); + intreg = RK_SPI_READ_4(sc, RK_SPI_IMR); + isr = RK_SPI_READ_4(sc, RK_SPI_ISR); + RK_SPI_WRITE_4(sc, RK_SPI_ICR, isr); + + if (isr & ISR_RFFIS) + rk_spi_empty_rxfifo(sc); + + if (isr & ISR_TFEIS) + rk_spi_fill_txfifo(sc); + + /* no bytes left, disable interrupt */ + if (sc->txidx == sc->txlen) { + sc->intreg = 0; + wakeup(sc); + } + + if (sc->intreg != intreg) { + (void)RK_SPI_WRITE_4(sc, RK_SPI_IMR, sc->intreg); + (void)RK_SPI_READ_4(sc, RK_SPI_IMR); + } + + RK_SPI_UNLOCK(sc); +} + +static phandle_t +rk_spi_get_node(device_t bus, device_t dev) +{ + + return ofw_bus_get_node(bus); +} + +static int +rk_spi_transfer(device_t dev, device_t child, struct spi_command *cmd) +{ + struct rk_spi_softc *sc; + uint32_t cs, mode, clock; + int err = 0; + + sc = device_get_softc(dev); + + spibus_get_cs(child, &cs); + spibus_get_clock(child, &clock); + spibus_get_mode(child, &mode); + + RK_SPI_LOCK(sc); + rk_spi_hw_setup(sc, mode, clock); + rk_spi_enable_chip(sc, 1); + err = rk_spi_set_cs(sc, cs, true); + if (err != 0) { + rk_spi_enable_chip(sc, 0); + RK_SPI_UNLOCK(sc); + return (err); + } + + /* Transfer command then data bytes. */ + err = 0; + if (cmd->tx_cmd_sz > 0) + err = rk_spi_xfer_buf(sc, cmd->rx_cmd, cmd->tx_cmd, + cmd->tx_cmd_sz); + if (cmd->tx_data_sz > 0 && err == 0) + err = rk_spi_xfer_buf(sc, cmd->rx_data, cmd->tx_data, + cmd->tx_data_sz); + + rk_spi_set_cs(sc, cs, false); + rk_spi_enable_chip(sc, 0); + RK_SPI_UNLOCK(sc); + + return (err); +} + +static device_method_t rk_spi_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, rk_spi_probe), + DEVMETHOD(device_attach, rk_spi_attach), + DEVMETHOD(device_detach, rk_spi_detach), + + /* spibus_if */ + DEVMETHOD(spibus_transfer, rk_spi_transfer), + + /* ofw_bus_if */ + DEVMETHOD(ofw_bus_get_node, rk_spi_get_node), + + DEVMETHOD_END +}; + +static driver_t rk_spi_driver = { + "spi", + rk_spi_methods, + sizeof(struct rk_spi_softc), +}; + +static devclass_t rk_spi_devclass; + +DRIVER_MODULE(rk_spi, simplebus, rk_spi_driver, rk_spi_devclass, 0, 0); +DRIVER_MODULE(ofw_spibus, rk_spi, ofw_spibus_driver, ofw_spibus_devclass, 0, 0); +MODULE_DEPEND(rk_spi, ofw_spibus, 1, 1, 1); +SIMPLEBUS_PNP_INFO(compat_data); Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Oct 25 21:32:28 2019 (r354102) +++ head/sys/conf/files.arm64 Fri Oct 25 21:38:38 2019 (r354103) @@ -298,6 +298,7 @@ arm64/rockchip/rk805.c optional fdt rk805 soc_rockch arm64/rockchip/rk_grf.c optional fdt soc_rockchip_rk3328 | fdt soc_rockchip_rk3399 arm64/rockchip/rk_pinctrl.c optional fdt rk_pinctrl soc_rockchip_rk3328 | fdt rk_pinctrl soc_rockchip_rk3399 arm64/rockchip/rk_gpio.c optional fdt rk_gpio soc_rockchip_rk3328 | fdt rk_gpio soc_rockchip_rk3399 +arm64/rockchip/rk_spi.c optional fdt rk_spi arm64/rockchip/rk_usb2phy.c optional fdt rk_usb2phy soc_rockchip_rk3328 | soc_rockchip_rk3399 arm64/rockchip/rk_typec_phy.c optional fdt rk_typec_phy soc_rockchip_rk3399 arm64/rockchip/if_dwc_rk.c optional fdt dwc_rk soc_rockchip_rk3328 | fdt dwc_rk soc_rockchip_rk3399 From owner-svn-src-all@freebsd.org Fri Oct 25 21:39:30 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0619615BFFE; Fri, 25 Oct 2019 21:39:30 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470HZ96DFMz45lw; Fri, 25 Oct 2019 21:39:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B8D9A2C972; Fri, 25 Oct 2019 21:39:29 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLdTX1045690; Fri, 25 Oct 2019 21:39:29 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLdTWZ045689; Fri, 25 Oct 2019 21:39:29 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <201910252139.x9PLdTWZ045689@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 25 Oct 2019 21:39:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354104 - head/sys/riscv/riscv X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/riscv/riscv X-SVN-Commit-Revision: 354104 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:39:30 -0000 Author: mhorne Date: Fri Oct 25 21:39:29 2019 New Revision: 354104 URL: https://svnweb.freebsd.org/changeset/base/354104 Log: RISC-V: skip cpu-map when parsing elf_hwcap The fill_elf_hwcap() function expects to find only cpu nodes under the /cpus entry of the device tree. Newer versions of QEMU insert a cpu-map node which describes the CPU topology, breaking this function. To fix this, simply skip any non-cpu entries. Reviewed by: markj, kp, jhb MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22151 Modified: head/sys/riscv/riscv/identcpu.c Modified: head/sys/riscv/riscv/identcpu.c ============================================================================== --- head/sys/riscv/riscv/identcpu.c Fri Oct 25 21:38:38 2019 (r354103) +++ head/sys/riscv/riscv/identcpu.c Fri Oct 25 21:39:29 2019 (r354104) @@ -142,11 +142,9 @@ fill_elf_hwcap(void *dummy __unused) * ISAs, keep only the extension bits that are common to all harts. */ for (node = OF_child(node); node > 0; node = OF_peer(node)) { - if (!ofw_bus_node_is_compatible(node, "riscv")) { - if (bootverbose) - printf("fill_elf_hwcap: Can't find cpu\n"); - return; - } + /* Skip any non-CPU nodes, such as cpu-map. */ + if (!ofw_bus_node_is_compatible(node, "riscv")) + continue; len = OF_getprop(node, "riscv,isa", isa, sizeof(isa)); KASSERT(len <= ISA_NAME_MAXLEN, ("ISA string truncated")); From owner-svn-src-all@freebsd.org Fri Oct 25 21:52:02 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F134B15CB48; Fri, 25 Oct 2019 21:52:02 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Hrf6BZ3z46vZ; Fri, 25 Oct 2019 21:52:02 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B95062CCBD; Fri, 25 Oct 2019 21:52:02 +0000 (UTC) (envelope-from lwhsu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLq26n055719; Fri, 25 Oct 2019 21:52:02 GMT (envelope-from lwhsu@FreeBSD.org) Received: (from lwhsu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLq2ak055718; Fri, 25 Oct 2019 21:52:02 GMT (envelope-from lwhsu@FreeBSD.org) Message-Id: <201910252152.x9PLq2ak055718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: lwhsu set sender to lwhsu@FreeBSD.org using -f From: Li-Wen Hsu Date: Fri, 25 Oct 2019 21:52:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354105 - stable/12/tests/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: lwhsu X-SVN-Commit-Paths: stable/12/tests/sys/kern X-SVN-Commit-Revision: 354105 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:52:03 -0000 Author: lwhsu Date: Fri Oct 25 21:52:02 2019 New Revision: 354105 URL: https://svnweb.freebsd.org/changeset/base/354105 Log: MFC r350211, r350220, r350235, r350238-r350239, r350295, r350512, r350700, r352219 r350211: Temporarily skip flakey test case sys.kern.ptrace_test.ptrace__follow_fork_child_detached_unrelated_debugger PR: 239292 Sponsored by: The FreeBSD Foundation r350220: Fix URL. Sponsored by: The FreeBSD Foundation r350235: Temporarily skip flakey test case sys.kern.ptrace_test.ptrace__PT_KILL_competing_stop PR: 220841 Sponsored by: The FreeBSD Foundation r350238: Temporarily skip flakey test case sys.kern.ptrace_test.ptrace__follow_fork_both_attached_unrelated_debugger PR: 239397 Sponsored by: The FreeBSD Foundation r350239: Temporarily skip flakey test case sys.kern.ptrace_test.ptrace__parent_sees_exit_after_child_debugger PR: 239399 Sponsored by: The FreeBSD Foundation r350295: Temporarily skip flakey test case sys.kern.ptrace_test.ptrace__follow_fork_parent_detached_unrelated_debugger PR: 239425 Sponsored by: The FreeBSD Foundation r350512: Only skip test cases sometimes failing in CI when they are running in CI Suggested by: jhb Sponsored by: The FreeBSD Foundation r350700: Get configuration variable with default value for not breaking default setting Reported by: markj Sponsored by: The FreeBSD Foundation r352219: Temporarily skip flakey test case sys.kern.ptrace_test.ptrace__getppid PR: 240510 Sponsored by: The FreeBSD Foundation Modified: stable/12/tests/sys/kern/ptrace_test.c Directory Properties: stable/12/ (props changed) Modified: stable/12/tests/sys/kern/ptrace_test.c ============================================================================== --- stable/12/tests/sys/kern/ptrace_test.c Fri Oct 25 21:39:29 2019 (r354104) +++ stable/12/tests/sys/kern/ptrace_test.c Fri Oct 25 21:52:02 2019 (r354105) @@ -261,6 +261,9 @@ ATF_TC_BODY(ptrace__parent_sees_exit_after_child_debug int cpipe[2], dpipe[2], status; char c; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/239399"); + ATF_REQUIRE(pipe(cpipe) == 0); ATF_REQUIRE((child = fork()) != -1); @@ -802,6 +805,9 @@ ATF_TC_BODY(ptrace__follow_fork_both_attached_unrelate pid_t children[2], fpid, wpid; int cpipe[2], status; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/239397"); + ATF_REQUIRE(pipe(cpipe) == 0); ATF_REQUIRE((fpid = fork()) != -1); if (fpid == 0) { @@ -870,6 +876,9 @@ ATF_TC_BODY(ptrace__follow_fork_child_detached_unrelat pid_t children[2], fpid, wpid; int cpipe[2], status; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/239292"); + ATF_REQUIRE(pipe(cpipe) == 0); ATF_REQUIRE((fpid = fork()) != -1); if (fpid == 0) { @@ -933,6 +942,9 @@ ATF_TC_BODY(ptrace__follow_fork_parent_detached_unrela pid_t children[2], fpid, wpid; int cpipe[2], status; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/239425"); + ATF_REQUIRE(pipe(cpipe) == 0); ATF_REQUIRE((fpid = fork()) != -1); if (fpid == 0) { @@ -995,6 +1007,10 @@ ATF_TC_BODY(ptrace__getppid, tc) int cpipe[2], dpipe[2], status; char c; + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/240510"); + + ATF_REQUIRE(pipe(cpipe) == 0); ATF_REQUIRE((child = fork()) != -1); @@ -2078,6 +2094,9 @@ ATF_TC_BODY(ptrace__PT_KILL_competing_stop, tc) lwpid_t main_lwp; struct ptrace_lwpinfo pl; struct sched_param sched_param; + + if (atf_tc_get_config_var_as_bool_wd(tc, "ci", false)) + atf_tc_skip("https://bugs.freebsd.org/220841"); ATF_REQUIRE((fpid = fork()) != -1); if (fpid == 0) { From owner-svn-src-all@freebsd.org Fri Oct 25 21:53:06 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C2D5915CC7D; Fri, 25 Oct 2019 21:53:06 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Hst4n6Hz478W; Fri, 25 Oct 2019 21:53:06 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8899E2CD08; Fri, 25 Oct 2019 21:53:06 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PLr6cq057280; Fri, 25 Oct 2019 21:53:06 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PLr5JP057277; Fri, 25 Oct 2019 21:53:05 GMT (envelope-from np@FreeBSD.org) Message-Id: <201910252153.x9PLr5JP057277@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 25 Oct 2019 21:53:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354106 - in head/sys/dev/cxgbe: . common iw_cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common iw_cxgbe X-SVN-Commit-Revision: 354106 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 21:53:06 -0000 Author: np Date: Fri Oct 25 21:53:05 2019 New Revision: 354106 URL: https://svnweb.freebsd.org/changeset/base/354106 Log: cxgbe(4): Use correct FetchBurstMin values for T6. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/t4_regs_values.h head/sys/dev/cxgbe/iw_cxgbe/qp.c head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/common/t4_regs_values.h ============================================================================== --- head/sys/dev/cxgbe/common/t4_regs_values.h Fri Oct 25 21:52:02 2019 (r354105) +++ head/sys/dev/cxgbe/common/t4_regs_values.h Fri Oct 25 21:53:05 2019 (r354106) @@ -147,6 +147,11 @@ #define X_FETCHBURSTMIN_64B 2 #define X_FETCHBURSTMIN_128B 3 +/* T6 and later use a single-bit encoding for FetchBurstMin */ +#define X_FETCHBURSTMIN_SHIFT_T6 6 +#define X_FETCHBURSTMIN_64B_T6 0 +#define X_FETCHBURSTMIN_128B_T6 1 + #define X_FETCHBURSTMAX_SHIFT 6 #define X_FETCHBURSTMAX_64B 0 #define X_FETCHBURSTMAX_128B 1 Modified: head/sys/dev/cxgbe/iw_cxgbe/qp.c ============================================================================== --- head/sys/dev/cxgbe/iw_cxgbe/qp.c Fri Oct 25 21:52:02 2019 (r354105) +++ head/sys/dev/cxgbe/iw_cxgbe/qp.c Fri Oct 25 21:53:05 2019 (r354106) @@ -266,7 +266,8 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4 res->u.sqrq.dcaen_to_eqsize = cpu_to_be32( V_FW_RI_RES_WR_DCAEN(0) | V_FW_RI_RES_WR_DCACPU(0) | - V_FW_RI_RES_WR_FBMIN(2) | + V_FW_RI_RES_WR_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | V_FW_RI_RES_WR_FBMAX(3) | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | V_FW_RI_RES_WR_CIDXFTHRESH(0) | @@ -288,7 +289,8 @@ static int create_qp(struct c4iw_rdev *rdev, struct t4 res->u.sqrq.dcaen_to_eqsize = cpu_to_be32( V_FW_RI_RES_WR_DCAEN(0) | V_FW_RI_RES_WR_DCACPU(0) | - V_FW_RI_RES_WR_FBMIN(2) | + V_FW_RI_RES_WR_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | V_FW_RI_RES_WR_FBMAX(3) | V_FW_RI_RES_WR_CIDXFTHRESHO(0) | V_FW_RI_RES_WR_CIDXFTHRESH(0) | Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Fri Oct 25 21:52:02 2019 (r354105) +++ head/sys/dev/cxgbe/t4_netmap.c Fri Oct 25 21:53:05 2019 (r354106) @@ -159,7 +159,7 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq (black_hole == 2 ? F_FW_IQ_CMD_FL0PACKEN : 0)); c.fl0dcaen_to_fl0cidxfthresh = htobe16(V_FW_IQ_CMD_FL0FBMIN(chip_id(sc) <= CHELSIO_T5 ? - X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B) | + X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B_T6) | V_FW_IQ_CMD_FL0FBMAX(chip_id(sc) <= CHELSIO_T5 ? X_FETCHBURSTMAX_512B : X_FETCHBURSTMAX_256B)); c.fl0size = htobe16(na->num_rx_desc / 8 + sp->spg_len / EQ_ESIZE); @@ -274,9 +274,11 @@ alloc_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq htobe32(V_FW_EQ_ETH_CMD_HOSTFCMODE(X_HOSTFCMODE_NONE) | V_FW_EQ_ETH_CMD_PCIECHN(vi->pi->tx_chan) | F_FW_EQ_ETH_CMD_FETCHRO | V_FW_EQ_ETH_CMD_IQID(sc->sge.nm_rxq[nm_txq->iqidx].iq_cntxt_id)); - c.dcaen_to_eqsize = htobe32(V_FW_EQ_ETH_CMD_FBMIN(X_FETCHBURSTMIN_64B) | - V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) | - V_FW_EQ_ETH_CMD_EQSIZE(len / EQ_ESIZE)); + c.dcaen_to_eqsize = + htobe32(V_FW_EQ_ETH_CMD_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | + V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) | + V_FW_EQ_ETH_CMD_EQSIZE(len / EQ_ESIZE)); c.eqaddr = htobe64(nm_txq->ba); rc = -t4_wr_mbox(sc, sc->mbox, &c, sizeof(c), &c); Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Fri Oct 25 21:52:02 2019 (r354105) +++ head/sys/dev/cxgbe/t4_sge.c Fri Oct 25 21:53:05 2019 (r354106) @@ -3212,7 +3212,7 @@ alloc_iq_fl(struct vi_info *vi, struct sge_iq *iq, str } c.fl0dcaen_to_fl0cidxfthresh = htobe16(V_FW_IQ_CMD_FL0FBMIN(chip_id(sc) <= CHELSIO_T5 ? - X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B) | + X_FETCHBURSTMIN_128B : X_FETCHBURSTMIN_64B_T6) | V_FW_IQ_CMD_FL0FBMAX(chip_id(sc) <= CHELSIO_T5 ? X_FETCHBURSTMAX_512B : X_FETCHBURSTMAX_256B)); c.fl0size = htobe16(fl->qsize); @@ -3798,7 +3798,8 @@ ctrl_eq_alloc(struct adapter *sc, struct sge_eq *eq) V_FW_EQ_CTRL_CMD_PCIECHN(eq->tx_chan) | F_FW_EQ_CTRL_CMD_FETCHRO | V_FW_EQ_CTRL_CMD_IQID(eq->iqid)); c.dcaen_to_eqsize = - htobe32(V_FW_EQ_CTRL_CMD_FBMIN(X_FETCHBURSTMIN_64B) | + htobe32(V_FW_EQ_CTRL_CMD_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | V_FW_EQ_CTRL_CMD_FBMAX(X_FETCHBURSTMAX_512B) | V_FW_EQ_CTRL_CMD_CIDXFTHRESH(qsize_to_fthresh(qsize)) | V_FW_EQ_CTRL_CMD_EQSIZE(qsize)); @@ -3842,9 +3843,11 @@ eth_eq_alloc(struct adapter *sc, struct vi_info *vi, s htobe32(V_FW_EQ_ETH_CMD_HOSTFCMODE(X_HOSTFCMODE_NONE) | V_FW_EQ_ETH_CMD_PCIECHN(eq->tx_chan) | F_FW_EQ_ETH_CMD_FETCHRO | V_FW_EQ_ETH_CMD_IQID(eq->iqid)); - c.dcaen_to_eqsize = htobe32(V_FW_EQ_ETH_CMD_FBMIN(X_FETCHBURSTMIN_64B) | - V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) | - V_FW_EQ_ETH_CMD_EQSIZE(qsize)); + c.dcaen_to_eqsize = + htobe32(V_FW_EQ_ETH_CMD_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | + V_FW_EQ_ETH_CMD_FBMAX(X_FETCHBURSTMAX_512B) | + V_FW_EQ_ETH_CMD_EQSIZE(qsize)); c.eqaddr = htobe64(eq->ba); rc = -t4_wr_mbox(sc, sc->mbox, &c, sizeof(c), &c); @@ -3886,7 +3889,8 @@ ofld_eq_alloc(struct adapter *sc, struct vi_info *vi, V_FW_EQ_OFLD_CMD_PCIECHN(eq->tx_chan) | F_FW_EQ_OFLD_CMD_FETCHRO | V_FW_EQ_OFLD_CMD_IQID(eq->iqid)); c.dcaen_to_eqsize = - htobe32(V_FW_EQ_OFLD_CMD_FBMIN(X_FETCHBURSTMIN_64B) | + htobe32(V_FW_EQ_OFLD_CMD_FBMIN(chip_id(sc) <= CHELSIO_T5 ? + X_FETCHBURSTMIN_64B : X_FETCHBURSTMIN_64B_T6) | V_FW_EQ_OFLD_CMD_FBMAX(X_FETCHBURSTMAX_512B) | V_FW_EQ_OFLD_CMD_CIDXFTHRESH(qsize_to_fthresh(qsize)) | V_FW_EQ_OFLD_CMD_EQSIZE(qsize)); From owner-svn-src-all@freebsd.org Fri Oct 25 22:04:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08EA215D025; Fri, 25 Oct 2019 22:04:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470J6Z5Kl0z47fj; Fri, 25 Oct 2019 22:04:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9ACDC2CF07; Fri, 25 Oct 2019 22:04:06 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PM46ui063247; Fri, 25 Oct 2019 22:04:06 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PM46cs063244; Fri, 25 Oct 2019 22:04:06 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910252204.x9PM46cs063244@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Oct 2019 22:04:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354107 - in stable: 11/sys/dev/acpica 11/sys/dev/pci 12/sys/dev/acpica 12/sys/dev/pci X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/dev/acpica 11/sys/dev/pci 12/sys/dev/acpica 12/sys/dev/pci X-SVN-Commit-Revision: 354107 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 22:04:07 -0000 Author: jhb Date: Fri Oct 25 22:04:05 2019 New Revision: 354107 URL: https://svnweb.freebsd.org/changeset/base/354107 Log: MFC 353585,353586: Support hot insertion and removal of PCI devices on EC2. 353585: Export pci_attach() and pci_detach(). 353586: Support hot insertion and removal of PCI devices on EC2. Install ACPI notify handlers on PCI devices with an _EJ0 method. This handler is invoked when devices are added or removed. - When an ACPI_NOTIFY_DEVICE_CHECK event posts, rescan the parent bus device. Note that strictly speaking we only need to rescan the specified device, but BUS_RESCAN is what is available, so we rescan the entire bus. - When an ACPI_NOTIFY_EJECT_REQUEST event posts, detach the device associated with the ACPI handle, invoke the _EJ0 method, and then delete the device. Eventually this might be changed to vector notify events to devd in userspace where devctl can be used instead to permit more complex actions such as graceful unmounting of filesystems. Modified: stable/12/sys/dev/acpica/acpi_pci.c stable/12/sys/dev/pci/pci.c stable/12/sys/dev/pci/pci_private.h Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/dev/acpica/acpi_pci.c stable/11/sys/dev/pci/pci.c stable/11/sys/dev/pci/pci_private.h Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/dev/acpica/acpi_pci.c ============================================================================== --- stable/12/sys/dev/acpica/acpi_pci.c Fri Oct 25 21:53:05 2019 (r354106) +++ stable/12/sys/dev/acpica/acpi_pci.c Fri Oct 25 22:04:05 2019 (r354107) @@ -71,9 +71,11 @@ CTASSERT(ACPI_STATE_D2 == PCI_POWERSTATE_D2); CTASSERT(ACPI_STATE_D3 == PCI_POWERSTATE_D3); static struct pci_devinfo *acpi_pci_alloc_devinfo(device_t dev); +static int acpi_pci_attach(device_t dev); static void acpi_pci_child_deleted(device_t dev, device_t child); static int acpi_pci_child_location_str_method(device_t cbdev, device_t child, char *buf, size_t buflen); +static int acpi_pci_detach(device_t dev); static int acpi_pci_probe(device_t dev); static int acpi_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result); @@ -89,6 +91,8 @@ static bus_dma_tag_t acpi_pci_get_dma_tag(device_t bus static device_method_t acpi_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, acpi_pci_probe), + DEVMETHOD(device_attach, acpi_pci_attach), + DEVMETHOD(device_detach, acpi_pci_detach), /* Bus interface */ DEVMETHOD(bus_read_ivar, acpi_pci_read_ivar), @@ -324,6 +328,108 @@ acpi_pci_probe(device_t dev) return (ENXIO); device_set_desc(dev, "ACPI PCI bus"); return (BUS_PROBE_DEFAULT); +} + +static void +acpi_pci_device_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) +{ + device_t child, dev; + ACPI_STATUS status; + int error; + + dev = context; + + switch (notify) { + case ACPI_NOTIFY_DEVICE_CHECK: + mtx_lock(&Giant); + BUS_RESCAN(dev); + mtx_unlock(&Giant); + break; + case ACPI_NOTIFY_EJECT_REQUEST: + child = acpi_get_device(h); + if (child == NULL) { + device_printf(dev, "no device to eject for %s\n", + acpi_name(h)); + return; + } + mtx_lock(&Giant); + error = device_detach(child); + if (error) { + mtx_unlock(&Giant); + device_printf(dev, "failed to detach %s: %d\n", + device_get_nameunit(child), error); + return; + } + status = acpi_SetInteger(h, "_EJ0", 1); + if (ACPI_FAILURE(status)) { + mtx_unlock(&Giant); + device_printf(dev, "failed to eject %s: %s\n", + acpi_name(h), AcpiFormatException(status)); + return; + } + BUS_RESCAN(dev); + mtx_unlock(&Giant); + break; + default: + device_printf(dev, "unknown notify %#x for %s\n", notify, + acpi_name(h)); + break; + } +} + +static ACPI_STATUS +acpi_pci_install_device_notify_handler(ACPI_HANDLE handle, UINT32 level, + void *context, void **status) +{ + ACPI_HANDLE h; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + + if (ACPI_FAILURE(AcpiGetHandle(handle, "_EJ0", &h))) + return_ACPI_STATUS (AE_OK); + + AcpiInstallNotifyHandler(handle, ACPI_SYSTEM_NOTIFY, + acpi_pci_device_notify_handler, context); + return_ACPI_STATUS (AE_OK); +} + +static int +acpi_pci_attach(device_t dev) +{ + int error; + + error = pci_attach(dev); + if (error) + return (error); + AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, + acpi_pci_install_device_notify_handler, NULL, dev, NULL); + + return (0); +} + +static ACPI_STATUS +acpi_pci_remove_notify_handler(ACPI_HANDLE handle, UINT32 level, void *context, + void **status) +{ + ACPI_HANDLE h; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + + if (ACPI_FAILURE(AcpiGetHandle(handle, "_EJ0", &h))) + return_ACPI_STATUS (AE_OK); + + AcpiRemoveNotifyHandler(handle, ACPI_SYSTEM_NOTIFY, + acpi_pci_device_notify_handler); + return_ACPI_STATUS (AE_OK); +} + +static int +acpi_pci_detach(device_t dev) +{ + + AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, + acpi_pci_remove_notify_handler, NULL, dev, NULL); + return (pci_detach(dev)); } #ifdef ACPI_DMAR Modified: stable/12/sys/dev/pci/pci.c ============================================================================== --- stable/12/sys/dev/pci/pci.c Fri Oct 25 21:53:05 2019 (r354106) +++ stable/12/sys/dev/pci/pci.c Fri Oct 25 22:04:05 2019 (r354107) @@ -98,8 +98,6 @@ static void pci_assign_interrupt(device_t bus, device static int pci_add_map(device_t bus, device_t dev, int reg, struct resource_list *rl, int force, int prefetch); static int pci_probe(device_t dev); -static int pci_attach(device_t dev); -static int pci_detach(device_t dev); static void pci_load_vendor_data(void); static int pci_describe_parse_line(char **ptr, int *vendor, int *device, char **desc); @@ -4380,7 +4378,7 @@ pci_attach_common(device_t dev) return (0); } -static int +int pci_attach(device_t dev) { int busno, domain, error; @@ -4401,7 +4399,7 @@ pci_attach(device_t dev) return (bus_generic_attach(dev)); } -static int +int pci_detach(device_t dev) { #ifdef PCI_RES_BUS Modified: stable/12/sys/dev/pci/pci_private.h ============================================================================== --- stable/12/sys/dev/pci/pci_private.h Fri Oct 25 21:53:05 2019 (r354106) +++ stable/12/sys/dev/pci/pci_private.h Fri Oct 25 22:04:05 2019 (r354107) @@ -58,7 +58,9 @@ void pci_add_resources(device_t bus, device_t dev, in uint32_t prefetchmask); void pci_add_resources_ea(device_t bus, device_t dev, int alloc_iov); struct pci_devinfo *pci_alloc_devinfo_method(device_t dev); +int pci_attach(device_t dev); int pci_attach_common(device_t dev); +int pci_detach(device_t dev); int pci_rescan_method(device_t dev); void pci_driver_added(device_t dev, driver_t *driver); int pci_ea_is_enabled(device_t dev, int rid); From owner-svn-src-all@freebsd.org Fri Oct 25 22:04:07 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A437315D02F; Fri, 25 Oct 2019 22:04:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470J6b3vcBz47fk; Fri, 25 Oct 2019 22:04:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6A7202CF08; Fri, 25 Oct 2019 22:04:07 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PM4774063255; Fri, 25 Oct 2019 22:04:07 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PM46HA063252; Fri, 25 Oct 2019 22:04:06 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910252204.x9PM46HA063252@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Oct 2019 22:04:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354107 - in stable: 11/sys/dev/acpica 11/sys/dev/pci 12/sys/dev/acpica 12/sys/dev/pci X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/dev/acpica 11/sys/dev/pci 12/sys/dev/acpica 12/sys/dev/pci X-SVN-Commit-Revision: 354107 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 22:04:07 -0000 Author: jhb Date: Fri Oct 25 22:04:05 2019 New Revision: 354107 URL: https://svnweb.freebsd.org/changeset/base/354107 Log: MFC 353585,353586: Support hot insertion and removal of PCI devices on EC2. 353585: Export pci_attach() and pci_detach(). 353586: Support hot insertion and removal of PCI devices on EC2. Install ACPI notify handlers on PCI devices with an _EJ0 method. This handler is invoked when devices are added or removed. - When an ACPI_NOTIFY_DEVICE_CHECK event posts, rescan the parent bus device. Note that strictly speaking we only need to rescan the specified device, but BUS_RESCAN is what is available, so we rescan the entire bus. - When an ACPI_NOTIFY_EJECT_REQUEST event posts, detach the device associated with the ACPI handle, invoke the _EJ0 method, and then delete the device. Eventually this might be changed to vector notify events to devd in userspace where devctl can be used instead to permit more complex actions such as graceful unmounting of filesystems. Modified: stable/11/sys/dev/acpica/acpi_pci.c stable/11/sys/dev/pci/pci.c stable/11/sys/dev/pci/pci_private.h Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/dev/acpica/acpi_pci.c stable/12/sys/dev/pci/pci.c stable/12/sys/dev/pci/pci_private.h Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/dev/acpica/acpi_pci.c ============================================================================== --- stable/11/sys/dev/acpica/acpi_pci.c Fri Oct 25 21:53:05 2019 (r354106) +++ stable/11/sys/dev/acpica/acpi_pci.c Fri Oct 25 22:04:05 2019 (r354107) @@ -71,9 +71,11 @@ CTASSERT(ACPI_STATE_D2 == PCI_POWERSTATE_D2); CTASSERT(ACPI_STATE_D3 == PCI_POWERSTATE_D3); static struct pci_devinfo *acpi_pci_alloc_devinfo(device_t dev); +static int acpi_pci_attach(device_t dev); static void acpi_pci_child_deleted(device_t dev, device_t child); static int acpi_pci_child_location_str_method(device_t cbdev, device_t child, char *buf, size_t buflen); +static int acpi_pci_detach(device_t dev); static int acpi_pci_probe(device_t dev); static int acpi_pci_read_ivar(device_t dev, device_t child, int which, uintptr_t *result); @@ -89,6 +91,8 @@ static bus_dma_tag_t acpi_pci_get_dma_tag(device_t bus static device_method_t acpi_pci_methods[] = { /* Device interface */ DEVMETHOD(device_probe, acpi_pci_probe), + DEVMETHOD(device_attach, acpi_pci_attach), + DEVMETHOD(device_detach, acpi_pci_detach), /* Bus interface */ DEVMETHOD(bus_read_ivar, acpi_pci_read_ivar), @@ -324,6 +328,108 @@ acpi_pci_probe(device_t dev) return (ENXIO); device_set_desc(dev, "ACPI PCI bus"); return (BUS_PROBE_DEFAULT); +} + +static void +acpi_pci_device_notify_handler(ACPI_HANDLE h, UINT32 notify, void *context) +{ + device_t child, dev; + ACPI_STATUS status; + int error; + + dev = context; + + switch (notify) { + case ACPI_NOTIFY_DEVICE_CHECK: + mtx_lock(&Giant); + BUS_RESCAN(dev); + mtx_unlock(&Giant); + break; + case ACPI_NOTIFY_EJECT_REQUEST: + child = acpi_get_device(h); + if (child == NULL) { + device_printf(dev, "no device to eject for %s\n", + acpi_name(h)); + return; + } + mtx_lock(&Giant); + error = device_detach(child); + if (error) { + mtx_unlock(&Giant); + device_printf(dev, "failed to detach %s: %d\n", + device_get_nameunit(child), error); + return; + } + status = acpi_SetInteger(h, "_EJ0", 1); + if (ACPI_FAILURE(status)) { + mtx_unlock(&Giant); + device_printf(dev, "failed to eject %s: %s\n", + acpi_name(h), AcpiFormatException(status)); + return; + } + BUS_RESCAN(dev); + mtx_unlock(&Giant); + break; + default: + device_printf(dev, "unknown notify %#x for %s\n", notify, + acpi_name(h)); + break; + } +} + +static ACPI_STATUS +acpi_pci_install_device_notify_handler(ACPI_HANDLE handle, UINT32 level, + void *context, void **status) +{ + ACPI_HANDLE h; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + + if (ACPI_FAILURE(AcpiGetHandle(handle, "_EJ0", &h))) + return_ACPI_STATUS (AE_OK); + + AcpiInstallNotifyHandler(handle, ACPI_SYSTEM_NOTIFY, + acpi_pci_device_notify_handler, context); + return_ACPI_STATUS (AE_OK); +} + +static int +acpi_pci_attach(device_t dev) +{ + int error; + + error = pci_attach(dev); + if (error) + return (error); + AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, + acpi_pci_install_device_notify_handler, NULL, dev, NULL); + + return (0); +} + +static ACPI_STATUS +acpi_pci_remove_notify_handler(ACPI_HANDLE handle, UINT32 level, void *context, + void **status) +{ + ACPI_HANDLE h; + + ACPI_FUNCTION_TRACE((char *)(uintptr_t)__func__); + + if (ACPI_FAILURE(AcpiGetHandle(handle, "_EJ0", &h))) + return_ACPI_STATUS (AE_OK); + + AcpiRemoveNotifyHandler(handle, ACPI_SYSTEM_NOTIFY, + acpi_pci_device_notify_handler); + return_ACPI_STATUS (AE_OK); +} + +static int +acpi_pci_detach(device_t dev) +{ + + AcpiWalkNamespace(ACPI_TYPE_DEVICE, acpi_get_handle(dev), 1, + acpi_pci_remove_notify_handler, NULL, dev, NULL); + return (pci_detach(dev)); } #ifdef ACPI_DMAR Modified: stable/11/sys/dev/pci/pci.c ============================================================================== --- stable/11/sys/dev/pci/pci.c Fri Oct 25 21:53:05 2019 (r354106) +++ stable/11/sys/dev/pci/pci.c Fri Oct 25 22:04:05 2019 (r354107) @@ -96,8 +96,6 @@ static void pci_assign_interrupt(device_t bus, device static int pci_add_map(device_t bus, device_t dev, int reg, struct resource_list *rl, int force, int prefetch); static int pci_probe(device_t dev); -static int pci_attach(device_t dev); -static int pci_detach(device_t dev); static void pci_load_vendor_data(void); static int pci_describe_parse_line(char **ptr, int *vendor, int *device, char **desc); @@ -4371,7 +4369,7 @@ pci_attach_common(device_t dev) return (0); } -static int +int pci_attach(device_t dev) { int busno, domain, error; @@ -4392,7 +4390,7 @@ pci_attach(device_t dev) return (bus_generic_attach(dev)); } -static int +int pci_detach(device_t dev) { #ifdef PCI_RES_BUS Modified: stable/11/sys/dev/pci/pci_private.h ============================================================================== --- stable/11/sys/dev/pci/pci_private.h Fri Oct 25 21:53:05 2019 (r354106) +++ stable/11/sys/dev/pci/pci_private.h Fri Oct 25 22:04:05 2019 (r354107) @@ -56,7 +56,9 @@ void pci_add_resources(device_t bus, device_t dev, in uint32_t prefetchmask); void pci_add_resources_ea(device_t bus, device_t dev, int alloc_iov); struct pci_devinfo *pci_alloc_devinfo_method(device_t dev); +int pci_attach(device_t dev); int pci_attach_common(device_t dev); +int pci_detach(device_t dev); int pci_rescan_method(device_t dev); void pci_driver_added(device_t dev, driver_t *driver); int pci_ea_is_enabled(device_t dev, int rid); From owner-svn-src-all@freebsd.org Fri Oct 25 22:15:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7880D15D53C; Fri, 25 Oct 2019 22:15:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470JMY2bS5z48LG; Fri, 25 Oct 2019 22:15:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3C3F22D0C7; Fri, 25 Oct 2019 22:15:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PMFLNS069317; Fri, 25 Oct 2019 22:15:21 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PMFL2G069316; Fri, 25 Oct 2019 22:15:21 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910252215.x9PMFL2G069316@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Oct 2019 22:15:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354108 - in stable: 11/usr.bin/netstat 12/usr.bin/netstat X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/usr.bin/netstat 12/usr.bin/netstat X-SVN-Commit-Revision: 354108 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 22:15:21 -0000 Author: jhb Date: Fri Oct 25 22:15:20 2019 New Revision: 354108 URL: https://svnweb.freebsd.org/changeset/base/354108 Log: MFC 353059: Restore description of packets dropped due to full reassembly queue. r265408 renamed tcps_rcvmemdrop to tcps_rcvreassfull and gave it a more specific description. r279122 (libxo-ification) reverted that change. This commit brings it back, but with a small tweak to the description. Modified: stable/12/usr.bin/netstat/inet.c Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/usr.bin/netstat/inet.c Directory Properties: stable/11/ (props changed) Modified: stable/12/usr.bin/netstat/inet.c ============================================================================== --- stable/12/usr.bin/netstat/inet.c Fri Oct 25 22:04:05 2019 (r354107) +++ stable/12/usr.bin/netstat/inet.c Fri Oct 25 22:15:20 2019 (r354108) @@ -640,8 +640,8 @@ tcp_stats(u_long off, const char *name, int af1 __unus "{N:/discarded for bad header offset field%s}\n"); p1a(tcps_rcvshort, "\t\t{:discard-too-short/%ju} " "{N:discarded because packet too short}\n"); - p1a(tcps_rcvmemdrop, "\t\t{:discard-memory-problems/%ju} " - "{N:discarded due to memory problems}\n"); + p1a(tcps_rcvreassfull, "\t\t{:discard-reassembly-queue-full/%ju} " + "{N:discarded due to full reassembly queue}\n"); p(tcps_connattempt, "\t{:connection-requests/%ju} " "{N:/connection request%s}\n"); p(tcps_accepts, "\t{:connections-accepts/%ju} " From owner-svn-src-all@freebsd.org Fri Oct 25 22:15:21 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C91B515D540; Fri, 25 Oct 2019 22:15:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470JMY51MFz48LH; Fri, 25 Oct 2019 22:15:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9014C2D0C8; Fri, 25 Oct 2019 22:15:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PMFLJi069323; Fri, 25 Oct 2019 22:15:21 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PMFLIo069322; Fri, 25 Oct 2019 22:15:21 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910252215.x9PMFLIo069322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Oct 2019 22:15:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354108 - in stable: 11/usr.bin/netstat 12/usr.bin/netstat X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/usr.bin/netstat 12/usr.bin/netstat X-SVN-Commit-Revision: 354108 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 22:15:21 -0000 Author: jhb Date: Fri Oct 25 22:15:20 2019 New Revision: 354108 URL: https://svnweb.freebsd.org/changeset/base/354108 Log: MFC 353059: Restore description of packets dropped due to full reassembly queue. r265408 renamed tcps_rcvmemdrop to tcps_rcvreassfull and gave it a more specific description. r279122 (libxo-ification) reverted that change. This commit brings it back, but with a small tweak to the description. Modified: stable/11/usr.bin/netstat/inet.c Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/usr.bin/netstat/inet.c Directory Properties: stable/12/ (props changed) Modified: stable/11/usr.bin/netstat/inet.c ============================================================================== --- stable/11/usr.bin/netstat/inet.c Fri Oct 25 22:04:05 2019 (r354107) +++ stable/11/usr.bin/netstat/inet.c Fri Oct 25 22:15:20 2019 (r354108) @@ -753,8 +753,8 @@ tcp_stats(u_long off, const char *name, int af1 __unus "{N:/discarded for bad header offset field%s}\n"); p1a(tcps_rcvshort, "\t\t{:discard-too-short/%ju} " "{N:discarded because packet too short}\n"); - p1a(tcps_rcvmemdrop, "\t\t{:discard-memory-problems/%ju} " - "{N:discarded due to memory problems}\n"); + p1a(tcps_rcvreassfull, "\t\t{:discard-reassembly-queue-full/%ju} " + "{N:discarded due to full reassembly queue}\n"); p(tcps_connattempt, "\t{:connection-requests/%ju} " "{N:/connection request%s}\n"); p(tcps_accepts, "\t{:connections-accepts/%ju} " From owner-svn-src-all@freebsd.org Fri Oct 25 22:17:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9A3215D6DD; Fri, 25 Oct 2019 22:17:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470JPx5STKz48bP; Fri, 25 Oct 2019 22:17:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9FDBC2D0CA; Fri, 25 Oct 2019 22:17:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PMHPDi069495; Fri, 25 Oct 2019 22:17:25 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PMHPGQ069494; Fri, 25 Oct 2019 22:17:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910252217.x9PMHPGQ069494@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Oct 2019 22:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354109 - in stable: 11/sys/conf 12/sys/conf X-SVN-Group: stable-11 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/conf 12/sys/conf X-SVN-Commit-Revision: 354109 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 22:17:25 -0000 Author: jhb Date: Fri Oct 25 22:17:24 2019 New Revision: 354109 URL: https://svnweb.freebsd.org/changeset/base/354109 Log: MFC 353023: Fix the EMBEDFS_FORMAT helper variable for riscv64. It was defined with the wrong MACHINE_ARCH previously. This permits using an MFS image without defining MD_ROOT_SIZE which has various benefits (one being that the build is able to treat the MFS image as a dependency and properly re-link the kernel with the new image when building with NO_CLEAN). Modified: stable/11/sys/conf/kern.pre.mk Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/sys/conf/kern.pre.mk Directory Properties: stable/12/ (props changed) Modified: stable/11/sys/conf/kern.pre.mk ============================================================================== --- stable/11/sys/conf/kern.pre.mk Fri Oct 25 22:15:20 2019 (r354108) +++ stable/11/sys/conf/kern.pre.mk Fri Oct 25 22:17:24 2019 (r354109) @@ -265,7 +265,7 @@ EMBEDFS_FORMAT.mips?= elf32-tradbigmips EMBEDFS_FORMAT.mipsel?= elf32-tradlittlemips EMBEDFS_FORMAT.mips64?= elf64-tradbigmips EMBEDFS_FORMAT.mips64el?= elf64-tradlittlemips -EMBEDFS_FORMAT.riscv?= elf64-littleriscv +EMBEDFS_FORMAT.riscv64?= elf64-littleriscv .endif .endif From owner-svn-src-all@freebsd.org Fri Oct 25 22:17:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9F21C15D6D7; Fri, 25 Oct 2019 22:17:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470JPx3lfbz48bN; Fri, 25 Oct 2019 22:17:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5FA292D0C9; Fri, 25 Oct 2019 22:17:25 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PMHPbb069489; Fri, 25 Oct 2019 22:17:25 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PMHPSE069488; Fri, 25 Oct 2019 22:17:25 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <201910252217.x9PMHPSE069488@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 25 Oct 2019 22:17:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354109 - in stable: 11/sys/conf 12/sys/conf X-SVN-Group: stable-12 X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in stable: 11/sys/conf 12/sys/conf X-SVN-Commit-Revision: 354109 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 22:17:25 -0000 Author: jhb Date: Fri Oct 25 22:17:24 2019 New Revision: 354109 URL: https://svnweb.freebsd.org/changeset/base/354109 Log: MFC 353023: Fix the EMBEDFS_FORMAT helper variable for riscv64. It was defined with the wrong MACHINE_ARCH previously. This permits using an MFS image without defining MD_ROOT_SIZE which has various benefits (one being that the build is able to treat the MFS image as a dependency and properly re-link the kernel with the new image when building with NO_CLEAN). Modified: stable/12/sys/conf/kern.pre.mk Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/sys/conf/kern.pre.mk Directory Properties: stable/11/ (props changed) Modified: stable/12/sys/conf/kern.pre.mk ============================================================================== --- stable/12/sys/conf/kern.pre.mk Fri Oct 25 22:15:20 2019 (r354108) +++ stable/12/sys/conf/kern.pre.mk Fri Oct 25 22:17:24 2019 (r354109) @@ -288,7 +288,7 @@ EMBEDFS_FORMAT.mips?= elf32-tradbigmips EMBEDFS_FORMAT.mipsel?= elf32-tradlittlemips EMBEDFS_FORMAT.mips64?= elf64-tradbigmips EMBEDFS_FORMAT.mips64el?= elf64-tradlittlemips -EMBEDFS_FORMAT.riscv?= elf64-littleriscv +EMBEDFS_FORMAT.riscv64?= elf64-littleriscv .endif .endif From owner-svn-src-all@freebsd.org Fri Oct 25 22:39:27 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3CDC115DCB2; Fri, 25 Oct 2019 22:39:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470JvM0h4Jz49T4; Fri, 25 Oct 2019 22:39:27 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EAB282D453; Fri, 25 Oct 2019 22:39:26 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9PMdQ6g081256; Fri, 25 Oct 2019 22:39:26 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9PMdQ4Q081255; Fri, 25 Oct 2019 22:39:26 GMT (envelope-from np@FreeBSD.org) Message-Id: <201910252239.x9PMdQ4Q081255@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Fri, 25 Oct 2019 22:39:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354110 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 354110 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 25 Oct 2019 22:39:27 -0000 Author: np Date: Fri Oct 25 22:39:26 2019 New Revision: 354110 URL: https://svnweb.freebsd.org/changeset/base/354110 Log: Fix typo in cxgbe.4. MFC after: 1 week Modified: head/share/man/man4/cxgbe.4 Modified: head/share/man/man4/cxgbe.4 ============================================================================== --- head/share/man/man4/cxgbe.4 Fri Oct 25 22:17:24 2019 (r354109) +++ head/share/man/man4/cxgbe.4 Fri Oct 25 22:39:26 2019 (r354110) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd Sep 24, 2018 +.Dd Oct 25, 2019 .Dt CXGBE 4 .Os .Sh NAME @@ -292,7 +292,7 @@ Settings can be displayed and controlled on a per-port dev..X.pause_settings sysctl. .It Va hw.cxgbe.fec FEC (Forward Error Correction) settings. -0 diables FEC. +0 disables FEC. Bit 0 enables RS FEC, bit 1 enables BASE-R FEC (aka Firecode FEC). The default is -1 which lets the driver pick a value. This tunable establishes the default FEC settings for all ports. From owner-svn-src-all@freebsd.org Sat Oct 26 00:51:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 405AC161575; Sat, 26 Oct 2019 00:51:29 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 470Mqj0Qclz4GCB; Sat, 26 Oct 2019 00:51:28 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id x9Q0pK0K058677; Fri, 25 Oct 2019 17:51:20 -0700 (PDT) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id x9Q0pKl3058676; Fri, 25 Oct 2019 17:51:20 -0700 (PDT) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <201910260051.x9Q0pKl3058676@gndrsh.dnsmgr.net> Subject: Re: svn commit: r354076 - head/sys/dev/ow In-Reply-To: <8baac891351521c9e7148a0c0db9978645158dce.camel@freebsd.org> To: Ian Lepore Date: Fri, 25 Oct 2019 17:51:20 -0700 (PDT) CC: Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 470Mqj0Qclz4GCB X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.985,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 00:51:29 -0000 > On Fri, 2019-10-25 at 19:03 +0300, Andriy Gapon wrote: > > On 25/10/2019 18:56, Ian Lepore wrote: > > > On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote: > > > > On 25/10/2019 18:46, Ian Lepore wrote: > > > > > On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: > > > > > > Author: avg > > > > > > Date: Fri Oct 25 15:38:09 2019 > > > > > > New Revision: 354076 > > > > > > URL: https://svnweb.freebsd.org/changeset/base/354076 > > > > > > > > > > > > Log: > > > > > > owc_gpiobus_read_data: compare times in sbintime_t units > > > > > > > > > > > > Previously the code used sbttous() before microseconds > > > > > > comparison > > > > > > in one > > > > > > place, sbttons() and nanoseconds in another, division by > > > > > > SBT_1US > > > > > > and > > > > > > microseconds in yet another. > > > > > > > > > > > > Now the code consistently uses multiplication by SBT_1US to > > > > > > convert > > > > > > microseconds to sbintime_t before comparing them with > > > > > > periods > > > > > > between > > > > > > calls to sbinuptime(). This is fast, this is precise > > > > > > enough > > > > > > (below > > > > > > 0.03%) and the periods defined by the protocol cannot > > > > > > overflow. > > > > > > > > > > > > Reviewed by: imp (D22108) > > > > > > MFC after: 2 weeks > > > > > > > > > > > > Modified: > > > > > > head/sys/dev/ow/owc_gpiobus.c > > > > > > > > > > > > Modified: head/sys/dev/ow/owc_gpiobus.c > > > > > > ============================================================= > > > > > > ==== > > > > > > ==== > > > > > > ========= > > > > > > --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 > > > > > > 2019 ( > > > > > > r354 > > > > > > 075) > > > > > > +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 > > > > > > 2019 ( > > > > > > r354 > > > > > > 076) > > > > > > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, > > > > > > struct > > > > > > ow_timing * > > > > > > do { > > > > > > now = sbinuptime(); > > > > > > GETPIN(sc, &sample); > > > > > > - } while (sbttous(now - then) < t->t_rdv + 2 && sample > > > > > > == 0); > > > > > > + } while (now - then < (t->t_rdv + 2) * SBT_1US && > > > > > > sample == 0); > > > > > > critical_exit(); > > > > > > > > > > > > - if (sbttons(now - then) < t->t_rdv * 1000) > > > > > > + if (now - then < t->t_rdv * SBT_1US) > > > > > > *bit = 1; > > > > > > else > > > > > > *bit = 0; > > > > > > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, > > > > > > struct > > > > > > ow_timing * > > > > > > /* Wait out the rest of t_slot */ > > > > > > do { > > > > > > now = sbinuptime(); > > > > > > - } while ((now - then) / SBT_1US < t->t_slot); > > > > > > + } while (now - then < t->t_slot * SBT_1US); > > > > > > > > > > > > RELBUS(sc); > > > > > > > > > > > > > > > > Unit conversions with sbt times should be done using the macros > > > > > that > > > > > carefully avoid roundoff errors. I don't understand why you've > > > > > changed > > > > > the code that correctly did use those macros to inline math. > > > > > > > > I think that the commit message explains it: > > > > This is fast, this is precise enough (below 0.03%) and the > > > > periods > > > > defined by > > > > the protocol cannot overflow. > > > > > > > > Do you disagree? > > > > Could you please explain in which of the three lines changed the > > > > new > > > > code is > > > > worse and why? > > > > > > > > > > I absolutely disagree (or I wouldn't have replied). Unit > > > conversions > > > using sbt times should use the predefined macros, NOT incline > > > multiplication and division. I don't know how to say it more > > > clearly > > > than that. The conversion macros are idiomatic (at least, they > > > would > > > be if people stopped writing inline conversion expressions). > > > > I can agree that I should have used ustosbt() instead of > > multiplication by > > SBT_1US, but I don't agree with your original message that I changed > > the code > > that correctly used the macros. > > > > But again, I know the times being converted, they are fixed by the > > protocol and > > I do not see why I have to use this: > > > > static __inline sbintime_t > > ustosbt(int64_t _us) > > { > > sbintime_t sb = 0; > > > > #ifdef KASSERT > > KASSERT(_us >= 0, ("Negative values illegal for ustosbt: > > %jd", _us)); > > #endif > > if (_us >= SBT_1S) { > > sb = (_us / 1000000) * SBT_1S; > > _us = _us % 1000000; > > } > > /* 9223372036855 = ceil(2^63 / 1000000) */ > > sb += ((_us * 9223372036855ull) + 0x7fffffff) >> 31; > > return (sb); > > } > > > > instead of this > > x * (((sbintime_t)1 << 32) / 1000000) > > > > The times: > > static struct ow_timing timing_regular = { > > .t_slot = 60, /* 60 to 120 */ > > .t_low0 = 60, /* really 60 to 120 */ > > .t_low1 = 1, /* really 1 to 15 */ > > .t_release = 45, /* <= 45us */ > > .t_rec = 1, /* at least 1us */ > > .t_rdv = 15, /* 15us */ > > .t_rstl = 480, /* 480us or more */ > > .t_rsth = 480, /* 480us or more */ > > .t_pdl = 60, /* 60us to 240us */ > > .t_pdh = 60, /* 15us to 60us */ > > .t_lowr = 1, /* 1us */ > > }; Should this chunk of code now have a bit fat NB: if you modify these be careful, there is other code that assumes the values here can not cause overflow? > > > > > > The fact that you could say all that means that there is nothing I can > say that is going to change your mind. I will say if you ever do > anything like this to code I wrote, I will revert it immediately. > > -- Ian > > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-all@freebsd.org Sat Oct 26 01:14:25 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B2B2161FBC for ; Sat, 26 Oct 2019 01:14:25 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470NL73KLlz4H59 for ; Sat, 26 Oct 2019 01:14:23 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x844.google.com with SMTP id t8so6078000qtc.6 for ; Fri, 25 Oct 2019 18:14:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=iDTb7mnkdmlYk/CMcfOg6K8Z5nBnAroUgHhF+RPa50M=; b=z/faNAO/2PY/8+4iMKe3OPxa6HEys9b6ZlTtbv4jRt3zL4udlNd1StaI01LG/05Juf E7nULWN2uPKiuQP5HmFc5fGx+f/asBxX3l8FC6Ibqvf3KRCq0O8IKMnw7DmAXRodkQ7R gqs/qako3y1qGoGNUUs+jY/GwexG8nenjNK+QABuB8FBihJAsKqBFtuXh3JwXzoAfL+e uRV0qUnU2VIF1m2xmxU2a99MhSCxDJFdhsnfjxaS1HA/xRK55+OO0msCNt4Y2UNRvwfJ czkbyrrmjgQHS6qi7GT+9QMyvOxgHICL9VpXs5ji0VC/vqZzC0xwF32x4Ik7NRwuGbC2 LG7w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=iDTb7mnkdmlYk/CMcfOg6K8Z5nBnAroUgHhF+RPa50M=; b=speVv2RNsZLggK+uiJGSr5x36XZd3PcOw7xuTm5ZqdB2l7pgjbiwZdNKknSx8VS3ir x4oMfdjcaOv9aHnYrTa0TTktcJwLUBt1Y4rJHQQTNAIi9WU+R/JcGlvQ4BsPb95bzqRo W+iS60kutUAvdsbKPmPfHdhZA3NCsn/dsYeQ/JGD9REdhJ9DJbEsy2sBNkHJE8Lxfsvs JJP635/RBOo6qnxvrQyDGGfhFeOKzMrY03F2yJjvNu7dCittXKW6uPKpyrOq0QExDX+c jB4aKiNP3xCKNkpUxl61njNAjeW+zXqMZyBgeMXYYut8j42Ty0DARHiJzqemC7GQ9TiK btXQ== X-Gm-Message-State: APjAAAW0AtdF5Uoo9m+UzhaapWKfzCqQsp12eJ+QhIMRq30JguUX8PXe SW8+vFbRFPCWsW6HZ7CC2dJCaADCAorYJ2i9olevDSts X-Google-Smtp-Source: APXvYqxfSAqg+j5NMbGF7U9dVwq+/r5O/iPTvQF3F//BxJHL0u3yWSDKNoPdL9fZYjuNTP1o8aYtWOf20z2W5Xlewrs= X-Received: by 2002:a0c:ee49:: with SMTP id m9mr6439446qvs.118.1572052462146; Fri, 25 Oct 2019 18:14:22 -0700 (PDT) MIME-Version: 1.0 References: <8baac891351521c9e7148a0c0db9978645158dce.camel@freebsd.org> <201910260051.x9Q0pKl3058676@gndrsh.dnsmgr.net> In-Reply-To: <201910260051.x9Q0pKl3058676@gndrsh.dnsmgr.net> From: Warner Losh Date: Fri, 25 Oct 2019 19:14:10 -0600 Message-ID: Subject: Re: svn commit: r354076 - head/sys/dev/ow To: "Rodney W. Grimes" Cc: Ian Lepore , Andriy Gapon , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-Rspamd-Queue-Id: 470NL73KLlz4H59 X-Spamd-Bar: - Authentication-Results: mx1.freebsd.org; dkim=pass header.d=bsdimp-com.20150623.gappssmtp.com header.s=20150623 header.b=z/faNAO/; dmarc=none; spf=none (mx1.freebsd.org: domain of wlosh@bsdimp.com has no SPF policy when checking 2607:f8b0:4864:20::844) smtp.mailfrom=wlosh@bsdimp.com X-Spamd-Result: default: False [-1.39 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-0.99)[-0.991,0]; R_DKIM_ALLOW(-0.20)[bsdimp-com.20150623.gappssmtp.com:s=20150623]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; PREVIOUSLY_DELIVERED(0.00)[svn-src-all@freebsd.org]; DMARC_NA(0.00)[bsdimp.com]; URI_COUNT_ODD(1.00)[3]; RCPT_COUNT_FIVE(0.00)[6]; TO_MATCH_ENVRCPT_SOME(0.00)[]; DKIM_TRACE(0.00)[bsdimp-com.20150623.gappssmtp.com:+]; RCVD_IN_DNSWL_NONE(0.00)[4.4.8.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.4.6.8.4.0.b.8.f.7.0.6.2.list.dnswl.org : 127.0.5.0]; R_SPF_NA(0.00)[]; FORGED_SENDER(0.30)[imp@bsdimp.com,wlosh@bsdimp.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; IP_SCORE(-0.40)[ip: (2.49), ipnet: 2607:f8b0::/32(-2.40), asn: 15169(-2.05), country: US(-0.05)]; ASN(0.00)[asn:15169, ipnet:2607:f8b0::/32, country:US]; FROM_NEQ_ENVFROM(0.00)[imp@bsdimp.com,wlosh@bsdimp.com]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 01:14:25 -0000 On Fri, Oct 25, 2019, 6:51 PM Rodney W. Grimes wrote: > > On Fri, 2019-10-25 at 19:03 +0300, Andriy Gapon wrote: > > > On 25/10/2019 18:56, Ian Lepore wrote: > > > > On Fri, 2019-10-25 at 18:51 +0300, Andriy Gapon wrote: > > > > > On 25/10/2019 18:46, Ian Lepore wrote: > > > > > > On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: > > > > > > > Author: avg > > > > > > > Date: Fri Oct 25 15:38:09 2019 > > > > > > > New Revision: 354076 > > > > > > > URL: https://svnweb.freebsd.org/changeset/base/354076 > > > > > > > > > > > > > > Log: > > > > > > > owc_gpiobus_read_data: compare times in sbintime_t units > > > > > > > > > > > > > > Previously the code used sbttous() before microseconds > > > > > > > comparison > > > > > > > in one > > > > > > > place, sbttons() and nanoseconds in another, division by > > > > > > > SBT_1US > > > > > > > and > > > > > > > microseconds in yet another. > > > > > > > > > > > > > > Now the code consistently uses multiplication by SBT_1US to > > > > > > > convert > > > > > > > microseconds to sbintime_t before comparing them with > > > > > > > periods > > > > > > > between > > > > > > > calls to sbinuptime(). This is fast, this is precise > > > > > > > enough > > > > > > > (below > > > > > > > 0.03%) and the periods defined by the protocol cannot > > > > > > > overflow. > > > > > > > > > > > > > > Reviewed by: imp (D22108) > > > > > > > MFC after: 2 weeks > > > > > > > > > > > > > > Modified: > > > > > > > head/sys/dev/ow/owc_gpiobus.c > > > > > > > > > > > > > > Modified: head/sys/dev/ow/owc_gpiobus.c > > > > > > > ============================================================= > > > > > > > ==== > > > > > > > ==== > > > > > > > ========= > > > > > > > --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 > > > > > > > 2019 ( > > > > > > > r354 > > > > > > > 075) > > > > > > > +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 > > > > > > > 2019 ( > > > > > > > r354 > > > > > > > 076) > > > > > > > @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, > > > > > > > struct > > > > > > > ow_timing * > > > > > > > do { > > > > > > > now = sbinuptime(); > > > > > > > GETPIN(sc, &sample); > > > > > > > - } while (sbttous(now - then) < t->t_rdv + 2 && sample > > > > > > > == 0); > > > > > > > + } while (now - then < (t->t_rdv + 2) * SBT_1US && > > > > > > > sample == 0); > > > > > > > critical_exit(); > > > > > > > > > > > > > > - if (sbttons(now - then) < t->t_rdv * 1000) > > > > > > > + if (now - then < t->t_rdv * SBT_1US) > > > > > > > *bit = 1; > > > > > > > else > > > > > > > *bit = 0; > > > > > > > @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, > > > > > > > struct > > > > > > > ow_timing * > > > > > > > /* Wait out the rest of t_slot */ > > > > > > > do { > > > > > > > now = sbinuptime(); > > > > > > > - } while ((now - then) / SBT_1US < t->t_slot); > > > > > > > + } while (now - then < t->t_slot * SBT_1US); > > > > > > > > > > > > > > RELBUS(sc); > > > > > > > > > > > > > > > > > > > Unit conversions with sbt times should be done using the macros > > > > > > that > > > > > > carefully avoid roundoff errors. I don't understand why you've > > > > > > changed > > > > > > the code that correctly did use those macros to inline math. > > > > > > > > > > I think that the commit message explains it: > > > > > This is fast, this is precise enough (below 0.03%) and the > > > > > periods > > > > > defined by > > > > > the protocol cannot overflow. > > > > > > > > > > Do you disagree? > > > > > Could you please explain in which of the three lines changed the > > > > > new > > > > > code is > > > > > worse and why? > > > > > > > > > > > > > I absolutely disagree (or I wouldn't have replied). Unit > > > > conversions > > > > using sbt times should use the predefined macros, NOT incline > > > > multiplication and division. I don't know how to say it more > > > > clearly > > > > than that. The conversion macros are idiomatic (at least, they > > > > would > > > > be if people stopped writing inline conversion expressions). > > > > > > I can agree that I should have used ustosbt() instead of > > > multiplication by > > > SBT_1US, but I don't agree with your original message that I changed > > > the code > > > that correctly used the macros. > > > > > > But again, I know the times being converted, they are fixed by the > > > protocol and > > > I do not see why I have to use this: > > > > > > static __inline sbintime_t > > > ustosbt(int64_t _us) > > > { > > > sbintime_t sb = 0; > > > > > > #ifdef KASSERT > > > KASSERT(_us >= 0, ("Negative values illegal for ustosbt: > > > %jd", _us)); > > > #endif > > > if (_us >= SBT_1S) { > > > sb = (_us / 1000000) * SBT_1S; > > > _us = _us % 1000000; > > > } > > > /* 9223372036855 = ceil(2^63 / 1000000) */ > > > sb += ((_us * 9223372036855ull) + 0x7fffffff) >> 31; > > > return (sb); > > > } > > > > > > instead of this > > > x * (((sbintime_t)1 << 32) / 1000000) > > > > > > The times: > > > static struct ow_timing timing_regular = { > > > .t_slot = 60, /* 60 to 120 */ > > > .t_low0 = 60, /* really 60 to 120 */ > > > .t_low1 = 1, /* really 1 to 15 */ > > > .t_release = 45, /* <= 45us */ > > > .t_rec = 1, /* at least 1us */ > > > .t_rdv = 15, /* 15us */ > > > .t_rstl = 480, /* 480us or more */ > > > .t_rsth = 480, /* 480us or more */ > > > .t_pdl = 60, /* 60us to 240us */ > > > .t_pdh = 60, /* 15us to 60us */ > > > .t_lowr = 1, /* 1us */ > > > }; > > Should this chunk of code now have a bit fat NB: if you > modify these be careful, there is other code that assumes > the values here can not cause overflow? > No. The values won't com close to overflowing even at the slowest transfer speeds. The macros are most needed for nanosecond stuff, and these are all at most tens of microseconds... Warner > > > > > > > > > The fact that you could say all that means that there is nothing I can > > say that is going to change your mind. I will say if you ever do > > anything like this to code I wrote, I will revert it immediately. > > > > -- Ian > > > > > > -- > Rod Grimes > rgrimes@freebsd.org > From owner-svn-src-all@freebsd.org Sat Oct 26 03:07:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 16581179202; Sat, 26 Oct 2019 03:07:29 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Qrc5nVJz4b9s; Sat, 26 Oct 2019 03:07:28 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8194168D; Sat, 26 Oct 2019 03:07:28 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9Q37So7042297; Sat, 26 Oct 2019 03:07:28 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9Q37SYt042296; Sat, 26 Oct 2019 03:07:28 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201910260307.x9Q37SYt042296@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 26 Oct 2019 03:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-11@freebsd.org Subject: svn commit: r354111 - in stable: 11/contrib/ipfilter/tools 12/contrib/ipfilter/tools X-SVN-Group: stable-11 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/ipfilter/tools 12/contrib/ipfilter/tools X-SVN-Commit-Revision: 354111 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 03:07:29 -0000 Author: cy Date: Sat Oct 26 03:07:28 2019 New Revision: 354111 URL: https://svnweb.freebsd.org/changeset/base/354111 Log: MFC r352738: Teach the ippool parser about address families. This is a precursor to implementing IPv6 support within ippool which requires reworking radix_ipf.c. Modified: stable/11/contrib/ipfilter/tools/ippool_y.y Directory Properties: stable/11/ (props changed) Changes in other areas also in this revision: Modified: stable/12/contrib/ipfilter/tools/ippool_y.y Directory Properties: stable/12/ (props changed) Modified: stable/11/contrib/ipfilter/tools/ippool_y.y ============================================================================== --- stable/11/contrib/ipfilter/tools/ippool_y.y Fri Oct 25 22:39:26 2019 (r354110) +++ stable/11/contrib/ipfilter/tools/ippool_y.y Sat Oct 26 03:07:28 2019 (r354111) @@ -309,11 +309,27 @@ range: addrmask { $$ = calloc(1, sizeof(*$$)); $$->ipn_info = 0; $$->ipn_addr = $1[0]; $$->ipn_mask = $1[1]; +#ifdef USE_INET6 + if (use_inet6) + $$->ipn_addr.adf_family = + AF_INET6; + else +#endif + $$->ipn_addr.adf_family = + AF_INET; } | '!' addrmask { $$ = calloc(1, sizeof(*$$)); $$->ipn_info = 1; $$->ipn_addr = $2[0]; $$->ipn_mask = $2[1]; +#ifdef USE_INET6 + if (use_inet6) + $$->ipn_addr.adf_family = + AF_INET6; + else +#endif + $$->ipn_addr.adf_family = + AF_INET; } | YY_STR { $$ = add_poolhosts($1); free($1); From owner-svn-src-all@freebsd.org Sat Oct 26 03:07:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47B2A179206; Sat, 26 Oct 2019 03:07:29 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Qrd08r4z4b9t; Sat, 26 Oct 2019 03:07:29 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DD782168E; Sat, 26 Oct 2019 03:07:28 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9Q37SWV042303; Sat, 26 Oct 2019 03:07:28 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9Q37SQf042302; Sat, 26 Oct 2019 03:07:28 GMT (envelope-from cy@FreeBSD.org) Message-Id: <201910260307.x9Q37SQf042302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Sat, 26 Oct 2019 03:07:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354111 - in stable: 11/contrib/ipfilter/tools 12/contrib/ipfilter/tools X-SVN-Group: stable-12 X-SVN-Commit-Author: cy X-SVN-Commit-Paths: in stable: 11/contrib/ipfilter/tools 12/contrib/ipfilter/tools X-SVN-Commit-Revision: 354111 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 03:07:29 -0000 Author: cy Date: Sat Oct 26 03:07:28 2019 New Revision: 354111 URL: https://svnweb.freebsd.org/changeset/base/354111 Log: MFC r352738: Teach the ippool parser about address families. This is a precursor to implementing IPv6 support within ippool which requires reworking radix_ipf.c. Modified: stable/12/contrib/ipfilter/tools/ippool_y.y Directory Properties: stable/12/ (props changed) Changes in other areas also in this revision: Modified: stable/11/contrib/ipfilter/tools/ippool_y.y Directory Properties: stable/11/ (props changed) Modified: stable/12/contrib/ipfilter/tools/ippool_y.y ============================================================================== --- stable/12/contrib/ipfilter/tools/ippool_y.y Fri Oct 25 22:39:26 2019 (r354110) +++ stable/12/contrib/ipfilter/tools/ippool_y.y Sat Oct 26 03:07:28 2019 (r354111) @@ -309,11 +309,27 @@ range: addrmask { $$ = calloc(1, sizeof(*$$)); $$->ipn_info = 0; $$->ipn_addr = $1[0]; $$->ipn_mask = $1[1]; +#ifdef USE_INET6 + if (use_inet6) + $$->ipn_addr.adf_family = + AF_INET6; + else +#endif + $$->ipn_addr.adf_family = + AF_INET; } | '!' addrmask { $$ = calloc(1, sizeof(*$$)); $$->ipn_info = 1; $$->ipn_addr = $2[0]; $$->ipn_mask = $2[1]; +#ifdef USE_INET6 + if (use_inet6) + $$->ipn_addr.adf_family = + AF_INET6; + else +#endif + $$->ipn_addr.adf_family = + AF_INET; } | YY_STR { $$ = add_poolhosts($1); free($1); From owner-svn-src-all@freebsd.org Sat Oct 26 06:24:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3FF5B160260; Sat, 26 Oct 2019 06:24:22 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt1-f195.google.com (mail-qt1-f195.google.com [209.85.160.195]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470WCp0Pwcz3Jy0; Sat, 26 Oct 2019 06:24:21 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qt1-f195.google.com with SMTP id u22so6682446qtq.13; Fri, 25 Oct 2019 23:24:21 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=ahW9qVMNt/ZHgXI3B4iGEn55aASqNM3T9o0h0jcuAsU=; b=F3cXKaA2K5U+wZj9uRpNoNaL/OuCYJUKWf4CeZejpoALKbLc3wprH+3NOjsXwwJNPa 1/ll1EOkSF2GGcM3rPheKN5u8bH388WWs44S6e3rvf4CWFhgagVBns/Egz9LsN1sRZIu sVuhdK/mE5M8Rww5Etdp+h8L/z+/YsJ9EUOUDG4OLbN2W40BRbqrkmdoT5dVccevhdLR w2MfA3iRhnGHFlafnG16u4rR1+Odk5WUZLUggOvKJeMzBGOOApu4o4QzOaiZ2ttpg+L5 8vd2hMBMo1NOPWaQhylRkxoZ2S+G6ZnPyLTBI2C8E3bHBuTvkIcRgxvz+wqs040G/uOm SkSA== X-Gm-Message-State: APjAAAVciTEVrpWYD1uhAwJQTPA0lpDxWquab16xtgmx5q3I1Y047KVV cYupp1JTSnoX/I3Bx2eBgg9j+TZSPSxc0InvtsyPYDV7 X-Google-Smtp-Source: APXvYqzNzjLJZ5xtLiLxoF8Y7q8hkYxk9vzdxG5Pk/ytN1reAdOQOjQtIf3mR/nNKo68PkMLvp5wZXP4JslIUFuza3E= X-Received: by 2002:ad4:44b3:: with SMTP id n19mr1344349qvt.133.1572071060329; Fri, 25 Oct 2019 23:24:20 -0700 (PDT) MIME-Version: 1.0 References: <201910252009.x9PK9gIV092660@repo.freebsd.org> In-Reply-To: <201910252009.x9PK9gIV092660@repo.freebsd.org> From: Antoine Brodin Date: Sat, 26 Oct 2019 08:24:09 +0200 Message-ID: Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Gerald Pfeifer Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 470WCp0Pwcz3Jy0 X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-6.00 / 15.00]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 06:24:22 -0000 On Fri, Oct 25, 2019 at 10:09 PM Konstantin Belousov wrote: > > Author: kib > Date: Fri Oct 25 20:09:42 2019 > New Revision: 354095 > URL: https://svnweb.freebsd.org/changeset/base/354095 > > Log: > amd64: move pcb out of kstack to struct thread. > > This saves 320 bytes of the precious stack space. > > The only negative aspect of the change I can think of is that the > struct thread increased by 320 bytes obviously, and that 320 bytes are > not swapped out anymore. I believe the freed stack space is much more > important than that. Also, current struct thread size is 1392 bytes > on amd64, so UMA will allocate two thread structures per (4KB) slab, > which leaves a space for pcb without increasing zone memory use. > > Reviewed by: alc, markj > Tested by: pho > Sponsored by: The FreeBSD Foundation > MFC after: 2 weeks > Differential revision: https://reviews.freebsd.org/D22138 Hi, It seems that this breaks at least some versions of gcc: In file included from /usr/include/sys/proc.h:75, from /usr/include/sys/user.h:51, from ./md-unwind-support.h:34, from /wrkdirs/usr/ports/lang/gcc10-devel/work/gcc-10-20191020/libgcc/unwind-dw2.c:412: /usr/include/machine/proc.h:76:13: error: field 'md_pcb' has incomplete type 76 | struct pcb md_pcb; | ^~~~~~ Antoine From owner-svn-src-all@freebsd.org Sat Oct 26 07:00:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C1912161840; Sat, 26 Oct 2019 07:00:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470X0w4jB9z3LLH; Sat, 26 Oct 2019 07:00:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 84A8C42A4; Sat, 26 Oct 2019 07:00:00 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9Q7002d078085; Sat, 26 Oct 2019 07:00:00 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9Q700CJ078075; Sat, 26 Oct 2019 07:00:00 GMT (envelope-from cem@FreeBSD.org) Message-Id: <201910260700.x9Q700CJ078075@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 26 Oct 2019 07:00:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354112 - in head: contrib/libexecinfo lib/libexecinfo X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: contrib/libexecinfo lib/libexecinfo X-SVN-Commit-Revision: 354112 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 07:00:00 -0000 Author: cem Date: Sat Oct 26 06:59:59 2019 New Revision: 354112 URL: https://svnweb.freebsd.org/changeset/base/354112 Log: Sync up with NetBSD libexecinfo changes 2014-2019 Drop portions that are unlit or redundant with llvm-libunwind: builtin.c, unwind.h, and unwind_arm_ehabi_stub.c. This code should now work with -fPIE binaries, should we choose to build any that way. When backtrace() array is full, signal an error so the underlying Itanium-style C++ exception handling library (llvm-libunwind) knows to stop tracing instead of continuing. (It should stop on its own when it finishes unwinding, so this is mostly an extra seatbelt against an infinite loop bug in the unwinder.) Deleted: head/contrib/libexecinfo/builtin.c head/contrib/libexecinfo/unwind.h head/contrib/libexecinfo/unwind_arm_ehabi_stub.c Modified: head/contrib/libexecinfo/symtab.c head/contrib/libexecinfo/unwind.c head/lib/libexecinfo/Makefile Modified: head/contrib/libexecinfo/symtab.c ============================================================================== --- head/contrib/libexecinfo/symtab.c Sat Oct 26 03:07:28 2019 (r354111) +++ head/contrib/libexecinfo/symtab.c Sat Oct 26 06:59:59 2019 (r354112) @@ -1,4 +1,4 @@ -/* $NetBSD: symtab.c,v 1.2 2013/08/29 15:01:57 christos Exp $ */ +/* $NetBSD: symtab.c,v 1.5 2016/04/20 14:00:16 christos Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -29,12 +29,13 @@ * POSSIBILITY OF SUCH DAMAGE. */ #include -__RCSID("$NetBSD: symtab.c,v 1.2 2013/08/29 15:01:57 christos Exp $"); +__RCSID("$NetBSD: symtab.c,v 1.5 2016/04/20 14:00:16 christos Exp $"); #include #include #include #include +#include #include #include @@ -47,7 +48,6 @@ __RCSID("$NetBSD: symtab.c,v 1.2 2013/08/29 15:01:57 c #define ELF_ST_TYPE(x) (((unsigned int)x) & 0xf) #endif - #include "symtab.h" struct symbol { @@ -59,6 +59,7 @@ struct symbol { struct symtab { size_t nsymbols; struct symbol *symbols; + bool ispie; }; static int @@ -86,6 +87,7 @@ symtab_create(int fd, int bind, int type) Elf *elf; symtab_t *st; Elf_Scn *scn = NULL; + GElf_Ehdr ehdr; if (elf_version(EV_CURRENT) == EV_NONE) { warnx("Elf Library is out of date."); @@ -103,7 +105,14 @@ symtab_create(int fd, int bind, int type) elf_end(elf); return NULL; } + if (gelf_getehdr(elf, &ehdr) == NULL) { + warnx("Error getting ELF Ehdr"); + elf_end(elf); + return NULL; + } + st->ispie = ehdr.e_type == ET_DYN; + while ((scn = elf_nextscn(elf, scn)) != NULL) { GElf_Shdr shdr; Elf_Data *edata; @@ -127,6 +136,13 @@ symtab_create(int fd, int bind, int type) GElf_Sym sym; gelf_getsym(edata, (int)i, &sym); +#ifdef SYMTAB_DEBUG + fprintf(stderr, "%s: %s@%#jx=%d,%d\n", __func__, + elf_strptr(elf, shdr.sh_link, sym.st_name), + (uintmax_t)sym.st_value, ELF_ST_BIND(sym.st_info), + ELF_ST_TYPE(sym.st_info)); +#endif + if (bind != -1 && (unsigned)bind != ELF_ST_BIND(sym.st_info)) continue; @@ -159,7 +175,7 @@ out: return NULL; } - + int symtab_find(const symtab_t *st, const void *p, Dl_info *dli) { @@ -168,8 +184,15 @@ symtab_find(const symtab_t *st, const void *p, Dl_info size_t hi = ns; size_t lo = 0; size_t mid = ns / 2; - uintptr_t dd, sd, me = (uintptr_t)p; + uintptr_t fbase = st->ispie ? (uintptr_t)dli->dli_fbase : 0; + uintptr_t dd, sd, me = (uintptr_t)p - fbase; + uintptr_t ad = (uintptr_t)dli->dli_saddr - fbase; +#ifdef SYMTAB_DEBUG + fprintf(stderr, "%s: [fbase=%#jx, saddr=%p, me=%#jx ad=%#jx]\n", + __func__, (uintmax_t)fbase, dli->dli_saddr, (uintmax_t)me, + (uintmax_t)ad); +#endif for (;;) { if (s[mid].st_value < me) lo = mid; @@ -183,11 +206,20 @@ symtab_find(const symtab_t *st, const void *p, Dl_info } mid = (hi + lo) / 2; } - dd = me - (uintptr_t)dli->dli_saddr; + dd = me - ad; sd = me - s[mid].st_value; if (dd > sd) { dli->dli_saddr = (void *)s[mid].st_value; dli->dli_sname = s[mid].st_name; +#ifdef SYMTAB_DEBUG + fprintf(stderr, "%s: me=%#jx -> [%#jx, %s]\n", __func__, + (uintmax_t)me, (uintmax_t)sd, dli->dli_sname); +#endif } +#ifdef SYMTAB_DEBUG + else + fprintf(stderr, "%s: %#jx -> [%#jx, ***]\n", __func__, + (uintmax_t)me, (uintmax_t)sd); +#endif return 1; } Modified: head/contrib/libexecinfo/unwind.c ============================================================================== --- head/contrib/libexecinfo/unwind.c Sat Oct 26 03:07:28 2019 (r354111) +++ head/contrib/libexecinfo/unwind.c Sat Oct 26 06:59:59 2019 (r354112) @@ -1,4 +1,4 @@ -/* $NetBSD: unwind.c,v 1.1 2012/05/26 22:02:29 christos Exp $ */ +/* $NetBSD: unwind.c,v 1.3 2019/01/30 22:46:49 mrg Exp $ */ /*- * Copyright (c) 2012 The NetBSD Foundation, Inc. @@ -51,8 +51,10 @@ tracer(struct _Unwind_Context *ctx, void *arg) return 0; } if (t->n < t->len) - t->arr[t->n++] = _Unwind_GetIP(ctx); - return 0; + t->arr[t->n++] = (void *)_Unwind_GetIP(ctx); + else + return _URC_END_OF_STACK; + return _URC_NO_REASON; } size_t Modified: head/lib/libexecinfo/Makefile ============================================================================== --- head/lib/libexecinfo/Makefile Sat Oct 26 03:07:28 2019 (r354111) +++ head/lib/libexecinfo/Makefile Sat Oct 26 06:59:59 2019 (r354112) @@ -10,6 +10,7 @@ SHLIB_MAJOR= 1 INCS= execinfo.h SRCS= backtrace.c symtab.c unwind.c +CFLAGS+= -I${SRCTOP}/contrib/libunwind/include LIBADD= elf From owner-svn-src-all@freebsd.org Sat Oct 26 08:27:04 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1E6DE1650DE; Sat, 26 Oct 2019 08:27:04 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 470YxM64qrz3Pjp; Sat, 26 Oct 2019 08:27:03 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x9Q8Qt1H023601 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 26 Oct 2019 11:26:58 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x9Q8Qt1H023601 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x9Q8Qtoc023600; Sat, 26 Oct 2019 11:26:55 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 26 Oct 2019 11:26:55 +0300 From: Konstantin Belousov To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Gerald Pfeifer Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern Message-ID: <20191026082655.GJ73312@kib.kiev.ua> References: <201910252009.x9PK9gIV092660@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 470YxM64qrz3Pjp X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 08:27:04 -0000 On Sat, Oct 26, 2019 at 08:24:09AM +0200, Antoine Brodin wrote: > On Fri, Oct 25, 2019 at 10:09 PM Konstantin Belousov wrote: > > > > Author: kib > > Date: Fri Oct 25 20:09:42 2019 > > New Revision: 354095 > > URL: https://svnweb.freebsd.org/changeset/base/354095 > > > > Log: > > amd64: move pcb out of kstack to struct thread. > > > > This saves 320 bytes of the precious stack space. > > > > The only negative aspect of the change I can think of is that the > > struct thread increased by 320 bytes obviously, and that 320 bytes are > > not swapped out anymore. I believe the freed stack space is much more > > important than that. Also, current struct thread size is 1392 bytes > > on amd64, so UMA will allocate two thread structures per (4KB) slab, > > which leaves a space for pcb without increasing zone memory use. > > > > Reviewed by: alc, markj > > Tested by: pho > > Sponsored by: The FreeBSD Foundation > > MFC after: 2 weeks > > Differential revision: https://reviews.freebsd.org/D22138 > > Hi, > > It seems that this breaks at least some versions of gcc: > > In file included from /usr/include/sys/proc.h:75, > from /usr/include/sys/user.h:51, > from ./md-unwind-support.h:34, > from > /wrkdirs/usr/ports/lang/gcc10-devel/work/gcc-10-20191020/libgcc/unwind-dw2.c:412: > /usr/include/machine/proc.h:76:13: error: field 'md_pcb' has incomplete type > 76 | struct pcb md_pcb; > | ^~~~~~ > It is very strange. Are gcc 9 or 8 affected ? As a blind guess, please try this patch. diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h index 44e34fa5c83..9758e684da2 100644 --- a/sys/amd64/include/pcb.h +++ b/sys/amd64/include/pcb.h @@ -45,7 +45,7 @@ #include #include -#ifdef __amd64__ +#if defined(__amd64__) || defined(__x86_64__) /* * NB: The fields marked with (*) are used by kernel debuggers. Their * ABI should be preserved. From owner-svn-src-all@freebsd.org Sat Oct 26 08:37:29 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10E1C165664; Sat, 26 Oct 2019 08:37:29 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470Z9N6fVvz3Q7t; Sat, 26 Oct 2019 08:37:28 +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 C45555482; Sat, 26 Oct 2019 08:37:28 +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 x9Q8bSQf036252; Sat, 26 Oct 2019 08:37:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9Q8bScl036251; Sat, 26 Oct 2019 08:37:28 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910260837.x9Q8bScl036251@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 26 Oct 2019 08:37:28 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354113 - stable/12/sys/kern X-SVN-Group: stable-12 X-SVN-Commit-Author: kib X-SVN-Commit-Paths: stable/12/sys/kern X-SVN-Commit-Revision: 354113 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 08:37:29 -0000 Author: kib Date: Sat Oct 26 08:37:28 2019 New Revision: 354113 URL: https://svnweb.freebsd.org/changeset/base/354113 Log: MFC r353928: vn_printf(): Decode VI_TEXT_REF. Modified: stable/12/sys/kern/vfs_subr.c Directory Properties: stable/12/ (props changed) Modified: stable/12/sys/kern/vfs_subr.c ============================================================================== --- stable/12/sys/kern/vfs_subr.c Sat Oct 26 06:59:59 2019 (r354112) +++ stable/12/sys/kern/vfs_subr.c Sat Oct 26 08:37:28 2019 (r354113) @@ -3656,8 +3656,10 @@ vn_printf(struct vnode *vp, const char *fmt, ...) strlcat(buf, "|VI_DOINGINACT", sizeof(buf)); if (vp->v_iflag & VI_OWEINACT) strlcat(buf, "|VI_OWEINACT", sizeof(buf)); + if (vp->v_iflag & VI_TEXT_REF) + strlcat(buf, "|VI_TEXT_REF", sizeof(buf)); flags = vp->v_iflag & ~(VI_MOUNT | VI_DOOMED | VI_FREE | - VI_ACTIVE | VI_DOINGINACT | VI_OWEINACT); + VI_ACTIVE | VI_DOINGINACT | VI_OWEINACT | VI_TEXT_REF); if (flags != 0) { snprintf(buf2, sizeof(buf2), "|VI(0x%lx)", flags); strlcat(buf, buf2, sizeof(buf)); From owner-svn-src-all@freebsd.org Sat Oct 26 10:33:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3633716A92A; Sat, 26 Oct 2019 10:33:22 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470cl60hDNz41Cr; Sat, 26 Oct 2019 10:33:22 +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 EEE0A6A24; Sat, 26 Oct 2019 10:33:21 +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 x9QAXLAW006956; Sat, 26 Oct 2019 10:33:21 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QAXLNC006955; Sat, 26 Oct 2019 10:33:21 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201910261033.x9QAXLNC006955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 26 Oct 2019 10:33:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-12@freebsd.org Subject: svn commit: r354114 - stable/12/stand/libsa/zfs X-SVN-Group: stable-12 X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: stable/12/stand/libsa/zfs X-SVN-Commit-Revision: 354114 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 10:33:22 -0000 Author: tsoome Date: Sat Oct 26 10:33:21 2019 New Revision: 354114 URL: https://svnweb.freebsd.org/changeset/base/354114 Log: MFC r353757: loader: zfs_fmtdev can crash when pool discovery did fail and we have no spa When zfs probe did fail and no spa was created, but zfs_fmtdev() is called, we will crash while dereferencing spa (NULL pointer dereference). Modified: stable/12/stand/libsa/zfs/zfs.c Directory Properties: stable/12/ (props changed) Modified: stable/12/stand/libsa/zfs/zfs.c ============================================================================== --- stable/12/stand/libsa/zfs/zfs.c Sat Oct 26 08:37:28 2019 (r354113) +++ stable/12/stand/libsa/zfs/zfs.c Sat Oct 26 10:33:21 2019 (r354114) @@ -769,11 +769,16 @@ zfs_fmtdev(void *vdev) if (dev->dd.d_dev->dv_type != DEVT_ZFS) return (buf); - if (dev->pool_guid == 0) { - spa = STAILQ_FIRST(&zfs_pools); + /* Do we have any pools? */ + spa = STAILQ_FIRST(&zfs_pools); + if (spa == NULL) + return (buf); + + if (dev->pool_guid == 0) dev->pool_guid = spa->spa_guid; - } else + else spa = spa_find_by_guid(dev->pool_guid); + if (spa == NULL) { printf("ZFS: can't find pool by guid\n"); return (buf); From owner-svn-src-all@freebsd.org Sat Oct 26 10:45:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 909EF16AF3D; Sat, 26 Oct 2019 10:45:28 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (hamza.pair.com [209.68.5.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 470d1307cCz41dC; Sat, 26 Oct 2019 10:45:26 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (localhost [127.0.0.1]) by hamza.pair.com (Postfix) with ESMTP id D38C033E13; Sat, 26 Oct 2019 06:45:24 -0400 (EDT) Received: from anthias (unknown [178.114.204.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hamza.pair.com (Postfix) with ESMTPSA id F282E33E12; Sat, 26 Oct 2019 06:45:23 -0400 (EDT) Date: Sat, 26 Oct 2019 12:45:21 +0200 (CEST) From: Gerald Pfeifer To: Konstantin Belousov cc: Antoine Brodin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern In-Reply-To: <20191026082655.GJ73312@kib.kiev.ua> Message-ID: References: <201910252009.x9PK9gIV092660@repo.freebsd.org> <20191026082655.GJ73312@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 470d1307cCz41dC X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of gerald@pfeifer.com designates 209.68.5.143 as permitted sender) smtp.mailfrom=gerald@pfeifer.com X-Spamd-Result: default: False [-4.49 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:hamza.pair.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[pfeifer.com]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[143.5.68.209.list.dnswl.org : 127.0.10.0]; IP_SCORE(-2.19)[ip: (-7.74), ipnet: 209.68.0.0/18(-2.02), asn: 7859(-1.15), country: US(-0.05)]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:7859, ipnet:209.68.0.0/18, country:US]; RCVD_TLS_LAST(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 10:45:28 -0000 On Sat, 26 Oct 2019, Konstantin Belousov wrote: > It is very strange. Are gcc 9 or 8 affected ? So far I have only received notification from the head-amd64-default package builder for lang/gcc10-devel, none of the other ports. Gerald > As a blind guess, please try this patch. Thank you! I'm not able to do so (no suitable system with root access); hopefully someone else can. Antoine, can you? From owner-svn-src-all@freebsd.org Sat Oct 26 11:51:32 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E841116DFAC; Sat, 26 Oct 2019 11:51:32 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from mail105.syd.optusnet.com.au (mail105.syd.optusnet.com.au [211.29.132.249]) by mx1.freebsd.org (Postfix) with ESMTP id 470fTJ21RSz44BY; Sat, 26 Oct 2019 11:51:31 +0000 (UTC) (envelope-from brde@optusnet.com.au) Received: from [192.168.0.102] (c110-21-101-228.carlnfd1.nsw.optusnet.com.au [110.21.101.228]) by mail105.syd.optusnet.com.au (Postfix) with ESMTPS id BA4E53A057E; Sat, 26 Oct 2019 22:51:27 +1100 (AEDT) Date: Sat, 26 Oct 2019 22:51:25 +1100 (EST) From: Bruce Evans X-X-Sender: bde@besplex.bde.org To: Andriy Gapon cc: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354076 - head/sys/dev/ow In-Reply-To: <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> Message-ID: <20191026204953.A894@besplex.bde.org> References: <201910251538.x9PFc9ii028313@repo.freebsd.org> <2fde5b7b-6186-0969-08a5-83524b6aa274@FreeBSD.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed X-Optus-CM-Score: 0 X-Optus-CM-Analysis: v=2.2 cv=P6RKvmIu c=1 sm=1 tr=0 a=PalzARQSbocsUSjMRkwAPg==:117 a=PalzARQSbocsUSjMRkwAPg==:17 a=jpOVt7BSZ2e4Z31A5e1TngXxSK0=:19 a=kj9zAlcOel0A:10 a=6I5d2MoRAAAA:8 a=La-k9SJ9Jmyq5Ap1hsAA:9 a=7Zwj6sZBwVKJAoWSPKxL6X1jA+E=:19 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 X-Rspamd-Queue-Id: 470fTJ21RSz44BY X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.986,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 11:51:33 -0000 On Fri, 25 Oct 2019, Andriy Gapon wrote: > On 25/10/2019 18:46, Ian Lepore wrote: >> On Fri, 2019-10-25 at 15:38 +0000, Andriy Gapon wrote: >>> Author: avg >>> Date: Fri Oct 25 15:38:09 2019 >>> New Revision: 354076 >>> URL: https://svnweb.freebsd.org/changeset/base/354076 >>> >>> Log: >>> owc_gpiobus_read_data: compare times in sbintime_t units >>> >>> Previously the code used sbttous() before microseconds comparison >>> in one >>> place, sbttons() and nanoseconds in another, division by SBT_1US >>> and >>> microseconds in yet another. >>> >>> Now the code consistently uses multiplication by SBT_1US to convert >>> microseconds to sbintime_t before comparing them with periods >>> between >>> calls to sbinuptime(). This is fast, this is precise enough (below >>> 0.03%) and the periods defined by the protocol cannot overflow. >>> >>> Reviewed by: imp (D22108) >>> MFC after: 2 weeks >>> >>> Modified: >>> head/sys/dev/ow/owc_gpiobus.c >>> >>> Modified: head/sys/dev/ow/owc_gpiobus.c >>> ===================================================================== >>> ========= >>> --- head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:02:50 2019 (r354 >>> 075) >>> +++ head/sys/dev/ow/owc_gpiobus.c Fri Oct 25 15:38:09 2019 (r354 >>> 076) >>> @@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct >>> ow_timing * >>> do { >>> now = sbinuptime(); >>> GETPIN(sc, &sample); >>> - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); >>> + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); >>> critical_exit(); >>> >>> - if (sbttons(now - then) < t->t_rdv * 1000) >>> + if (now - then < t->t_rdv * SBT_1US) >>> *bit = 1; >>> else >>> *bit = 0; >>> @@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct >>> ow_timing * >>> /* Wait out the rest of t_slot */ >>> do { >>> now = sbinuptime(); >>> - } while ((now - then) / SBT_1US < t->t_slot); >>> + } while (now - then < t->t_slot * SBT_1US); >>> >>> RELBUS(sc); >>> >> >> Unit conversions with sbt times should be done using the macros that >> carefully avoid roundoff errors. I don't understand why you've changed >> the code that correctly did use those macros to inline math. > > I think that the commit message explains it: > This is fast, this is precise enough (below 0.03%) and the periods defined by > the protocol cannot overflow. > > Do you disagree? > Could you please explain in which of the three lines changed the new code is > worse and why? The old code is worse. This is partly because the inline functions are over-engineered and poorly implemented and don't even work. The first thing improved in the change is: >>> do { >>> now = sbinuptime(); >>> GETPIN(sc, &sample); >>> - } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0); >>> + } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0); sbintime_t is signed so that negative differences work. Scaling negative differences by SBT_1*S works right. Scaling of negative difference by the inline functions attempts to panic, but even the panic is broken (unreachable). Here 'now' is an uptime and 'then' is presumably a previous uptime, so now < then "can't happen". Similar code with non-monotonic or untrusted times might produce a negative difference. For efficiency, t_rdv + 2 could be kept as an sbintime. Scaling it at runtime gives the cleaner code: } while (now - then < ustosbt(t->t_rdv + 2) && sample == 0); Sign extension bugs are further away in this expression. The arg (t->t_rdv + 2) is more obviously >= 0 since it is a limit, and all of the inline functions return a signed type (sbintime_t or int64_t) so that signed differences work. The next thing improved is: >>> - if (sbttons(now - then) < t->t_rdv * 1000) >>> + if (now - then < t->t_rdv * SBT_1US) This preserves full accuracy and signs for 'now - then' but loses a little more accuracy than needed for conversion of t_rdv. But accuracy of t_rdv is apparently unimportant. If the last bit in it were important, then it should be kept as an sbintime and difference like 'now - then' should never be scaled since even perfect rounding would lose bits. The final thing improved is: >>> - } while ((now - then) / SBT_1US < t->t_slot); >>> + } while (now - then < t->t_slot * SBT_1US); This already used the unscaled 'now - then', but with a style bug (excessive parentheses. imp still hasn't replied to my mails that fix some of the bugs in the overengineerined committed version. My version is even more overengineered. I maintain the following version but only use the non-comment parts of sbttons(). First look at the bugs in the committed sbtons(): XX /* XX * Large comment. The function is not very overengineered except in the XX * comment. Half the detals are wrong. XX */ XX static __inline int64_t XX sbttons(sbintime_t _sbt) XX { XX uint64_t ns; XX XX #ifdef KASSERT XX KASSERT(_sbt >= 0, ("Negative values illegal for sbttons: %jx", _sbt)); XX #endif Multiplication by SBT_1NS used to be the proper conversion KPI. It loses some accuracy, but works for negative _sbt (since SBT_1NS is signed). Here the conversion is more complicated. It still uses mostly signed types (0xffffffffu gets promoted), but doesn't work if )sbt is negative. The above attempts to detect and panic for this, but has no effect in most cases, since due tp standard namespace pollution in , is always included before , so KASSERT in only defined here for kernel files for kernel files that have style bugs in their #include order or selection. XX ns = _sbt; Bad style (use ns as scratch for an sbtbintime_t variable). XX if (ns >= SBT_1S) XX ns = (ns >> 32) * 1000000000; XX else XX ns = 0; This avoids overflow for ns large and < 0. For ns large and < 0, it doesn't reduce adjust ns, so later code adds a garbage bs (unscaled ns = full _sbt) to the fractional part of _sbt. XX XX return (ns + (1000000000 * (_sbt & 0xffffffffu) >> 32)); XX } The large buggy comment is attached only to this function, but only applies to function converting in the other direction. In this direction, the complications and overengineering are small. The functions just avoid overflow for large ns. XX --- /home/bde/sys13/sys/time.h 2019-09-19 17:44:48.507873000 +0000 XX +++ time.h 2018-11-16 07:19:07.542131000 +0000 XX @@ -30,5 +30,5 @@ XX * XX * @(#)time.h 8.5 (Berkeley) 5/4/95 XX - * $FreeBSD: head/sys/sys/time.h 346176 2019-04-13 04:46:35Z imp $ XX + * $FreeBSD: head/sys/sys/time.h 340450 2018-11-15 16:02:13Z imp $ XX */ XX XX @@ -98,9 +98,9 @@ XX uint64_t _p1, _p2; XX XX - _p1 = (_bt->frac & 0xffffffffull) * _x; XX + _p1 = (_bt->frac & 0xffffffff) * _x; XX _p2 = (_bt->frac >> 32) * _x + (_p1 >> 32); XX _bt->sec *= _x; XX _bt->sec += (_p2 >> 32); XX - _bt->frac = (_p2 << 32) | (_p1 & 0xffffffffull); XX + _bt->frac = (_p2 << 32) | (_p1 & 0xffffffff); XX } XX Vestiges of my old fixes for similar problems converting between bintimes and timevals/timespecs. Although bintimes have much more precision, they can't represent timevals or timespecs exactly, so conversions to bintimes and back tend to lose a bit. E.g., 1 second survives, but 999999 usec becomes 999998 usec. The use of ull is just a style bug here. We just want to extract low bits from _bt->frac. The type of the sub-expression remains as uint64_t. XX @@ -163,38 +163,60 @@ XX * microsecond functions are also provided for completeness. XX * XX - * These functions return the smallest sbt larger or equal to the XX - * number of seconds requested so that sbttoX(Xtosbt(y)) == y. Unlike These functions are not as accurate as claimed. XX - * top of second computations below, which require that we tick at the XX - * top of second, these need to be rounded up so we do whatever for at XX - * least as long as requested. XX - * XX - * The naive computation we'd do is this XX - * ((unit * 2^64 / SIFACTOR) + 2^32-1) >> 32 XX - * However, that overflows. Instead, we compute XX - * ((unit * 2^63 / SIFACTOR) + 2^31-1) >> 32 XX - * and use pre-computed constants that are the ceil of the 2^63 / SIFACTOR XX - * term to ensure we are using exactly the right constant. We use the lesser This method is routine and shouldn't be documented here. Howver, there are some complications and shortcuts in the details that should be documented or avoided. XX - * evil of ull rather than a uint64_t cast to ensure we have well defined XX - * right shift semantics. With these changes, we get all the ns, us and ms XX - * conversions back and forth right. Using ull instead of the correct cast is just a gross style bug. Using any unsigned type asks for unsign extension bugs but may be needed for technical reasons (we start with int64_t types and must handle negative values before combinining with uint64_t constants. XX - * Note: This file is used for both kernel and userland includes, so we can't XX - * rely on KASSERT being defined, nor can we pollute the namespace by including XX - * assert.h. Remove nonense about KASSERT. XX + * Violate the comment about "Background information": phk didn't like my rounding fixes for bintimes and responded by adding the the "Background information" comment. This demands always perfectly rounding down. The sbintime conversion functions violate this by always rounding up. Multiplication by SBT1_*S rounds down a bit too much, but always perfectly rounding down would do much the same after a few iterations. XX + * XX + * All these functions do sloppy scaling and/or rounding, but it is arranged XX + * that the errors compensate for each other so that sbttoX(Xtosbt(x)) == x XX + * for all valid args. XX + * XX + * Sloppy scaling in the decimal->sbt functions tends to give a result that XX + * is significantly far below the floor of the correctly rounded result (call XX + * this the "true floor"). Similary sloppy scaling in the sbt->decimal XX + * functions reduces further below the true floor. The result was that XX + * sbttoX(Xtosbt(x)) was 1 too small for all cases except x = 0. XX + * XX + * Doing correct even scaling and rounding up to the true ceiling in the XX + * decimal->sbt functions alone is useless for fixing this, since, the XX + * sbt->decimal functions reduc even true ceilings to below true floors. XX + * XX + * Instead of correcting all the functions, return a fake ceiling in the XX + * decimal->sbt functions. This ceiling is approx. 1 decimal unit above the XX + * sloppily scaled value. It is thus above the true ceiling but not 1 XX + * decimal unit or more above. It is unobvious that the sbt->decimal XX + * functions don't reduce even this fake ceiling to below the true floor. XX + * Exhaustive testing shows that they don't. The fake ceiling must be XX + * significantly more than 1 sbt unit above the true ceiling for the XX + * reduction to be not too large. Fortunately, there are no numerical XX + * accidents that give a too-low fake ceiling. XX + * XX + * The previous version claimed to calculate true ceilings. These never XX + * work. But it actually calculated fake ceilings of 2**32-1 sbt units XX + * above the sloppily scaled value. This value is nonsense, but worked XX + * accidentally in some cases. The decimal unit of 1 nsec is XX + * 2**64/10**9 ~= 18e9 sbt units. 2**32-1 is thus about 4.29 times too XX + * small to work non-accidentally. In practice, it worked accidentally in XX + * about 92% of cases. For conversions of microseconds, the value used was XX + * about 4.29e3 times too small, but worked accidentally in all except 32 XX + * cases. For conversions of milliseconds, the value used was about 4.29e6 XX + * times too small, but worked accidentally in all cases. XX + * XX + * Note that the range of valid args is significantly limited, since the XX + * efficient sloppy scaling and rounding methods used here only work up to 1 XX + * second. E.g., _ms must be between 0 and 999 inclusive, since XX + * ustosbt(1000) = 0 due to overflow of of the multiplication to almost XX + * exactly 0. This allows exhaustive testing that the sloppy methods work XX + * It is unclear if similar sloppy scaling would work above 1 second, but XX + * non-sloppy scaling is very easy for whole seconds (see tstosbt()). XX + * XX + * Uncommitted code for ts/tv<->bt was more careful, but was disapproved and XX + * the comment about "Background information" was added to inhibit commits XX + * in this area. It does non-sloppy scaling of fractional parts, then rounds XX + * to nearest. I don't remember doing exhaustive testing of it, and now don't XX + * see why rounding to nearest is enough. XX */ XX static __inline int64_t XX sbttons(sbintime_t _sbt) XX { XX - uint64_t ns; XX - XX -#ifdef KASSERT XX - KASSERT(_sbt >= 0, ("Negative values illegal for sbttons: %jx", _sbt)); XX -#endif XX - ns = _sbt; XX - if (ns >= SBT_1S) XX - ns = (ns >> 32) * 1000000000; XX - else XX - ns = 0; XX XX - return (ns + (1000000000 * (_sbt & 0xffffffffu) >> 32)); XX + return ((1000000000 * _sbt) >> 32); XX } In this direction, I just removed the buggy overflow handling (but kept the accurate scaling). Overflow occurs after only ~2 seconds for nanoseconds. XX XX @@ -202,16 +224,78 @@ XX nstosbt(int64_t _ns) XX { XX - sbintime_t sb = 0; XX XX -#ifdef KASSERT XX - KASSERT(_ns >= 0, ("Negative values illegal for nstosbt: %jd", _ns)); XX + /* XX + * The adjustment is essentially to add SBT_1NS to the result of XX + * sloppy scaling and rounding down. That happens to work too, but XX + * use the slightly less sloppy method of combining shifts and XX + * subtracting 1. The result in most cses is much higher than the XX + * true ceiling, but sloppy rounding for the reverse conversion XX + * discards the extras. XX + * XX + * E.g., 2**64/10**9 has a fractional part of ~0.71. Multiplying XX + * this by the maximum valid _ns of 10**9-1 gives ~0.71e9, so XX + * rounding down after scaling gives a raw sbt that is ~0.71e9 below XX + * the true floor (only ~0.17 below the true floor in seconds). XX + * Replacing _ns by (_ns + 1) gives a raw sbt that is ~0.29e9 above XX + * the true ceiling (only ~0.068 above the true ceiling in seconds). XX + * Subtracting 1 from this makes no significant difference. Sloppy XX + * scaling and rounding in the reverse conversion recovers the XX + * original value: the sloppy scaling reduces the value from above the XX + * true ceiling to below the true ceiling (but not below the true XX + * floor); then rounding down recovers the true floor. XX + * XX + * Similarly for _all_ valid args and for the us and ms conversions. XX + * It is fairly obvious that the result of conversion back to ns is XX + * never 1 too low (since we add 1), but not obvious that the result XX + * is never 1 too high (since adding 1 risks this). XX + * XX + * Conversion from sbt to decimal and back has no chance of always XX + * restoring the original values since the decimal formats have less XX + * precision. Adding 1 is too sloppy to do anything good for this XX + * direction. The uncommitted ts/tv<->bt conversions are supposed to XX + * work as well as possible in both directions. Rounding to nearest XX + * works better and non-sloppy scaling is obviously needed to work in XX + * both directions. However, non-sloppy scaling doesn't work with XX + * mixed or sloppy rounding. In the above example with _ns = 10**9-1, XX + * it gives a raw sbt that is just 1 below the true floor. Adding 1 XX + * to this gives the true ceiling in the sbt, but unless the reverse XX + * conversion is changed similarly, it reduces from the true ceiling XX + * to below the true floor, so the result of converting back has much XX + * the same off-by-1 errors as simpler method (always 1 too low except XX + * for an arg of 0). XX + * XX + * Further examples: XX + * - when _ns = 0, sbt is SBT_1NS, but converting this back to ns XX + * gives 0. If we start with this sbt, oue conversion functions XX + * are still unusable for printing it in nsec. XX + * - when _ns = 10**9-1, we are close to overflow. Adding 1 to it XX + * doesn't quite reach the overflow threshold. XX + * - in previous versions, when _ns = 10**9, overflow was not quite XX + * reached, and the result of a double conversion had the usual XX + * off-by-1 error. XX + * - when _ns = 10**9, overflow now occurs and the result of a double XX + * conversion is 0 XX + * - when _ns = 10**9+1, overflow occurs in previous versions and the XX + * result of a double conversion is 0 (overflow gives an off-by-10**9 XX + * error and then the usual off-by-1-error occurs. XX + */ XX +#if 1 XX + /* XX + * This version does non-sloppy scaling which after rounding down is XX + * close to or equal 1 below the true ceiling for all nonzero args. XX + * Then adding 1 gives an adequate true or fake ceiling. Some of the XX + * above comments are wrong about the true ceiling not working. XX + * Unfortunately, this is about 30% slower (a whole cycle extra in XX + * the test). The unnecessary subtraction of 1 in the main version XX + * costs about 1/2 of a cycle in the test. XX + */ XX + uint64_t factor, frac; XX + XX + factor = ((uint64_t)1 << 63) / 500000000; XX + frac = ((0 - factor * 1000000000) << 32) / 1000000000; XX + return (((_ns * factor + ((_ns * frac) >> 32)) >> 32) + 1); This is the fully overengineered version. It is too slow to use. XX +#else XX + return (((_ns + 1) * (((uint64_t)1 << 63) / 500000000) - 1) >> 32); XX #endif XX - if (_ns >= SBT_1S) { XX - sb = (_ns / 1000000000) * SBT_1S; XX - _ns = _ns % 1000000000; XX - } XX - /* 9223372037 = ceil(2^63 / 1000000000) */ XX - sb += ((_ns * 9223372037ull) + 0x7fffffff) >> 31; Rounding to the ceiling gives an intger scale factor which is a bit too high; after multiplying by _ns the error in nanoseconds can be more than 1 and so can the error in sbintimes. Using (_ns + 1) instead of _ns is supposed to fix this. The version that I actually use is: sb += (__ns << 32) / 1000000000 + (_ns == 0 : 0 : 1) This does simpler scaling to first round down, then violates the "Background information" comment by always rounding up except for _ns == 0, so that it it is clear that the rounding is as intended (don't do extra work to avoid rounding up if _ns is exactly representable. XX - return (sb); XX } XX XX @@ -226,16 +310,6 @@ XX ustosbt(int64_t _us) XX { XX - sbintime_t sb = 0; XX XX -#ifdef KASSERT XX - KASSERT(_us >= 0, ("Negative values illegal for ustosbt: %jd", _us)); XX -#endif XX - if (_us >= SBT_1S) { XX - sb = (_us / 1000000) * SBT_1S; XX - _us = _us % 1000000; XX - } XX - /* 9223372036855 = ceil(2^63 / 1000000) */ XX - sb += ((_us * 9223372036855ull) + 0x7fffffff) >> 31; XX - return (sb); XX + return (((_us + 1) * (((uint64_t)1 << 63) / 500000) - 1) >> 32); XX } XX XX @@ -250,16 +324,6 @@ XX mstosbt(int64_t _ms) XX { XX - sbintime_t sb = 0; XX XX -#ifdef KASSERT XX - KASSERT(_ms >= 0, ("Negative values illegal for mstosbt: %jd", _ms)); XX -#endif XX - if (_ms >= SBT_1S) { XX - sb = (_ms / 1000) * SBT_1S; XX - _ms = _ms % 1000; XX - } XX - /* 9223372036854776 = ceil(2^63 / 1000) */ XX - sb += ((_ms * 9223372036854776ull) + 0x7fffffff) >> 31; XX - return (sb); XX + return (((_ms + 1) * (((uint64_t)1 << 63) / 500) - 1) >> 32); XX } XX Bruce From owner-svn-src-all@freebsd.org Sat Oct 26 12:16:33 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C588D16F891; Sat, 26 Oct 2019 12:16:33 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt1-f194.google.com (mail-qt1-f194.google.com [209.85.160.194]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470g285r3bz45w7; Sat, 26 Oct 2019 12:16:32 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qt1-f194.google.com with SMTP id y39so2169410qty.0; Sat, 26 Oct 2019 05:16:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Lol3MMf7s/sjVmbpieHfsCoGPRSQUqLuyPvXpqjKTMk=; b=mrznCoUZdEZK3eacliEcKZ6V5TRzabi/e+bMcvgsze3/XVA/X7LSdCG1qO6wzkzqob G/s7Fv01qWlPdWMnNPwxnKoUIIiNDdhDfDmwhxfoCBrpqBW+5xsJUfFuP+jX6G4vLtxP qHCCvYkou8WO8LwA94OmeVtBBZZOD60sC1f60wypwE/DidujN25y/Cw3tOHmmn81mU5m vgDt2+DuRYhYfJpQo7fQXnRdHgmfwIOOfKK0fd/o3i4yfCCGLRGmeK0FSIOmG5qxDaJo HRs/wnhv50kSlZLv493tLUYeVO+z3e5bfshOnBeblfrZ3TsznHqw8wwDWGOS6rAQM1XM IVrQ== X-Gm-Message-State: APjAAAU2KrGShGSeFWV/UOvuCuA/mWl6sq52JlxumzNQP2MNUsVooE6m 9qh4HsAWkNRys/40VxuN//XzdL2mGRjT+AvXCJ8= X-Google-Smtp-Source: APXvYqwkWLBh/z51XdZxK3LAyWoI8mMobkmtbmNH6bnRtOiUuk4rTEyd9cEW70Nzx/IeiC3ghawNFoFyHG0mYlXX6NU= X-Received: by 2002:ac8:1413:: with SMTP id k19mr8316578qtj.360.1572092191288; Sat, 26 Oct 2019 05:16:31 -0700 (PDT) MIME-Version: 1.0 References: <201910252009.x9PK9gIV092660@repo.freebsd.org> <20191026082655.GJ73312@kib.kiev.ua> In-Reply-To: <20191026082655.GJ73312@kib.kiev.ua> From: Antoine Brodin Date: Sat, 26 Oct 2019 14:16:19 +0200 Message-ID: Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Gerald Pfeifer Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 470g285r3bz45w7 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of antoinebrodinfreebsd@gmail.com designates 209.85.160.194 as permitted sender) smtp.mailfrom=antoinebrodinfreebsd@gmail.com X-Spamd-Result: default: False [-4.14 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; RWL_MAILSPIKE_GOOD(0.00)[194.160.85.209.rep.mailspike.net : 127.0.0.18]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[194.160.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-2.14)[ip: (-5.40), ipnet: 209.85.128.0/17(-3.22), asn: 15169(-2.05), country: US(-0.05)]; FORGED_SENDER(0.30)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 12:16:33 -0000 On Sat, Oct 26, 2019 at 10:27 AM Konstantin Belousov wrote: > On Sat, Oct 26, 2019 at 08:24:09AM +0200, Antoine Brodin wrote: > > On Fri, Oct 25, 2019 at 10:09 PM Konstantin Belousov wrote: > > > > > > Author: kib > > > Date: Fri Oct 25 20:09:42 2019 > > > New Revision: 354095 > > > URL: https://svnweb.freebsd.org/changeset/base/354095 > > > > > > Log: > > > amd64: move pcb out of kstack to struct thread. > > > > > > This saves 320 bytes of the precious stack space. > > > > > > The only negative aspect of the change I can think of is that the > > > struct thread increased by 320 bytes obviously, and that 320 bytes are > > > not swapped out anymore. I believe the freed stack space is much more > > > important than that. Also, current struct thread size is 1392 bytes > > > on amd64, so UMA will allocate two thread structures per (4KB) slab, > > > which leaves a space for pcb without increasing zone memory use. > > > > > > Reviewed by: alc, markj > > > Tested by: pho > > > Sponsored by: The FreeBSD Foundation > > > MFC after: 2 weeks > > > Differential revision: https://reviews.freebsd.org/D22138 > > > > Hi, > > > > It seems that this breaks at least some versions of gcc: > > > > In file included from /usr/include/sys/proc.h:75, > > from /usr/include/sys/user.h:51, > > from ./md-unwind-support.h:34, > > from > > /wrkdirs/usr/ports/lang/gcc10-devel/work/gcc-10-20191020/libgcc/unwind-dw2.c:412: > > /usr/include/machine/proc.h:76:13: error: field 'md_pcb' has incomplete type > > 76 | struct pcb md_pcb; > > | ^~~~~~ > > > > It is very strange. Are gcc 9 or 8 affected ? gcc 8 and 9 are affected too. > As a blind guess, please try this patch. > > diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h > index 44e34fa5c83..9758e684da2 100644 > --- a/sys/amd64/include/pcb.h > +++ b/sys/amd64/include/pcb.h > @@ -45,7 +45,7 @@ > #include > #include > > -#ifdef __amd64__ > +#if defined(__amd64__) || defined(__x86_64__) > /* > * NB: The fields marked with (*) are used by kernel debuggers. Their > * ABI should be preserved. I will test this. Antoine From owner-svn-src-all@freebsd.org Sat Oct 26 13:00:57 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD647171538; Sat, 26 Oct 2019 13:00:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 470h1P3BtJz480d; Sat, 26 Oct 2019 13:00:57 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id x9QD0mGm095893 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sat, 26 Oct 2019 16:00:51 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua x9QD0mGm095893 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id x9QD0ma8095892; Sat, 26 Oct 2019 16:00:48 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 26 Oct 2019 16:00:48 +0300 From: Konstantin Belousov To: Antoine Brodin Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Gerald Pfeifer Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern Message-ID: <20191026130048.GL73312@kib.kiev.ua> References: <201910252009.x9PK9gIV092660@repo.freebsd.org> <20191026082655.GJ73312@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.2 (2019-09-21) X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on tom.home X-Rspamd-Queue-Id: 470h1P3BtJz480d X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 13:00:57 -0000 On Sat, Oct 26, 2019 at 02:16:19PM +0200, Antoine Brodin wrote: > On Sat, Oct 26, 2019 at 10:27 AM Konstantin Belousov > wrote: > > On Sat, Oct 26, 2019 at 08:24:09AM +0200, Antoine Brodin wrote: > > > On Fri, Oct 25, 2019 at 10:09 PM Konstantin Belousov wrote: > > > > > > > > Author: kib > > > > Date: Fri Oct 25 20:09:42 2019 > > > > New Revision: 354095 > > > > URL: https://svnweb.freebsd.org/changeset/base/354095 > > > > > > > > Log: > > > > amd64: move pcb out of kstack to struct thread. > > > > > > > > This saves 320 bytes of the precious stack space. > > > > > > > > The only negative aspect of the change I can think of is that the > > > > struct thread increased by 320 bytes obviously, and that 320 bytes are > > > > not swapped out anymore. I believe the freed stack space is much more > > > > important than that. Also, current struct thread size is 1392 bytes > > > > on amd64, so UMA will allocate two thread structures per (4KB) slab, > > > > which leaves a space for pcb without increasing zone memory use. > > > > > > > > Reviewed by: alc, markj > > > > Tested by: pho > > > > Sponsored by: The FreeBSD Foundation > > > > MFC after: 2 weeks > > > > Differential revision: https://reviews.freebsd.org/D22138 > > > > > > Hi, > > > > > > It seems that this breaks at least some versions of gcc: > > > > > > In file included from /usr/include/sys/proc.h:75, > > > from /usr/include/sys/user.h:51, > > > from ./md-unwind-support.h:34, > > > from > > > /wrkdirs/usr/ports/lang/gcc10-devel/work/gcc-10-20191020/libgcc/unwind-dw2.c:412: > > > /usr/include/machine/proc.h:76:13: error: field 'md_pcb' has incomplete type > > > 76 | struct pcb md_pcb; > > > | ^~~~~~ > > > > > > > It is very strange. Are gcc 9 or 8 affected ? > > gcc 8 and 9 are affected too. Then this is a completely different cause then I guessed below, and I think I know why. All of 8/9/10 gcc ports have support for multiarch, and the error must happen for gcc or xgcc invocation with -m32, am I right ? If yes, please try the patch at the end of the message instead. > > > As a blind guess, please try this patch. > > > > diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h > > index 44e34fa5c83..9758e684da2 100644 > > --- a/sys/amd64/include/pcb.h > > +++ b/sys/amd64/include/pcb.h > > @@ -45,7 +45,7 @@ > > #include > > #include > > > > -#ifdef __amd64__ > > +#if defined(__amd64__) || defined(__x86_64__) > > /* > > * NB: The fields marked with (*) are used by kernel debuggers. Their > > * ABI should be preserved. > > I will test this. Please use this instead diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h index 44e34fa5c83..8800b355c9a 100644 --- a/sys/amd64/include/pcb.h +++ b/sys/amd64/include/pcb.h @@ -116,6 +116,10 @@ struct susppcb { /* fpu context for suspend/resume */ void *sp_fpususpend; }; +#else /* 32bit */ +struct pcb { + uint64_t pcb_dummy[40]; +}; #endif #ifdef _KERNEL From owner-svn-src-all@freebsd.org Sat Oct 26 13:25:48 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6823317242A; Sat, 26 Oct 2019 13:25:48 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (hamza.pair.com [209.68.5.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 470hZ30lGHz49QR; Sat, 26 Oct 2019 13:25:46 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (localhost [127.0.0.1]) by hamza.pair.com (Postfix) with ESMTP id D9F0A33E0E; Sat, 26 Oct 2019 09:25:45 -0400 (EDT) Received: from anthias (unknown [178.114.204.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hamza.pair.com (Postfix) with ESMTPSA id F3AFD33E0D; Sat, 26 Oct 2019 09:25:44 -0400 (EDT) Date: Sat, 26 Oct 2019 15:25:43 +0200 (CEST) From: Gerald Pfeifer To: Konstantin Belousov cc: Antoine Brodin , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern In-Reply-To: <20191026130048.GL73312@kib.kiev.ua> Message-ID: References: <201910252009.x9PK9gIV092660@repo.freebsd.org> <20191026082655.GJ73312@kib.kiev.ua> <20191026130048.GL73312@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 470hZ30lGHz49QR X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of gerald@pfeifer.com designates 209.68.5.143 as permitted sender) smtp.mailfrom=gerald@pfeifer.com X-Spamd-Result: default: False [-4.50 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:hamza.pair.com]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[pfeifer.com]; RCPT_COUNT_FIVE(0.00)[5]; RCVD_COUNT_THREE(0.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[143.5.68.209.list.dnswl.org : 127.0.10.0]; IP_SCORE(-2.20)[ip: (-7.77), ipnet: 209.68.0.0/18(-2.05), asn: 7859(-1.16), country: US(-0.05)]; FREEMAIL_TO(0.00)[gmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:7859, ipnet:209.68.0.0/18, country:US]; RCVD_TLS_LAST(0.00)[] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 13:25:48 -0000 On Sat, 26 Oct 2019, Konstantin Belousov wrote: >>> It is very strange. Are gcc 9 or 8 affected ? >> gcc 8 and 9 are affected too. > Then this is a completely different cause then I guessed below, and I think > I know why. All of 8/9/10 gcc ports have support for multiarch, and the > error must happen for gcc or xgcc invocation with -m32, am I right ? Here is what I got in terms of just being bombarded with build failure reports across the board, the two below being for lang/gcc8: Date: Sat, 26 Oct 2019 11:46:37 GMT Subject: [package - head-amd64-default][lang/gcc8] Failed for gcc8-8.3.0_3 in build Log URL: http://beefy19.nyi.freebsd.org/data/head-amd64-default/2019-10-26_10h54m41s/logs/gcc8-8.3.0_3.log Build URL: http://beefy19.nyi.freebsd.org/build.html?mastername=head-amd64-default&build=2019-10-26_10h54m41s -and- Date: Sat, 26 Oct 2019 12:59:10 GMT Subject: [package - head-amd64-pcb-default][lang/gcc8] Failed for gcc8-8.3.0_3 in build Log URL: http://beefy19.nyi.freebsd.org/data/head-amd64-pcb-default/2019-10-26_12h17m09s/logs/gcc8-8.3.0_3.log Build URL: http://beefy19.nyi.freebsd.org/build.html?mastername=head-amd64-pcb-default&build=2019-10-26_12h17m09s Indeed I see -m32 in the last invocation of xgcc here in both case. Gerald From owner-svn-src-all@freebsd.org Sat Oct 26 14:34:22 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0D293175539; Sat, 26 Oct 2019 14:34:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470k596cWVz4GLY; Sat, 26 Oct 2019 14:34:21 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from tensor.andric.com (tensor.andric.com [IPv6:2001:470:7a58:1::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "tensor.andric.com", Issuer "Let's Encrypt Authority X3" (verified OK)) (Authenticated sender: dim) by smtp.freebsd.org (Postfix) with ESMTPSA id 9C7B31EF02; Sat, 26 Oct 2019 14:34:21 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from [IPv6:2001:470:7a58::80c4:747d:baa2:7d92] (unknown [IPv6:2001:470:7a58:0:80c4:747d:baa2:7d92]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by tensor.andric.com (Postfix) with ESMTPSA id 323B44D1B4; Sat, 26 Oct 2019 16:34:20 +0200 (CEST) From: Dimitry Andric Message-Id: <67F6BDD3-B633-4C85-AE85-9B075FF0E49E@FreeBSD.org> Content-Type: multipart/signed; boundary="Apple-Mail=_48607C31-39D2-4632-979A-EBE534FAA450"; protocol="application/pgp-signature"; micalg=pgp-sha1 Mime-Version: 1.0 (Mac OS X Mail 12.4 \(3445.104.11\)) Subject: Re: svn commit: r353937 - in head/share: man/man5 mk Date: Sat, 26 Oct 2019 16:34:14 +0200 In-Reply-To: <20191024124910.GA93913@FreeBSD.org> Cc: Enji Cooper , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org To: Alexey Dokuchaev References: <201910231702.x9NH2jQv045130@repo.freebsd.org> <2B855247-5097-442D-8D4A-77D68D2F6186@gmail.com> <20191024124910.GA93913@FreeBSD.org> X-Mailer: Apple Mail (2.3445.104.11) X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 14:34:22 -0000 --Apple-Mail=_48607C31-39D2-4632-979A-EBE534FAA450 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii > On 24 Oct 2019, at 14:49, Alexey Dokuchaev wrote: > > On Wed, Oct 23, 2019 at 11:31:41AM -0700, Enji Cooper wrote: >>> On Oct 23, 2019, at 10:02, Dimitry Andric wrote: >>> New Revision: 353937 >>> URL: https://svnweb.freebsd.org/changeset/base/353937 >>> >>> Log: >>> Build toolchain components as dynamically linked executables by default > > What are the benefits of the new order? The advantages and disadvantages of dynamic linking are a contentious and almost religious issue, so I hope you don't mind that I will not go into this. >>> In this day and age, we have boot environments, virtual machine >>> snapshots, cloud backups, and other much more reliable methods to >>> restore systems to working order. So I think the time is ripe to flip > > What about those of us who cannot use BEs, VMs, and other "cloudy" tech > because, well, they might not work as well and reliably as one might think? There are many possibilities, such as making backups, using WITHOUT_SHARED_TOOLCHAIN (and hoping that you can compile/link your way out of a botched installation), or even using NO_SHARED. >> Using dynamic binaries instead of static binaries might actually regress >> performance in a way you don't expect, depending on -j values, etc. Static >> binaries avoid the dynamic linker, which (obviously) results in a perf hit >> at scale [...] > > Very good point. But if you take this point to its logical conclusion, then you should link everything statically, and never use dynamic linking at all. :) >> Did you calculate the perf trade offs for the static binaries at low -j vs >> high -j, system and user time, etc? > > I'd like to know the answer to this question (and the results) as well. I only tested -j24 on a 32-core system, but I could probably repeat the experiment with lower and higher -j values: * host system (and dynamic linker): head r346082 (2019-04-10) * base/head checkout at r354065 * clang and lld compiled from r354065, dynamically linked: text data bss dec hex filename 69007497 52320 290469 69350286 0x422338e bin-dynamic/cc 45708182 35280 320613 46064075 0x2bee1cb bin-dynamic/ld * clang and lld compiled from r354065, statically linked: text data bss dec hex filename 70828318 71656 2592977 73492951 0x46169d7 bin-static/cc 47533406 54776 2623121 50211303 0x2fe29e7 bin-static/ld * built world with __MAKE_CONF and SRCCONF set to /dev/null, and CC, CXX, CPP and LD set to point to either the dynamic or static binaries * verified that the cross-tools stage did /not/ attempt to bootstrap the compiler and linker * repeated experiment 7 times, for each case * measured real, user and system time of each experiment Results for real time: --------------------------------------------------------------------------- x static-real.txt + dynamic-real.txt N Min Max Median Avg Stddev x 7 1851.71 1892.11 1868.79 1868.6829 13.569253 + 7 1882.95 1940.74 1912.9 1912.6886 17.510156 Difference at 95.0% confidence 44.0057 +/- 18.2444 2.35491% +/- 0.985013% (Student's t, pooled s = 15.6641) Results for user time: --------------------------------------------------------------------------- x static-user.txt + dynamic-user.txt N Min Max Median Avg Stddev x 7 31734.75 32055.47 31983.16 31942.131 118.2333 + 7 32957 33282.1 33224.25 33150.727 137.84805 Difference at 95.0% confidence 1208.6 +/- 149.569 3.7837% +/- 0.47584% (Student's t, pooled s = 128.416) Results for user time: --------------------------------------------------------------------------- x static-sys.txt + dynamic-sys.txt N Min Max Median Avg Stddev x 7 2434.98 2661.22 2461.95 2516.3843 100.88134 + 7 2545.07 2813.8 2655.65 2682.5243 116.80319 Difference at 95.0% confidence 166.14 +/- 127.11 6.60233% +/- 5.1964% (Student's t, pooled s = 109.133) So ~2.3% difference in real time, which is not too bad I think. There are probably opportunities to improve the performance of the dynamic linker, which would be beneficial to every program in the system. -Dimitry --Apple-Mail=_48607C31-39D2-4632-979A-EBE534FAA450 Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=signature.asc Content-Type: application/pgp-signature; name=signature.asc Content-Description: Message signed with OpenPGP -----BEGIN PGP SIGNATURE----- Version: GnuPG/MacGPG2 v2.2 iF0EARECAB0WIQR6tGLSzjX8bUI5T82wXqMKLiCWowUCXbRZZgAKCRCwXqMKLiCW o2BUAJ9ndlMld+F7K83SDJeJ3Y6G78mkKgCfYUfcFVxZsFLdl9uvFwvYmCRVuN8= =ER9l -----END PGP SIGNATURE----- --Apple-Mail=_48607C31-39D2-4632-979A-EBE534FAA450-- From owner-svn-src-all@freebsd.org Sat Oct 26 17:10:28 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3EF90179E0E; Sat, 26 Oct 2019 17:10:28 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470nYJ0xzSz4Nt7; Sat, 26 Oct 2019 17:10:28 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 03A82B031; Sat, 26 Oct 2019 17:10:28 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QHARer039596; Sat, 26 Oct 2019 17:10:27 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QHARnn039594; Sat, 26 Oct 2019 17:10:27 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910261710.x9QHARnn039594@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 26 Oct 2019 17:10:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354115 - head/usr.bin/dtc X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/usr.bin/dtc X-SVN-Commit-Revision: 354115 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 17:10:28 -0000 Author: manu Date: Sat Oct 26 17:10:27 2019 New Revision: 354115 URL: https://svnweb.freebsd.org/changeset/base/354115 Log: dtc: Allow multiple dts-v1 tag Some dts are including dtsi that also contain a /dts-v1/ tag at the top. GNU DTC doesn't seems to have a problem with that so fix our dtc to behave the same. Reviewed by: kevans MFC after: 1 week Modified: head/usr.bin/dtc/fdt.cc Modified: head/usr.bin/dtc/fdt.cc ============================================================================== --- head/usr.bin/dtc/fdt.cc Sat Oct 26 10:33:21 2019 (r354114) +++ head/usr.bin/dtc/fdt.cc Sat Oct 26 17:10:27 2019 (r354115) @@ -1563,11 +1563,11 @@ device_tree::parse_file(text_input_buffer &input, { input.next_token(); // Read the header - if (input.consume("/dts-v1/;")) + while (input.consume("/dts-v1/;")) { read_header = true; + input.next_token(); } - input.next_token(); if (input.consume("/plugin/;")) { is_plugin = true; From owner-svn-src-all@freebsd.org Sat Oct 26 17:11:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 394F6179EB9; Sat, 26 Oct 2019 17:11:05 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470nZ11SPzz4P91; Sat, 26 Oct 2019 17:11:05 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1538AB17B; Sat, 26 Oct 2019 17:11:05 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QHB4vl040406; Sat, 26 Oct 2019 17:11:04 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QHB308040398; Sat, 26 Oct 2019 17:11:03 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201910261711.x9QHB308040398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 26 Oct 2019 17:11:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354116 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs X-SVN-Commit-Revision: 354116 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 17:11:05 -0000 Author: asomers Date: Sat Oct 26 17:11:02 2019 New Revision: 354116 URL: https://svnweb.freebsd.org/changeset/base/354116 Log: MFZoL: Avoid retrieving unused snapshot props This patch modifies the zfs_ioc_snapshot_list_next() ioctl to enable it to take input parameters that alter the way looping through the list of snapshots is performed. The idea here is to restrict functions that throw away some of the snapshots returned by the ioctl to a range of snapshots that these functions actually use. This improves efficiency and execution speed for some rollback and send operations. Reviewed-by: Tom Caputi Reviewed-by: Brian Behlendorf Reviewed by: Matt Ahrens Signed-off-by: Alek Pinchuk Closes #8077 zfsonlinux/zfs@4c0883fb4af0d5565459099b98fcf90ecbfa1ca1 MFC after: 2 weeks Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Sat Oct 26 17:10:27 2019 (r354115) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Sat Oct 26 17:11:02 2019 (r354116) @@ -139,7 +139,7 @@ zfs_callback(zfs_handle_t *zhp, void *data) ZFS_TYPE_BOOKMARK)) == 0) && include_snaps) (void) zfs_iter_snapshots(zhp, (cb->cb_flags & ZFS_ITER_SIMPLE) != 0, zfs_callback, - data); + data, 0, 0); if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT | ZFS_TYPE_BOOKMARK)) == 0) && include_bmarks) (void) zfs_iter_bookmarks(zhp, zfs_callback, data); Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 26 17:10:27 2019 (r354115) +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 26 17:11:02 2019 (r354116) @@ -30,7 +30,7 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Igor Kozhukhov . * Copyright 2016 Nexenta Systems, Inc. - * Copyright (c) 2018 Datto Inc. + * Copyright (c) 2019 Datto Inc. */ #include @@ -1174,7 +1174,7 @@ destroy_print_snapshots(zfs_handle_t *fs_zhp, destroy_ int err = 0; assert(cb->cb_firstsnap == NULL); assert(cb->cb_prevsnap == NULL); - err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb); + err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb, 0, 0); if (cb->cb_firstsnap != NULL) { uint64_t used = 0; if (err == 0) { @@ -3437,6 +3437,7 @@ zfs_do_promote(int argc, char **argv) */ typedef struct rollback_cbdata { uint64_t cb_create; + uint8_t cb_younger_ds_printed; boolean_t cb_first; int cb_doclones; char *cb_target; @@ -3467,15 +3468,20 @@ rollback_check_dependent(zfs_handle_t *zhp, void *data } /* - * Report any snapshots more recent than the one specified. Used when '-r' is - * not specified. We reuse this same callback for the snapshot dependents - if - * 'cb_dependent' is set, then this is a dependent and we should report it - * without checking the transaction group. + * Report some snapshots/bookmarks more recent than the one specified. + * Used when '-r' is not specified. We reuse this same callback for the + * snapshot dependents - if 'cb_dependent' is set, then this is a + * dependent and we should report it without checking the transaction group. */ static int rollback_check(zfs_handle_t *zhp, void *data) { rollback_cbdata_t *cbp = data; + /* + * Max number of younger snapshots and/or bookmarks to display before + * we stop the iteration. + */ + const uint8_t max_younger = 32; if (cbp->cb_doclones) { zfs_close(zhp); @@ -3504,9 +3510,24 @@ rollback_check(zfs_handle_t *zhp, void *data) } else { (void) fprintf(stderr, "%s\n", zfs_get_name(zhp)); + cbp->cb_younger_ds_printed++; } } zfs_close(zhp); + + if (cbp->cb_younger_ds_printed == max_younger) { + /* + * This non-recursive rollback is going to fail due to the + * presence of snapshots and/or bookmarks that are younger than + * the rollback target. + * We printed some of the offending objects, now we stop + * zfs_iter_snapshot/bookmark iteration so we can fail fast and + * avoid iterating over the rest of the younger objects + */ + (void) fprintf(stderr, gettext("Output limited to %d " + "snapshots/bookmarks\n"), max_younger); + return (-1); + } return (0); } @@ -3520,6 +3541,7 @@ zfs_do_rollback(int argc, char **argv) zfs_handle_t *zhp, *snap; char parentname[ZFS_MAX_DATASET_NAME_LEN]; char *delim; + uint64_t min_txg = 0; /* check options */ while ((c = getopt(argc, argv, "rRf")) != -1) { @@ -3575,7 +3597,12 @@ zfs_do_rollback(int argc, char **argv) cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG); cb.cb_first = B_TRUE; cb.cb_error = 0; - if ((ret = zfs_iter_snapshots(zhp, B_FALSE, rollback_check, &cb)) != 0) + + if (cb.cb_create > 0) + min_txg = cb.cb_create; + + if ((ret = zfs_iter_snapshots(zhp, B_FALSE, rollback_check, &cb, + min_txg, 0)) != 0) goto out; if ((ret = zfs_iter_bookmarks(zhp, rollback_check, &cb)) != 0) goto out; Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Oct 26 17:10:27 2019 (r354115) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Oct 26 17:11:02 2019 (r354116) @@ -28,7 +28,7 @@ * Copyright (c) 2013 Steven Hartland. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Nexenta Systems, Inc. - * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2019 Datto Inc. */ #ifndef _LIBZFS_H @@ -570,8 +570,10 @@ extern int zfs_iter_root(libzfs_handle_t *, zfs_iter_f extern int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *); extern int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, void *); extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *); -extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *); -extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *); +extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *, + uint64_t, uint64_t); +extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *, + uint64_t, uint64_t); extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *); extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *); Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Oct 26 17:10:27 2019 (r354115) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Oct 26 17:11:02 2019 (r354116) @@ -31,6 +31,7 @@ * Copyright 2017 Nexenta Systems, Inc. * Copyright 2016 Igor Kozhukhov * Copyright 2017-2018 RackTop Systems. + * Copyright (c) 2019 Datto Inc. */ #include @@ -4163,7 +4164,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo rollback_data_t cb = { 0 }; int err; boolean_t restore_resv = 0; - uint64_t old_volsize = 0, new_volsize; + uint64_t min_txg = 0, old_volsize = 0, new_volsize; zfs_prop_t resv_prop; assert(zhp->zfs_type == ZFS_TYPE_FILESYSTEM || @@ -4175,7 +4176,13 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo cb.cb_force = force; cb.cb_target = snap->zfs_name; cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG); - (void) zfs_iter_snapshots(zhp, B_FALSE, rollback_destroy, &cb); + + if (cb.cb_create > 0) + min_txg = cb.cb_create; + + (void) zfs_iter_snapshots(zhp, B_FALSE, rollback_destroy, &cb, + min_txg, 0); + (void) zfs_iter_bookmarks(zhp, rollback_destroy, &cb); if (cb.cb_error) Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Sat Oct 26 17:10:27 2019 (r354115) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Sat Oct 26 17:11:02 2019 (r354116) @@ -24,6 +24,7 @@ * Copyright (c) 2013, 2015 by Delphix. All rights reserved. * Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved. * Copyright 2014 Nexenta Systems, Inc. All rights reserved. + * Copyright (c) 2019 Datto Inc. */ #include @@ -139,11 +140,12 @@ zfs_iter_filesystems(zfs_handle_t *zhp, zfs_iter_f fun */ int zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple, zfs_iter_f func, - void *data) + void *data, uint64_t min_txg, uint64_t max_txg) { zfs_cmd_t zc = { 0 }; zfs_handle_t *nzhp; int ret; + nvlist_t *range_nvl = NULL; if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT || zhp->zfs_type == ZFS_TYPE_BOOKMARK) @@ -153,6 +155,24 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple if (zcmd_alloc_dst_nvlist(zhp->zfs_hdl, &zc, 0) != 0) return (-1); + + if (min_txg != 0) { + range_nvl = fnvlist_alloc(); + fnvlist_add_uint64(range_nvl, SNAP_ITER_MIN_TXG, min_txg); + } + if (max_txg != 0) { + if (range_nvl == NULL) + range_nvl = fnvlist_alloc(); + fnvlist_add_uint64(range_nvl, SNAP_ITER_MAX_TXG, max_txg); + } + + if (range_nvl != NULL && + zcmd_write_src_nvlist(zhp->zfs_hdl, &zc, range_nvl) != 0) { + zcmd_free_nvlists(&zc); + fnvlist_free(range_nvl); + return (-1); + } + while ((ret = zfs_do_list_ioctl(zhp, ZFS_IOC_SNAPSHOT_LIST_NEXT, &zc)) == 0) { @@ -165,10 +185,12 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple if ((ret = func(nzhp, data)) != 0) { zcmd_free_nvlists(&zc); + fnvlist_free(range_nvl); return (ret); } } zcmd_free_nvlists(&zc); + fnvlist_free(range_nvl); return ((ret < 0) ? ret : 0); } @@ -276,7 +298,8 @@ zfs_snapshot_compare(const void *larg, const void *rar } int -zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_f callback, void *data) +zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_f callback, void *data, + uint64_t min_txg, uint64_t max_txg) { int ret = 0; zfs_node_t *node; @@ -286,7 +309,8 @@ zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_ avl_create(&avl, zfs_snapshot_compare, sizeof (zfs_node_t), offsetof(zfs_node_t, zn_avlnode)); - ret = zfs_iter_snapshots(zhp, B_FALSE, zfs_sort_snaps, &avl); + ret = zfs_iter_snapshots(zhp, B_FALSE, zfs_sort_snaps, &avl, min_txg, + max_txg); for (node = avl_first(&avl); node != NULL; node = AVL_NEXT(&avl, node)) ret |= callback(node->zn_handle, data); @@ -389,7 +413,7 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *sp } err = zfs_iter_snapshots_sorted(fs_zhp, - snapspec_cb, &ssa); + snapspec_cb, &ssa, 0, 0); if (ret == 0) ret = err; if (ret == 0 && (!ssa.ssa_seenfirst || @@ -429,7 +453,7 @@ zfs_iter_children(zfs_handle_t *zhp, zfs_iter_f func, { int ret; - if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data)) != 0) + if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data, 0, 0)) != 0) return (ret); return (zfs_iter_filesystems(zhp, func, data)); @@ -495,7 +519,7 @@ iter_dependents_cb(zfs_handle_t *zhp, void *arg) err = zfs_iter_filesystems(zhp, iter_dependents_cb, ida); if (err == 0) { err = zfs_iter_snapshots(zhp, B_FALSE, - iter_dependents_cb, ida); + iter_dependents_cb, ida, 0, 0); } ida->stack = isf.next; } Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c ============================================================================== --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 26 17:10:27 2019 (r354115) +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 26 17:11:02 2019 (r354116) @@ -28,6 +28,7 @@ * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Igor Kozhukhov + * Copyright (c) 2019 Datto Inc. */ #include @@ -612,6 +613,7 @@ typedef struct send_data { const char *tosnap; boolean_t recursive; boolean_t verbose; + boolean_t replicate; /* * The header nvlist is of the following format: @@ -789,6 +791,7 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) send_data_t *sd = arg; nvlist_t *nvfs, *nv; int rv = 0; + uint64_t min_txg = 0, max_txg = 0; uint64_t parent_fromsnap_guid_save = sd->parent_fromsnap_guid; uint64_t fromsnap_txg_save = sd->fromsnap_txg; uint64_t tosnap_txg_save = sd->tosnap_txg; @@ -832,10 +835,10 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) goto out; } - VERIFY(0 == nvlist_alloc(&nvfs, NV_UNIQUE_NAME, 0)); - VERIFY(0 == nvlist_add_string(nvfs, "name", zhp->zfs_name)); - VERIFY(0 == nvlist_add_uint64(nvfs, "parentfromsnap", - sd->parent_fromsnap_guid)); + nvfs = fnvlist_alloc(); + fnvlist_add_string(nvfs, "name", zhp->zfs_name); + fnvlist_add_uint64(nvfs, "parentfromsnap", + sd->parent_fromsnap_guid); if (zhp->zfs_dmustats.dds_origin[0]) { zfs_handle_t *origin = zfs_open(zhp->zfs_hdl, @@ -855,14 +858,19 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) nvlist_free(nv); /* iterate over snaps, and set sd->parent_fromsnap_guid */ + if (!sd->replicate && fromsnap_txg != 0) + min_txg = fromsnap_txg; + if (!sd->replicate && tosnap_txg != 0) + max_txg = tosnap_txg; sd->parent_fromsnap_guid = 0; VERIFY(0 == nvlist_alloc(&sd->parent_snaps, NV_UNIQUE_NAME, 0)); VERIFY(0 == nvlist_alloc(&sd->snapprops, NV_UNIQUE_NAME, 0)); - (void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd); + (void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd, + min_txg, max_txg); VERIFY(0 == nvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps)); VERIFY(0 == nvlist_add_nvlist(nvfs, "snapprops", sd->snapprops)); - nvlist_free(sd->parent_snaps); - nvlist_free(sd->snapprops); + fnvlist_free(sd->parent_snaps); + fnvlist_free(sd->snapprops); /* add this fs to nvlist */ (void) snprintf(guidstring, sizeof (guidstring), @@ -886,11 +894,12 @@ out: static int gather_nvlist(libzfs_handle_t *hdl, const char *fsname, const char *fromsnap, const char *tosnap, boolean_t recursive, boolean_t verbose, - nvlist_t **nvlp, avl_tree_t **avlp) + boolean_t replicate, nvlist_t **nvlp, avl_tree_t **avlp) { zfs_handle_t *zhp; - send_data_t sd = { 0 }; int error; + uint64_t min_txg = 0, max_txg = 0; + send_data_t sd = { 0 }; zhp = zfs_open(hdl, fsname, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); if (zhp == NULL) @@ -902,6 +911,7 @@ gather_nvlist(libzfs_handle_t *hdl, const char *fsname sd.tosnap = tosnap; sd.recursive = recursive; sd.verbose = verbose; + sd.replicate = replicate; if ((error = send_iterate_fs(zhp, &sd)) != 0) { nvlist_free(sd.fss); @@ -1338,6 +1348,7 @@ static int dump_filesystem(zfs_handle_t *zhp, void *arg) { int rv = 0; + uint64_t min_txg = 0, max_txg = 0; send_dump_data_t *sdd = arg; boolean_t missingfrom = B_FALSE; zfs_cmd_t zc = { 0 }; @@ -1373,7 +1384,15 @@ dump_filesystem(zfs_handle_t *zhp, void *arg) if (sdd->fromsnap == NULL || missingfrom) sdd->seenfrom = B_TRUE; - rv = zfs_iter_snapshots_sorted(zhp, dump_snapshot, arg); + if (!sdd->replicate && sdd->fromsnap != NULL) + min_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, + sdd->fromsnap); + if (!sdd->replicate && sdd->tosnap != NULL) + max_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, + sdd->tosnap); + + rv = zfs_iter_snapshots_sorted(zhp, dump_snapshot, arg, + min_txg, max_txg); if (!sdd->seenfrom) { (void) fprintf(stderr, dgettext(TEXT_DOMAIN, "WARNING: could not send %s@%s:\n" @@ -1834,7 +1853,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, cons err = gather_nvlist(zhp->zfs_hdl, zhp->zfs_name, fromsnap, tosnap, flags->replicate, flags->verbose, - &fss, &fsavl); + flags->replicate, &fss, &fsavl); if (err) goto err_out; VERIFY(0 == nvlist_add_nvlist(hdrnv, "fss", fss)); @@ -2477,7 +2496,7 @@ again: VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0)); if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL, - recursive, B_FALSE, &local_nv, &local_avl)) != 0) + recursive, B_FALSE, B_FALSE, &local_nv, &local_avl)) != 0) return (error); /* @@ -3554,7 +3573,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const */ *cp = '\0'; if (gather_nvlist(hdl, zc.zc_value, NULL, NULL, B_FALSE, - B_FALSE, &local_nv, &local_avl) == 0) { + B_FALSE, B_FALSE, &local_nv, &local_avl) == 0) { *cp = '@'; fs = fsavl_find(local_avl, drrb->drr_toguid, NULL); fsavl_destroy(local_avl); Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 26 17:10:27 2019 (r354115) +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 26 17:11:02 2019 (r354116) @@ -33,7 +33,7 @@ * Copyright (c) 2014 Integros [integros.com] * Copyright 2016 Toomas Soome * Copyright 2017 RackTop Systems. - * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2019 Datto Inc. */ /* @@ -2345,7 +2345,8 @@ dataset_name_hidden(const char *name) * inputs: * zc_name name of filesystem * zc_cookie zap cursor - * zc_nvlist_dst_size size of buffer for property nvlist + * zc_nvlist_src iteration range nvlist + * zc_nvlist_src_size size of iteration range nvlist * * outputs: * zc_name name of next filesystem @@ -2414,9 +2415,24 @@ top: static int zfs_ioc_snapshot_list_next(zfs_cmd_t *zc) { - objset_t *os; int error; + objset_t *os, *ossnap; + dsl_dataset_t *ds; + uint64_t min_txg = 0, max_txg = 0; + if (zc->zc_nvlist_src_size != 0) { + nvlist_t *props = NULL; + error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, + zc->zc_iflags, &props); + if (error != 0) + return (error); + (void) nvlist_lookup_uint64(props, SNAP_ITER_MIN_TXG, + &min_txg); + (void) nvlist_lookup_uint64(props, SNAP_ITER_MAX_TXG, + &max_txg); + nvlist_free(props); + } + error = dmu_objset_hold(zc->zc_name, FTAG, &os); if (error != 0) { return (error == ENOENT ? ESRCH : error); @@ -2432,26 +2448,52 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc) return (SET_ERROR(ESRCH)); } - error = dmu_snapshot_list_next(os, - sizeof (zc->zc_name) - strlen(zc->zc_name), - zc->zc_name + strlen(zc->zc_name), &zc->zc_obj, &zc->zc_cookie, - NULL); + while (error == 0) { + if (issig(JUSTLOOKING) && issig(FORREAL)) { + error = SET_ERROR(EINTR); + break; + } - if (error == 0 && !zc->zc_simple) { - dsl_dataset_t *ds; - dsl_pool_t *dp = os->os_dsl_dataset->ds_dir->dd_pool; + error = dmu_snapshot_list_next(os, + sizeof (zc->zc_name) - strlen(zc->zc_name), + zc->zc_name + strlen(zc->zc_name), &zc->zc_obj, + &zc->zc_cookie, NULL); + if (error == ENOENT) { + error = SET_ERROR(ESRCH); + break; + } else if (error != 0) { + break; + } - error = dsl_dataset_hold_obj(dp, zc->zc_obj, FTAG, &ds); - if (error == 0) { - objset_t *ossnap; + error = dsl_dataset_hold_obj(dmu_objset_pool(os), zc->zc_obj, + FTAG, &ds); + if (error != 0) + break; - error = dmu_objset_from_ds(ds, &ossnap); - if (error == 0) - error = zfs_ioc_objset_stats_impl(zc, ossnap); + if ((min_txg != 0 && dsl_get_creationtxg(ds) < min_txg) || + (max_txg != 0 && dsl_get_creationtxg(ds) > max_txg)) { dsl_dataset_rele(ds, FTAG); + /* undo snapshot name append */ + *(strchr(zc->zc_name, '@') + 1) = '\0'; + /* skip snapshot */ + continue; } - } else if (error == ENOENT) { - error = SET_ERROR(ESRCH); + + if (zc->zc_simple) { + dsl_dataset_rele(ds, FTAG); + break; + } + + if ((error = dmu_objset_from_ds(ds, &ossnap)) != 0) { + dsl_dataset_rele(ds, FTAG); + break; + } + if ((error = zfs_ioc_objset_stats_impl(zc, ossnap)) != 0) { + dsl_dataset_rele(ds, FTAG); + break; + } + dsl_dataset_rele(ds, FTAG); + break; } dmu_objset_rele(os, FTAG); Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h ============================================================================== --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Oct 26 17:10:27 2019 (r354115) +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Oct 26 17:11:02 2019 (r354116) @@ -26,7 +26,7 @@ * Copyright (c) 2012, Martin Matuska . All rights reserved. * Copyright (c) 2014 Integros [integros.com] * Copyright 2017 Joyent, Inc. - * Copyright (c) 2017 Datto Inc. + * Copyright (c) 2019 Datto Inc. */ /* Portions Copyright 2010 Robert Milkowski */ @@ -1122,6 +1122,13 @@ typedef enum { #define ZCP_MAX_INSTRLIMIT (10 * ZCP_DEFAULT_INSTRLIMIT) #define ZCP_DEFAULT_MEMLIMIT (10 * 1024 * 1024) #define ZCP_MAX_MEMLIMIT (10 * ZCP_DEFAULT_MEMLIMIT) + +/* + * nvlist name constants. Facilitate restricting snapshot iteration range for + * the "list next snapshot" ioctl + */ +#define SNAP_ITER_MIN_TXG "snap_iter_min_txg" +#define SNAP_ITER_MAX_TXG "snap_iter_max_txg" /* * Sysevent payload members. ZFS will generate the following sysevents with the From owner-svn-src-all@freebsd.org Sat Oct 26 17:49:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D5E917B2D4; Sat, 26 Oct 2019 17:49:52 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: from mail-qt1-f193.google.com (mail-qt1-f193.google.com [209.85.160.193]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470pQl4jvdz4RMS; Sat, 26 Oct 2019 17:49:51 +0000 (UTC) (envelope-from antoine.brodin.freebsd@gmail.com) Received: by mail-qt1-f193.google.com with SMTP id z22so8283864qtq.11; Sat, 26 Oct 2019 10:49:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=YYjBQeOqXdwq0ULNQPnsrKlpNITOIU7jPXhFmSLzK1E=; b=U1FqTL6kzaX0D3puGhGDz3+teOcC4+Zn5TQxcCrQxJpGvST3KSgAK4yg1ulIwPfBsF PPmpv9N0iUOoobnSKGmug0jaLHHePz+vHRqvF0nFz/NrAICrZo7d5Em0mF4VaqD/5ZKf EYKZ2KmLdEcQlGv9cbh7kO9XwhGg3yCtddmzvmwtIpYcXwhTfyfuY3CgEXRn846JdWza KmVwlNuYMssTr+uyBcRlxUGIgFhMyFtw6mL8dmNywwXMres3N4fsQeXntJV/hBKu8DGN pL1s0jnjc39bGA0cInUlNG4fvSNf2BurzTQ8U70+Q32W80oU7snqGUJESXUShJMMcS54 QLNw== X-Gm-Message-State: APjAAAVafUkB34I/9MIFbCy6/6iu1hGXSHfserH2aBaRBqW39rldz7Va rsG2PDK8Nk4mra6g5d/yatHTPEsC3dD91FR8f40= X-Google-Smtp-Source: APXvYqyAU3vafLBF+EKhPq7fMNYpMoxd37+HN0wRwghf6P9OoZ743Y6shTPnmfNT0OENkPUurBTOuY2M4vCxpwAswNg= X-Received: by 2002:ac8:1413:: with SMTP id k19mr9700010qtj.360.1572112190050; Sat, 26 Oct 2019 10:49:50 -0700 (PDT) MIME-Version: 1.0 References: <201910252009.x9PK9gIV092660@repo.freebsd.org> <20191026082655.GJ73312@kib.kiev.ua> <20191026130048.GL73312@kib.kiev.ua> In-Reply-To: <20191026130048.GL73312@kib.kiev.ua> From: Antoine Brodin Date: Sat, 26 Oct 2019 19:49:38 +0200 Message-ID: Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern To: Konstantin Belousov Cc: src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org, Gerald Pfeifer Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 470pQl4jvdz4RMS X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of antoinebrodinfreebsd@gmail.com designates 209.85.160.193 as permitted sender) smtp.mailfrom=antoinebrodinfreebsd@gmail.com X-Spamd-Result: default: False [-3.55 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; MIME_TRACE(0.00)[0:+]; DMARC_NA(0.00)[freebsd.org]; RWL_MAILSPIKE_GOOD(0.00)[193.160.85.209.rep.mailspike.net : 127.0.0.18]; RCPT_COUNT_FIVE(0.00)[5]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[193.160.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.55)[ip: (-2.42), ipnet: 209.85.128.0/17(-3.22), asn: 15169(-2.05), country: US(-0.05)]; FORGED_SENDER(0.30)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; FREEMAIL_TO(0.00)[gmail.com]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; FROM_NEQ_ENVFROM(0.00)[antoine@freebsd.org,antoinebrodinfreebsd@gmail.com]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 17:49:52 -0000 On Sat, Oct 26, 2019 at 3:01 PM Konstantin Belousov wrote: > On Sat, Oct 26, 2019 at 02:16:19PM +0200, Antoine Brodin wrote: > > On Sat, Oct 26, 2019 at 10:27 AM Konstantin Belousov > > wrote: > > > On Sat, Oct 26, 2019 at 08:24:09AM +0200, Antoine Brodin wrote: > > > > On Fri, Oct 25, 2019 at 10:09 PM Konstantin Belousov wrote: > > > > > > > > > > Author: kib > > > > > Date: Fri Oct 25 20:09:42 2019 > > > > > New Revision: 354095 > > > > > URL: https://svnweb.freebsd.org/changeset/base/354095 > > > > > > > > > > Log: > > > > > amd64: move pcb out of kstack to struct thread. > > > > > > > > > > This saves 320 bytes of the precious stack space. > > > > > > > > > > The only negative aspect of the change I can think of is that the > > > > > struct thread increased by 320 bytes obviously, and that 320 bytes are > > > > > not swapped out anymore. I believe the freed stack space is much more > > > > > important than that. Also, current struct thread size is 1392 bytes > > > > > on amd64, so UMA will allocate two thread structures per (4KB) slab, > > > > > which leaves a space for pcb without increasing zone memory use. > > > > > > > > > > Reviewed by: alc, markj > > > > > Tested by: pho > > > > > Sponsored by: The FreeBSD Foundation > > > > > MFC after: 2 weeks > > > > > Differential revision: https://reviews.freebsd.org/D22138 > > > > > > > > Hi, > > > > > > > > It seems that this breaks at least some versions of gcc: > > > > > > > > In file included from /usr/include/sys/proc.h:75, > > > > from /usr/include/sys/user.h:51, > > > > from ./md-unwind-support.h:34, > > > > from > > > > /wrkdirs/usr/ports/lang/gcc10-devel/work/gcc-10-20191020/libgcc/unwind-dw2.c:412: > > > > /usr/include/machine/proc.h:76:13: error: field 'md_pcb' has incomplete type > > > > 76 | struct pcb md_pcb; > > > > | ^~~~~~ > > > > > > > > > > It is very strange. Are gcc 9 or 8 affected ? > > > > gcc 8 and 9 are affected too. > Then this is a completely different cause then I guessed below, and I think > I know why. All of 8/9/10 gcc ports have support for multiarch, and the > error must happen for gcc or xgcc invocation with -m32, am I right ? > > If yes, please try the patch at the end of the message instead. > > diff --git a/sys/amd64/include/pcb.h b/sys/amd64/include/pcb.h > index 44e34fa5c83..8800b355c9a 100644 > --- a/sys/amd64/include/pcb.h > +++ b/sys/amd64/include/pcb.h > @@ -116,6 +116,10 @@ struct susppcb { > /* fpu context for suspend/resume */ > void *sp_fpususpend; > }; > +#else /* 32bit */ > +struct pcb { > + uint64_t pcb_dummy[40]; > +}; > #endif > > #ifdef _KERNEL Hi, It builds fine with this patch. Antoine From owner-svn-src-all@freebsd.org Sat Oct 26 17:51:44 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04A2917B3C7; Sat, 26 Oct 2019 17:51:44 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470pSv6Prdz4RYk; Sat, 26 Oct 2019 17:51:43 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C0174B8D4; Sat, 26 Oct 2019 17:51:43 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QHph6j068730; Sat, 26 Oct 2019 17:51:43 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QHphtw068729; Sat, 26 Oct 2019 17:51:43 GMT (envelope-from manu@FreeBSD.org) Message-Id: <201910261751.x9QHphtw068729@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Sat, 26 Oct 2019 17:51:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354117 - head/sys/modules/dtb/rockchip X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/modules/dtb/rockchip X-SVN-Commit-Revision: 354117 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 17:51:44 -0000 Author: manu Date: Sat Oct 26 17:51:43 2019 New Revision: 354117 URL: https://svnweb.freebsd.org/changeset/base/354117 Log: arm64: rockchip: dts: Build the Khadas board DTS We boot on thoses boards so build them. Submitted by: s199p.wa1k9r@gmail.com MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D22158 Modified: head/sys/modules/dtb/rockchip/Makefile Modified: head/sys/modules/dtb/rockchip/Makefile ============================================================================== --- head/sys/modules/dtb/rockchip/Makefile Sat Oct 26 17:11:02 2019 (r354116) +++ head/sys/modules/dtb/rockchip/Makefile Sat Oct 26 17:51:43 2019 (r354117) @@ -1,6 +1,9 @@ # $FreeBSD$ DTS= \ + rockchip/rk3399-khadas-edge-captain.dts \ + rockchip/rk3399-khadas-edge.dts \ + rockchip/rk3399-khadas-edge-v.dts \ rockchip/rk3328-rock64.dts \ rockchip/rk3399-rockpro64.dts From owner-svn-src-all@freebsd.org Sat Oct 26 18:22:52 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BCE4E17C8B7; Sat, 26 Oct 2019 18:22:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470q8r4d8hz4TX2; Sat, 26 Oct 2019 18:22:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 804F5C054; Sat, 26 Oct 2019 18:22:52 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QIMqZb086867; Sat, 26 Oct 2019 18:22:52 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QIMqN0086866; Sat, 26 Oct 2019 18:22:52 GMT (envelope-from kib@FreeBSD.org) Message-Id: <201910261822.x9QIMqN0086866@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sat, 26 Oct 2019 18:22:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354118 - head/sys/amd64/include X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/include X-SVN-Commit-Revision: 354118 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 18:22:52 -0000 Author: kib Date: Sat Oct 26 18:22:52 2019 New Revision: 354118 URL: https://svnweb.freebsd.org/changeset/base/354118 Log: Provide dummy definition of the amd64 struct pcb for -m32 compilation. I do not see a need in the proper x86/include/pcb.h header. Reported and tested by: antoine MFC after: 1 week Modified: head/sys/amd64/include/pcb.h Modified: head/sys/amd64/include/pcb.h ============================================================================== --- head/sys/amd64/include/pcb.h Sat Oct 26 17:51:43 2019 (r354117) +++ head/sys/amd64/include/pcb.h Sat Oct 26 18:22:52 2019 (r354118) @@ -116,6 +116,10 @@ struct susppcb { /* fpu context for suspend/resume */ void *sp_fpususpend; }; +#else /* 32bit */ +struct pcb { + uint64_t pcb_dummy[40]; +}; #endif #ifdef _KERNEL From owner-svn-src-all@freebsd.org Sat Oct 26 18:29:03 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 47E3E17CC0B; Sat, 26 Oct 2019 18:29:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470qHz11Hzz4TnL; Sat, 26 Oct 2019 18:29:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 05DC4C06C; Sat, 26 Oct 2019 18:29:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QIT2wi087180; Sat, 26 Oct 2019 18:29:02 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QIT2hY087179; Sat, 26 Oct 2019 18:29:02 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <201910261829.x9QIT2hY087179@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Sat, 26 Oct 2019 18:29:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354119 - head/stand/libsa/zfs X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/libsa/zfs X-SVN-Commit-Revision: 354119 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 18:29:03 -0000 Author: tsoome Date: Sat Oct 26 18:29:02 2019 New Revision: 354119 URL: https://svnweb.freebsd.org/changeset/base/354119 Log: loader: rs_alloc() may return NULL rs_alloc() in zfs reader code may return NULL, so we need to check the return value and error out if needed. MFC after: 1 week Modified: head/stand/libsa/zfs/zfsimpl.c Modified: head/stand/libsa/zfs/zfsimpl.c ============================================================================== --- head/stand/libsa/zfs/zfsimpl.c Sat Oct 26 18:22:52 2019 (r354118) +++ head/stand/libsa/zfs/zfsimpl.c Sat Oct 26 18:29:02 2019 (r354119) @@ -840,12 +840,17 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 list_t stack; spa_t *spa = vd->spa; zio_t *zio = arg; + remap_segment_t *rs; list_create(&stack, sizeof (remap_segment_t), offsetof(remap_segment_t, rs_node)); - for (remap_segment_t *rs = rs_alloc(vd, offset, asize, 0); - rs != NULL; rs = list_remove_head(&stack)) { + rs = rs_alloc(vd, offset, asize, 0); + if (rs == NULL) { + printf("vdev_indirect_remap: out of memory.\n"); + zio->io_error = ENOMEM; + } + for ( ; rs != NULL; rs = list_remove_head(&stack)) { vdev_t *v = rs->rs_vd; uint64_t num_entries = 0; /* vdev_indirect_mapping_t *vim = v->v_mapping; */ @@ -853,6 +858,9 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 vdev_indirect_mapping_duplicate_adjacent_entries(v, rs->rs_offset, rs->rs_asize, &num_entries); + if (num_entries == 0) + zio->io_error = ENOMEM; + for (uint64_t i = 0; i < num_entries; i++) { vdev_indirect_mapping_entry_phys_t *m = &mapping[i]; uint64_t size = DVA_GET_ASIZE(&m->vimep_dst); @@ -865,9 +873,18 @@ vdev_indirect_remap(vdev_t *vd, uint64_t offset, uint6 vdev_t *dst_v = vdev_lookup_top(spa, dst_vdev); if (dst_v->v_read == vdev_indirect_read) { - list_insert_head(&stack, - rs_alloc(dst_v, dst_offset + inner_offset, - inner_size, rs->rs_split_offset)); + remap_segment_t *o; + + o = rs_alloc(dst_v, dst_offset + inner_offset, + inner_size, rs->rs_split_offset); + if (o == NULL) { + printf("vdev_indirect_remap: " + "out of memory.\n"); + zio->io_error = ENOMEM; + break; + } + + list_insert_head(&stack, o); } vdev_indirect_gather_splits(rs->rs_split_offset, dst_v, dst_offset + inner_offset, From owner-svn-src-all@freebsd.org Sat Oct 26 18:37:05 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A80017CF30; Sat, 26 Oct 2019 18:37:05 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from mail.macktronics.com (coco.macktronics.com [209.181.253.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 470qTF0VVxz4VCt; Sat, 26 Oct 2019 18:37:04 +0000 (UTC) (envelope-from mack@macktronics.com) Received: from olive.macktronics.com (unknown [209.181.253.67]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.macktronics.com (Postfix) with ESMTPS id 36F861456F; Sat, 26 Oct 2019 13:36:58 -0500 (CDT) Date: Sat, 26 Oct 2019 13:36:57 -0500 (CDT) From: Dan Mack X-X-Sender: mack@localhost.local To: Alan Somers cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354116 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs In-Reply-To: <201910261711.x9QHB308040398@repo.freebsd.org> Message-ID: References: <201910261711.x9QHB308040398@repo.freebsd.org> User-Agent: Alpine 2.20 (GSO 67 2015-01-07) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed X-Rspamd-Queue-Id: 470qTF0VVxz4VCt X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.99 / 15.00]; NEURAL_HAM_MEDIUM(-0.99)[-0.987,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 18:37:05 -0000 This appears to have broken my buildworld unless I did something wrong on my end: Last Changed Rev: 354116 snip ... ===> lib/ofed/libibumad (all) --- all_subdir_lib/libbe --- /usr/src/lib/libbe/be_info.c:260:67: error: too few arguments to function call, expected 5, have 3 return (zfs_iter_snapshots_sorted(hdl, prop_list_builder_cb, data)); ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ /usr/src/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h:575:1: note: 'zfs_iter_snapshots_sorted' declared here extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *, ^ 1 error generated. *** [be_info.o] Error code 1 On Sat, 26 Oct 2019, Alan Somers wrote: > Author: asomers > Date: Sat Oct 26 17:11:02 2019 > New Revision: 354116 > URL: https://svnweb.freebsd.org/changeset/base/354116 > > Log: > MFZoL: Avoid retrieving unused snapshot props > > This patch modifies the zfs_ioc_snapshot_list_next() ioctl to enable it > to take input parameters that alter the way looping through the list of > snapshots is performed. The idea here is to restrict functions that > throw away some of the snapshots returned by the ioctl to a range of > snapshots that these functions actually use. This improves efficiency > and execution speed for some rollback and send operations. > > Reviewed-by: Tom Caputi > Reviewed-by: Brian Behlendorf > Reviewed by: Matt Ahrens > Signed-off-by: Alek Pinchuk > Closes #8077 > zfsonlinux/zfs@4c0883fb4af0d5565459099b98fcf90ecbfa1ca1 > > MFC after: 2 weeks > > Modified: > head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c > head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c > head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h > > Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Sat Oct 26 17:10:27 2019 (r354115) > +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c Sat Oct 26 17:11:02 2019 (r354116) > @@ -139,7 +139,7 @@ zfs_callback(zfs_handle_t *zhp, void *data) > ZFS_TYPE_BOOKMARK)) == 0) && include_snaps) > (void) zfs_iter_snapshots(zhp, > (cb->cb_flags & ZFS_ITER_SIMPLE) != 0, zfs_callback, > - data); > + data, 0, 0); > if (((zfs_get_type(zhp) & (ZFS_TYPE_SNAPSHOT | > ZFS_TYPE_BOOKMARK)) == 0) && include_bmarks) > (void) zfs_iter_bookmarks(zhp, zfs_callback, data); > > Modified: head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c > ============================================================================== > --- head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 26 17:10:27 2019 (r354115) > +++ head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c Sat Oct 26 17:11:02 2019 (r354116) > @@ -30,7 +30,7 @@ > * Copyright (c) 2014 Integros [integros.com] > * Copyright 2016 Igor Kozhukhov . > * Copyright 2016 Nexenta Systems, Inc. > - * Copyright (c) 2018 Datto Inc. > + * Copyright (c) 2019 Datto Inc. > */ > > #include > @@ -1174,7 +1174,7 @@ destroy_print_snapshots(zfs_handle_t *fs_zhp, destroy_ > int err = 0; > assert(cb->cb_firstsnap == NULL); > assert(cb->cb_prevsnap == NULL); > - err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb); > + err = zfs_iter_snapshots_sorted(fs_zhp, destroy_print_cb, cb, 0, 0); > if (cb->cb_firstsnap != NULL) { > uint64_t used = 0; > if (err == 0) { > @@ -3437,6 +3437,7 @@ zfs_do_promote(int argc, char **argv) > */ > typedef struct rollback_cbdata { > uint64_t cb_create; > + uint8_t cb_younger_ds_printed; > boolean_t cb_first; > int cb_doclones; > char *cb_target; > @@ -3467,15 +3468,20 @@ rollback_check_dependent(zfs_handle_t *zhp, void *data > } > > /* > - * Report any snapshots more recent than the one specified. Used when '-r' is > - * not specified. We reuse this same callback for the snapshot dependents - if > - * 'cb_dependent' is set, then this is a dependent and we should report it > - * without checking the transaction group. > + * Report some snapshots/bookmarks more recent than the one specified. > + * Used when '-r' is not specified. We reuse this same callback for the > + * snapshot dependents - if 'cb_dependent' is set, then this is a > + * dependent and we should report it without checking the transaction group. > */ > static int > rollback_check(zfs_handle_t *zhp, void *data) > { > rollback_cbdata_t *cbp = data; > + /* > + * Max number of younger snapshots and/or bookmarks to display before > + * we stop the iteration. > + */ > + const uint8_t max_younger = 32; > > if (cbp->cb_doclones) { > zfs_close(zhp); > @@ -3504,9 +3510,24 @@ rollback_check(zfs_handle_t *zhp, void *data) > } else { > (void) fprintf(stderr, "%s\n", > zfs_get_name(zhp)); > + cbp->cb_younger_ds_printed++; > } > } > zfs_close(zhp); > + > + if (cbp->cb_younger_ds_printed == max_younger) { > + /* > + * This non-recursive rollback is going to fail due to the > + * presence of snapshots and/or bookmarks that are younger than > + * the rollback target. > + * We printed some of the offending objects, now we stop > + * zfs_iter_snapshot/bookmark iteration so we can fail fast and > + * avoid iterating over the rest of the younger objects > + */ > + (void) fprintf(stderr, gettext("Output limited to %d " > + "snapshots/bookmarks\n"), max_younger); > + return (-1); > + } > return (0); > } > > @@ -3520,6 +3541,7 @@ zfs_do_rollback(int argc, char **argv) > zfs_handle_t *zhp, *snap; > char parentname[ZFS_MAX_DATASET_NAME_LEN]; > char *delim; > + uint64_t min_txg = 0; > > /* check options */ > while ((c = getopt(argc, argv, "rRf")) != -1) { > @@ -3575,7 +3597,12 @@ zfs_do_rollback(int argc, char **argv) > cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG); > cb.cb_first = B_TRUE; > cb.cb_error = 0; > - if ((ret = zfs_iter_snapshots(zhp, B_FALSE, rollback_check, &cb)) != 0) > + > + if (cb.cb_create > 0) > + min_txg = cb.cb_create; > + > + if ((ret = zfs_iter_snapshots(zhp, B_FALSE, rollback_check, &cb, > + min_txg, 0)) != 0) > goto out; > if ((ret = zfs_iter_bookmarks(zhp, rollback_check, &cb)) != 0) > goto out; > > Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h > ============================================================================== > --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Oct 26 17:10:27 2019 (r354115) > +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h Sat Oct 26 17:11:02 2019 (r354116) > @@ -28,7 +28,7 @@ > * Copyright (c) 2013 Steven Hartland. All rights reserved. > * Copyright (c) 2014 Integros [integros.com] > * Copyright 2016 Nexenta Systems, Inc. > - * Copyright (c) 2017 Datto Inc. > + * Copyright (c) 2019 Datto Inc. > */ > > #ifndef _LIBZFS_H > @@ -570,8 +570,10 @@ extern int zfs_iter_root(libzfs_handle_t *, zfs_iter_f > extern int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *); > extern int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, void *); > extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *); > -extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *); > -extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *); > +extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *, > + uint64_t, uint64_t); > +extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *, > + uint64_t, uint64_t); > extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *); > extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *); > > > Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c > ============================================================================== > --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Oct 26 17:10:27 2019 (r354115) > +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c Sat Oct 26 17:11:02 2019 (r354116) > @@ -31,6 +31,7 @@ > * Copyright 2017 Nexenta Systems, Inc. > * Copyright 2016 Igor Kozhukhov > * Copyright 2017-2018 RackTop Systems. > + * Copyright (c) 2019 Datto Inc. > */ > > #include > @@ -4163,7 +4164,7 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo > rollback_data_t cb = { 0 }; > int err; > boolean_t restore_resv = 0; > - uint64_t old_volsize = 0, new_volsize; > + uint64_t min_txg = 0, old_volsize = 0, new_volsize; > zfs_prop_t resv_prop; > > assert(zhp->zfs_type == ZFS_TYPE_FILESYSTEM || > @@ -4175,7 +4176,13 @@ zfs_rollback(zfs_handle_t *zhp, zfs_handle_t *snap, bo > cb.cb_force = force; > cb.cb_target = snap->zfs_name; > cb.cb_create = zfs_prop_get_int(snap, ZFS_PROP_CREATETXG); > - (void) zfs_iter_snapshots(zhp, B_FALSE, rollback_destroy, &cb); > + > + if (cb.cb_create > 0) > + min_txg = cb.cb_create; > + > + (void) zfs_iter_snapshots(zhp, B_FALSE, rollback_destroy, &cb, > + min_txg, 0); > + > (void) zfs_iter_bookmarks(zhp, rollback_destroy, &cb); > > if (cb.cb_error) > > Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c > ============================================================================== > --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Sat Oct 26 17:10:27 2019 (r354115) > +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c Sat Oct 26 17:11:02 2019 (r354116) > @@ -24,6 +24,7 @@ > * Copyright (c) 2013, 2015 by Delphix. All rights reserved. > * Copyright (c) 2012 Pawel Jakub Dawidek. All rights reserved. > * Copyright 2014 Nexenta Systems, Inc. All rights reserved. > + * Copyright (c) 2019 Datto Inc. > */ > > #include > @@ -139,11 +140,12 @@ zfs_iter_filesystems(zfs_handle_t *zhp, zfs_iter_f fun > */ > int > zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple, zfs_iter_f func, > - void *data) > + void *data, uint64_t min_txg, uint64_t max_txg) > { > zfs_cmd_t zc = { 0 }; > zfs_handle_t *nzhp; > int ret; > + nvlist_t *range_nvl = NULL; > > if (zhp->zfs_type == ZFS_TYPE_SNAPSHOT || > zhp->zfs_type == ZFS_TYPE_BOOKMARK) > @@ -153,6 +155,24 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple > > if (zcmd_alloc_dst_nvlist(zhp->zfs_hdl, &zc, 0) != 0) > return (-1); > + > + if (min_txg != 0) { > + range_nvl = fnvlist_alloc(); > + fnvlist_add_uint64(range_nvl, SNAP_ITER_MIN_TXG, min_txg); > + } > + if (max_txg != 0) { > + if (range_nvl == NULL) > + range_nvl = fnvlist_alloc(); > + fnvlist_add_uint64(range_nvl, SNAP_ITER_MAX_TXG, max_txg); > + } > + > + if (range_nvl != NULL && > + zcmd_write_src_nvlist(zhp->zfs_hdl, &zc, range_nvl) != 0) { > + zcmd_free_nvlists(&zc); > + fnvlist_free(range_nvl); > + return (-1); > + } > + > while ((ret = zfs_do_list_ioctl(zhp, ZFS_IOC_SNAPSHOT_LIST_NEXT, > &zc)) == 0) { > > @@ -165,10 +185,12 @@ zfs_iter_snapshots(zfs_handle_t *zhp, boolean_t simple > > if ((ret = func(nzhp, data)) != 0) { > zcmd_free_nvlists(&zc); > + fnvlist_free(range_nvl); > return (ret); > } > } > zcmd_free_nvlists(&zc); > + fnvlist_free(range_nvl); > return ((ret < 0) ? ret : 0); > } > > @@ -276,7 +298,8 @@ zfs_snapshot_compare(const void *larg, const void *rar > } > > int > -zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_f callback, void *data) > +zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_f callback, void *data, > + uint64_t min_txg, uint64_t max_txg) > { > int ret = 0; > zfs_node_t *node; > @@ -286,7 +309,8 @@ zfs_iter_snapshots_sorted(zfs_handle_t *zhp, zfs_iter_ > avl_create(&avl, zfs_snapshot_compare, > sizeof (zfs_node_t), offsetof(zfs_node_t, zn_avlnode)); > > - ret = zfs_iter_snapshots(zhp, B_FALSE, zfs_sort_snaps, &avl); > + ret = zfs_iter_snapshots(zhp, B_FALSE, zfs_sort_snaps, &avl, min_txg, > + max_txg); > > for (node = avl_first(&avl); node != NULL; node = AVL_NEXT(&avl, node)) > ret |= callback(node->zn_handle, data); > @@ -389,7 +413,7 @@ zfs_iter_snapspec(zfs_handle_t *fs_zhp, const char *sp > } > > err = zfs_iter_snapshots_sorted(fs_zhp, > - snapspec_cb, &ssa); > + snapspec_cb, &ssa, 0, 0); > if (ret == 0) > ret = err; > if (ret == 0 && (!ssa.ssa_seenfirst || > @@ -429,7 +453,7 @@ zfs_iter_children(zfs_handle_t *zhp, zfs_iter_f func, > { > int ret; > > - if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data)) != 0) > + if ((ret = zfs_iter_snapshots(zhp, B_FALSE, func, data, 0, 0)) != 0) > return (ret); > > return (zfs_iter_filesystems(zhp, func, data)); > @@ -495,7 +519,7 @@ iter_dependents_cb(zfs_handle_t *zhp, void *arg) > err = zfs_iter_filesystems(zhp, iter_dependents_cb, ida); > if (err == 0) { > err = zfs_iter_snapshots(zhp, B_FALSE, > - iter_dependents_cb, ida); > + iter_dependents_cb, ida, 0, 0); > } > ida->stack = isf.next; > } > > Modified: head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c > ============================================================================== > --- head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 26 17:10:27 2019 (r354115) > +++ head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c Sat Oct 26 17:11:02 2019 (r354116) > @@ -28,6 +28,7 @@ > * Copyright 2015, OmniTI Computer Consulting, Inc. All rights reserved. > * Copyright (c) 2014 Integros [integros.com] > * Copyright 2016 Igor Kozhukhov > + * Copyright (c) 2019 Datto Inc. > */ > > #include > @@ -612,6 +613,7 @@ typedef struct send_data { > const char *tosnap; > boolean_t recursive; > boolean_t verbose; > + boolean_t replicate; > > /* > * The header nvlist is of the following format: > @@ -789,6 +791,7 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) > send_data_t *sd = arg; > nvlist_t *nvfs, *nv; > int rv = 0; > + uint64_t min_txg = 0, max_txg = 0; > uint64_t parent_fromsnap_guid_save = sd->parent_fromsnap_guid; > uint64_t fromsnap_txg_save = sd->fromsnap_txg; > uint64_t tosnap_txg_save = sd->tosnap_txg; > @@ -832,10 +835,10 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) > goto out; > } > > - VERIFY(0 == nvlist_alloc(&nvfs, NV_UNIQUE_NAME, 0)); > - VERIFY(0 == nvlist_add_string(nvfs, "name", zhp->zfs_name)); > - VERIFY(0 == nvlist_add_uint64(nvfs, "parentfromsnap", > - sd->parent_fromsnap_guid)); > + nvfs = fnvlist_alloc(); > + fnvlist_add_string(nvfs, "name", zhp->zfs_name); > + fnvlist_add_uint64(nvfs, "parentfromsnap", > + sd->parent_fromsnap_guid); > > if (zhp->zfs_dmustats.dds_origin[0]) { > zfs_handle_t *origin = zfs_open(zhp->zfs_hdl, > @@ -855,14 +858,19 @@ send_iterate_fs(zfs_handle_t *zhp, void *arg) > nvlist_free(nv); > > /* iterate over snaps, and set sd->parent_fromsnap_guid */ > + if (!sd->replicate && fromsnap_txg != 0) > + min_txg = fromsnap_txg; > + if (!sd->replicate && tosnap_txg != 0) > + max_txg = tosnap_txg; > sd->parent_fromsnap_guid = 0; > VERIFY(0 == nvlist_alloc(&sd->parent_snaps, NV_UNIQUE_NAME, 0)); > VERIFY(0 == nvlist_alloc(&sd->snapprops, NV_UNIQUE_NAME, 0)); > - (void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd); > + (void) zfs_iter_snapshots_sorted(zhp, send_iterate_snap, sd, > + min_txg, max_txg); > VERIFY(0 == nvlist_add_nvlist(nvfs, "snaps", sd->parent_snaps)); > VERIFY(0 == nvlist_add_nvlist(nvfs, "snapprops", sd->snapprops)); > - nvlist_free(sd->parent_snaps); > - nvlist_free(sd->snapprops); > + fnvlist_free(sd->parent_snaps); > + fnvlist_free(sd->snapprops); > > /* add this fs to nvlist */ > (void) snprintf(guidstring, sizeof (guidstring), > @@ -886,11 +894,12 @@ out: > static int > gather_nvlist(libzfs_handle_t *hdl, const char *fsname, const char *fromsnap, > const char *tosnap, boolean_t recursive, boolean_t verbose, > - nvlist_t **nvlp, avl_tree_t **avlp) > + boolean_t replicate, nvlist_t **nvlp, avl_tree_t **avlp) > { > zfs_handle_t *zhp; > - send_data_t sd = { 0 }; > int error; > + uint64_t min_txg = 0, max_txg = 0; > + send_data_t sd = { 0 }; > > zhp = zfs_open(hdl, fsname, ZFS_TYPE_FILESYSTEM | ZFS_TYPE_VOLUME); > if (zhp == NULL) > @@ -902,6 +911,7 @@ gather_nvlist(libzfs_handle_t *hdl, const char *fsname > sd.tosnap = tosnap; > sd.recursive = recursive; > sd.verbose = verbose; > + sd.replicate = replicate; > > if ((error = send_iterate_fs(zhp, &sd)) != 0) { > nvlist_free(sd.fss); > @@ -1338,6 +1348,7 @@ static int > dump_filesystem(zfs_handle_t *zhp, void *arg) > { > int rv = 0; > + uint64_t min_txg = 0, max_txg = 0; > send_dump_data_t *sdd = arg; > boolean_t missingfrom = B_FALSE; > zfs_cmd_t zc = { 0 }; > @@ -1373,7 +1384,15 @@ dump_filesystem(zfs_handle_t *zhp, void *arg) > if (sdd->fromsnap == NULL || missingfrom) > sdd->seenfrom = B_TRUE; > > - rv = zfs_iter_snapshots_sorted(zhp, dump_snapshot, arg); > + if (!sdd->replicate && sdd->fromsnap != NULL) > + min_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, > + sdd->fromsnap); > + if (!sdd->replicate && sdd->tosnap != NULL) > + max_txg = get_snap_txg(zhp->zfs_hdl, zhp->zfs_name, > + sdd->tosnap); > + > + rv = zfs_iter_snapshots_sorted(zhp, dump_snapshot, arg, > + min_txg, max_txg); > if (!sdd->seenfrom) { > (void) fprintf(stderr, dgettext(TEXT_DOMAIN, > "WARNING: could not send %s@%s:\n" > @@ -1834,7 +1853,7 @@ zfs_send(zfs_handle_t *zhp, const char *fromsnap, cons > > err = gather_nvlist(zhp->zfs_hdl, zhp->zfs_name, > fromsnap, tosnap, flags->replicate, flags->verbose, > - &fss, &fsavl); > + flags->replicate, &fss, &fsavl); > if (err) > goto err_out; > VERIFY(0 == nvlist_add_nvlist(hdrnv, "fss", fss)); > @@ -2477,7 +2496,7 @@ again: > VERIFY(0 == nvlist_alloc(&deleted, NV_UNIQUE_NAME, 0)); > > if ((error = gather_nvlist(hdl, tofs, fromsnap, NULL, > - recursive, B_FALSE, &local_nv, &local_avl)) != 0) > + recursive, B_FALSE, B_FALSE, &local_nv, &local_avl)) != 0) > return (error); > > /* > @@ -3554,7 +3573,7 @@ zfs_receive_one(libzfs_handle_t *hdl, int infd, const > */ > *cp = '\0'; > if (gather_nvlist(hdl, zc.zc_value, NULL, NULL, B_FALSE, > - B_FALSE, &local_nv, &local_avl) == 0) { > + B_FALSE, B_FALSE, &local_nv, &local_avl) == 0) { > *cp = '@'; > fs = fsavl_find(local_avl, drrb->drr_toguid, NULL); > fsavl_destroy(local_avl); > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 26 17:10:27 2019 (r354115) > +++ head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c Sat Oct 26 17:11:02 2019 (r354116) > @@ -33,7 +33,7 @@ > * Copyright (c) 2014 Integros [integros.com] > * Copyright 2016 Toomas Soome > * Copyright 2017 RackTop Systems. > - * Copyright (c) 2017 Datto Inc. > + * Copyright (c) 2019 Datto Inc. > */ > > /* > @@ -2345,7 +2345,8 @@ dataset_name_hidden(const char *name) > * inputs: > * zc_name name of filesystem > * zc_cookie zap cursor > - * zc_nvlist_dst_size size of buffer for property nvlist > + * zc_nvlist_src iteration range nvlist > + * zc_nvlist_src_size size of iteration range nvlist > * > * outputs: > * zc_name name of next filesystem > @@ -2414,9 +2415,24 @@ top: > static int > zfs_ioc_snapshot_list_next(zfs_cmd_t *zc) > { > - objset_t *os; > int error; > + objset_t *os, *ossnap; > + dsl_dataset_t *ds; > + uint64_t min_txg = 0, max_txg = 0; > > + if (zc->zc_nvlist_src_size != 0) { > + nvlist_t *props = NULL; > + error = get_nvlist(zc->zc_nvlist_src, zc->zc_nvlist_src_size, > + zc->zc_iflags, &props); > + if (error != 0) > + return (error); > + (void) nvlist_lookup_uint64(props, SNAP_ITER_MIN_TXG, > + &min_txg); > + (void) nvlist_lookup_uint64(props, SNAP_ITER_MAX_TXG, > + &max_txg); > + nvlist_free(props); > + } > + > error = dmu_objset_hold(zc->zc_name, FTAG, &os); > if (error != 0) { > return (error == ENOENT ? ESRCH : error); > @@ -2432,26 +2448,52 @@ zfs_ioc_snapshot_list_next(zfs_cmd_t *zc) > return (SET_ERROR(ESRCH)); > } > > - error = dmu_snapshot_list_next(os, > - sizeof (zc->zc_name) - strlen(zc->zc_name), > - zc->zc_name + strlen(zc->zc_name), &zc->zc_obj, &zc->zc_cookie, > - NULL); > + while (error == 0) { > + if (issig(JUSTLOOKING) && issig(FORREAL)) { > + error = SET_ERROR(EINTR); > + break; > + } > > - if (error == 0 && !zc->zc_simple) { > - dsl_dataset_t *ds; > - dsl_pool_t *dp = os->os_dsl_dataset->ds_dir->dd_pool; > + error = dmu_snapshot_list_next(os, > + sizeof (zc->zc_name) - strlen(zc->zc_name), > + zc->zc_name + strlen(zc->zc_name), &zc->zc_obj, > + &zc->zc_cookie, NULL); > + if (error == ENOENT) { > + error = SET_ERROR(ESRCH); > + break; > + } else if (error != 0) { > + break; > + } > > - error = dsl_dataset_hold_obj(dp, zc->zc_obj, FTAG, &ds); > - if (error == 0) { > - objset_t *ossnap; > + error = dsl_dataset_hold_obj(dmu_objset_pool(os), zc->zc_obj, > + FTAG, &ds); > + if (error != 0) > + break; > > - error = dmu_objset_from_ds(ds, &ossnap); > - if (error == 0) > - error = zfs_ioc_objset_stats_impl(zc, ossnap); > + if ((min_txg != 0 && dsl_get_creationtxg(ds) < min_txg) || > + (max_txg != 0 && dsl_get_creationtxg(ds) > max_txg)) { > dsl_dataset_rele(ds, FTAG); > + /* undo snapshot name append */ > + *(strchr(zc->zc_name, '@') + 1) = '\0'; > + /* skip snapshot */ > + continue; > } > - } else if (error == ENOENT) { > - error = SET_ERROR(ESRCH); > + > + if (zc->zc_simple) { > + dsl_dataset_rele(ds, FTAG); > + break; > + } > + > + if ((error = dmu_objset_from_ds(ds, &ossnap)) != 0) { > + dsl_dataset_rele(ds, FTAG); > + break; > + } > + if ((error = zfs_ioc_objset_stats_impl(zc, ossnap)) != 0) { > + dsl_dataset_rele(ds, FTAG); > + break; > + } > + dsl_dataset_rele(ds, FTAG); > + break; > } > > dmu_objset_rele(os, FTAG); > > Modified: head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h > ============================================================================== > --- head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Oct 26 17:10:27 2019 (r354115) > +++ head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h Sat Oct 26 17:11:02 2019 (r354116) > @@ -26,7 +26,7 @@ > * Copyright (c) 2012, Martin Matuska . All rights reserved. > * Copyright (c) 2014 Integros [integros.com] > * Copyright 2017 Joyent, Inc. > - * Copyright (c) 2017 Datto Inc. > + * Copyright (c) 2019 Datto Inc. > */ > > /* Portions Copyright 2010 Robert Milkowski */ > @@ -1122,6 +1122,13 @@ typedef enum { > #define ZCP_MAX_INSTRLIMIT (10 * ZCP_DEFAULT_INSTRLIMIT) > #define ZCP_DEFAULT_MEMLIMIT (10 * 1024 * 1024) > #define ZCP_MAX_MEMLIMIT (10 * ZCP_DEFAULT_MEMLIMIT) > + > +/* > + * nvlist name constants. Facilitate restricting snapshot iteration range for > + * the "list next snapshot" ioctl > + */ > +#define SNAP_ITER_MIN_TXG "snap_iter_min_txg" > +#define SNAP_ITER_MAX_TXG "snap_iter_max_txg" > > /* > * Sysevent payload members. ZFS will generate the following sysevents with the > _______________________________________________ > svn-src-all@freebsd.org mailing list > https://lists.freebsd.org/mailman/listinfo/svn-src-all > To unsubscribe, send any mail to "svn-src-all-unsubscribe@freebsd.org" > From owner-svn-src-all@freebsd.org Sat Oct 26 19:12:10 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7241417DDE5; Sat, 26 Oct 2019 19:12:10 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-ot1-f49.google.com (mail-ot1-f49.google.com [209.85.210.49]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470rFj4j6gz4X35; Sat, 26 Oct 2019 19:12:09 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-ot1-f49.google.com with SMTP id 94so4258949oty.8; Sat, 26 Oct 2019 12:12:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Yi0JN2o4i86NL+YaFGIAI2SSyoZt5F9u6aiN1Jv6eGk=; b=Bc+bqqt6CtHFh7VhlYXNMi1mWL0mXnRTtRjcwIsXEni2Y4yMJ6SYTbZ90zxSZMfkxd O63Rkq5vffClHsAIxvHTUUHaXhdSzNDSzoo56xBejlfdmFiuJbMtAY5pSwUHyBYQGal+ LzIklWiy9UU4Dx1B/c840SaAdM4bqzeC1AVF+/d6n36CfXvycoDUGSJgP7DQ3c9isvsP X1Gzk4WyNx36IaYC2jyuUwqJn+NCmtrMGmAzjHQqTeQcbrno3tM+N3a9uuWOsElfqx3v ml+C4X+Q0Fp2ws4B43S9RjAxO/7Ys5rDfdD3AcrK6TbTgy/dxpy8/rJZGOqavpZ2x03z dbqQ== X-Gm-Message-State: APjAAAW/LK229HTEB4wY8CJjCJDPIhpYzofehROVn/VnroFKT6Y/YycE KbZB0eGFkFP4fW4gmCPcrx3evReSUnyhOMFdA4mvl0zU X-Google-Smtp-Source: APXvYqz6EMQVgSUhr+gbiaEwG6R9EDjqJMw7YVbTfjD4B8U8YC0pB8iRXmaip/IYSXofwbQiG61K3Su42fVaJL9ebmw= X-Received: by 2002:a9d:5f0f:: with SMTP id f15mr7314245oti.251.1572117127979; Sat, 26 Oct 2019 12:12:07 -0700 (PDT) MIME-Version: 1.0 References: <201910261711.x9QHB308040398@repo.freebsd.org> In-Reply-To: From: Alan Somers Date: Sat, 26 Oct 2019 13:11:56 -0600 Message-ID: Subject: Re: svn commit: r354116 - in head: cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/lib/libzfs/common sys/cddl/contrib/opensolaris/uts/common/fs/zfs sys/cddl/contrib/opensolaris/uts/common/sys/fs To: Dan Mack Cc: src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 470rFj4j6gz4X35 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of asomers@gmail.com designates 209.85.210.49 as permitted sender) smtp.mailfrom=asomers@gmail.com X-Spamd-Result: default: False [-2.12 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-0.998,0]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[multipart/alternative,text/plain]; DMARC_NA(0.00)[freebsd.org]; URI_COUNT_ODD(1.00)[3]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; RCVD_IN_DNSWL_NONE(0.00)[49.210.85.209.list.dnswl.org : 127.0.5.0]; IP_SCORE(-1.12)[ip: (-0.26), ipnet: 209.85.128.0/17(-3.22), asn: 15169(-2.05), country: US(-0.05)]; FORGED_SENDER(0.30)[asomers@freebsd.org,asomers@gmail.com]; MIME_TRACE(0.00)[0:+,1:+,2:~]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[asomers@freebsd.org,asomers@gmail.com]; RCVD_COUNT_TWO(0.00)[2] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 19:12:10 -0000 Ack, my bad. Fix coming... On Sat, Oct 26, 2019 at 12:37 PM Dan Mack wrote: > > This appears to have broken my buildworld unless I did something wrong on > my end: Last Changed Rev: 354116 > > > snip ... > > ===> lib/ofed/libibumad (all) > --- all_subdir_lib/libbe --- > /usr/src/lib/libbe/be_info.c:260:67: error: too few arguments to function > call, expected 5, have 3 > return (zfs_iter_snapshots_sorted(hdl, prop_list_builder_cb, > data)); > ~~~~~~~~~~~~~~~~~~~~~~~~~ ^ > /usr/src/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h:575:1: note: > 'zfs_iter_snapshots_sorted' declared here > extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *, > ^ > 1 error generated. > *** [be_info.o] Error code 1 > > On Sat, 26 Oct 2019, Alan Somers wrote: > > > Author: asomers > > Date: Sat Oct 26 17:11:02 2019 > > New Revision: 354116 > > URL: https://svnweb.freebsd.org/changeset/base/354116 > > > > Log: > > MFZoL: Avoid retrieving unused snapshot props > > > > This patch modifies the zfs_ioc_snapshot_list_next() ioctl to enable it > > to take input parameters that alter the way looping through the list of > > snapshots is performed. The idea here is to restrict functions that > > throw away some of the snapshots returned by the ioctl to a range of > > snapshots that these functions actually use. This improves efficiency > > and execution speed for some rollback and send operations. > > > > Reviewed-by: Tom Caputi > > Reviewed-by: Brian Behlendorf > > Reviewed by: Matt Ahrens > > Signed-off-by: Alek Pinchuk > > Closes #8077 > > zfsonlinux/zfs@4c0883fb4af0d5565459099b98fcf90ecbfa1ca1 > > > > MFC after: 2 weeks > > > > Modified: > > head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c > > head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c > > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h > > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c > > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_iter.c > > head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c > > head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c > > head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h > > From owner-svn-src-all@freebsd.org Sat Oct 26 19:21:00 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 05B1D17E092; Sat, 26 Oct 2019 19:21:00 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470rRv6NjWz4XHV; Sat, 26 Oct 2019 19:20:59 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BFAE8C97A; Sat, 26 Oct 2019 19:20:59 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QJKxQk017424; Sat, 26 Oct 2019 19:20:59 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QJKx7r017423; Sat, 26 Oct 2019 19:20:59 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <201910261920.x9QJKx7r017423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Sat, 26 Oct 2019 19:20:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354120 - head/lib/libbe X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/lib/libbe X-SVN-Commit-Revision: 354120 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 19:21:00 -0000 Author: asomers Date: Sat Oct 26 19:20:59 2019 New Revision: 354120 URL: https://svnweb.freebsd.org/changeset/base/354120 Log: Commit missing file from r354116 Pointy-hat-to: Me Reported by: Dan Mack MFC after: 2 weeks MFC-With: 354116 Modified: head/lib/libbe/be_info.c Modified: head/lib/libbe/be_info.c ============================================================================== --- head/lib/libbe/be_info.c Sat Oct 26 18:29:02 2019 (r354119) +++ head/lib/libbe/be_info.c Sat Oct 26 19:20:59 2019 (r354120) @@ -257,7 +257,8 @@ static int snapshot_proplist_update(zfs_handle_t *hdl, prop_data_t *data) { - return (zfs_iter_snapshots_sorted(hdl, prop_list_builder_cb, data)); + return (zfs_iter_snapshots_sorted(hdl, prop_list_builder_cb, data, + 0, 0)); } From owner-svn-src-all@freebsd.org Sat Oct 26 20:30:59 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E49A217FE62; Sat, 26 Oct 2019 20:30:59 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (hamza.pair.com [209.68.5.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 470t0g30Ghz4ZqS; Sat, 26 Oct 2019 20:30:59 +0000 (UTC) (envelope-from gerald@pfeifer.com) Received: from hamza.pair.com (localhost [127.0.0.1]) by hamza.pair.com (Postfix) with ESMTP id 8263633E10; Sat, 26 Oct 2019 16:30:57 -0400 (EDT) Received: from anthias (unknown [178.114.204.130]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hamza.pair.com (Postfix) with ESMTPSA id A2CC533E0F; Sat, 26 Oct 2019 16:30:56 -0400 (EDT) Date: Sat, 26 Oct 2019 22:30:55 +0200 (CEST) From: Gerald Pfeifer To: Antoine Brodin cc: Konstantin Belousov , src-committers , svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r354095 - in head/sys: amd64/amd64 amd64/include kern In-Reply-To: Message-ID: References: <201910252009.x9PK9gIV092660@repo.freebsd.org> <20191026082655.GJ73312@kib.kiev.ua> <20191026130048.GL73312@kib.kiev.ua> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 470t0g30Ghz4ZqS X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-5.98 / 15.00]; NEURAL_HAM_MEDIUM(-0.98)[-0.984,0]; REPLY(-4.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 20:31:00 -0000 On Sat, 26 Oct 2019, Antoine Brodin wrote: > It builds fine with this patch. Thank you for the quick report and testing, Antoine, and the quick fix, Konstantin! Gerald From owner-svn-src-all@freebsd.org Sat Oct 26 21:19:56 2019 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8A5A81596D4; Sat, 26 Oct 2019 21:19:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 470v5837jfz4cwd; Sat, 26 Oct 2019 21:19:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5024FDF81; Sat, 26 Oct 2019 21:19:56 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x9QLJusd086966; Sat, 26 Oct 2019 21:19:56 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x9QLJtF2086963; Sat, 26 Oct 2019 21:19:55 GMT (envelope-from bz@FreeBSD.org) Message-Id: <201910262119.x9QLJtF2086963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Sat, 26 Oct 2019 21:19:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r354121 - in head/tests/sys/netpfil: common pf X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head/tests/sys/netpfil: common pf X-SVN-Commit-Revision: 354121 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Oct 2019 21:19:56 -0000 Author: bz Date: Sat Oct 26 21:19:55 2019 New Revision: 354121 URL: https://svnweb.freebsd.org/changeset/base/354121 Log: Upgrade (scapy) py2 tests to work on py3. In order to move python2 out of the test framework to avoid py2 vs. py3 confusions upgrade the remaining test cases using scapy to work with py3. That means only one version of scapy needs to be installed in the CI system. It also gives a path forward for testing i386 issues observed in the CI system with some of these tests. Fixes are: - Use default python from environment (which is 3.x these days). - properly ident some lines as common for the rest of the file to avoid errors. - cast the calculated offset to an int as the division result is considered a float which is not accepted input. - when comparing payload to a magic number make sure we always add the payload properly to the packet and do not try to compare string in the result but convert the data payload back into an integer. - fix print formating. Discussed with: lwhsu, kp (taking it off his todo :) MFC after: 2 weeks Modified: head/tests/sys/netpfil/common/pft_ping.py head/tests/sys/netpfil/pf/CVE-2019-5597.py head/tests/sys/netpfil/pf/CVE-2019-5598.py Modified: head/tests/sys/netpfil/common/pft_ping.py ============================================================================== --- head/tests/sys/netpfil/common/pft_ping.py Sat Oct 26 19:20:59 2019 (r354120) +++ head/tests/sys/netpfil/common/pft_ping.py Sat Oct 26 21:19:55 2019 (r354121) @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/bin/env python import argparse import scapy.all as sp @@ -34,15 +34,15 @@ def check_ping4_request(args, packet): raw = packet.getlayer(sp.Raw) if not raw: return False - if raw.load != str(PAYLOAD_MAGIC): + if int(raw.load) != PAYLOAD_MAGIC: return False # Wait to check expectations until we've established this is the packet we # sent. if args.expect_tos: if ip.tos != int(args.expect_tos[0]): - print "Unexpected ToS value %d, expected %s" \ - % (ip.tos, args.expect_tos[0]) + print("Unexpected ToS value %d, expected %d" \ + % (ip.tos, int(args.expect_tos[0]))) return False return True @@ -62,7 +62,7 @@ def check_ping6_request(args, packet): icmp = packet.getlayer(sp.ICMPv6EchoRequest) if not icmp: return False - if icmp.data != str(PAYLOAD_MAGIC): + if int(icmp.data) != PAYLOAD_MAGIC: return False return True @@ -71,7 +71,7 @@ def ping(send_if, dst_ip, args): ether = sp.Ether() ip = sp.IP(dst=dst_ip) icmp = sp.ICMP(type='echo-request') - raw = sp.Raw(str(PAYLOAD_MAGIC)) + raw = sp.raw(str(PAYLOAD_MAGIC)) if args.send_tos: ip.tos = int(args.send_tos[0]) @@ -82,7 +82,7 @@ def ping(send_if, dst_ip, args): def ping6(send_if, dst_ip, args): ether = sp.Ether() ip6 = sp.IPv6(dst=dst_ip) - icmp = sp.ICMPv6EchoRequest(data=PAYLOAD_MAGIC) + icmp = sp.ICMPv6EchoRequest(data=sp.raw(str(PAYLOAD_MAGIC))) req = ether / ip6 / icmp sp.sendp(req, iface=send_if, verbose=False) Modified: head/tests/sys/netpfil/pf/CVE-2019-5597.py ============================================================================== --- head/tests/sys/netpfil/pf/CVE-2019-5597.py Sat Oct 26 19:20:59 2019 (r354120) +++ head/tests/sys/netpfil/pf/CVE-2019-5597.py Sat Oct 26 21:19:55 2019 (r354121) @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/bin/env python import random import scapy.all as sp @@ -18,7 +18,8 @@ def main(): padding = 8 fid = random.randint(0,100000) frag_0 = sp.IPv6ExtHdrFragment(id=fid, nh=UDP_PROTO, m=1, offset=0) - frag_1 = sp.IPv6ExtHdrFragment(id=fid, nh=UDP_PROTO, m=0, offset=padding/8) + foff_1 = (int)(padding/8) + frag_1 = sp.IPv6ExtHdrFragment(id=fid, nh=UDP_PROTO, m=0, offset=foff_1) pkt1_opts = sp.AH(nh=AH_PROTO, payloadlen=200) \ / sp.Raw('XXXX' * 199) \ Modified: head/tests/sys/netpfil/pf/CVE-2019-5598.py ============================================================================== --- head/tests/sys/netpfil/pf/CVE-2019-5598.py Sat Oct 26 19:20:59 2019 (r354120) +++ head/tests/sys/netpfil/pf/CVE-2019-5598.py Sat Oct 26 21:19:55 2019 (r354121) @@ -1,4 +1,4 @@ -#!/usr/local/bin/python2.7 +#!/usr/bin/env python import argparse import scapy.all as sp @@ -38,18 +38,18 @@ def main(): args = parser.parse_args() - # Send the allowed packet to establish state - udp = sp.Ether() / \ - sp.IP(src=args.src[0], dst=args.to[0]) / \ - sp.UDP(dport=53, sport=1234) - sp.sendp(udp, iface=args.sendif[0], verbose=False) + # Send the allowed packet to establish state + udp = sp.Ether() / \ + sp.IP(src=args.src[0], dst=args.to[0]) / \ + sp.UDP(dport=53, sport=1234) + sp.sendp(udp, iface=args.sendif[0], verbose=False) # Start sniffing on recvif sniffer = Sniffer(args, check_icmp_error) # Send the bad error packet icmp_reachable = sp.Ether() / \ - sp.IP(src=args.src[0], dst=args.to[0]) / \ + sp.IP(src=args.src[0], dst=args.to[0]) / \ sp.ICMP(type=3, code=3) / \ sp.IP(src="4.3.2.1", dst="1.2.3.4") / \ sp.UDP(dport=53, sport=1234)